composer.phar 1.8 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668636696367063671636726367363674636756367663677636786367963680636816368263683636846368563686636876368863689636906369163692636936369463695636966369763698636996370063701637026370363704637056370663707637086370963710637116371263713637146371563716637176371863719637206372163722637236372463725637266372763728637296373063731637326373363734637356373663737637386373963740637416374263743637446374563746637476374863749637506375163752637536375463755637566375763758637596376063761637626376363764637656376663767637686376963770637716377263773637746377563776637776377863779637806378163782637836378463785637866378763788637896379063791637926379363794637956379663797637986379963800638016380263803638046380563806638076380863809638106381163812638136381463815638166381763818638196382063821638226382363824638256382663827638286382963830638316383263833638346383563836638376383863839638406384163842638436384463845638466384763848638496385063851638526385363854638556385663857638586385963860638616386263863638646386563866638676386863869638706387163872638736387463875638766387763878638796388063881638826388363884638856388663887638886388963890638916389263893638946389563896638976389863899639006390163902639036390463905639066390763908639096391063911639126391363914639156391663917639186391963920639216392263923639246392563926639276392863929639306393163932639336393463935639366393763938639396394063941639426394363944639456394663947639486394963950639516395263953639546395563956639576395863959639606396163962639636396463965639666396763968639696397063971639726397363974639756397663977639786397963980639816398263983639846398563986639876398863989639906399163992639936399463995639966399763998639996400064001640026400364004640056400664007640086400964010640116401264013640146401564016640176401864019640206402164022640236402464025640266402764028640296403064031640326403364034640356403664037640386403964040640416404264043640446404564046640476404864049640506405164052640536405464055640566405764058640596406064061640626406364064640656406664067640686406964070640716407264073640746407564076640776407864079640806408164082640836408464085640866408764088640896409064091640926409364094640956409664097640986409964100641016410264103641046410564106641076410864109641106411164112641136411464115641166411764118641196412064121641226412364124641256412664127641286412964130641316413264133641346413564136641376413864139641406414164142641436414464145641466414764148641496415064151641526415364154641556415664157641586415964160641616416264163641646416564166641676416864169641706417164172641736417464175641766417764178641796418064181641826418364184641856418664187641886418964190641916419264193641946419564196641976419864199642006420164202642036420464205642066420764208642096421064211642126421364214642156421664217642186421964220642216422264223642246422564226642276422864229642306423164232642336423464235642366423764238642396424064241642426424364244642456424664247642486424964250642516425264253642546425564256642576425864259642606426164262642636426464265642666426764268642696427064271642726427364274642756427664277642786427964280642816428264283642846428564286642876428864289642906429164292642936429464295642966429764298642996430064301643026430364304643056430664307643086430964310643116431264313643146431564316643176431864319643206432164322643236432464325643266432764328643296433064331643326433364334643356433664337643386433964340643416434264343643446434564346643476434864349643506435164352643536435464355643566435764358643596436064361643626436364364643656436664367643686436964370643716437264373643746437564376643776437864379643806438164382643836438464385643866438764388643896439064391643926439364394643956439664397643986439964400644016440264403644046440564406644076440864409644106441164412644136441464415644166441764418644196442064421644226442364424644256442664427644286442964430644316443264433644346443564436644376443864439644406444164442644436444464445644466444764448644496445064451644526445364454644556445664457644586445964460644616446264463644646446564466644676446864469644706447164472644736447464475644766447764478644796448064481644826448364484644856448664487644886448964490644916449264493644946449564496644976449864499645006450164502645036450464505645066450764508645096451064511645126451364514645156451664517645186451964520645216452264523645246452564526645276452864529645306453164532645336453464535645366453764538645396454064541645426454364544645456454664547645486454964550645516455264553645546455564556645576455864559645606456164562645636456464565645666456764568645696457064571645726457364574645756457664577645786457964580645816458264583645846458564586645876458864589645906459164592645936459464595645966459764598645996460064601646026460364604646056460664607646086460964610646116461264613646146461564616646176461864619646206462164622646236462464625646266462764628646296463064631646326463364634646356463664637646386463964640646416464264643646446464564646646476464864649646506465164652646536465464655646566465764658646596466064661646626466364664646656466664667646686466964670646716467264673646746467564676646776467864679646806468164682646836468464685646866468764688646896469064691646926469364694646956469664697646986469964700647016470264703647046470564706647076470864709647106471164712647136471464715647166471764718647196472064721647226472364724647256472664727647286472964730647316473264733647346473564736647376473864739647406474164742647436474464745647466474764748647496475064751647526475364754647556475664757647586475964760647616476264763647646476564766647676476864769647706477164772647736477464775647766477764778647796478064781647826478364784647856478664787647886478964790647916479264793647946479564796647976479864799648006480164802648036480464805648066480764808648096481064811648126481364814648156481664817648186481964820648216482264823648246482564826648276482864829648306483164832648336483464835648366483764838648396484064841648426484364844648456484664847648486484964850648516485264853648546485564856648576485864859648606486164862648636486464865648666486764868648696487064871648726487364874648756487664877648786487964880648816488264883648846488564886648876488864889648906489164892648936489464895648966489764898648996490064901649026490364904649056490664907649086490964910649116491264913649146491564916649176491864919649206492164922649236492464925649266492764928649296493064931649326493364934649356493664937649386493964940649416494264943649446494564946649476494864949649506495164952649536495464955649566495764958649596496064961649626496364964649656496664967649686496964970649716497264973649746497564976649776497864979649806498164982649836498464985649866498764988649896499064991649926499364994649956499664997649986499965000650016500265003650046500565006650076500865009650106501165012650136501465015650166501765018650196502065021650226502365024650256502665027650286502965030650316503265033650346503565036650376503865039650406504165042650436504465045650466504765048650496505065051650526505365054650556505665057650586505965060650616506265063650646506565066650676506865069650706507165072650736507465075650766507765078650796508065081650826508365084650856508665087650886508965090650916509265093650946509565096650976509865099651006510165102651036510465105651066510765108651096511065111651126511365114651156511665117651186511965120651216512265123651246512565126651276512865129651306513165132651336513465135651366513765138651396514065141651426514365144651456514665147651486514965150651516515265153651546515565156651576515865159651606516165162651636516465165651666516765168651696517065171651726517365174651756517665177651786517965180651816518265183651846518565186651876518865189651906519165192651936519465195651966519765198651996520065201652026520365204652056520665207652086520965210652116521265213652146521565216652176521865219652206522165222652236522465225652266522765228652296523065231652326523365234652356523665237652386523965240652416524265243652446524565246652476524865249652506525165252652536525465255652566525765258652596526065261652626526365264652656526665267652686526965270652716527265273652746527565276652776527865279652806528165282652836528465285652866528765288652896529065291652926529365294652956529665297652986529965300653016530265303653046530565306653076530865309653106531165312653136531465315653166531765318653196532065321653226532365324653256532665327653286532965330653316533265333653346533565336653376533865339653406534165342653436534465345653466534765348653496535065351653526535365354653556535665357653586535965360653616536265363653646536565366653676536865369653706537165372653736537465375653766537765378653796538065381653826538365384653856538665387653886538965390653916539265393653946539565396653976539865399654006540165402654036540465405654066540765408654096541065411654126541365414654156541665417654186541965420654216542265423654246542565426654276542865429654306543165432654336543465435654366543765438654396544065441654426544365444654456544665447654486544965450654516545265453654546545565456654576545865459654606546165462654636546465465654666546765468654696547065471654726547365474654756547665477654786547965480654816548265483654846548565486654876548865489654906549165492654936549465495654966549765498654996550065501655026550365504655056550665507655086550965510655116551265513655146551565516655176551865519655206552165522655236552465525655266552765528655296553065531655326553365534655356553665537655386553965540655416554265543655446554565546655476554865549655506555165552655536555465555655566555765558655596556065561655626556365564655656556665567655686556965570655716557265573655746557565576655776557865579655806558165582655836558465585655866558765588655896559065591655926559365594655956559665597655986559965600656016560265603656046560565606656076560865609656106561165612656136561465615656166561765618656196562065621656226562365624656256562665627656286562965630656316563265633656346563565636656376563865639656406564165642656436564465645656466564765648656496565065651656526565365654656556565665657656586565965660656616566265663656646566565666656676566865669656706567165672656736567465675656766567765678656796568065681656826568365684656856568665687656886568965690656916569265693656946569565696656976569865699657006570165702657036570465705657066570765708657096571065711657126571365714657156571665717657186571965720657216572265723657246572565726657276572865729657306573165732657336573465735657366573765738657396574065741657426574365744657456574665747657486574965750657516575265753657546575565756657576575865759657606576165762657636576465765657666576765768657696577065771657726577365774657756577665777657786577965780657816578265783657846578565786657876578865789657906579165792657936579465795657966579765798657996580065801658026580365804658056580665807658086580965810658116581265813658146581565816658176581865819658206582165822658236582465825658266582765828658296583065831658326583365834658356583665837658386583965840658416584265843658446584565846658476584865849658506585165852658536585465855658566585765858658596586065861658626586365864658656586665867658686586965870658716587265873658746587565876658776587865879658806588165882658836588465885658866588765888658896589065891658926589365894658956589665897658986589965900659016590265903659046590565906659076590865909659106591165912659136591465915659166591765918659196592065921659226592365924659256592665927659286592965930659316593265933659346593565936659376593865939659406594165942659436594465945659466594765948659496595065951659526595365954659556595665957659586595965960659616596265963659646596565966659676596865969659706597165972659736597465975659766597765978659796598065981659826598365984659856598665987659886598965990659916599265993659946599565996659976599865999660006600166002660036600466005660066600766008660096601066011660126601366014660156601666017660186601966020660216602266023660246602566026660276602866029660306603166032660336603466035660366603766038660396604066041660426604366044660456604666047660486604966050660516605266053660546605566056660576605866059660606606166062660636606466065660666606766068660696607066071660726607366074660756607666077660786607966080660816608266083660846608566086660876608866089660906609166092660936609466095660966609766098660996610066101661026610366104661056610666107661086610966110661116611266113661146611566116661176611866119661206612166122661236612466125661266612766128661296613066131661326613366134661356613666137661386613966140661416614266143661446614566146661476614866149661506615166152661536615466155661566615766158661596616066161661626616366164661656616666167661686616966170661716617266173661746617566176661776617866179661806618166182661836618466185661866618766188661896619066191661926619366194661956619666197661986619966200662016620266203662046620566206662076620866209662106621166212662136621466215662166621766218662196622066221662226622366224662256622666227662286622966230662316623266233662346623566236662376623866239662406624166242662436624466245662466624766248662496625066251662526625366254662556625666257662586625966260662616626266263662646626566266662676626866269662706627166272662736627466275662766627766278662796628066281662826628366284662856628666287662886628966290662916629266293662946629566296662976629866299663006630166302663036630466305663066630766308663096631066311663126631366314663156631666317663186631966320663216632266323663246632566326663276632866329663306633166332663336633466335663366633766338663396634066341663426634366344663456634666347663486634966350663516635266353663546635566356663576635866359663606636166362663636636466365663666636766368663696637066371663726637366374663756637666377663786637966380663816638266383663846638566386663876638866389663906639166392663936639466395663966639766398663996640066401664026640366404664056640666407664086640966410664116641266413664146641566416664176641866419664206642166422664236642466425664266642766428664296643066431664326643366434664356643666437664386643966440664416644266443664446644566446664476644866449664506645166452664536645466455664566645766458664596646066461664626646366464664656646666467664686646966470664716647266473664746647566476664776647866479664806648166482664836648466485664866648766488664896649066491664926649366494664956649666497664986649966500665016650266503665046650566506665076650866509665106651166512665136651466515665166651766518665196652066521665226652366524665256652666527665286652966530665316653266533665346653566536665376653866539665406654166542665436654466545665466654766548665496655066551665526655366554665556655666557665586655966560665616656266563665646656566566665676656866569665706657166572665736657466575665766657766578665796658066581665826658366584665856658666587665886658966590665916659266593665946659566596665976659866599666006660166602666036660466605666066660766608666096661066611666126661366614666156661666617666186661966620666216662266623666246662566626666276662866629666306663166632666336663466635666366663766638666396664066641666426664366644666456664666647666486664966650666516665266653666546665566656666576665866659666606666166662666636666466665666666666766668666696667066671666726667366674666756667666677666786667966680666816668266683666846668566686666876668866689666906669166692666936669466695666966669766698666996670066701667026670366704667056670666707667086670966710667116671266713667146671566716667176671866719667206672166722667236672466725667266672766728667296673066731667326673366734667356673666737667386673966740667416674266743667446674566746667476674866749667506675166752667536675466755667566675766758667596676066761667626676366764667656676666767667686676966770667716677266773667746677566776667776677866779667806678166782667836678466785667866678766788667896679066791667926679366794667956679666797667986679966800668016680266803668046680566806668076680866809668106681166812668136681466815668166681766818668196682066821668226682366824668256682666827668286682966830668316683266833668346683566836668376683866839668406684166842668436684466845668466684766848668496685066851668526685366854668556685666857668586685966860668616686266863668646686566866668676686866869668706687166872668736687466875668766687766878668796688066881668826688366884668856688666887668886688966890668916689266893668946689566896668976689866899669006690166902669036690466905669066690766908669096691066911669126691366914669156691666917669186691966920669216692266923669246692566926669276692866929669306693166932669336693466935669366693766938669396694066941669426694366944669456694666947669486694966950669516695266953669546695566956669576695866959669606696166962669636696466965669666696766968669696697066971669726697366974669756697666977669786697966980669816698266983669846698566986669876698866989669906699166992669936699466995669966699766998669996700067001670026700367004670056700667007670086700967010670116701267013670146701567016670176701867019670206702167022670236702467025670266702767028670296703067031670326703367034670356703667037670386703967040670416704267043670446704567046670476704867049670506705167052670536705467055670566705767058670596706067061670626706367064670656706667067670686706967070670716707267073670746707567076670776707867079670806708167082670836708467085670866708767088670896709067091670926709367094670956709667097670986709967100671016710267103671046710567106671076710867109671106711167112671136711467115671166711767118671196712067121671226712367124671256712667127671286712967130671316713267133671346713567136671376713867139671406714167142671436714467145671466714767148671496715067151671526715367154671556715667157671586715967160671616716267163671646716567166671676716867169671706717167172671736717467175671766717767178671796718067181671826718367184671856718667187671886718967190671916719267193671946719567196671976719867199672006720167202672036720467205672066720767208672096721067211672126721367214672156721667217672186721967220672216722267223672246722567226672276722867229672306723167232672336723467235672366723767238672396724067241672426724367244672456724667247672486724967250672516725267253672546725567256672576725867259672606726167262672636726467265672666726767268672696727067271672726727367274672756727667277672786727967280672816728267283672846728567286672876728867289672906729167292672936729467295672966729767298672996730067301673026730367304673056730667307673086730967310673116731267313673146731567316673176731867319673206732167322673236732467325673266732767328673296733067331673326733367334673356733667337673386733967340673416734267343673446734567346673476734867349673506735167352673536735467355673566735767358673596736067361673626736367364673656736667367673686736967370673716737267373673746737567376673776737867379673806738167382673836738467385673866738767388673896739067391673926739367394673956739667397673986739967400674016740267403674046740567406674076740867409674106741167412674136741467415674166741767418674196742067421674226742367424674256742667427674286742967430674316743267433674346743567436674376743867439674406744167442674436744467445674466744767448674496745067451674526745367454674556745667457674586745967460674616746267463674646746567466674676746867469674706747167472674736747467475674766747767478674796748067481674826748367484674856748667487674886748967490674916749267493674946749567496674976749867499675006750167502675036750467505675066750767508675096751067511675126751367514675156751667517675186751967520675216752267523675246752567526675276752867529675306753167532675336753467535675366753767538675396754067541675426754367544675456754667547675486754967550675516755267553675546755567556675576755867559675606756167562675636756467565675666756767568675696757067571675726757367574675756757667577675786757967580675816758267583675846758567586675876758867589675906759167592675936759467595675966759767598675996760067601676026760367604676056760667607676086760967610676116761267613676146761567616676176761867619676206762167622676236762467625676266762767628676296763067631676326763367634676356763667637676386763967640676416764267643676446764567646676476764867649676506765167652676536765467655676566765767658676596766067661676626766367664676656766667667676686766967670676716767267673676746767567676676776767867679676806768167682676836768467685676866768767688676896769067691676926769367694676956769667697676986769967700677016770267703677046770567706677076770867709677106771167712677136771467715677166771767718677196772067721677226772367724677256772667727677286772967730677316773267733677346773567736677376773867739677406774167742677436774467745677466774767748677496775067751677526775367754677556775667757677586775967760677616776267763677646776567766677676776867769677706777167772677736777467775677766777767778677796778067781677826778367784677856778667787677886778967790677916779267793677946779567796677976779867799678006780167802678036780467805678066780767808678096781067811678126781367814678156781667817678186781967820678216782267823678246782567826678276782867829678306783167832678336783467835678366783767838678396784067841678426784367844678456784667847678486784967850678516785267853678546785567856678576785867859678606786167862678636786467865678666786767868678696787067871678726787367874678756787667877678786787967880678816788267883678846788567886678876788867889678906789167892678936789467895678966789767898678996790067901679026790367904679056790667907679086790967910679116791267913679146791567916679176791867919679206792167922679236792467925679266792767928679296793067931679326793367934679356793667937679386793967940679416794267943679446794567946679476794867949679506795167952679536795467955679566795767958679596796067961679626796367964679656796667967679686796967970679716797267973679746797567976679776797867979679806798167982679836798467985679866798767988679896799067991679926799367994679956799667997679986799968000680016800268003680046800568006680076800868009680106801168012680136801468015680166801768018680196802068021680226802368024680256802668027680286802968030680316803268033680346803568036680376803868039680406804168042680436804468045680466804768048680496805068051680526805368054680556805668057680586805968060680616806268063680646806568066680676806868069680706807168072680736807468075680766807768078680796808068081680826808368084680856808668087680886808968090680916809268093680946809568096680976809868099681006810168102681036810468105681066810768108681096811068111681126811368114681156811668117681186811968120681216812268123681246812568126681276812868129681306813168132681336813468135681366813768138681396814068141681426814368144681456814668147681486814968150681516815268153681546815568156681576815868159681606816168162681636816468165681666816768168681696817068171681726817368174681756817668177681786817968180681816818268183681846818568186681876818868189681906819168192681936819468195681966819768198681996820068201682026820368204682056820668207682086820968210682116821268213682146821568216682176821868219682206822168222682236822468225682266822768228682296823068231682326823368234682356823668237682386823968240682416824268243682446824568246682476824868249682506825168252682536825468255682566825768258682596826068261682626826368264682656826668267682686826968270682716827268273682746827568276682776827868279682806828168282682836828468285682866828768288682896829068291682926829368294682956829668297682986829968300683016830268303683046830568306683076830868309683106831168312683136831468315683166831768318683196832068321683226832368324683256832668327683286832968330683316833268333683346833568336683376833868339683406834168342683436834468345683466834768348683496835068351683526835368354683556835668357683586835968360683616836268363683646836568366683676836868369683706837168372683736837468375683766837768378683796838068381683826838368384683856838668387683886838968390683916839268393683946839568396683976839868399684006840168402684036840468405684066840768408684096841068411684126841368414684156841668417684186841968420684216842268423684246842568426684276842868429684306843168432684336843468435684366843768438684396844068441684426844368444684456844668447684486844968450684516845268453684546845568456684576845868459684606846168462684636846468465684666846768468684696847068471684726847368474684756847668477684786847968480684816848268483684846848568486684876848868489684906849168492684936849468495684966849768498684996850068501685026850368504685056850668507685086850968510685116851268513685146851568516685176851868519685206852168522685236852468525685266852768528685296853068531685326853368534685356853668537685386853968540685416854268543685446854568546685476854868549685506855168552685536855468555685566855768558685596856068561685626856368564685656856668567685686856968570685716857268573685746857568576685776857868579685806858168582685836858468585685866858768588685896859068591685926859368594685956859668597685986859968600686016860268603686046860568606686076860868609686106861168612686136861468615686166861768618686196862068621686226862368624686256862668627686286862968630686316863268633686346863568636686376863868639686406864168642686436864468645686466864768648686496865068651686526865368654686556865668657686586865968660686616866268663686646866568666686676866868669686706867168672686736867468675686766867768678686796868068681686826868368684686856868668687686886868968690686916869268693686946869568696686976869868699687006870168702687036870468705687066870768708687096871068711687126871368714687156871668717687186871968720687216872268723687246872568726687276872868729687306873168732687336873468735687366873768738687396874068741687426874368744687456874668747687486874968750687516875268753687546875568756687576875868759687606876168762687636876468765687666876768768687696877068771687726877368774687756877668777687786877968780687816878268783687846878568786687876878868789687906879168792687936879468795687966879768798687996880068801688026880368804688056880668807688086880968810688116881268813688146881568816688176881868819688206882168822688236882468825688266882768828688296883068831688326883368834688356883668837688386883968840688416884268843688446884568846688476884868849688506885168852688536885468855688566885768858688596886068861688626886368864688656886668867688686886968870688716887268873688746887568876688776887868879688806888168882688836888468885688866888768888688896889068891688926889368894688956889668897688986889968900689016890268903689046890568906689076890868909689106891168912689136891468915689166891768918689196892068921689226892368924689256892668927689286892968930689316893268933689346893568936689376893868939689406894168942689436894468945689466894768948689496895068951689526895368954689556895668957689586895968960689616896268963689646896568966689676896868969689706897168972689736897468975689766897768978689796898068981689826898368984689856898668987689886898968990689916899268993689946899568996689976899868999690006900169002690036900469005690066900769008690096901069011690126901369014690156901669017690186901969020690216902269023690246902569026690276902869029690306903169032690336903469035690366903769038690396904069041690426904369044690456904669047690486904969050690516905269053690546905569056690576905869059690606906169062690636906469065690666906769068690696907069071690726907369074690756907669077690786907969080690816908269083690846908569086690876908869089690906909169092690936909469095690966909769098690996910069101691026910369104691056910669107691086910969110691116911269113691146911569116691176911869119691206912169122691236912469125691266912769128691296913069131691326913369134691356913669137691386913969140691416914269143691446914569146691476914869149691506915169152691536915469155691566915769158691596916069161691626916369164691656916669167691686916969170691716917269173691746917569176691776917869179691806918169182691836918469185691866918769188691896919069191691926919369194691956919669197691986919969200692016920269203692046920569206692076920869209692106921169212692136921469215692166921769218692196922069221692226922369224692256922669227692286922969230692316923269233692346923569236692376923869239692406924169242692436924469245692466924769248692496925069251692526925369254692556925669257692586925969260692616926269263692646926569266692676926869269692706927169272692736927469275692766927769278692796928069281692826928369284692856928669287692886928969290692916929269293692946929569296692976929869299693006930169302693036930469305693066930769308693096931069311693126931369314693156931669317693186931969320693216932269323693246932569326693276932869329693306933169332693336933469335693366933769338693396934069341693426934369344693456934669347693486934969350693516935269353693546935569356693576935869359693606936169362693636936469365693666936769368693696937069371693726937369374693756937669377693786937969380693816938269383693846938569386693876938869389693906939169392693936939469395693966939769398693996940069401694026940369404694056940669407694086940969410694116941269413694146941569416694176941869419694206942169422694236942469425694266942769428694296943069431694326943369434694356943669437694386943969440694416944269443694446944569446694476944869449694506945169452694536945469455694566945769458694596946069461694626946369464694656946669467694686946969470694716947269473694746947569476694776947869479694806948169482694836948469485694866948769488694896949069491694926949369494694956949669497694986949969500695016950269503695046950569506695076950869509695106951169512695136951469515695166951769518695196952069521695226952369524695256952669527695286952969530695316953269533695346953569536695376953869539695406954169542695436954469545695466954769548695496955069551695526955369554695556955669557695586955969560695616956269563695646956569566695676956869569695706957169572695736957469575695766957769578695796958069581695826958369584695856958669587695886958969590695916959269593695946959569596695976959869599696006960169602696036960469605696066960769608696096961069611696126961369614696156961669617696186961969620696216962269623696246962569626696276962869629696306963169632696336963469635696366963769638696396964069641696426964369644696456964669647696486964969650696516965269653696546965569656696576965869659696606966169662696636966469665696666966769668696696967069671696726967369674696756967669677696786967969680696816968269683696846968569686696876968869689696906969169692696936969469695696966969769698696996970069701697026970369704697056970669707697086970969710697116971269713697146971569716697176971869719697206972169722697236972469725697266972769728697296973069731697326973369734697356973669737697386973969740697416974269743697446974569746697476974869749697506975169752697536975469755697566975769758697596976069761697626976369764697656976669767697686976969770697716977269773697746977569776697776977869779697806978169782697836978469785697866978769788697896979069791697926979369794697956979669797697986979969800698016980269803698046980569806698076980869809698106981169812698136981469815698166981769818698196982069821698226982369824698256982669827698286982969830698316983269833698346983569836698376983869839698406984169842698436984469845698466984769848698496985069851698526985369854698556985669857698586985969860698616986269863698646986569866698676986869869698706987169872698736987469875698766987769878698796988069881698826988369884698856988669887698886988969890698916989269893698946989569896698976989869899699006990169902699036990469905699066990769908699096991069911699126991369914699156991669917699186991969920699216992269923699246992569926699276992869929699306993169932699336993469935699366993769938699396994069941699426994369944699456994669947699486994969950699516995269953699546995569956699576995869959699606996169962699636996469965699666996769968699696997069971699726997369974699756997669977699786997969980699816998269983699846998569986699876998869989699906999169992699936999469995699966999769998699997000070001700027000370004700057000670007700087000970010700117001270013700147001570016700177001870019700207002170022700237002470025700267002770028700297003070031700327003370034700357003670037700387003970040700417004270043700447004570046700477004870049700507005170052700537005470055700567005770058700597006070061700627006370064700657006670067700687006970070700717007270073700747007570076700777007870079700807008170082700837008470085700867008770088700897009070091700927009370094700957009670097700987009970100701017010270103701047010570106701077010870109701107011170112701137011470115701167011770118701197012070121701227012370124701257012670127701287012970130701317013270133701347013570136701377013870139701407014170142701437014470145701467014770148701497015070151701527015370154701557015670157701587015970160701617016270163701647016570166701677016870169701707017170172701737017470175701767017770178701797018070181701827018370184701857018670187701887018970190701917019270193701947019570196701977019870199702007020170202702037020470205702067020770208702097021070211702127021370214702157021670217702187021970220702217022270223702247022570226702277022870229702307023170232702337023470235702367023770238702397024070241702427024370244702457024670247702487024970250702517025270253702547025570256702577025870259702607026170262702637026470265702667026770268702697027070271702727027370274702757027670277702787027970280702817028270283702847028570286702877028870289702907029170292702937029470295702967029770298702997030070301703027030370304703057030670307703087030970310703117031270313703147031570316703177031870319703207032170322703237032470325703267032770328703297033070331703327033370334703357033670337703387033970340703417034270343703447034570346703477034870349703507035170352703537035470355703567035770358703597036070361703627036370364703657036670367703687036970370703717037270373703747037570376703777037870379703807038170382703837038470385703867038770388703897039070391703927039370394703957039670397703987039970400704017040270403704047040570406704077040870409704107041170412704137041470415704167041770418704197042070421704227042370424704257042670427704287042970430704317043270433704347043570436704377043870439704407044170442704437044470445704467044770448704497045070451704527045370454704557045670457704587045970460704617046270463704647046570466704677046870469704707047170472704737047470475704767047770478704797048070481704827048370484704857048670487704887048970490704917049270493704947049570496704977049870499705007050170502705037050470505705067050770508705097051070511705127051370514705157051670517705187051970520705217052270523705247052570526705277052870529705307053170532705337053470535705367053770538705397054070541705427054370544705457054670547705487054970550705517055270553705547055570556705577055870559705607056170562705637056470565705667056770568705697057070571705727057370574705757057670577705787057970580705817058270583705847058570586705877058870589705907059170592705937059470595705967059770598705997060070601706027060370604706057060670607706087060970610706117061270613706147061570616706177061870619706207062170622706237062470625706267062770628706297063070631706327063370634706357063670637706387063970640706417064270643706447064570646706477064870649706507065170652706537065470655706567065770658706597066070661706627066370664706657066670667706687066970670706717067270673706747067570676706777067870679706807068170682706837068470685706867068770688706897069070691706927069370694706957069670697706987069970700707017070270703707047070570706707077070870709707107071170712707137071470715707167071770718707197072070721707227072370724707257072670727707287072970730707317073270733707347073570736707377073870739707407074170742707437074470745707467074770748707497075070751707527075370754707557075670757707587075970760707617076270763707647076570766707677076870769707707077170772707737077470775707767077770778707797078070781707827078370784707857078670787707887078970790707917079270793707947079570796707977079870799708007080170802708037080470805708067080770808708097081070811708127081370814708157081670817708187081970820708217082270823708247082570826708277082870829708307083170832708337083470835708367083770838708397084070841708427084370844708457084670847708487084970850708517085270853708547085570856708577085870859708607086170862708637086470865708667086770868708697087070871708727087370874708757087670877708787087970880708817088270883708847088570886708877088870889708907089170892708937089470895708967089770898708997090070901709027090370904709057090670907709087090970910709117091270913709147091570916709177091870919709207092170922709237092470925709267092770928709297093070931709327093370934709357093670937709387093970940709417094270943709447094570946709477094870949709507095170952709537095470955709567095770958709597096070961709627096370964709657096670967709687096970970709717097270973709747097570976709777097870979709807098170982709837098470985709867098770988709897099070991709927099370994709957099670997709987099971000710017100271003710047100571006710077100871009710107101171012710137101471015710167101771018710197102071021710227102371024710257102671027710287102971030710317103271033710347103571036710377103871039710407104171042710437104471045710467104771048710497105071051710527105371054710557105671057710587105971060710617106271063710647106571066710677106871069710707107171072710737107471075710767107771078710797108071081710827108371084710857108671087710887108971090710917109271093710947109571096710977109871099711007110171102711037110471105711067110771108711097111071111711127111371114711157111671117711187111971120711217112271123711247112571126711277112871129711307113171132711337113471135711367113771138711397114071141711427114371144711457114671147711487114971150711517115271153711547115571156711577115871159711607116171162711637116471165711667116771168711697117071171711727117371174711757117671177711787117971180711817118271183711847118571186711877118871189711907119171192711937119471195711967119771198711997120071201712027120371204712057120671207712087120971210712117121271213712147121571216712177121871219712207122171222712237122471225712267122771228712297123071231712327123371234712357123671237712387123971240712417124271243712447124571246712477124871249712507125171252712537125471255712567125771258712597126071261712627126371264712657126671267712687126971270712717127271273712747127571276712777127871279712807128171282712837128471285712867128771288712897129071291712927129371294712957129671297712987129971300713017130271303713047130571306713077130871309713107131171312713137131471315713167131771318713197132071321713227132371324713257132671327713287132971330713317133271333713347133571336713377133871339713407134171342713437134471345713467134771348713497135071351713527135371354713557135671357713587135971360713617136271363713647136571366713677136871369713707137171372713737137471375713767137771378713797138071381713827138371384713857138671387713887138971390713917139271393713947139571396713977139871399714007140171402714037140471405714067140771408714097141071411714127141371414714157141671417714187141971420714217142271423714247142571426714277142871429714307143171432714337143471435714367143771438714397144071441714427144371444714457144671447714487144971450714517145271453714547145571456714577145871459714607146171462714637146471465714667146771468714697147071471714727147371474714757147671477714787147971480714817148271483714847148571486714877148871489714907149171492714937149471495714967149771498714997150071501715027150371504715057150671507715087150971510715117151271513715147151571516715177151871519715207152171522715237152471525715267152771528715297153071531715327153371534715357153671537715387153971540715417154271543715447154571546715477154871549715507155171552715537155471555715567155771558715597156071561715627156371564715657156671567715687156971570715717157271573715747157571576715777157871579715807158171582715837158471585715867158771588715897159071591715927159371594715957159671597715987159971600716017160271603716047160571606716077160871609716107161171612716137161471615716167161771618716197162071621716227162371624716257162671627716287162971630716317163271633716347163571636716377163871639716407164171642716437164471645716467164771648716497165071651716527165371654716557165671657716587165971660716617166271663716647166571666716677166871669716707167171672716737167471675716767167771678716797168071681716827168371684716857168671687716887168971690716917169271693716947169571696716977169871699717007170171702717037170471705717067170771708717097171071711717127171371714717157171671717717187171971720717217172271723717247172571726717277172871729717307173171732717337173471735717367173771738717397174071741717427174371744717457174671747717487174971750717517175271753717547175571756717577175871759717607176171762717637176471765717667176771768717697177071771717727177371774717757177671777717787177971780717817178271783717847178571786717877178871789717907179171792717937179471795717967179771798717997180071801718027180371804718057180671807718087180971810718117181271813718147181571816718177181871819718207182171822718237182471825718267182771828718297183071831718327183371834718357183671837718387183971840718417184271843718447184571846718477184871849718507185171852718537185471855718567185771858718597186071861718627186371864718657186671867718687186971870718717187271873718747187571876718777187871879718807188171882718837188471885718867188771888718897189071891718927189371894718957189671897718987189971900719017190271903719047190571906719077190871909719107191171912719137191471915719167191771918719197192071921719227192371924719257192671927719287192971930719317193271933719347193571936719377193871939719407194171942719437194471945719467194771948719497195071951719527195371954719557195671957719587195971960719617196271963719647196571966719677196871969719707197171972719737197471975719767197771978719797198071981719827198371984719857198671987719887198971990719917199271993719947199571996719977199871999720007200172002720037200472005720067200772008720097201072011720127201372014720157201672017720187201972020720217202272023720247202572026720277202872029720307203172032720337203472035720367203772038720397204072041720427204372044720457204672047720487204972050720517205272053720547205572056720577205872059720607206172062720637206472065720667206772068720697207072071720727207372074720757207672077720787207972080720817208272083720847208572086720877208872089720907209172092720937209472095720967209772098720997210072101721027210372104721057210672107721087210972110721117211272113721147211572116721177211872119721207212172122721237212472125721267212772128721297213072131721327213372134721357213672137721387213972140721417214272143721447214572146721477214872149721507215172152721537215472155721567215772158721597216072161721627216372164721657216672167721687216972170721717217272173721747217572176721777217872179721807218172182721837218472185721867218772188721897219072191721927219372194721957219672197721987219972200722017220272203722047220572206722077220872209722107221172212722137221472215722167221772218722197222072221722227222372224722257222672227722287222972230722317223272233722347223572236722377223872239722407224172242722437224472245722467224772248722497225072251722527225372254722557225672257722587225972260722617226272263722647226572266722677226872269722707227172272722737227472275722767227772278722797228072281722827228372284722857228672287722887228972290722917229272293722947229572296722977229872299723007230172302723037230472305723067230772308723097231072311723127231372314723157231672317723187231972320723217232272323723247232572326723277232872329723307233172332723337233472335723367233772338723397234072341723427234372344723457234672347723487234972350723517235272353723547235572356723577235872359723607236172362723637236472365723667236772368723697237072371723727237372374723757237672377723787237972380723817238272383723847238572386723877238872389723907239172392723937239472395723967239772398723997240072401724027240372404724057240672407724087240972410724117241272413724147241572416724177241872419724207242172422724237242472425724267242772428724297243072431724327243372434724357243672437724387243972440724417244272443724447244572446724477244872449724507245172452724537245472455724567245772458724597246072461724627246372464724657246672467724687246972470724717247272473724747247572476724777247872479724807248172482724837248472485724867248772488724897249072491724927249372494724957249672497724987249972500725017250272503725047250572506725077250872509725107251172512725137251472515725167251772518725197252072521725227252372524725257252672527725287252972530725317253272533725347253572536725377253872539725407254172542725437254472545725467254772548725497255072551725527255372554725557255672557725587255972560725617256272563725647256572566725677256872569725707257172572725737257472575725767257772578725797258072581725827258372584725857258672587725887258972590725917259272593725947259572596725977259872599726007260172602726037260472605726067260772608726097261072611726127261372614726157261672617726187261972620726217262272623726247262572626726277262872629726307263172632726337263472635726367263772638726397264072641726427264372644726457264672647726487264972650726517265272653726547265572656726577265872659726607266172662726637266472665726667266772668726697267072671726727267372674726757267672677726787267972680726817268272683726847268572686726877268872689726907269172692726937269472695726967269772698726997270072701727027270372704727057270672707727087270972710727117271272713727147271572716727177271872719727207272172722727237272472725727267272772728727297273072731727327273372734727357273672737727387273972740727417274272743727447274572746727477274872749727507275172752727537275472755727567275772758727597276072761727627276372764727657276672767727687276972770727717277272773727747277572776727777277872779727807278172782727837278472785727867278772788727897279072791727927279372794727957279672797727987279972800728017280272803728047280572806728077280872809728107281172812728137281472815728167281772818728197282072821728227282372824728257282672827728287282972830728317283272833728347283572836728377283872839728407284172842728437284472845728467284772848728497285072851728527285372854728557285672857728587285972860728617286272863728647286572866728677286872869728707287172872728737287472875728767287772878728797288072881728827288372884728857288672887728887288972890728917289272893728947289572896728977289872899729007290172902729037290472905729067290772908729097291072911729127291372914729157291672917729187291972920729217292272923729247292572926729277292872929729307293172932729337293472935729367293772938729397294072941729427294372944729457294672947729487294972950729517295272953729547295572956729577295872959729607296172962729637296472965729667296772968729697297072971729727297372974729757297672977729787297972980729817298272983729847298572986729877298872989729907299172992729937299472995729967299772998729997300073001730027300373004730057300673007730087300973010730117301273013730147301573016730177301873019730207302173022730237302473025730267302773028730297303073031730327303373034730357303673037730387303973040730417304273043730447304573046730477304873049730507305173052730537305473055730567305773058730597306073061730627306373064730657306673067730687306973070730717307273073730747307573076730777307873079730807308173082730837308473085730867308773088730897309073091730927309373094730957309673097730987309973100731017310273103731047310573106731077310873109731107311173112731137311473115731167311773118731197312073121731227312373124731257312673127731287312973130731317313273133731347313573136731377313873139731407314173142731437314473145731467314773148731497315073151731527315373154731557315673157731587315973160731617316273163731647316573166731677316873169731707317173172731737317473175731767317773178731797318073181731827318373184731857318673187731887318973190731917319273193731947319573196731977319873199732007320173202732037320473205732067320773208732097321073211732127321373214732157321673217732187321973220732217322273223732247322573226732277322873229732307323173232732337323473235732367323773238732397324073241732427324373244732457324673247732487324973250732517325273253732547325573256732577325873259732607326173262732637326473265732667326773268732697327073271732727327373274732757327673277732787327973280732817328273283732847328573286732877328873289732907329173292732937329473295732967329773298732997330073301733027330373304733057330673307733087330973310733117331273313733147331573316733177331873319733207332173322733237332473325733267332773328733297333073331733327333373334733357333673337733387333973340733417334273343733447334573346733477334873349733507335173352733537335473355733567335773358733597336073361733627336373364733657336673367733687336973370733717337273373733747337573376733777337873379733807338173382733837338473385733867338773388733897339073391733927339373394733957339673397733987339973400734017340273403734047340573406734077340873409734107341173412734137341473415734167341773418734197342073421734227342373424734257342673427734287342973430734317343273433734347343573436734377343873439734407344173442734437344473445734467344773448734497345073451734527345373454734557345673457734587345973460734617346273463734647346573466734677346873469734707347173472734737347473475734767347773478734797348073481734827348373484734857348673487734887348973490734917349273493734947349573496734977349873499735007350173502735037350473505735067350773508735097351073511735127351373514735157351673517735187351973520735217352273523735247352573526735277352873529735307353173532735337353473535735367353773538735397354073541735427354373544735457354673547735487354973550735517355273553735547355573556735577355873559735607356173562735637356473565735667356773568735697357073571735727357373574735757357673577735787357973580735817358273583735847358573586735877358873589735907359173592735937359473595735967359773598735997360073601736027360373604736057360673607736087360973610736117361273613736147361573616736177361873619736207362173622736237362473625736267362773628736297363073631736327363373634736357363673637736387363973640736417364273643736447364573646736477364873649736507365173652736537365473655736567365773658736597366073661736627366373664736657366673667736687366973670736717367273673736747367573676736777367873679736807368173682736837368473685736867368773688736897369073691736927369373694736957369673697736987369973700737017370273703737047370573706737077370873709737107371173712737137371473715737167371773718737197372073721737227372373724737257372673727737287372973730737317373273733737347373573736737377373873739737407374173742737437374473745737467374773748737497375073751737527375373754737557375673757737587375973760737617376273763737647376573766737677376873769737707377173772737737377473775737767377773778737797378073781737827378373784737857378673787737887378973790737917379273793737947379573796737977379873799738007380173802738037380473805738067380773808738097381073811738127381373814738157381673817738187381973820738217382273823738247382573826738277382873829738307383173832738337383473835738367383773838738397384073841738427384373844738457384673847738487384973850738517385273853738547385573856738577385873859738607386173862738637386473865738667386773868738697387073871738727387373874738757387673877738787387973880738817388273883738847388573886738877388873889738907389173892738937389473895738967389773898738997390073901739027390373904739057390673907739087390973910739117391273913739147391573916739177391873919739207392173922739237392473925739267392773928739297393073931739327393373934739357393673937739387393973940739417394273943739447394573946739477394873949739507395173952739537395473955739567395773958739597396073961739627396373964739657396673967739687396973970739717397273973739747397573976739777397873979739807398173982739837398473985739867398773988739897399073991739927399373994739957399673997739987399974000740017400274003740047400574006740077400874009740107401174012740137401474015740167401774018740197402074021740227402374024740257402674027740287402974030740317403274033740347403574036740377403874039740407404174042740437404474045740467404774048740497405074051740527405374054740557405674057740587405974060740617406274063740647406574066740677406874069740707407174072740737407474075740767407774078740797408074081740827408374084740857408674087740887408974090740917409274093740947409574096740977409874099741007410174102741037410474105741067410774108741097411074111741127411374114741157411674117741187411974120741217412274123741247412574126741277412874129741307413174132741337413474135741367413774138741397414074141741427414374144741457414674147741487414974150741517415274153741547415574156741577415874159741607416174162741637416474165741667416774168741697417074171741727417374174741757417674177741787417974180741817418274183741847418574186741877418874189741907419174192741937419474195741967419774198741997420074201742027420374204742057420674207742087420974210742117421274213742147421574216742177421874219742207422174222742237422474225742267422774228742297423074231742327423374234742357423674237742387423974240742417424274243742447424574246742477424874249742507425174252742537425474255742567425774258742597426074261742627426374264742657426674267742687426974270742717427274273742747427574276742777427874279742807428174282742837428474285742867428774288742897429074291742927429374294742957429674297742987429974300743017430274303743047430574306743077430874309743107431174312743137431474315743167431774318743197432074321743227432374324743257432674327743287432974330743317433274333743347433574336743377433874339743407434174342743437434474345743467434774348743497435074351743527435374354743557435674357743587435974360743617436274363743647436574366743677436874369743707437174372743737437474375743767437774378743797438074381743827438374384743857438674387743887438974390743917439274393743947439574396743977439874399744007440174402744037440474405744067440774408744097441074411744127441374414744157441674417744187441974420744217442274423744247442574426744277442874429744307443174432744337443474435744367443774438744397444074441744427444374444744457444674447744487444974450744517445274453744547445574456744577445874459744607446174462744637446474465744667446774468744697447074471744727447374474744757447674477744787447974480744817448274483744847448574486744877448874489744907449174492744937449474495744967449774498744997450074501745027450374504745057450674507745087450974510745117451274513745147451574516745177451874519745207452174522745237452474525745267452774528745297453074531745327453374534745357453674537745387453974540745417454274543745447454574546745477454874549745507455174552745537455474555745567455774558745597456074561745627456374564745657456674567745687456974570745717457274573745747457574576745777457874579745807458174582745837458474585745867458774588745897459074591745927459374594745957459674597745987459974600746017460274603746047460574606746077460874609746107461174612746137461474615746167461774618746197462074621746227462374624746257462674627746287462974630746317463274633746347463574636746377463874639746407464174642746437464474645746467464774648746497465074651746527465374654746557465674657746587465974660746617466274663746647466574666746677466874669746707467174672746737467474675746767467774678746797468074681746827468374684746857468674687746887468974690746917469274693746947469574696746977469874699747007470174702747037470474705747067470774708747097471074711747127471374714747157471674717747187471974720747217472274723747247472574726747277472874729747307473174732747337473474735747367473774738747397474074741747427474374744747457474674747747487474974750747517475274753747547475574756747577475874759747607476174762747637476474765747667476774768747697477074771747727477374774747757477674777747787477974780747817478274783747847478574786747877478874789747907479174792747937479474795747967479774798747997480074801748027480374804748057480674807748087480974810748117481274813748147481574816748177481874819748207482174822748237482474825748267482774828748297483074831748327483374834748357483674837748387483974840748417484274843748447484574846748477484874849748507485174852748537485474855748567485774858748597486074861748627486374864748657486674867748687486974870748717487274873748747487574876748777487874879748807488174882748837488474885748867488774888748897489074891748927489374894748957489674897748987489974900749017490274903749047490574906749077490874909749107491174912749137491474915749167491774918749197492074921749227492374924749257492674927749287492974930749317493274933749347493574936749377493874939749407494174942749437494474945749467494774948749497495074951749527495374954749557495674957749587495974960749617496274963749647496574966749677496874969749707497174972749737497474975749767497774978749797498074981749827498374984749857498674987749887498974990749917499274993749947499574996749977499874999750007500175002750037500475005750067500775008750097501075011750127501375014750157501675017750187501975020750217502275023750247502575026750277502875029750307503175032750337503475035750367503775038750397504075041750427504375044750457504675047750487504975050750517505275053750547505575056750577505875059750607506175062750637506475065750667506775068750697507075071750727507375074750757507675077750787507975080750817508275083750847508575086750877508875089750907509175092750937509475095750967509775098750997510075101751027510375104751057510675107751087510975110751117511275113751147511575116751177511875119751207512175122751237512475125751267512775128751297513075131751327513375134751357513675137751387513975140751417514275143751447514575146751477514875149751507515175152751537515475155751567515775158751597516075161751627516375164751657516675167751687516975170751717517275173751747517575176751777517875179751807518175182751837518475185751867518775188751897519075191751927519375194751957519675197751987519975200752017520275203752047520575206752077520875209752107521175212752137521475215752167521775218752197522075221752227522375224752257522675227752287522975230752317523275233752347523575236752377523875239752407524175242752437524475245752467524775248752497525075251752527525375254752557525675257752587525975260752617526275263752647526575266752677526875269752707527175272752737527475275752767527775278752797528075281752827528375284752857528675287752887528975290752917529275293752947529575296752977529875299753007530175302753037530475305753067530775308753097531075311753127531375314753157531675317753187531975320753217532275323753247532575326753277532875329753307533175332753337533475335753367533775338753397534075341753427534375344753457534675347753487534975350753517535275353753547535575356753577535875359753607536175362753637536475365753667536775368753697537075371753727537375374753757537675377753787537975380753817538275383753847538575386753877538875389753907539175392753937539475395753967539775398753997540075401754027540375404754057540675407754087540975410754117541275413754147541575416754177541875419754207542175422754237542475425754267542775428754297543075431754327543375434754357543675437754387543975440754417544275443754447544575446754477544875449754507545175452754537545475455754567545775458754597546075461754627546375464754657546675467754687546975470754717547275473754747547575476754777547875479754807548175482754837548475485754867548775488754897549075491754927549375494754957549675497754987549975500755017550275503755047550575506755077550875509755107551175512755137551475515755167551775518755197552075521755227552375524755257552675527755287552975530755317553275533755347553575536755377553875539755407554175542755437554475545755467554775548755497555075551755527555375554755557555675557755587555975560755617556275563755647556575566755677556875569755707557175572755737557475575755767557775578755797558075581755827558375584755857558675587755887558975590755917559275593755947559575596755977559875599756007560175602756037560475605756067560775608756097561075611756127561375614756157561675617756187561975620756217562275623756247562575626756277562875629756307563175632756337563475635756367563775638756397564075641756427564375644756457564675647756487564975650756517565275653756547565575656756577565875659756607566175662756637566475665756667566775668756697567075671756727567375674756757567675677756787567975680756817568275683756847568575686756877568875689756907569175692756937569475695756967569775698756997570075701757027570375704757057570675707757087570975710757117571275713757147571575716757177571875719757207572175722757237572475725757267572775728757297573075731757327573375734757357573675737757387573975740757417574275743757447574575746757477574875749757507575175752757537575475755757567575775758757597576075761757627576375764757657576675767757687576975770757717577275773757747577575776757777577875779757807578175782757837578475785757867578775788757897579075791757927579375794757957579675797757987579975800758017580275803758047580575806758077580875809758107581175812758137581475815758167581775818758197582075821758227582375824758257582675827758287582975830758317583275833758347583575836758377583875839758407584175842758437584475845758467584775848758497585075851758527585375854758557585675857758587585975860758617586275863758647586575866758677586875869758707587175872758737587475875758767587775878758797588075881758827588375884758857588675887758887588975890758917589275893758947589575896758977589875899759007590175902759037590475905759067590775908759097591075911759127591375914759157591675917759187591975920759217592275923759247592575926759277592875929759307593175932759337593475935759367593775938759397594075941759427594375944759457594675947759487594975950759517595275953759547595575956759577595875959759607596175962759637596475965759667596775968759697597075971759727597375974759757597675977759787597975980759817598275983759847598575986759877598875989759907599175992759937599475995759967599775998759997600076001760027600376004760057600676007760087600976010760117601276013760147601576016760177601876019760207602176022760237602476025760267602776028760297603076031760327603376034760357603676037760387603976040760417604276043760447604576046760477604876049760507605176052760537605476055760567605776058760597606076061760627606376064760657606676067760687606976070760717607276073760747607576076760777607876079760807608176082760837608476085760867608776088760897609076091760927609376094760957609676097760987609976100761017610276103761047610576106761077610876109761107611176112761137611476115761167611776118761197612076121761227612376124761257612676127761287612976130761317613276133761347613576136761377613876139761407614176142761437614476145761467614776148761497615076151761527615376154761557615676157761587615976160761617616276163761647616576166761677616876169761707617176172761737617476175761767617776178761797618076181761827618376184761857618676187761887618976190761917619276193761947619576196761977619876199762007620176202762037620476205762067620776208762097621076211762127621376214762157621676217762187621976220762217622276223762247622576226762277622876229762307623176232762337623476235762367623776238762397624076241762427624376244762457624676247762487624976250762517625276253762547625576256762577625876259762607626176262762637626476265762667626776268762697627076271762727627376274762757627676277762787627976280762817628276283762847628576286762877628876289762907629176292762937629476295762967629776298762997630076301763027630376304763057630676307763087630976310763117631276313763147631576316763177631876319763207632176322763237632476325763267632776328763297633076331763327633376334763357633676337763387633976340763417634276343763447634576346763477634876349763507635176352763537635476355763567635776358763597636076361763627636376364763657636676367763687636976370763717637276373763747637576376763777637876379763807638176382763837638476385763867638776388763897639076391763927639376394763957639676397763987639976400764017640276403764047640576406764077640876409764107641176412764137641476415764167641776418764197642076421764227642376424764257642676427764287642976430764317643276433764347643576436764377643876439764407644176442764437644476445764467644776448764497645076451764527645376454764557645676457764587645976460764617646276463764647646576466764677646876469764707647176472764737647476475764767647776478764797648076481764827648376484764857648676487764887648976490764917649276493764947649576496764977649876499765007650176502765037650476505765067650776508765097651076511765127651376514765157651676517765187651976520765217652276523765247652576526765277652876529765307653176532765337653476535765367653776538765397654076541765427654376544765457654676547765487654976550765517655276553765547655576556765577655876559765607656176562765637656476565765667656776568765697657076571765727657376574765757657676577765787657976580765817658276583765847658576586765877658876589765907659176592765937659476595765967659776598765997660076601766027660376604766057660676607766087660976610766117661276613766147661576616766177661876619766207662176622766237662476625766267662776628766297663076631766327663376634766357663676637766387663976640766417664276643766447664576646766477664876649766507665176652766537665476655766567665776658766597666076661766627666376664766657666676667766687666976670766717667276673766747667576676766777667876679766807668176682766837668476685766867668776688766897669076691766927669376694766957669676697766987669976700767017670276703767047670576706767077670876709767107671176712767137671476715767167671776718767197672076721767227672376724767257672676727767287672976730767317673276733767347673576736767377673876739767407674176742767437674476745767467674776748767497675076751767527675376754767557675676757767587675976760767617676276763767647676576766767677676876769767707677176772767737677476775767767677776778767797678076781767827678376784767857678676787767887678976790767917679276793767947679576796767977679876799768007680176802768037680476805768067680776808768097681076811768127681376814768157681676817768187681976820768217682276823768247682576826768277682876829768307683176832768337683476835768367683776838768397684076841768427684376844768457684676847768487684976850768517685276853768547685576856768577685876859768607686176862768637686476865768667686776868768697687076871768727687376874768757687676877768787687976880768817688276883768847688576886768877688876889768907689176892768937689476895768967689776898768997690076901769027690376904769057690676907769087690976910769117691276913769147691576916769177691876919769207692176922769237692476925769267692776928769297693076931769327693376934769357693676937769387693976940769417694276943769447694576946769477694876949769507695176952769537695476955769567695776958769597696076961769627696376964769657696676967769687696976970769717697276973769747697576976769777697876979769807698176982769837698476985769867698776988769897699076991769927699376994769957699676997769987699977000770017700277003770047700577006770077700877009770107701177012770137701477015770167701777018770197702077021770227702377024770257702677027770287702977030770317703277033770347703577036770377703877039770407704177042770437704477045770467704777048770497705077051770527705377054770557705677057770587705977060770617706277063770647706577066770677706877069770707707177072770737707477075770767707777078770797708077081770827708377084770857708677087770887708977090770917709277093770947709577096770977709877099771007710177102771037710477105771067710777108771097711077111771127711377114771157711677117771187711977120771217712277123771247712577126771277712877129771307713177132771337713477135771367713777138771397714077141771427714377144771457714677147771487714977150771517715277153771547715577156771577715877159771607716177162771637716477165771667716777168771697717077171771727717377174771757717677177771787717977180771817718277183771847718577186771877718877189771907719177192771937719477195771967719777198771997720077201772027720377204772057720677207772087720977210772117721277213772147721577216772177721877219772207722177222772237722477225772267722777228772297723077231772327723377234772357723677237772387723977240772417724277243772447724577246772477724877249772507725177252772537725477255772567725777258772597726077261772627726377264772657726677267772687726977270772717727277273772747727577276772777727877279772807728177282772837728477285772867728777288772897729077291772927729377294772957729677297772987729977300773017730277303773047730577306773077730877309773107731177312773137731477315773167731777318773197732077321773227732377324773257732677327773287732977330773317733277333773347733577336773377733877339773407734177342773437734477345773467734777348773497735077351773527735377354773557735677357773587735977360773617736277363773647736577366773677736877369773707737177372773737737477375773767737777378773797738077381773827738377384773857738677387773887738977390773917739277393773947739577396773977739877399774007740177402774037740477405774067740777408774097741077411774127741377414774157741677417774187741977420774217742277423774247742577426774277742877429774307743177432774337743477435774367743777438774397744077441774427744377444774457744677447774487744977450774517745277453774547745577456774577745877459774607746177462774637746477465774667746777468774697747077471774727747377474774757747677477774787747977480774817748277483774847748577486774877748877489774907749177492774937749477495774967749777498774997750077501775027750377504775057750677507775087750977510775117751277513775147751577516775177751877519775207752177522775237752477525775267752777528775297753077531775327753377534775357753677537775387753977540775417754277543775447754577546775477754877549775507755177552775537755477555775567755777558775597756077561775627756377564775657756677567775687756977570775717757277573775747757577576775777757877579775807758177582775837758477585775867758777588775897759077591775927759377594775957759677597775987759977600776017760277603776047760577606776077760877609776107761177612776137761477615776167761777618776197762077621776227762377624776257762677627776287762977630776317763277633776347763577636776377763877639776407764177642776437764477645776467764777648776497765077651776527765377654776557765677657776587765977660776617766277663776647766577666776677766877669776707767177672776737767477675776767767777678776797768077681776827768377684776857768677687776887768977690776917769277693776947769577696776977769877699777007770177702777037770477705777067770777708777097771077711777127771377714777157771677717777187771977720777217772277723777247772577726777277772877729777307773177732777337773477735777367773777738777397774077741777427774377744777457774677747777487774977750777517775277753777547775577756777577775877759777607776177762777637776477765777667776777768777697777077771777727777377774777757777677777777787777977780777817778277783777847778577786777877778877789777907779177792777937779477795777967779777798777997780077801778027780377804778057780677807778087780977810778117781277813778147781577816778177781877819778207782177822778237782477825778267782777828778297783077831778327783377834778357783677837778387783977840778417784277843778447784577846778477784877849778507785177852778537785477855778567785777858778597786077861778627786377864778657786677867778687786977870778717787277873778747787577876778777787877879778807788177882778837788477885778867788777888778897789077891778927789377894778957789677897778987789977900779017790277903779047790577906779077790877909779107791177912779137791477915779167791777918779197792077921779227792377924779257792677927779287792977930779317793277933779347793577936779377793877939779407794177942779437794477945779467794777948779497795077951779527795377954779557795677957779587795977960779617796277963779647796577966779677796877969779707797177972779737797477975779767797777978779797798077981779827798377984779857798677987779887798977990779917799277993779947799577996779977799877999780007800178002780037800478005780067800778008780097801078011780127801378014780157801678017780187801978020780217802278023780247802578026780277802878029780307803178032780337803478035780367803778038780397804078041780427804378044780457804678047780487804978050780517805278053780547805578056780577805878059780607806178062780637806478065780667806778068780697807078071780727807378074780757807678077780787807978080780817808278083780847808578086780877808878089780907809178092780937809478095780967809778098780997810078101781027810378104781057810678107781087810978110781117811278113781147811578116781177811878119781207812178122781237812478125781267812778128781297813078131781327813378134781357813678137781387813978140781417814278143781447814578146781477814878149781507815178152781537815478155781567815778158781597816078161781627816378164781657816678167781687816978170781717817278173781747817578176781777817878179781807818178182781837818478185781867818778188781897819078191781927819378194781957819678197781987819978200782017820278203782047820578206782077820878209782107821178212782137821478215782167821778218782197822078221782227822378224782257822678227782287822978230782317823278233782347823578236782377823878239782407824178242782437824478245782467824778248782497825078251782527825378254782557825678257782587825978260782617826278263782647826578266782677826878269782707827178272782737827478275782767827778278782797828078281782827828378284782857828678287782887828978290782917829278293782947829578296782977829878299783007830178302783037830478305783067830778308783097831078311783127831378314783157831678317783187831978320783217832278323783247832578326783277832878329783307833178332783337833478335783367833778338783397834078341783427834378344783457834678347783487834978350783517835278353783547835578356783577835878359783607836178362783637836478365783667836778368783697837078371783727837378374783757837678377783787837978380783817838278383783847838578386783877838878389783907839178392783937839478395783967839778398783997840078401784027840378404784057840678407784087840978410784117841278413784147841578416784177841878419784207842178422784237842478425784267842778428784297843078431784327843378434784357843678437784387843978440784417844278443784447844578446784477844878449784507845178452784537845478455784567845778458784597846078461784627846378464784657846678467784687846978470784717847278473784747847578476784777847878479784807848178482784837848478485784867848778488784897849078491784927849378494784957849678497784987849978500785017850278503785047850578506785077850878509785107851178512785137851478515785167851778518785197852078521785227852378524785257852678527785287852978530785317853278533785347853578536785377853878539785407854178542785437854478545785467854778548785497855078551785527855378554785557855678557785587855978560785617856278563785647856578566785677856878569785707857178572785737857478575785767857778578785797858078581785827858378584785857858678587785887858978590785917859278593785947859578596785977859878599786007860178602786037860478605786067860778608786097861078611786127861378614786157861678617786187861978620786217862278623786247862578626786277862878629786307863178632786337863478635786367863778638786397864078641786427864378644786457864678647786487864978650786517865278653786547865578656786577865878659786607866178662786637866478665786667866778668786697867078671786727867378674786757867678677786787867978680786817868278683786847868578686786877868878689786907869178692786937869478695786967869778698786997870078701787027870378704787057870678707787087870978710787117871278713787147871578716787177871878719787207872178722787237872478725787267872778728787297873078731787327873378734787357873678737787387873978740787417874278743787447874578746787477874878749787507875178752787537875478755787567875778758787597876078761787627876378764787657876678767787687876978770787717877278773787747877578776787777877878779787807878178782787837878478785787867878778788787897879078791787927879378794787957879678797787987879978800788017880278803788047880578806788077880878809788107881178812788137881478815788167881778818788197882078821788227882378824788257882678827788287882978830788317883278833788347883578836788377883878839788407884178842788437884478845788467884778848788497885078851788527885378854788557885678857788587885978860788617886278863788647886578866788677886878869788707887178872788737887478875788767887778878788797888078881788827888378884788857888678887788887888978890788917889278893788947889578896788977889878899789007890178902789037890478905789067890778908789097891078911789127891378914789157891678917789187891978920789217892278923789247892578926789277892878929789307893178932789337893478935789367893778938789397894078941789427894378944789457894678947789487894978950789517895278953789547895578956789577895878959789607896178962789637896478965789667896778968789697897078971789727897378974789757897678977789787897978980789817898278983789847898578986789877898878989789907899178992789937899478995789967899778998789997900079001790027900379004790057900679007790087900979010790117901279013790147901579016790177901879019790207902179022790237902479025790267902779028790297903079031790327903379034790357903679037790387903979040790417904279043790447904579046790477904879049790507905179052790537905479055790567905779058790597906079061790627906379064790657906679067790687906979070790717907279073790747907579076790777907879079790807908179082790837908479085790867908779088790897909079091790927909379094790957909679097790987909979100791017910279103791047910579106791077910879109791107911179112791137911479115791167911779118791197912079121791227912379124791257912679127791287912979130791317913279133791347913579136791377913879139791407914179142791437914479145791467914779148791497915079151791527915379154791557915679157791587915979160791617916279163791647916579166791677916879169791707917179172791737917479175791767917779178791797918079181791827918379184791857918679187791887918979190791917919279193791947919579196791977919879199792007920179202792037920479205792067920779208792097921079211792127921379214792157921679217792187921979220792217922279223792247922579226792277922879229792307923179232792337923479235792367923779238792397924079241792427924379244792457924679247792487924979250792517925279253792547925579256792577925879259792607926179262792637926479265792667926779268792697927079271792727927379274792757927679277792787927979280792817928279283792847928579286792877928879289792907929179292792937929479295792967929779298792997930079301793027930379304793057930679307793087930979310793117931279313793147931579316793177931879319793207932179322793237932479325793267932779328793297933079331793327933379334793357933679337793387933979340793417934279343793447934579346793477934879349793507935179352793537935479355793567935779358793597936079361793627936379364793657936679367793687936979370793717937279373793747937579376793777937879379793807938179382793837938479385793867938779388793897939079391793927939379394793957939679397793987939979400794017940279403794047940579406794077940879409794107941179412794137941479415794167941779418794197942079421794227942379424794257942679427794287942979430794317943279433794347943579436794377943879439794407944179442794437944479445794467944779448794497945079451794527945379454794557945679457794587945979460794617946279463794647946579466794677946879469794707947179472794737947479475794767947779478794797948079481794827948379484794857948679487794887948979490794917949279493794947949579496794977949879499795007950179502795037950479505795067950779508795097951079511795127951379514795157951679517795187951979520795217952279523795247952579526795277952879529795307953179532795337953479535795367953779538795397954079541795427954379544795457954679547795487954979550795517955279553795547955579556795577955879559795607956179562795637956479565795667956779568795697957079571795727957379574795757957679577795787957979580795817958279583795847958579586795877958879589795907959179592795937959479595795967959779598795997960079601796027960379604796057960679607796087960979610796117961279613796147961579616796177961879619796207962179622796237962479625796267962779628796297963079631796327963379634796357963679637796387963979640796417964279643796447964579646796477964879649796507965179652796537965479655796567965779658796597966079661796627966379664796657966679667796687966979670796717967279673796747967579676796777967879679796807968179682796837968479685796867968779688796897969079691796927969379694796957969679697796987969979700797017970279703797047970579706797077970879709797107971179712797137971479715797167971779718797197972079721797227972379724797257972679727797287972979730797317973279733797347973579736797377973879739797407974179742797437974479745797467974779748797497975079751797527975379754797557975679757797587975979760797617976279763797647976579766797677976879769797707977179772797737977479775797767977779778797797978079781797827978379784797857978679787797887978979790797917979279793797947979579796797977979879799798007980179802798037980479805798067980779808798097981079811798127981379814798157981679817798187981979820798217982279823798247982579826798277982879829798307983179832798337983479835798367983779838798397984079841798427984379844798457984679847798487984979850798517985279853798547985579856798577985879859798607986179862798637986479865798667986779868798697987079871798727987379874798757987679877798787987979880798817988279883798847988579886798877988879889798907989179892798937989479895798967989779898798997990079901799027990379904799057990679907799087990979910799117991279913799147991579916799177991879919799207992179922799237992479925799267992779928799297993079931799327993379934799357993679937799387993979940799417994279943799447994579946799477994879949799507995179952799537995479955799567995779958799597996079961799627996379964799657996679967799687996979970799717997279973799747997579976799777997879979799807998179982799837998479985799867998779988799897999079991799927999379994799957999679997799987999980000800018000280003800048000580006800078000880009800108001180012800138001480015800168001780018800198002080021800228002380024800258002680027800288002980030800318003280033800348003580036800378003880039800408004180042800438004480045800468004780048800498005080051800528005380054800558005680057800588005980060800618006280063800648006580066800678006880069800708007180072800738007480075800768007780078800798008080081800828008380084800858008680087800888008980090800918009280093800948009580096800978009880099801008010180102801038010480105801068010780108801098011080111801128011380114801158011680117801188011980120801218012280123801248012580126801278012880129801308013180132801338013480135801368013780138801398014080141801428014380144801458014680147801488014980150801518015280153801548015580156801578015880159801608016180162801638016480165801668016780168801698017080171801728017380174801758017680177801788017980180801818018280183801848018580186801878018880189801908019180192801938019480195801968019780198801998020080201802028020380204802058020680207802088020980210802118021280213802148021580216802178021880219802208022180222802238022480225802268022780228802298023080231802328023380234802358023680237802388023980240802418024280243802448024580246802478024880249802508025180252802538025480255802568025780258802598026080261802628026380264802658026680267802688026980270802718027280273802748027580276802778027880279802808028180282802838028480285802868028780288802898029080291802928029380294802958029680297802988029980300803018030280303803048030580306803078030880309803108031180312803138031480315803168031780318803198032080321803228032380324803258032680327803288032980330803318033280333803348033580336803378033880339803408034180342803438034480345803468034780348803498035080351803528035380354803558035680357803588035980360803618036280363803648036580366803678036880369803708037180372803738037480375803768037780378803798038080381803828038380384803858038680387803888038980390803918039280393803948039580396803978039880399804008040180402804038040480405804068040780408804098041080411804128041380414804158041680417804188041980420804218042280423804248042580426804278042880429804308043180432804338043480435804368043780438804398044080441804428044380444804458044680447804488044980450804518045280453804548045580456804578045880459804608046180462804638046480465804668046780468804698047080471804728047380474804758047680477804788047980480804818048280483804848048580486804878048880489804908049180492804938049480495804968049780498804998050080501805028050380504805058050680507805088050980510805118051280513805148051580516805178051880519805208052180522805238052480525805268052780528805298053080531805328053380534805358053680537805388053980540805418054280543805448054580546805478054880549805508055180552805538055480555805568055780558805598056080561805628056380564805658056680567805688056980570805718057280573805748057580576805778057880579805808058180582805838058480585805868058780588805898059080591805928059380594805958059680597805988059980600806018060280603806048060580606806078060880609806108061180612806138061480615806168061780618806198062080621806228062380624806258062680627806288062980630806318063280633806348063580636806378063880639806408064180642806438064480645806468064780648806498065080651806528065380654806558065680657806588065980660806618066280663806648066580666806678066880669806708067180672806738067480675806768067780678806798068080681806828068380684806858068680687806888068980690806918069280693806948069580696806978069880699807008070180702807038070480705807068070780708807098071080711807128071380714807158071680717807188071980720807218072280723807248072580726807278072880729807308073180732807338073480735807368073780738807398074080741807428074380744807458074680747807488074980750807518075280753807548075580756807578075880759807608076180762807638076480765807668076780768807698077080771807728077380774807758077680777807788077980780807818078280783807848078580786807878078880789807908079180792807938079480795807968079780798807998080080801808028080380804808058080680807808088080980810808118081280813808148081580816808178081880819808208082180822808238082480825808268082780828808298083080831808328083380834808358083680837808388083980840808418084280843808448084580846808478084880849808508085180852808538085480855808568085780858808598086080861808628086380864808658086680867808688086980870808718087280873808748087580876808778087880879808808088180882808838088480885808868088780888808898089080891808928089380894808958089680897808988089980900809018090280903809048090580906809078090880909809108091180912809138091480915809168091780918809198092080921809228092380924809258092680927809288092980930809318093280933809348093580936809378093880939809408094180942809438094480945809468094780948809498095080951809528095380954809558095680957809588095980960809618096280963809648096580966809678096880969809708097180972809738097480975809768097780978809798098080981809828098380984809858098680987809888098980990809918099280993809948099580996809978099880999810008100181002810038100481005810068100781008810098101081011810128101381014810158101681017810188101981020810218102281023810248102581026810278102881029810308103181032810338103481035810368103781038810398104081041810428104381044810458104681047810488104981050810518105281053810548105581056810578105881059810608106181062810638106481065810668106781068810698107081071810728107381074810758107681077810788107981080810818108281083810848108581086810878108881089810908109181092810938109481095810968109781098810998110081101811028110381104811058110681107811088110981110811118111281113811148111581116811178111881119811208112181122811238112481125811268112781128811298113081131811328113381134811358113681137811388113981140811418114281143811448114581146811478114881149811508115181152811538115481155811568115781158811598116081161811628116381164811658116681167811688116981170811718117281173811748117581176811778117881179811808118181182811838118481185811868118781188811898119081191811928119381194811958119681197811988119981200812018120281203812048120581206812078120881209812108121181212812138121481215812168121781218812198122081221812228122381224812258122681227812288122981230812318123281233812348123581236812378123881239812408124181242812438124481245812468124781248812498125081251812528125381254812558125681257812588125981260812618126281263812648126581266812678126881269812708127181272812738127481275812768127781278812798128081281812828128381284812858128681287812888128981290812918129281293812948129581296812978129881299813008130181302813038130481305813068130781308813098131081311813128131381314813158131681317813188131981320813218132281323813248132581326813278132881329813308133181332813338133481335813368133781338813398134081341813428134381344813458134681347813488134981350813518135281353813548135581356813578135881359813608136181362813638136481365813668136781368813698137081371813728137381374813758137681377813788137981380813818138281383813848138581386813878138881389813908139181392813938139481395813968139781398813998140081401814028140381404814058140681407814088140981410814118141281413814148141581416814178141881419814208142181422814238142481425814268142781428814298143081431814328143381434814358143681437814388143981440814418144281443814448144581446814478144881449814508145181452814538145481455814568145781458814598146081461814628146381464814658146681467814688146981470814718147281473814748147581476814778147881479814808148181482814838148481485814868148781488814898149081491814928149381494814958149681497814988149981500815018150281503815048150581506815078150881509815108151181512815138151481515815168151781518815198152081521815228152381524815258152681527815288152981530815318153281533815348153581536815378153881539815408154181542815438154481545815468154781548815498155081551815528155381554815558155681557815588155981560815618156281563815648156581566815678156881569815708157181572815738157481575815768157781578815798158081581815828158381584815858158681587815888158981590815918159281593815948159581596815978159881599816008160181602816038160481605816068160781608816098161081611816128161381614816158161681617816188161981620816218162281623816248162581626816278162881629816308163181632816338163481635816368163781638816398164081641816428164381644816458164681647816488164981650816518165281653816548165581656816578165881659816608166181662816638166481665816668166781668816698167081671816728167381674816758167681677816788167981680816818168281683816848168581686816878168881689816908169181692816938169481695816968169781698816998170081701817028170381704817058170681707817088170981710817118171281713817148171581716817178171881719817208172181722817238172481725817268172781728817298173081731817328173381734817358173681737817388173981740817418174281743817448174581746817478174881749817508175181752817538175481755817568175781758817598176081761817628176381764817658176681767817688176981770817718177281773817748177581776817778177881779817808178181782817838178481785817868178781788817898179081791817928179381794817958179681797817988179981800818018180281803818048180581806818078180881809818108181181812818138181481815818168181781818818198182081821818228182381824818258182681827818288182981830818318183281833818348183581836818378183881839818408184181842818438184481845818468184781848818498185081851818528185381854818558185681857818588185981860818618186281863818648186581866818678186881869818708187181872818738187481875818768187781878818798188081881818828188381884818858188681887818888188981890818918189281893818948189581896818978189881899819008190181902819038190481905819068190781908819098191081911819128191381914819158191681917819188191981920819218192281923819248192581926819278192881929819308193181932819338193481935819368193781938819398194081941819428194381944819458194681947819488194981950819518195281953819548195581956819578195881959819608196181962819638196481965819668196781968819698197081971819728197381974819758197681977819788197981980819818198281983819848198581986819878198881989819908199181992819938199481995819968199781998819998200082001820028200382004820058200682007820088200982010820118201282013820148201582016820178201882019820208202182022820238202482025820268202782028820298203082031820328203382034820358203682037820388203982040820418204282043820448204582046820478204882049820508205182052820538205482055820568205782058820598206082061820628206382064820658206682067820688206982070820718207282073820748207582076820778207882079820808208182082820838208482085820868208782088820898209082091820928209382094820958209682097820988209982100821018210282103821048210582106821078210882109821108211182112821138211482115821168211782118821198212082121821228212382124821258212682127821288212982130821318213282133821348213582136821378213882139821408214182142821438214482145821468214782148821498215082151821528215382154821558215682157821588215982160821618216282163821648216582166821678216882169821708217182172821738217482175821768217782178821798218082181821828218382184821858218682187821888218982190821918219282193821948219582196821978219882199822008220182202822038220482205822068220782208822098221082211822128221382214822158221682217822188221982220822218222282223822248222582226822278222882229822308223182232822338223482235822368223782238822398224082241822428224382244822458224682247822488224982250822518225282253822548225582256822578225882259822608226182262822638226482265822668226782268822698227082271822728227382274822758227682277822788227982280822818228282283822848228582286822878228882289822908229182292822938229482295822968229782298822998230082301823028230382304823058230682307823088230982310823118231282313823148231582316823178231882319823208232182322823238232482325823268232782328823298233082331823328233382334823358233682337823388233982340823418234282343823448234582346823478234882349823508235182352823538235482355823568235782358823598236082361823628236382364823658236682367823688236982370823718237282373823748237582376823778237882379823808238182382823838238482385823868238782388823898239082391823928239382394823958239682397823988239982400824018240282403824048240582406824078240882409824108241182412824138241482415824168241782418824198242082421824228242382424824258242682427824288242982430824318243282433824348243582436824378243882439824408244182442824438244482445824468244782448824498245082451824528245382454824558245682457824588245982460824618246282463824648246582466824678246882469824708247182472824738247482475824768247782478824798248082481824828248382484824858248682487824888248982490824918249282493824948249582496824978249882499825008250182502825038250482505825068250782508825098251082511825128251382514825158251682517825188251982520825218252282523825248252582526825278252882529825308253182532825338253482535825368253782538825398254082541825428254382544825458254682547825488254982550825518255282553825548255582556825578255882559825608256182562825638256482565825668256782568825698257082571825728257382574825758257682577825788257982580825818258282583825848258582586825878258882589825908259182592825938259482595825968259782598825998260082601826028260382604826058260682607826088260982610826118261282613826148261582616826178261882619826208262182622826238262482625826268262782628826298263082631826328263382634826358263682637826388263982640826418264282643826448264582646826478264882649826508265182652826538265482655826568265782658826598266082661826628266382664826658266682667826688266982670826718267282673826748267582676826778267882679826808268182682826838268482685826868268782688826898269082691826928269382694826958269682697826988269982700827018270282703827048270582706827078270882709827108271182712827138271482715827168271782718827198272082721827228272382724827258272682727827288272982730827318273282733827348273582736827378273882739827408274182742827438274482745827468274782748827498275082751827528275382754827558275682757827588275982760827618276282763827648276582766827678276882769827708277182772827738277482775827768277782778827798278082781827828278382784827858278682787827888278982790827918279282793827948279582796827978279882799828008280182802828038280482805828068280782808828098281082811828128281382814828158281682817828188281982820828218282282823828248282582826828278282882829828308283182832828338283482835828368283782838828398284082841828428284382844828458284682847828488284982850828518285282853828548285582856828578285882859828608286182862828638286482865828668286782868828698287082871828728287382874828758287682877828788287982880828818288282883828848288582886828878288882889828908289182892828938289482895828968289782898828998290082901829028290382904829058290682907829088290982910829118291282913829148291582916829178291882919829208292182922829238292482925829268292782928829298293082931829328293382934829358293682937829388293982940829418294282943829448294582946829478294882949829508295182952829538295482955829568295782958829598296082961829628296382964829658296682967829688296982970829718297282973829748297582976829778297882979829808298182982829838298482985829868298782988829898299082991829928299382994829958299682997829988299983000830018300283003830048300583006830078300883009830108301183012830138301483015830168301783018830198302083021830228302383024830258302683027830288302983030830318303283033830348303583036830378303883039830408304183042830438304483045830468304783048830498305083051830528305383054830558305683057830588305983060830618306283063830648306583066830678306883069830708307183072830738307483075830768307783078830798308083081830828308383084830858308683087830888308983090830918309283093830948309583096830978309883099831008310183102831038310483105831068310783108831098311083111831128311383114831158311683117831188311983120831218312283123831248312583126831278312883129831308313183132831338313483135831368313783138831398314083141831428314383144831458314683147831488314983150831518315283153831548315583156831578315883159831608316183162831638316483165831668316783168831698317083171831728317383174831758317683177831788317983180831818318283183831848318583186831878318883189831908319183192831938319483195831968319783198831998320083201832028320383204832058320683207832088320983210832118321283213832148321583216832178321883219832208322183222832238322483225832268322783228832298323083231832328323383234832358323683237832388323983240832418324283243832448324583246832478324883249832508325183252832538325483255832568325783258832598326083261832628326383264832658326683267832688326983270832718327283273832748327583276832778327883279832808328183282832838328483285832868328783288832898329083291832928329383294832958329683297832988329983300833018330283303833048330583306833078330883309833108331183312833138331483315833168331783318833198332083321833228332383324833258332683327833288332983330833318333283333833348333583336833378333883339833408334183342833438334483345833468334783348833498335083351833528335383354833558335683357833588335983360833618336283363833648336583366833678336883369833708337183372833738337483375833768337783378833798338083381833828338383384833858338683387833888338983390833918339283393833948339583396833978339883399834008340183402834038340483405834068340783408834098341083411834128341383414834158341683417834188341983420834218342283423834248342583426834278342883429834308343183432834338343483435834368343783438834398344083441834428344383444834458344683447834488344983450834518345283453834548345583456834578345883459834608346183462834638346483465834668346783468834698347083471834728347383474834758347683477834788347983480834818348283483834848348583486834878348883489834908349183492834938349483495834968349783498834998350083501835028350383504835058350683507835088350983510835118351283513835148351583516835178351883519835208352183522835238352483525835268352783528835298353083531835328353383534835358353683537835388353983540835418354283543835448354583546835478354883549835508355183552835538355483555835568355783558835598356083561835628356383564835658356683567835688356983570835718357283573835748357583576835778357883579835808358183582835838358483585835868358783588835898359083591835928359383594835958359683597835988359983600836018360283603836048360583606836078360883609836108361183612836138361483615836168361783618836198362083621836228362383624836258362683627836288362983630836318363283633836348363583636836378363883639836408364183642836438364483645836468364783648836498365083651836528365383654836558365683657836588365983660836618366283663836648366583666836678366883669836708367183672836738367483675836768367783678836798368083681836828368383684836858368683687836888368983690836918369283693836948369583696836978369883699837008370183702837038370483705837068370783708837098371083711837128371383714837158371683717837188371983720837218372283723837248372583726837278372883729837308373183732837338373483735837368373783738837398374083741837428374383744837458374683747837488374983750837518375283753837548375583756837578375883759837608376183762837638376483765837668376783768837698377083771837728377383774837758377683777837788377983780837818378283783837848378583786837878378883789837908379183792837938379483795837968379783798837998380083801838028380383804838058380683807838088380983810838118381283813838148381583816838178381883819838208382183822838238382483825838268382783828838298383083831838328383383834838358383683837838388383983840838418384283843838448384583846838478384883849838508385183852838538385483855838568385783858838598386083861838628386383864838658386683867838688386983870838718387283873838748387583876838778387883879838808388183882838838388483885838868388783888838898389083891838928389383894838958389683897838988389983900839018390283903839048390583906839078390883909839108391183912839138391483915839168391783918839198392083921839228392383924839258392683927839288392983930839318393283933839348393583936839378393883939839408394183942839438394483945839468394783948839498395083951839528395383954839558395683957839588395983960839618396283963839648396583966839678396883969839708397183972839738397483975839768397783978839798398083981839828398383984839858398683987839888398983990839918399283993839948399583996839978399883999840008400184002840038400484005840068400784008840098401084011840128401384014840158401684017840188401984020840218402284023840248402584026840278402884029840308403184032840338403484035840368403784038840398404084041840428404384044840458404684047840488404984050840518405284053840548405584056840578405884059840608406184062840638406484065840668406784068840698407084071840728407384074840758407684077840788407984080840818408284083840848408584086840878408884089840908409184092840938409484095840968409784098840998410084101841028410384104841058410684107841088410984110841118411284113841148411584116841178411884119841208412184122841238412484125841268412784128841298413084131841328413384134841358413684137841388413984140841418414284143841448414584146841478414884149841508415184152841538415484155841568415784158841598416084161841628416384164841658416684167841688416984170841718417284173841748417584176841778417884179841808418184182841838418484185841868418784188841898419084191841928419384194841958419684197841988419984200842018420284203842048420584206842078420884209842108421184212842138421484215842168421784218842198422084221842228422384224842258422684227842288422984230842318423284233842348423584236842378423884239842408424184242842438424484245842468424784248842498425084251842528425384254842558425684257842588425984260842618426284263842648426584266842678426884269842708427184272842738427484275842768427784278842798428084281842828428384284842858428684287842888428984290842918429284293842948429584296842978429884299843008430184302843038430484305843068430784308843098431084311843128431384314843158431684317843188431984320843218432284323843248432584326843278432884329843308433184332843338433484335843368433784338843398434084341843428434384344843458434684347843488434984350843518435284353843548435584356843578435884359843608436184362843638436484365843668436784368843698437084371843728437384374843758437684377843788437984380843818438284383843848438584386843878438884389843908439184392843938439484395843968439784398843998440084401844028440384404844058440684407844088440984410844118441284413844148441584416844178441884419844208442184422844238442484425844268442784428844298443084431844328443384434844358443684437844388443984440844418444284443844448444584446844478444884449844508445184452844538445484455844568445784458844598446084461844628446384464844658446684467844688446984470844718447284473844748447584476844778447884479844808448184482844838448484485844868448784488844898449084491844928449384494844958449684497844988449984500845018450284503845048450584506845078450884509845108451184512845138451484515845168451784518845198452084521845228452384524845258452684527845288452984530845318453284533845348453584536845378453884539845408454184542845438454484545845468454784548845498455084551845528455384554845558455684557845588455984560845618456284563845648456584566845678456884569845708457184572845738457484575845768457784578845798458084581845828458384584845858458684587845888458984590845918459284593845948459584596845978459884599846008460184602846038460484605846068460784608846098461084611846128461384614846158461684617846188461984620846218462284623846248462584626846278462884629846308463184632846338463484635846368463784638846398464084641846428464384644846458464684647846488464984650846518465284653846548465584656846578465884659846608466184662846638466484665846668466784668846698467084671846728467384674846758467684677846788467984680846818468284683846848468584686846878468884689846908469184692846938469484695846968469784698846998470084701847028470384704847058470684707847088470984710847118471284713847148471584716847178471884719847208472184722847238472484725847268472784728847298473084731847328473384734847358473684737847388473984740847418474284743847448474584746847478474884749847508475184752847538475484755847568475784758847598476084761847628476384764847658476684767847688476984770847718477284773847748477584776847778477884779847808478184782847838478484785847868478784788847898479084791847928479384794847958479684797847988479984800848018480284803848048480584806848078480884809848108481184812848138481484815848168481784818848198482084821848228482384824848258482684827848288482984830848318483284833848348483584836848378483884839848408484184842848438484484845848468484784848848498485084851848528485384854848558485684857848588485984860848618486284863848648486584866848678486884869848708487184872848738487484875848768487784878848798488084881848828488384884848858488684887848888488984890848918489284893848948489584896848978489884899849008490184902849038490484905849068490784908849098491084911849128491384914849158491684917849188491984920849218492284923849248492584926849278492884929849308493184932849338493484935849368493784938849398494084941849428494384944849458494684947849488494984950849518495284953849548495584956849578495884959849608496184962849638496484965849668496784968849698497084971849728497384974849758497684977849788497984980849818498284983849848498584986849878498884989849908499184992849938499484995849968499784998849998500085001850028500385004850058500685007850088500985010850118501285013850148501585016850178501885019850208502185022850238502485025850268502785028850298503085031850328503385034850358503685037850388503985040850418504285043850448504585046850478504885049850508505185052850538505485055850568505785058850598506085061850628506385064850658506685067850688506985070850718507285073850748507585076850778507885079850808508185082850838508485085850868508785088850898509085091850928509385094850958509685097850988509985100851018510285103851048510585106851078510885109851108511185112851138511485115851168511785118851198512085121851228512385124851258512685127851288512985130851318513285133851348513585136851378513885139851408514185142851438514485145851468514785148851498515085151851528515385154851558515685157851588515985160851618516285163851648516585166851678516885169851708517185172851738517485175851768517785178851798518085181851828518385184851858518685187851888518985190851918519285193851948519585196851978519885199852008520185202852038520485205852068520785208852098521085211852128521385214852158521685217852188521985220852218522285223852248522585226852278522885229852308523185232852338523485235852368523785238852398524085241852428524385244852458524685247852488524985250852518525285253852548525585256852578525885259852608526185262852638526485265852668526785268852698527085271852728527385274852758527685277852788527985280852818528285283852848528585286852878528885289852908529185292852938529485295852968529785298852998530085301853028530385304853058530685307853088530985310853118531285313853148531585316853178531885319853208532185322853238532485325853268532785328853298533085331853328533385334853358533685337853388533985340853418534285343853448534585346853478534885349853508535185352853538535485355853568535785358853598536085361853628536385364853658536685367853688536985370853718537285373853748537585376853778537885379853808538185382853838538485385853868538785388853898539085391853928539385394853958539685397853988539985400854018540285403854048540585406854078540885409854108541185412854138541485415854168541785418854198542085421854228542385424854258542685427854288542985430854318543285433854348543585436854378543885439854408544185442854438544485445854468544785448854498545085451854528545385454854558545685457854588545985460854618546285463854648546585466854678546885469854708547185472854738547485475854768547785478854798548085481854828548385484854858548685487854888548985490854918549285493854948549585496854978549885499855008550185502855038550485505855068550785508855098551085511855128551385514855158551685517855188551985520855218552285523855248552585526855278552885529855308553185532855338553485535855368553785538855398554085541855428554385544855458554685547855488554985550855518555285553855548555585556855578555885559855608556185562855638556485565855668556785568855698557085571855728557385574855758557685577855788557985580855818558285583855848558585586855878558885589855908559185592855938559485595855968559785598855998560085601856028560385604856058560685607856088560985610856118561285613856148561585616856178561885619856208562185622856238562485625856268562785628856298563085631856328563385634856358563685637856388563985640856418564285643856448564585646856478564885649856508565185652856538565485655856568565785658856598566085661856628566385664856658566685667856688566985670856718567285673856748567585676856778567885679856808568185682856838568485685856868568785688856898569085691856928569385694856958569685697856988569985700857018570285703857048570585706857078570885709857108571185712857138571485715857168571785718857198572085721857228572385724857258572685727857288572985730857318573285733857348573585736857378573885739857408574185742857438574485745857468574785748857498575085751857528575385754857558575685757857588575985760857618576285763857648576585766857678576885769857708577185772857738577485775857768577785778857798578085781857828578385784857858578685787857888578985790857918579285793857948579585796857978579885799858008580185802858038580485805858068580785808858098581085811858128581385814858158581685817858188581985820858218582285823858248582585826858278582885829858308583185832858338583485835858368583785838858398584085841858428584385844858458584685847858488584985850858518585285853858548585585856858578585885859858608586185862858638586485865858668586785868858698587085871858728587385874858758587685877858788587985880858818588285883858848588585886858878588885889858908589185892858938589485895858968589785898858998590085901859028590385904859058590685907859088590985910859118591285913859148591585916859178591885919859208592185922859238592485925859268592785928859298593085931859328593385934859358593685937859388593985940859418594285943859448594585946859478594885949859508595185952859538595485955859568595785958859598596085961859628596385964859658596685967859688596985970859718597285973859748597585976859778597885979859808598185982859838598485985859868598785988859898599085991859928599385994859958599685997859988599986000860018600286003860048600586006860078600886009860108601186012860138601486015860168601786018860198602086021860228602386024860258602686027860288602986030860318603286033860348603586036860378603886039860408604186042860438604486045860468604786048860498605086051860528605386054860558605686057860588605986060860618606286063860648606586066860678606886069860708607186072860738607486075860768607786078860798608086081860828608386084860858608686087860888608986090860918609286093860948609586096860978609886099861008610186102861038610486105861068610786108861098611086111861128611386114861158611686117861188611986120861218612286123861248612586126861278612886129861308613186132861338613486135861368613786138861398614086141861428614386144861458614686147861488614986150861518615286153861548615586156861578615886159861608616186162861638616486165861668616786168861698617086171861728617386174861758617686177861788617986180861818618286183861848618586186861878618886189861908619186192861938619486195861968619786198861998620086201862028620386204862058620686207862088620986210862118621286213862148621586216862178621886219862208622186222862238622486225862268622786228862298623086231862328623386234862358623686237862388623986240862418624286243862448624586246862478624886249862508625186252862538625486255862568625786258862598626086261862628626386264862658626686267862688626986270862718627286273862748627586276862778627886279862808628186282862838628486285862868628786288862898629086291862928629386294862958629686297862988629986300863018630286303863048630586306863078630886309863108631186312863138631486315863168631786318863198632086321863228632386324863258632686327863288632986330863318633286333863348633586336863378633886339863408634186342863438634486345863468634786348863498635086351863528635386354863558635686357863588635986360863618636286363863648636586366863678636886369863708637186372863738637486375863768637786378863798638086381863828638386384863858638686387863888638986390863918639286393863948639586396863978639886399864008640186402864038640486405864068640786408864098641086411864128641386414864158641686417864188641986420864218642286423864248642586426864278642886429864308643186432864338643486435864368643786438864398644086441864428644386444864458644686447864488644986450864518645286453864548645586456864578645886459864608646186462864638646486465864668646786468864698647086471864728647386474864758647686477864788647986480864818648286483864848648586486864878648886489864908649186492864938649486495864968649786498864998650086501865028650386504865058650686507865088650986510865118651286513865148651586516865178651886519865208652186522865238652486525865268652786528865298653086531865328653386534865358653686537865388653986540865418654286543865448654586546865478654886549865508655186552865538655486555865568655786558865598656086561865628656386564865658656686567865688656986570865718657286573865748657586576865778657886579865808658186582865838658486585865868658786588865898659086591865928659386594865958659686597865988659986600866018660286603866048660586606866078660886609866108661186612866138661486615866168661786618866198662086621866228662386624866258662686627866288662986630866318663286633866348663586636866378663886639866408664186642866438664486645866468664786648866498665086651866528665386654866558665686657866588665986660866618666286663866648666586666866678666886669866708667186672866738667486675866768667786678866798668086681866828668386684866858668686687866888668986690866918669286693866948669586696866978669886699867008670186702867038670486705867068670786708867098671086711867128671386714867158671686717867188671986720867218672286723867248672586726867278672886729867308673186732867338673486735867368673786738867398674086741867428674386744867458674686747867488674986750867518675286753867548675586756867578675886759867608676186762867638676486765867668676786768867698677086771867728677386774867758677686777867788677986780867818678286783867848678586786867878678886789867908679186792867938679486795867968679786798867998680086801868028680386804868058680686807868088680986810868118681286813868148681586816868178681886819868208682186822868238682486825868268682786828868298683086831868328683386834868358683686837868388683986840868418684286843868448684586846868478684886849868508685186852868538685486855868568685786858868598686086861868628686386864868658686686867868688686986870868718687286873868748687586876868778687886879868808688186882868838688486885868868688786888868898689086891868928689386894868958689686897868988689986900869018690286903869048690586906869078690886909869108691186912869138691486915869168691786918869198692086921869228692386924869258692686927869288692986930869318693286933869348693586936869378693886939869408694186942869438694486945869468694786948869498695086951869528695386954869558695686957869588695986960869618696286963869648696586966869678696886969869708697186972869738697486975869768697786978869798698086981869828698386984869858698686987869888698986990869918699286993869948699586996869978699886999870008700187002870038700487005870068700787008870098701087011870128701387014870158701687017870188701987020870218702287023870248702587026870278702887029870308703187032870338703487035870368703787038870398704087041870428704387044870458704687047870488704987050870518705287053870548705587056870578705887059870608706187062870638706487065870668706787068870698707087071870728707387074870758707687077870788707987080870818708287083870848708587086870878708887089870908709187092870938709487095870968709787098870998710087101871028710387104871058710687107871088710987110871118711287113871148711587116871178711887119871208712187122871238712487125871268712787128871298713087131871328713387134871358713687137871388713987140871418714287143871448714587146871478714887149871508715187152871538715487155871568715787158871598716087161871628716387164871658716687167871688716987170871718717287173871748717587176871778717887179871808718187182871838718487185871868718787188871898719087191871928719387194871958719687197871988719987200872018720287203872048720587206872078720887209872108721187212872138721487215872168721787218872198722087221872228722387224872258722687227872288722987230872318723287233872348723587236872378723887239872408724187242872438724487245872468724787248872498725087251872528725387254872558725687257872588725987260872618726287263872648726587266872678726887269872708727187272872738727487275872768727787278872798728087281872828728387284872858728687287872888728987290872918729287293872948729587296872978729887299873008730187302873038730487305873068730787308873098731087311873128731387314873158731687317873188731987320873218732287323873248732587326873278732887329873308733187332873338733487335873368733787338873398734087341873428734387344873458734687347873488734987350873518735287353873548735587356873578735887359873608736187362873638736487365873668736787368873698737087371873728737387374873758737687377873788737987380873818738287383873848738587386873878738887389873908739187392873938739487395873968739787398873998740087401874028740387404874058740687407874088740987410874118741287413874148741587416874178741887419874208742187422874238742487425874268742787428874298743087431874328743387434874358743687437874388743987440874418744287443874448744587446874478744887449874508745187452874538745487455874568745787458874598746087461874628746387464874658746687467874688746987470874718747287473874748747587476874778747887479874808748187482874838748487485874868748787488874898749087491874928749387494874958749687497874988749987500875018750287503875048750587506875078750887509875108751187512875138751487515875168751787518875198752087521875228752387524875258752687527875288752987530875318753287533875348753587536875378753887539875408754187542875438754487545875468754787548875498755087551875528755387554875558755687557875588755987560875618756287563875648756587566875678756887569875708757187572875738757487575875768757787578875798758087581875828758387584875858758687587875888758987590875918759287593875948759587596875978759887599876008760187602876038760487605876068760787608876098761087611876128761387614876158761687617876188761987620876218762287623876248762587626876278762887629876308763187632876338763487635876368763787638876398764087641876428764387644876458764687647876488764987650876518765287653876548765587656876578765887659876608766187662876638766487665876668766787668876698767087671876728767387674876758767687677876788767987680876818768287683876848768587686876878768887689876908769187692876938769487695876968769787698876998770087701877028770387704877058770687707877088770987710877118771287713877148771587716877178771887719877208772187722877238772487725877268772787728877298773087731877328773387734877358773687737877388773987740877418774287743877448774587746877478774887749877508775187752877538775487755877568775787758877598776087761877628776387764877658776687767877688776987770877718777287773877748777587776877778777887779877808778187782877838778487785877868778787788877898779087791877928779387794877958779687797877988779987800878018780287803878048780587806878078780887809878108781187812878138781487815878168781787818878198782087821878228782387824878258782687827878288782987830878318783287833878348783587836878378783887839878408784187842878438784487845878468784787848878498785087851878528785387854878558785687857878588785987860878618786287863878648786587866878678786887869878708787187872878738787487875878768787787878878798788087881878828788387884878858788687887878888788987890878918789287893878948789587896878978789887899879008790187902879038790487905879068790787908879098791087911879128791387914879158791687917879188791987920879218792287923879248792587926879278792887929879308793187932879338793487935879368793787938879398794087941879428794387944879458794687947879488794987950879518795287953879548795587956879578795887959879608796187962879638796487965879668796787968879698797087971879728797387974879758797687977879788797987980879818798287983879848798587986879878798887989879908799187992879938799487995879968799787998879998800088001880028800388004880058800688007880088800988010880118801288013880148801588016880178801888019880208802188022880238802488025880268802788028880298803088031880328803388034880358803688037880388803988040880418804288043880448804588046880478804888049880508805188052880538805488055880568805788058880598806088061880628806388064880658806688067880688806988070880718807288073880748807588076880778807888079880808808188082880838808488085880868808788088880898809088091880928809388094880958809688097880988809988100881018810288103881048810588106881078810888109881108811188112881138811488115881168811788118881198812088121881228812388124881258812688127881288812988130881318813288133881348813588136881378813888139881408814188142881438814488145881468814788148881498815088151881528815388154881558815688157881588815988160881618816288163881648816588166881678816888169881708817188172881738817488175881768817788178881798818088181881828818388184881858818688187881888818988190881918819288193881948819588196881978819888199882008820188202882038820488205882068820788208882098821088211882128821388214882158821688217882188821988220882218822288223882248822588226882278822888229882308823188232882338823488235882368823788238882398824088241882428824388244882458824688247882488824988250882518825288253882548825588256882578825888259882608826188262882638826488265882668826788268882698827088271882728827388274882758827688277882788827988280882818828288283882848828588286882878828888289882908829188292882938829488295882968829788298882998830088301883028830388304883058830688307883088830988310883118831288313883148831588316883178831888319883208832188322883238832488325883268832788328883298833088331883328833388334883358833688337883388833988340883418834288343883448834588346883478834888349883508835188352883538835488355883568835788358883598836088361883628836388364883658836688367883688836988370883718837288373883748837588376883778837888379883808838188382883838838488385883868838788388883898839088391883928839388394883958839688397883988839988400884018840288403884048840588406884078840888409884108841188412884138841488415884168841788418884198842088421884228842388424884258842688427884288842988430884318843288433884348843588436884378843888439884408844188442884438844488445884468844788448884498845088451884528845388454884558845688457884588845988460884618846288463884648846588466884678846888469884708847188472884738847488475884768847788478884798848088481884828848388484884858848688487884888848988490884918849288493884948849588496884978849888499885008850188502885038850488505885068850788508885098851088511885128851388514885158851688517885188851988520885218852288523885248852588526885278852888529885308853188532885338853488535885368853788538885398854088541885428854388544885458854688547885488854988550885518855288553885548855588556885578855888559885608856188562885638856488565885668856788568885698857088571885728857388574885758857688577885788857988580885818858288583885848858588586885878858888589885908859188592885938859488595885968859788598885998860088601886028860388604886058860688607886088860988610886118861288613886148861588616886178861888619886208862188622886238862488625886268862788628886298863088631886328863388634886358863688637886388863988640886418864288643886448864588646886478864888649886508865188652886538865488655886568865788658886598866088661886628866388664886658866688667886688866988670886718867288673886748867588676886778867888679886808868188682886838868488685886868868788688886898869088691886928869388694886958869688697886988869988700887018870288703887048870588706887078870888709887108871188712887138871488715887168871788718887198872088721887228872388724887258872688727887288872988730887318873288733887348873588736887378873888739887408874188742887438874488745887468874788748887498875088751887528875388754887558875688757887588875988760887618876288763887648876588766887678876888769887708877188772887738877488775887768877788778887798878088781887828878388784887858878688787887888878988790887918879288793887948879588796887978879888799888008880188802888038880488805888068880788808888098881088811888128881388814888158881688817888188881988820888218882288823888248882588826888278882888829888308883188832888338883488835888368883788838888398884088841888428884388844888458884688847888488884988850888518885288853888548885588856888578885888859888608886188862888638886488865888668886788868888698887088871888728887388874888758887688877888788887988880888818888288883888848888588886888878888888889888908889188892888938889488895888968889788898888998890088901889028890388904889058890688907889088890988910889118891288913889148891588916889178891888919889208892188922889238892488925889268892788928889298893088931889328893388934889358893688937889388893988940889418894288943889448894588946889478894888949889508895188952889538895488955889568895788958889598896088961889628896388964889658896688967889688896988970889718897288973889748897588976889778897888979889808898188982889838898488985889868898788988
  1. #!/usr/bin/env php
  2. <?php
  3. /*
  4. * This file is part of Composer.
  5. *
  6. * (c) Nils Adermann <naderman@naderman.de>
  7. * Jordi Boggiano <j.boggiano@seld.be>
  8. *
  9. * For the full copyright and license information, please view
  10. * the license that is located at the bottom of this file.
  11. */
  12. // Avoid APC causing random fatal errors per https://github.com/composer/composer/issues/264
  13. if (extension_loaded('apc') && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN) && filter_var(ini_get('apc.cache_by_default'), FILTER_VALIDATE_BOOLEAN)) {
  14. if (version_compare(phpversion('apc'), '3.0.12', '>=')) {
  15. ini_set('apc.cache_by_default', 0);
  16. } else {
  17. fwrite(STDERR, 'Warning: APC <= 3.0.12 may cause fatal errors when running composer commands.'.PHP_EOL);
  18. fwrite(STDERR, 'Update APC, or set apc.enable_cli or apc.cache_by_default to 0 in your php.ini.'.PHP_EOL);
  19. }
  20. }
  21. Phar::mapPhar('composer.phar');
  22. require 'phar://composer.phar/bin/composer';
  23. __HALT_COMPILER(); ?>
  24. Œ”ô composer.phar+src/Composer/Autoload/AutoloadGenerator.phppeÂÁÚ[pe¬ËÕi¶+src/Composer/Autoload/ClassMapGenerator.php‹ÂÁÚ[‹Mè�Ķsrc/Composer/Cache.php’ÂÁÚ[’­bš0¶%src/Composer/Command/AboutCommand.phpÍÂÁÚ[ͳ¢Ay¶'src/Composer/Command/ArchiveCommand.phpcÂÁÚ[c¥{ï¶$src/Composer/Command/BaseCommand.phpÜ ÂÁÚ[Ü gô1¶.src/Composer/Command/BaseDependencyCommand.phpñÂÁÚ[ñXgFð¶1src/Composer/Command/CheckPlatformReqsCommand.php� ÂÁÚ[� ŸL’ž¶*src/Composer/Command/ClearCacheCommand.php^ÂÁÚ[^¨ãj¶&src/Composer/Command/ConfigCommand.php‰IÂÁÚ[‰Iä³ï€¶-src/Composer/Command/CreateProjectCommand.php%5ÂÁÚ[%5èP-¶'src/Composer/Command/DependsCommand.php¸ÂÁÚ[¸K°¶(src/Composer/Command/DiagnoseCommand.phpÜIÂÁÚ[ÜI.£ƒ³¶,src/Composer/Command/DumpAutoloadCommand.php
  25. ÂÁÚ[
  26. ݸ:¶$src/Composer/Command/ExecCommand.phpkÂÁÚ[k¼“À[¶&src/Composer/Command/GlobalCommand.php@ ÂÁÚ[@ ·©ð¶$src/Composer/Command/HomeCommand.phpÄÂÁÚ[ÄÇH¶$src/Composer/Command/InitCommand.php•KÂÁÚ[•K„yŸ¶'src/Composer/Command/InstallCommand.phpÂÁÚ[[ š¶(src/Composer/Command/LicensesCommand.php;ÂÁÚ[;™�U¶(src/Composer/Command/OutdatedCommand.php±
  27. ÂÁÚ[±
  28. ¼LÓ¶)src/Composer/Command/ProhibitsCommand.phpÌÂÁÚ[̨[®¶&src/Composer/Command/RemoveCommand.phpœÂÁÚ[œQ¶�¯¶'src/Composer/Command/RequireCommand.php× ÂÁÚ[× ³ª¨ß¶)src/Composer/Command/RunScriptCommand.phpãÂÁÚ[ã˜Ô¶+src/Composer/Command/ScriptAliasCommand.phppÂÁÚ[pg †(¶&src/Composer/Command/SearchCommand.php ÂÁÚ[ Ò=Á‹¶*src/Composer/Command/SelfUpdateCommand.phpå2ÂÁÚ[å2ÔÛ„¶$src/Composer/Command/ShowCommand.phpânÂÁÚ[ân„©¿­¶&src/Composer/Command/StatusCommand.php\ÂÁÚ[\«In¶(src/Composer/Command/SuggestsCommand.php© ÂÁÚ[© <Qþ¶&src/Composer/Command/UpdateCommand.phpµ#ÂÁÚ[µ#@Š4-¶(src/Composer/Command/ValidateCommand.phpPÂÁÚ[P|ugü¶src/Composer/Composer.phpù ÂÁÚ[ù |5Eý¶src/Composer/Config.phpÎ"ÂÁÚ[Î")Î\¶-src/Composer/Config/ConfigSourceInterface.phpÂÁÚ[³ [/¶(src/Composer/Config/JsonConfigSource.phpuÂÁÚ[u=¤ƒ¶$src/Composer/Console/Application.phpÚ3ÂÁÚ[Ú3 ý%D¶,src/Composer/Console/HtmlOutputFormatter.php3ÂÁÚ[3Ú�Eu¶-src/Composer/DependencyResolver/Decisions.phpQÂÁÚ[Q?˜¬$¶1src/Composer/DependencyResolver/DefaultPolicy.phpÂÁÚ[õÝv¶/src/Composer/DependencyResolver/GenericRule.phpµÂÁÚ[µ᫤¶>src/Composer/DependencyResolver/Operation/InstallOperation.phpCÂÁÚ[C´\õ*¶Isrc/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php÷ÂÁÚ[÷ïÎà÷¶Ksrc/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.phpýÂÁÚ[ý3#†¶@src/Composer/DependencyResolver/Operation/OperationInterface.phpÓÂÁÚ[ÓÙâ&ä¶=src/Composer/DependencyResolver/Operation/SolverOperation.php¹ÂÁÚ[¹&¢e
  29. ¶@src/Composer/DependencyResolver/Operation/UninstallOperation.phpIÂÁÚ[IFûÂɶ=src/Composer/DependencyResolver/Operation/UpdateOperation.phphÂÁÚ[höSÕ]¶3src/Composer/DependencyResolver/PolicyInterface.php­ÂÁÚ[­Ÿ‹R¶(src/Composer/DependencyResolver/Pool.php¯"ÂÁÚ[¯"m½ ¶+src/Composer/DependencyResolver/Problem.php¤ÂÁÚ[¤Þ¶+src/Composer/DependencyResolver/Request.phpƒÂÁÚ[ƒåVP„¶(src/Composer/DependencyResolver/Rule.php«ÂÁÚ[«ôÓç´¶1src/Composer/DependencyResolver/Rule2Literals.phpÂÁÚ[tZÅɶ+src/Composer/DependencyResolver/RuleSet.phpª
  30. ÂÁÚ[ª
  31. _΂¶4src/Composer/DependencyResolver/RuleSetGenerator.php&ÂÁÚ[&gÇF£¶3src/Composer/DependencyResolver/RuleSetIterator.phpÂÁÚ[›Cü$¶2src/Composer/DependencyResolver/RuleWatchChain.phpiÂÁÚ[ihïš,¶2src/Composer/DependencyResolver/RuleWatchGraph.phpáÂÁÚ[á‰rôv¶1src/Composer/DependencyResolver/RuleWatchNode.phpÂÁÚ[�Gd7¶*src/Composer/DependencyResolver/Solver.php,:ÂÁÚ[,:²ã~œ¶6src/Composer/DependencyResolver/SolverBugException.php™ÂÁÚ[™Xg6¶;src/Composer/DependencyResolver/SolverProblemsException.phpôÂÁÚ[ô×|Ŧ¶/src/Composer/DependencyResolver/Transaction.php×ÂÁÚ[×Vm쟶-src/Composer/Downloader/ArchiveDownloader.phpÆ ÂÁÚ[Æ G s0¶1src/Composer/Downloader/ChangeReportInterface.phpÌÂÁÚ[̯ਿ¶+src/Composer/Downloader/DownloadManager.php`ÂÁÚ[`#ÏX¶/src/Composer/Downloader/DownloaderInterface.phpÊÂÁÚ[Êgs!l¶3src/Composer/Downloader/DvcsDownloaderInterface.phpÑÂÁÚ[Ñ&Áœ¿¶*src/Composer/Downloader/FileDownloader.php?ÂÁÚ[?"Aý¶/src/Composer/Downloader/FilesystemException.php
  32. ÂÁÚ[
  33. .-‹¶,src/Composer/Downloader/FossilDownloader.php‚ ÂÁÚ[‚ Ü�Ii¶)src/Composer/Downloader/GitDownloader.phpq4ÂÁÚ[q4ZÎÇ׶*src/Composer/Downloader/GzipDownloader.phpóÂÁÚ[ó}Úo¶(src/Composer/Downloader/HgDownloader.php”ÂÁÚ[”ßis̶*src/Composer/Downloader/PathDownloader.phpQÂÁÚ[QCn¤¶0src/Composer/Downloader/PearPackageExtractor.phpuÂÁÚ[uz„‡¶.src/Composer/Downloader/PerforceDownloader.php§ÂÁÚ[§âƒ¨¶*src/Composer/Downloader/PharDownloader.phpåÂÁÚ[åÞÉç¶)src/Composer/Downloader/RarDownloader.phpžÂÁÚ[ž6 3U¶)src/Composer/Downloader/SvnDownloader.phpGÂÁÚ[GM#j¶)src/Composer/Downloader/TarDownloader.phpãÂÁÚ[ãÍ’X?¶.src/Composer/Downloader/TransportException.php=ÂÁÚ[=ZÎÈÞ¶9src/Composer/Downloader/VcsCapableDownloaderInterface.phpÔÂÁÚ[Ô`§ôö¶)src/Composer/Downloader/VcsDownloader.php¡ÂÁÚ[¡( à>¶(src/Composer/Downloader/XzDownloader.php§ÂÁÚ[§W$;á¶)src/Composer/Downloader/ZipDownloader.phpkÂÁÚ[kÒo”ζ&src/Composer/EventDispatcher/Event.php ÂÁÚ[ ±™jï¶0src/Composer/EventDispatcher/EventDispatcher.php 2ÂÁÚ[ 2anÕ3¶9src/Composer/EventDispatcher/EventSubscriberInterface.php©ÂÁÚ[©h·0¶9src/Composer/EventDispatcher/ScriptExecutionException.phpvÂÁÚ[vwZ8S¶)src/Composer/Exception/NoSslException.phpfÂÁÚ[fËíM�¶src/Composer/Factory.phpR=ÂÁÚ[R=d®¤¶src/Composer/IO/BaseIO.phpŒÂÁÚ[Œ(‚l‘¶src/Composer/IO/BufferIO.php*ÂÁÚ[*¢®hT¶src/Composer/IO/ConsoleIO.php6ÂÁÚ[6ö#$¶src/Composer/IO/IOInterface.phpìÂÁÚ[ìÕ�¶src/Composer/IO/NullIO.phpÀÂÁÚ[ÀF`sʶsrc/Composer/Installer.php�ÂÁÚ[�¡q4Ŷ*src/Composer/Installer/BinaryInstaller.php×ÂÁÚ[×£æq¶2src/Composer/Installer/BinaryPresenceInterface.phpËÂÁÚ[ËÀ5š¨¶.src/Composer/Installer/InstallationManager.php-ÂÁÚ[-¾}Œ7¶)src/Composer/Installer/InstallerEvent.phpÂÁÚ[lÔzi¶*src/Composer/Installer/InstallerEvents.phpÞÂÁÚ[ÞìŸ@G¶-src/Composer/Installer/InstallerInterface.phpãÂÁÚ[ã^ƒ“ʶ+src/Composer/Installer/LibraryInstaller.php%ÂÁÚ[% »�̶/src/Composer/Installer/MetapackageInstaller.phpœÂÁÚ[œÆÅ!¶(src/Composer/Installer/NoopInstaller.php+ÂÁÚ[+À·M}¶'src/Composer/Installer/PackageEvent.phpeÂÁÚ[e;° ¶(src/Composer/Installer/PackageEvents.php¸ÂÁÚ[¸dbØs¶.src/Composer/Installer/PearBinaryInstaller.phpø ÂÁÚ[ø *ë•k¶(src/Composer/Installer/PearInstaller.php¢ÂÁÚ[¢È‚¶Ñ¶*src/Composer/Installer/PluginInstaller.php‹ÂÁÚ[‹ÒX8¶+src/Composer/Installer/ProjectInstaller.phpÂÁÚ[*0@P¶4src/Composer/Installer/SuggestedPackagesReporter.php:ÂÁÚ[:‚´UV¶src/Composer/Json/JsonFile.phpîÂÁÚ[îb-~¶#src/Composer/Json/JsonFormatter.phpbÂÁÚ[bÝNš¶%src/Composer/Json/JsonManipulator.php’3ÂÁÚ[’3é7¶-src/Composer/Json/JsonValidationException.php\ÂÁÚ[\.Xóܶ%src/Composer/Package/AliasPackage.phpÂÁÚ[¹—~š¶7src/Composer/Package/Archiver/ArchivableFilesFilter.php ÂÁÚ[ yY+¦¶7src/Composer/Package/Archiver/ArchivableFilesFinder.phpÞÂÁÚ[Þ ²²¹¶0src/Composer/Package/Archiver/ArchiveManager.php† ÂÁÚ[† ß5°¶3src/Composer/Package/Archiver/ArchiverInterface.phpÂÁÚ[ñ´> ¶3src/Composer/Package/Archiver/BaseExcludeFilter.php–ÂÁÚ[–y¶=ƶ7src/Composer/Package/Archiver/ComposerExcludeFilter.phpÂÁÚ[‹SZ0¶2src/Composer/Package/Archiver/GitExcludeFilter.phprÂÁÚ[r3‘Mh¶1src/Composer/Package/Archiver/HgExcludeFilter.php ÂÁÚ[  •¦S¶.src/Composer/Package/Archiver/PharArchiver.php?ÂÁÚ[?®— u¶-src/Composer/Package/Archiver/ZipArchiver.php½ÂÁÚ[½VÀ‚¨¶$src/Composer/Package/BasePackage.php& ÂÁÚ[& 'ݶ*src/Composer/Package/Comparer/Comparer.phpRÂÁÚ[RÏسî¶(src/Composer/Package/CompletePackage.phpüÂÁÚ[üþM˶¶1src/Composer/Package/CompletePackageInterface.phpõÂÁÚ[õ¦Ê�ò¶+src/Composer/Package/Dumper/ArrayDumper.phpë ÂÁÚ[ë Ó8WE¶src/Composer/Package/Link.phpˆÂÁÚ[ˆå¶Y«¶7src/Composer/Package/LinkConstraint/EmptyConstraint.php‚ÂÁÚ[‚é~‹¶?src/Composer/Package/LinkConstraint/LinkConstraintInterface.phpdÂÁÚ[d¤ôLn¶7src/Composer/Package/LinkConstraint/MultiConstraint.php‚ÂÁÚ[‚ób`ý¶:src/Composer/Package/LinkConstraint/SpecificConstraint.phpiÂÁÚ[iÞ”š%¶9src/Composer/Package/LinkConstraint/VersionConstraint.phpXÂÁÚ[X}`y¶+src/Composer/Package/Loader/ArrayLoader.phpÂÁÚ[n~œ›¶7src/Composer/Package/Loader/InvalidPackageException.phpEÂÁÚ[Exb¾¶*src/Composer/Package/Loader/JsonLoader.phpùÂÁÚ[ù!~ˆ{¶/src/Composer/Package/Loader/LoaderInterface.php²ÂÁÚ[²¦}úζ1src/Composer/Package/Loader/RootPackageLoader.phpÂÁÚ[-‚£{¶5src/Composer/Package/Loader/ValidatingArrayLoader.php­6ÂÁÚ[­6\æ0¶src/Composer/Package/Locker.php¥!ÂÁÚ[¥!/=xö¶ src/Composer/Package/Package.phpÉÂÁÚ[ÉcÃ�h¶)src/Composer/Package/PackageInterface.php ÂÁÚ[ ûÇ^ƶ)src/Composer/Package/RootAliasPackage.php ÂÁÚ[ _€ø¶$src/Composer/Package/RootPackage.phpÂÁÚ[ŽÎ_¶-src/Composer/Package/RootPackageInterface.php¹ÂÁÚ[¹"maV¶/src/Composer/Package/Version/VersionGuesser.phpÏÂÁÚ[ÏÌÂ߶.src/Composer/Package/Version/VersionParser.php¥ÂÁÚ[¥ô´à¶0src/Composer/Package/Version/VersionSelector.phpK ÂÁÚ[K ²<ȶ-src/Composer/Plugin/Capability/Capability.phpWÂÁÚ[Wæ_¨1¶2src/Composer/Plugin/Capability/CommandProvider.php—ÂÁÚ[—ûOâ>¶src/Composer/Plugin/Capable.phpÂÁÚ[Æq+¶$src/Composer/Plugin/CommandEvent.phpâÂÁÚ[â³ÆÇW¶$src/Composer/Plugin/PluginEvents.phpöÂÁÚ[öá1=z¶'src/Composer/Plugin/PluginInterface.phpôÂÁÚ[ô)'*ض%src/Composer/Plugin/PluginManager.php$ÂÁÚ[$‹K©¶*src/Composer/Plugin/PreCommandRunEvent.phpõÂÁÚ[õ:ðd¶,src/Composer/Plugin/PreFileDownloadEvent.php`ÂÁÚ[`9-ζ4src/Composer/Question/StrictConfirmationQuestion.phpÂÁÚ['.³è¶+src/Composer/Repository/ArrayRepository.phpÂÁÚ[éÌt¶.src/Composer/Repository/ArtifactRepository.php ÂÁÚ[ Fœâò¶*src/Composer/Repository/BaseRepository.phpv ÂÁÚ[v „ÜL¶.src/Composer/Repository/ComposerRepository.phpÐUÂÁÚ[ÐUü­l�¶/src/Composer/Repository/CompositeRepository.php;ÂÁÚ[;¤¯S¶;src/Composer/Repository/ConfigurableRepositoryInterface.php…ÂÁÚ[…±Ÿ_¶0src/Composer/Repository/FilesystemRepository.php$ÂÁÚ[$¾Ãá…¶4src/Composer/Repository/InstalledArrayRepository.php£ÂÁÚ[£/ö~>¶9src/Composer/Repository/InstalledFilesystemRepository.php£ÂÁÚ[£V
  34. •_¶8src/Composer/Repository/InstalledRepositoryInterface.php‡ÂÁÚ[‡£9p¶6src/Composer/Repository/InvalidRepositoryException.phpnÂÁÚ[nà“똶-src/Composer/Repository/PackageRepository.phpjÂÁÚ[j¥ôò̶*src/Composer/Repository/PathRepository.php– ÂÁÚ[– WÛ¶2src/Composer/Repository/Pear/BaseChannelReader.phpIÂÁÚ[Ic6³¶,src/Composer/Repository/Pear/ChannelInfo.phpÄÂÁÚ[Ä:T*ɶ.src/Composer/Repository/Pear/ChannelReader.phpíÂÁÚ[í?ÈYT¶4src/Composer/Repository/Pear/ChannelRest10Reader.php® ÂÁÚ[® ™ÖÛú¶4src/Composer/Repository/Pear/ChannelRest11Reader.php& ÂÁÚ[& òUb¶5src/Composer/Repository/Pear/DependencyConstraint.phpqÂÁÚ[q9=¶/src/Composer/Repository/Pear/DependencyInfo.phpqÂÁÚ[qfºTò¶8src/Composer/Repository/Pear/PackageDependencyParser.php…ÂÁÚ[…÷$Li¶,src/Composer/Repository/Pear/PackageInfo.php°ÂÁÚ[°Ÿ ¸ ¶,src/Composer/Repository/Pear/ReleaseInfo.php’ÂÁÚ[’o“ŠÃ¶*src/Composer/Repository/PearRepository.phpªÂÁÚ[ª)Ÿƒ}¶.src/Composer/Repository/PlatformRepository.phpÂÁÚ[{©…]¶-src/Composer/Repository/RepositoryFactory.php2ÂÁÚ[2t>¶/src/Composer/Repository/RepositoryInterface.phpÛÂÁÚ[Û’âÁ¶-src/Composer/Repository/RepositoryManager.php2
  35. ÂÁÚ[2
  36. á…5#¶7src/Composer/Repository/RepositorySecurityException.phpoÂÁÚ[opÕ«ª¶/src/Composer/Repository/Vcs/BitbucketDriver.phpåÂÁÚ[åvãâ¶,src/Composer/Repository/Vcs/FossilDriver.php©ÂÁÚ[©t1Ú®¶2src/Composer/Repository/Vcs/GitBitbucketDriver.phpêÂÁÚ[êÃŽ»¶)src/Composer/Repository/Vcs/GitDriver.php¼ÂÁÚ[¼Š©Ðê¶,src/Composer/Repository/Vcs/GitHubDriver.php¡(ÂÁÚ[¡(‚º ¶,src/Composer/Repository/Vcs/GitLabDriver.phpÍ#ÂÁÚ[Í#ßNìʶ1src/Composer/Repository/Vcs/HgBitbucketDriver.phpäÂÁÚ[äi›üà¶(src/Composer/Repository/Vcs/HgDriver.php\ÂÁÚ[\sàض.src/Composer/Repository/Vcs/PerforceDriver.php' ÂÁÚ[' ÙóH¶)src/Composer/Repository/Vcs/SvnDriver.php¤ÂÁÚ[¤ ¶)src/Composer/Repository/Vcs/VcsDriver.phpæ
  37. ÂÁÚ[æ
  38. eׯ-¶2src/Composer/Repository/Vcs/VcsDriverInterface.php÷ÂÁÚ[÷ÇX[‰¶)src/Composer/Repository/VcsRepository.php±&ÂÁÚ[±&¢Þ¸t¶1src/Composer/Repository/VersionCacheInterface.php”ÂÁÚ[”A?Rï¶3src/Composer/Repository/WritableArrayRepository.phpÂÁÚ[¾G*¶7src/Composer/Repository/WritableRepositoryInterface.php‰ÂÁÚ[‰‘/sï¶$src/Composer/Script/CommandEvent.phpWÂÁÚ[W£VZt¶src/Composer/Script/Event.phpµÂÁÚ[µlt¦M¶$src/Composer/Script/PackageEvent.phpœÂÁÚ[œ§ÿÉ ¶$src/Composer/Script/ScriptEvents.phpPÂÁÚ[P‡�¶¶ src/Composer/SelfUpdate/Keys.php�ÂÁÚ[� îÊN¶$src/Composer/SelfUpdate/Versions.phpìÂÁÚ[ì͵‘ƒ¶ src/Composer/Util/AuthHelper.phpËÂÁÚ[Ë>zx–¶src/Composer/Util/Bitbucket.php*ÂÁÚ[*,Lšk¶$src/Composer/Util/ComposerMirror.php±ÂÁÚ[±­½øض%src/Composer/Util/ConfigValidator.php÷ÂÁÚ[÷v•Í¶"src/Composer/Util/ErrorHandler.php¬ÂÁÚ[¬š^`ƶ src/Composer/Util/Filesystem.phpj/ÂÁÚ[j/„ú?ý¶src/Composer/Util/Git.phpg&ÂÁÚ[g&]ó²´¶src/Composer/Util/GitHub.php| ÂÁÚ[| `0tü¶src/Composer/Util/GitLab.phpœ ÂÁÚ[œ `YÖ¶src/Composer/Util/Hg.php¾ÂÁÚ[¾LÓ �¶src/Composer/Util/IniHelper.phphÂÁÚ[h;FP¶$src/Composer/Util/NoProxyPattern.php¾ÂÁÚ[¾Z+°m¶src/Composer/Util/Perforce.phpf2ÂÁÚ[f2y0%¥¶src/Composer/Util/Platform.phpüÂÁÚ[üs­fç¶%src/Composer/Util/ProcessExecutor.phpV ÂÁÚ[V J;ËC¶&src/Composer/Util/RemoteFilesystem.phpÔjÂÁÚ[ÔjŒ
  39. ¶src/Composer/Util/Silencer.phpéÂÁÚ[é“Vjf¶!src/Composer/Util/SpdxLicense.phpÂÁÚ[¾7
  40. ñ¶*src/Composer/Util/StreamContextFactory.phpÂÁÚ[ŸÁI¶src/Composer/Util/Svn.php,ÂÁÚ[,Ì žÄ¶src/Composer/Util/TlsHelper.phpn
  41. ÂÁÚ[n
  42. S¯Í:¶src/Composer/Util/Url.php£ÂÁÚ[£3œÉܶsrc/Composer/XdebugHandler.phpðÂÁÚ[ðzÓf~¶src/bootstrap.php¹ÂÁÚ[¹I}œ¶%src/Composer/Autoload/ClassLoader.php“4ÂÁÚ[“4²z�–¶#res/composer-repository-schema.jsonðÂÁÚ[ð�GÐà¶res/composer-schema.jsonÏ•ÂÁÚ[Ï•&�R¶6vendor/composer/spdx-licenses/res/spdx-exceptions.json ÂÁÚ[ º¯¶4vendor/composer/spdx-licenses/res/spdx-licenses.jsonŸ�ÂÁÚ[Ÿ�J*B¶4vendor/symfony/console/Resources/bin/hiddeninput.exe$ÂÁÚ[$•�¥v¶&vendor/symfony/console/Application.php‚WÂÁÚ[‚WâPáz¶*vendor/symfony/console/Command/Command.phpñ"ÂÁÚ[ñ"Øô¶.vendor/symfony/console/Command/HelpCommand.phpØÂÁÚ[Ø$Y«¶.vendor/symfony/console/Command/ListCommand.phpZÂÁÚ[ZÉ£ ¶(vendor/symfony/console/ConsoleEvents.phpéÂÁÚ[éRÛÔe¶<vendor/symfony/console/Descriptor/ApplicationDescription.phpÐÂÁÚ[ЙŽ5°¶0vendor/symfony/console/Descriptor/Descriptor.phpŽÂÁÚ[Žéð8Ÿ¶9vendor/symfony/console/Descriptor/DescriptorInterface.phpüÂÁÚ[ü±Qµ¶4vendor/symfony/console/Descriptor/JsonDescriptor.phpÜ ÂÁÚ[Ü *û�ɶ8vendor/symfony/console/Descriptor/MarkdownDescriptor.php´ÂÁÚ[´�!³g¶4vendor/symfony/console/Descriptor/TextDescriptor.php²ÂÁÚ[²�­ùâ¶3vendor/symfony/console/Descriptor/XmlDescriptor.phpýÂÁÚ[ý
  43. G1¿¶4vendor/symfony/console/Event/ConsoleCommandEvent.php°ÂÁÚ[°!ȶ-vendor/symfony/console/Event/ConsoleEvent.phpÅÂÁÚ[ÅÒxÛ\¶6vendor/symfony/console/Event/ConsoleExceptionEvent.phpÂÁÚ[á2é¶6vendor/symfony/console/Event/ConsoleTerminateEvent.phpzÂÁÚ[z³,îL¶=vendor/symfony/console/Exception/CommandNotFoundException.phpÔÂÁÚ[ÔÈ÷ L¶7vendor/symfony/console/Exception/ExceptionInterface.phpfÂÁÚ[f¡ABª¶=vendor/symfony/console/Exception/InvalidArgumentException.php¦ÂÁÚ[¦Ö̽Z¶;vendor/symfony/console/Exception/InvalidOptionException.php¦ÂÁÚ[¦Ë×H¶3vendor/symfony/console/Exception/LogicException.php’ÂÁÚ[’ÍO\e¶5vendor/symfony/console/Exception/RuntimeException.php–ÂÁÚ[–Ùí,6¶4vendor/symfony/console/Formatter/OutputFormatter.php2ÂÁÚ[2RÌYh¶=vendor/symfony/console/Formatter/OutputFormatterInterface.phpŒÂÁÚ[ŒòññÀ¶9vendor/symfony/console/Formatter/OutputFormatterStyle.phpJÂÁÚ[JÏDSȶBvendor/symfony/console/Formatter/OutputFormatterStyleInterface.php„ÂÁÚ[„÷½G¶>vendor/symfony/console/Formatter/OutputFormatterStyleStack.php>ÂÁÚ[>[†¿–¶6vendor/symfony/console/Helper/DebugFormatterHelper.phpxÂÁÚ[xN©Ø¼¶2vendor/symfony/console/Helper/DescriptorHelper.phpwÂÁÚ[wÅHð.¶.vendor/symfony/console/Helper/DialogHelper.phpúÂÁÚ[ú "8m¶1vendor/symfony/console/Helper/FormatterHelper.phpcÂÁÚ[c“ý«N¶(vendor/symfony/console/Helper/Helper.php¨ÂÁÚ[¨œoû3¶1vendor/symfony/console/Helper/HelperInterface.phpåÂÁÚ[加¶+vendor/symfony/console/Helper/HelperSet.phpÉÂÁÚ[É?ã 2¶2vendor/symfony/console/Helper/InputAwareHelper.phpcÂÁÚ[cñø�|¶/vendor/symfony/console/Helper/ProcessHelper.phpÑ ÂÁÚ[Ñ @±ã�¶-vendor/symfony/console/Helper/ProgressBar.phpk%ÂÁÚ[k%H]„ȶ0vendor/symfony/console/Helper/ProgressHelper.php\ÂÁÚ[\èK+¶3vendor/symfony/console/Helper/ProgressIndicator.phpKÂÁÚ[KíÍ°¶0vendor/symfony/console/Helper/QuestionHelper.phpmÂÁÚ[mùÓ/¶7vendor/symfony/console/Helper/SymfonyQuestionHelper.phpl
  44. ÂÁÚ[l
  45. ÷ÞL¶'vendor/symfony/console/Helper/Table.phpª*ÂÁÚ[ª*í8ïM¶+vendor/symfony/console/Helper/TableCell.php€ÂÁÚ[€Ìî*Û¶-vendor/symfony/console/Helper/TableHelper.php ÂÁÚ[ ƒu®¹¶0vendor/symfony/console/Helper/TableSeparator.phpÊÂÁÚ[Êaz¶,vendor/symfony/console/Helper/TableStyle.php
  46. ÂÁÚ[
  47. PÞµ¦¶*vendor/symfony/console/Input/ArgvInput.php™ÂÁÚ[™,»Bô¶+vendor/symfony/console/Input/ArrayInput.php" ÂÁÚ[" uô™X¶&vendor/symfony/console/Input/Input.php¢ ÂÁÚ[¢ ”‡B"¶.vendor/symfony/console/Input/InputArgument.phpÂÁÚ[&<¦¯¶4vendor/symfony/console/Input/InputAwareInterface.phpšÂÁÚ[š‡jTŸ¶0vendor/symfony/console/Input/InputDefinition.phpŠÂÁÚ[Šœäf²¶/vendor/symfony/console/Input/InputInterface.php¡ÂÁÚ[¡,t^>¶,vendor/symfony/console/Input/InputOption.php ÂÁÚ[ ¸¬�_¶,vendor/symfony/console/Input/StringInput.php–ÂÁÚ[–cì\(¶vendor/symfony/console/LICENSE)ÂÁÚ[)NUN½¶/vendor/symfony/console/Logger/ConsoleLogger.php. ÂÁÚ[. ¤Œ…ζ0vendor/symfony/console/Output/BufferedOutput.php_ÂÁÚ[_‹ >P¶/vendor/symfony/console/Output/ConsoleOutput.php°ÂÁÚ[°]k~o¶8vendor/symfony/console/Output/ConsoleOutputInterface.phpàÂÁÚ[à‡†Æʶ,vendor/symfony/console/Output/NullOutput.phpÏÂÁÚ[Ï®˜‹Z¶(vendor/symfony/console/Output/Output.php˜ ÂÁÚ[˜ pf\¶1vendor/symfony/console/Output/OutputInterface.phpÂÁÚ[ì&¶.vendor/symfony/console/Output/StreamOutput.php­ÂÁÚ[­Îs6­¶2vendor/symfony/console/Question/ChoiceQuestion.phpw
  48. ÂÁÚ[w
  49. 2t¶8vendor/symfony/console/Question/ConfirmationQuestion.phpçÂÁÚ[ç ­òf¶,vendor/symfony/console/Question/Question.phpË ÂÁÚ[Ë ÒqµR¶ vendor/symfony/console/Shell.phpåÂÁÚ[å•šxS¶,vendor/symfony/console/Style/OutputStyle.php\ÂÁÚ[\wפ¶/vendor/symfony/console/Style/StyleInterface.phpÏÂÁÚ[Ï&nÅѶ-vendor/symfony/console/Style/SymfonyStyle.phpÜÂÁÚ[Üj®|R¶3vendor/symfony/console/Tester/ApplicationTester.phpÏÂÁÚ[Ïsž9i¶/vendor/symfony/console/Tester/CommandTester.phpªÂÁÚ[ªµ.âr¶(vendor/symfony/debug/BufferingLogger.phptÂÁÚ[t=hܶvendor/symfony/debug/Debug.phpÂÁÚ[˜'Ķ)vendor/symfony/debug/DebugClassLoader.php¡ÂÁÚ[¡tÅÍT¶%vendor/symfony/debug/ErrorHandler.phpHÂÁÚ[H‚vÌJ¶9vendor/symfony/debug/Exception/ClassNotFoundException.php–ÂÁÚ[–i‰æô¶8vendor/symfony/debug/Exception/ContextErrorException.php˜ÂÁÚ[˜-
  50. d2¶1vendor/symfony/debug/Exception/DummyException.phpÂÁÚ[®+Ãê¶6vendor/symfony/debug/Exception/FatalErrorException.php ÂÁÚ[ ˆ93?¶6vendor/symfony/debug/Exception/FatalThrowableError.phpWÂÁÚ[W?àèK¶3vendor/symfony/debug/Exception/FlattenException.php²ÂÁÚ[²HòѶ7vendor/symfony/debug/Exception/OutOfMemoryException.php~ÂÁÚ[~ë¨oâ¶=vendor/symfony/debug/Exception/UndefinedFunctionException.phpšÂÁÚ[š�ñJÀ¶;vendor/symfony/debug/Exception/UndefinedMethodException.php˜ÂÁÚ[˜nöêض)vendor/symfony/debug/ExceptionHandler.php!3ÂÁÚ[!3 Ïq ¶Ivendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php7ÂÁÚ[7Ñj/=¶Evendor/symfony/debug/FatalErrorHandler/FatalErrorHandlerInterface.phpÂÁÚ[ĹBV¶Mvendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.phpuÂÁÚ[uéj¶Kvendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.phpNÂÁÚ[NÇo-ç¶vendor/symfony/debug/LICENSE)ÂÁÚ[)NUN½¶:vendor/symfony/filesystem/Exception/ExceptionInterface.phpiÂÁÚ[i$ ÿ›¶=vendor/symfony/filesystem/Exception/FileNotFoundException.php¼ÂÁÚ[¼pí\¶¶3vendor/symfony/filesystem/Exception/IOException.php‡ÂÁÚ[‡€ü#Ѷ<vendor/symfony/filesystem/Exception/IOExceptionInterface.php¦ÂÁÚ[¦jÙwM¶(vendor/symfony/filesystem/Filesystem.phpK4ÂÁÚ[K4½oC·¶!vendor/symfony/filesystem/LICENSE)ÂÁÚ[)NUN½¶)vendor/symfony/filesystem/LockHandler.phpöÂÁÚ[öŸZµ1¶1vendor/symfony/finder/Adapter/AbstractAdapter.php\ ÂÁÚ[\ hˆB¶5vendor/symfony/finder/Adapter/AbstractFindAdapter.php‹ÂÁÚ[‹…Ôж2vendor/symfony/finder/Adapter/AdapterInterface.php›ÂÁÚ[›Mþ¶0vendor/symfony/finder/Adapter/BsdFindAdapter.php2ÂÁÚ[2+Eì¶0vendor/symfony/finder/Adapter/GnuFindAdapter.phpÂÁÚ[è„JL¶,vendor/symfony/finder/Adapter/PhpAdapter.phpôÂÁÚ[ôÞdè;¶/vendor/symfony/finder/Comparator/Comparator.phpŒÂÁÚ[ŒwþT¶3vendor/symfony/finder/Comparator/DateComparator.php#ÂÁÚ[#°ζ5vendor/symfony/finder/Comparator/NumberComparator.php|ÂÁÚ[|ITÇͶ9vendor/symfony/finder/Exception/AccessDeniedException.php„ÂÁÚ[„½¾sœ¶;vendor/symfony/finder/Exception/AdapterFailureException.php¬ÂÁÚ[¬wR¶6vendor/symfony/finder/Exception/ExceptionInterface.php„ÂÁÚ[„Gz-¶Avendor/symfony/finder/Exception/OperationNotPermitedException.php)ÂÁÚ[)x§e¶@vendor/symfony/finder/Exception/ShellCommandFailureException.phpºÂÁÚ[º˜þ˜¶/vendor/symfony/finder/Expression/Expression.phpÂÁÚ[i¥:Ŷ)vendor/symfony/finder/Expression/Glob.phpfÂÁÚ[fDÞcj¶*vendor/symfony/finder/Expression/Regex.phpÂÁÚ[ü(Ã϶3vendor/symfony/finder/Expression/ValueInterface.phpÍÂÁÚ[Í\p4†¶ vendor/symfony/finder/Finder.php].ÂÁÚ[].dìÇ¿¶vendor/symfony/finder/Glob.phpKÂÁÚ[Kjá±n¶7vendor/symfony/finder/Iterator/CustomFilterIterator.php[ÂÁÚ[[­åW¶:vendor/symfony/finder/Iterator/DateRangeFilterIterator.phpxÂÁÚ[xôP¶;vendor/symfony/finder/Iterator/DepthRangeFilterIterator.phpîÂÁÚ[îüÍ�q¶Avendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.phpíÂÁÚ[ínõH¶4vendor/symfony/finder/Iterator/FilePathsIterator.php ÂÁÚ[ ^ÁkF¶9vendor/symfony/finder/Iterator/FileTypeFilterIterator.phpZÂÁÚ[Z(&ø¶<vendor/symfony/finder/Iterator/FilecontentFilterIterator.php5ÂÁÚ[5ší¶9vendor/symfony/finder/Iterator/FilenameFilterIterator.phprÂÁÚ[rtu¶1vendor/symfony/finder/Iterator/FilterIterator.phpÃÂÁÚ[Ú+µÞ¶=vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php-ÂÁÚ[-ºÎÒ_¶5vendor/symfony/finder/Iterator/PathFilterIterator.phpÏÂÁÚ[ϺªÇ¶=vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php ÂÁÚ[ ÿ¶:vendor/symfony/finder/Iterator/SizeRangeFilterIterator.phpeÂÁÚ[eŸ’áé¶3vendor/symfony/finder/Iterator/SortableIterator.php*ÂÁÚ[*€õ´^¶vendor/symfony/finder/LICENSE)ÂÁÚ[)NUN½¶'vendor/symfony/finder/Shell/Command.php< ÂÁÚ[< „RŸ¶%vendor/symfony/finder/Shell/Shell.phppÂÁÚ[pQT�¶%vendor/symfony/finder/SplFileInfo.phpÂÁÚ[þíù¶'vendor/symfony/polyfill-ctype/Ctype.phpH ÂÁÚ[H ³�Õݶ%vendor/symfony/polyfill-ctype/LICENSE$ÂÁÚ[$?‡s:¶+vendor/symfony/polyfill-ctype/bootstrap.phpIÂÁÚ[I�D!e¶(vendor/symfony/polyfill-mbstring/LICENSE)ÂÁÚ[)±íж-vendor/symfony/polyfill-mbstring/Mbstring.phpCÂÁÚ[Cæø¶@vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php2AÂÁÚ[2A½=¨¶@vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php¡AÂÁÚ[¡AÚ Í¶.vendor/symfony/polyfill-mbstring/bootstrap.phpËÂÁÚ[Ëó<Ë¢¶7vendor/symfony/process/Exception/ExceptionInterface.phpfÂÁÚ[f]ö>T¶=vendor/symfony/process/Exception/InvalidArgumentException.php¨ÂÁÚ[¨ÐÀ+_¶3vendor/symfony/process/Exception/LogicException.php”ÂÁÚ[” ³ãñ¶;vendor/symfony/process/Exception/ProcessFailedException.phpxÂÁÚ[x¨Ìzy¶=vendor/symfony/process/Exception/ProcessTimedOutException.phpÂÁÚ[﫶5vendor/symfony/process/Exception/RuntimeException.php˜ÂÁÚ[˜¢Ø:¶+vendor/symfony/process/ExecutableFinder.phpšÂÁÚ[šT’³É¶vendor/symfony/process/LICENSE)ÂÁÚ[)NUN½¶.vendor/symfony/process/PhpExecutableFinder.phpÈÂÁÚ[Èš(À®¶%vendor/symfony/process/PhpProcess.phpúÂÁÚ[ú¯“Õ�¶.vendor/symfony/process/Pipes/AbstractPipes.php»ÂÁÚ[» Vw¶/vendor/symfony/process/Pipes/PipesInterface.phpDÂÁÚ[DvØ*vendor/symfony/process/Pipes/UnixPipes.php>ÂÁÚ[>ª•ir¶-vendor/symfony/process/Pipes/WindowsPipes.php‰ ÂÁÚ[‰ À"¢¶"vendor/symfony/process/Process.php£RÂÁÚ[£RÁÜÕ(¶)vendor/symfony/process/ProcessBuilder.phpß
  51. ÂÁÚ[ß
  52. ^ƒ8¶'vendor/symfony/process/ProcessUtils.phpKÂÁÚ[K2ÁÞg¶vendor/seld/jsonlint/LICENSE"ÂÁÚ["aƒsy¶@vendor/seld/jsonlint/src/Seld/JsonLint/DuplicateKeyException.php*ÂÁÚ[*•pñ¶5vendor/seld/jsonlint/src/Seld/JsonLint/JsonParser.php/2ÂÁÚ[/2­ß˜ö¶0vendor/seld/jsonlint/src/Seld/JsonLint/Lexer.phpÂÁÚ[%ÿ3N¶;vendor/seld/jsonlint/src/Seld/JsonLint/ParsingException.phpÂÁÚ[‰²ñ¶4vendor/seld/jsonlint/src/Seld/JsonLint/Undefined.php>ÂÁÚ[>ÿqŸŸ¶(vendor/justinrainbow/json-schema/LICENSE ÂÁÚ[ ºç©¶.vendor/justinrainbow/json-schema/demo/demo.phpñÂÁÚ[ñfC¶Nvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php¡ ÂÁÚ[¡ †wÌl¶Tvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/CollectionConstraint.php) ÂÁÚ[) #©¶Jvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php§ ÂÁÚ[§ ›VضSvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ConstraintInterface.php¼ÂÁÚ[¼ÿ Qœ¶Nvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/EnumConstraint.php]ÂÁÚ[]VŽU<¶Gvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.phpã ÂÁÚ[ã á0;¶Pvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/FormatConstraint.php…ÂÁÚ[…“TœÚ¶Pvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/NumberConstraint.phpš
  53. ÂÁÚ[š
  54. z&¶Pvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.phpÃÂÁÚ[éżx¶Pvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/SchemaConstraint.php0 ÂÁÚ[0 ×j´˜¶Pvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/StringConstraint.phpÂÁÚ[¥wš‡¶Xvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.phpaÂÁÚ[a qöYvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.phppÂÁÚ[prë¶\vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php‰ÂÁÚ[‰“µ+j¶Nvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeConstraint.php&ÂÁÚ[&4˜©T¶Svendor/justinrainbow/json-schema/src/JsonSchema/Constraints/UndefinedConstraint.php,"ÂÁÚ[,"ulÙ·¶Fvendor/justinrainbow/json-schema/src/JsonSchema/Entity/JsonPointer.phpèÂÁÚ[è{N–¶Pvendor/justinrainbow/json-schema/src/JsonSchema/Exception/ExceptionInterface.phpIÂÁÚ[I%|°¶Vvendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidArgumentException.php•ÂÁÚ[•‹àG¶Tvendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidConfigException.phplÂÁÚ[lA!L׶Tvendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaException.phplÂÁÚ[lè2÷þ¶]vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaMediaTypeException.phpuÂÁÚ[u=hç¶Wvendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSourceUriException.phpwÂÁÚ[wN-ò[¶Svendor/justinrainbow/json-schema/src/JsonSchema/Exception/JsonDecodingException.phpÞÂÁÚ[Þ\¸
  55. ¶Wvendor/justinrainbow/json-schema/src/JsonSchema/Exception/ResourceNotFoundException.phpoÂÁÚ[opíÛù¶Nvendor/justinrainbow/json-schema/src/JsonSchema/Exception/RuntimeException.php…ÂÁÚ[…%…—¶^vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UnresolvableJsonPointerException.php€ÂÁÚ[€u-#1¶Rvendor/justinrainbow/json-schema/src/JsonSchema/Exception/UriResolverException.phpjÂÁÚ[jå>�¶Qvendor/justinrainbow/json-schema/src/JsonSchema/Exception/ValidationException.phpfÂÁÚ[f¬¤„þ¶Kvendor/justinrainbow/json-schema/src/JsonSchema/Iterator/ObjectIterator.phpþÂÁÚ[þM�„õ¶;vendor/justinrainbow/json-schema/src/JsonSchema/Rfc3339.php ÂÁÚ[ f4÷³¶Avendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorage.phpœ ÂÁÚ[œ åfO¶Jvendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorageInterface.phpÂÁÚ[oŠ+}¶Tvendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/AbstractRetriever.phpáÂÁÚ[á[þA�¶Gvendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/Curl.php¥ÂÁÚ[¥Ô§Lb¶Rvendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/FileGetContents.php%ÂÁÚ[%5" ¶Rvendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/PredefinedArray.php,ÂÁÚ[,1•5þ¶Xvendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/UriRetrieverInterface.php®ÂÁÚ[®ÿ‹Áå¶Cvendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriResolver.php ÂÁÚ[ £Ÿ)à¶Dvendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriRetriever.php&ÂÁÚ[&¼î‚¢¶Hvendor/justinrainbow/json-schema/src/JsonSchema/UriResolverInterface.phpƒÂÁÚ[ƒJ€¶Ivendor/justinrainbow/json-schema/src/JsonSchema/UriRetrieverInterface.php…ÂÁÚ[…íæe¶=vendor/justinrainbow/json-schema/src/JsonSchema/Validator.phpxÂÁÚ[xeÃþ¶%vendor/composer/spdx-licenses/LICENSEÂÁÚ[Bhí¶2vendor/composer/spdx-licenses/src/SpdxLicenses.phpHÂÁÚ[H͉T¶vendor/composer/semver/LICENSEÂÁÚ[Bhí¶)vendor/composer/semver/src/Comparator.phpÂÁÚ[wlƒï¶<vendor/composer/semver/src/Constraint/AbstractConstraint.php×ÂÁÚ[×õî>Ž¶4vendor/composer/semver/src/Constraint/Constraint.phpª ÂÁÚ[ª ÇO7²¶=vendor/composer/semver/src/Constraint/ConstraintInterface.phpßÂÁÚ[ß0C,‡¶9vendor/composer/semver/src/Constraint/EmptyConstraint.phpéÂÁÚ[é!-Ø™¶9vendor/composer/semver/src/Constraint/MultiConstraint.php1ÂÁÚ[1í xU¶%vendor/composer/semver/src/Semver.phpvÂÁÚ[v‹×È›¶,vendor/composer/semver/src/VersionParser.php¿*ÂÁÚ[¿*)mƶ!vendor/composer/ca-bundle/LICENSEÂÁÚ[*!^`¶*vendor/composer/ca-bundle/src/CaBundle.phpÂÁÚ[Ê ~Ķ&vendor/composer/xdebug-handler/LICENSE)ÂÁÚ[)#Ô;^¶0vendor/composer/xdebug-handler/src/PhpConfig.php´ÂÁÚ[´*D’¶.vendor/composer/xdebug-handler/src/Process.phptÂÁÚ[tÛŒú&¶-vendor/composer/xdebug-handler/src/Status.php
  56. ÂÁÚ[
  57. ²‚²¶4vendor/composer/xdebug-handler/src/XdebugHandler.phpÝÂÁÚ[Ý9'–`¶vendor/psr/log/LICENSE=ÂÁÚ[=p±ŽO¶)vendor/psr/log/Psr/Log/AbstractLogger.php;ÂÁÚ[;ñ>3[¶3vendor/psr/log/Psr/Log/InvalidArgumentException.php`ÂÁÚ[` ˆX1¶#vendor/psr/log/Psr/Log/LogLevel.phpûÂÁÚ[ûjðñ8¶/vendor/psr/log/Psr/Log/LoggerAwareInterface.php|ÂÁÚ[|$£ˆ¶+vendor/psr/log/Psr/Log/LoggerAwareTrait.php§ÂÁÚ[§T½úB¶*vendor/psr/log/Psr/Log/LoggerInterface.phpÆÂÁÚ[Æ»sg¶&vendor/psr/log/Psr/Log/LoggerTrait.phpiÂÁÚ[i35§Þ¶%vendor/psr/log/Psr/Log/NullLogger.phpžÂÁÚ[žÇö3vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.phpü ÂÁÚ[ü iq0ضvendor/autoload.php‚ÂÁÚ[‚…Û2Œ¶'vendor/composer/autoload_namespaces.phpdÂÁÚ[dZ¡¦H¶!vendor/composer/autoload_psr4.php÷ÂÁÚ[÷Å*š¶%vendor/composer/autoload_classmap.phpdÂÁÚ[dZ¡¦H¶"vendor/composer/autoload_files.phpÂÁÚ[¥ ®¶!vendor/composer/autoload_real.phpIÂÁÚ[IÒ¶#vendor/composer/autoload_static.php§
  58. ÂÁÚ[§
  59. ÈSài¶vendor/composer/ClassLoader.php¨ÂÁÚ[¨xää`¶(vendor/composer/ca-bundle/res/cacert.pem�1ÂÁÚ[�1�Xó¶ bin/composeróÂÁÚ[ó]UÌ€¶LICENSE.ÂÁÚ[. Õ¶<?php
  60. namespace Composer\Autoload;
  61. use Composer\Config;
  62. use Composer\EventDispatcher\EventDispatcher;
  63. use Composer\Installer\InstallationManager;
  64. use Composer\IO\IOInterface;
  65. use Composer\Package\AliasPackage;
  66. use Composer\Package\PackageInterface;
  67. use Composer\Repository\InstalledRepositoryInterface;
  68. use Composer\Util\Filesystem;
  69. use Composer\Script\ScriptEvents;
  70. class AutoloadGenerator
  71. {
  72. private $eventDispatcher;
  73. private $io;
  74. private $devMode = false;
  75. private $classMapAuthoritative = false;
  76. private $apcu = false;
  77. private $runScripts = false;
  78. public function __construct(EventDispatcher $eventDispatcher, IOInterface $io = null)
  79. {
  80. $this->eventDispatcher = $eventDispatcher;
  81. $this->io = $io;
  82. }
  83. public function setDevMode($devMode = true)
  84. {
  85. $this->devMode = (bool) $devMode;
  86. }
  87. public function setClassMapAuthoritative($classMapAuthoritative)
  88. {
  89. $this->classMapAuthoritative = (bool) $classMapAuthoritative;
  90. }
  91. public function setApcu($apcu)
  92. {
  93. $this->apcu = (bool) $apcu;
  94. }
  95. public function setRunScripts($runScripts = true)
  96. {
  97. $this->runScripts = (bool) $runScripts;
  98. }
  99. public function dump(Config $config, InstalledRepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $scanPsr0Packages = false, $suffix = '')
  100. {
  101. if ($this->classMapAuthoritative) {
  102. $scanPsr0Packages = true;
  103. }
  104. if ($this->runScripts) {
  105. $this->eventDispatcher->dispatchScript(ScriptEvents::PRE_AUTOLOAD_DUMP, $this->devMode, array(), array(
  106. 'optimize' => (bool) $scanPsr0Packages,
  107. ));
  108. }
  109. $filesystem = new Filesystem();
  110. $filesystem->ensureDirectoryExists($config->get('vendor-dir'));
  111. $basePath = $filesystem->normalizePath(realpath(realpath(getcwd())));
  112. $vendorPath = $filesystem->normalizePath(realpath(realpath($config->get('vendor-dir'))));
  113. $useGlobalIncludePath = (bool) $config->get('use-include-path');
  114. $prependAutoloader = $config->get('prepend-autoloader') === false ? 'false' : 'true';
  115. $targetDir = $vendorPath.'/'.$targetDir;
  116. $filesystem->ensureDirectoryExists($targetDir);
  117. $vendorPathCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);
  118. $vendorPathCode52 = str_replace('__DIR__', 'dirname(__FILE__)', $vendorPathCode);
  119. $vendorPathToTargetDirCode = $filesystem->findShortestPathCode($vendorPath, realpath($targetDir), true);
  120. $appBaseDirCode = $filesystem->findShortestPathCode($vendorPath, $basePath, true);
  121. $appBaseDirCode = str_replace('__DIR__', '$vendorDir', $appBaseDirCode);
  122. $namespacesFile = <<<EOF
  123. <?php
  124. // autoload_namespaces.php @generated by Composer
  125. \$vendorDir = $vendorPathCode52;
  126. \$baseDir = $appBaseDirCode;
  127. return array(
  128. EOF;
  129. $psr4File = <<<EOF
  130. <?php
  131. // autoload_psr4.php @generated by Composer
  132. \$vendorDir = $vendorPathCode52;
  133. \$baseDir = $appBaseDirCode;
  134. return array(
  135. EOF;
  136. $packageMap = $this->buildPackageMap($installationManager, $mainPackage, $localRepo->getCanonicalPackages());
  137. $autoloads = $this->parseAutoloads($packageMap, $mainPackage, $this->devMode === false);
  138. foreach ($autoloads['psr-0'] as $namespace => $paths) {
  139. $exportedPaths = array();
  140. foreach ($paths as $path) {
  141. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  142. }
  143. $exportedPrefix = var_export($namespace, true);
  144. $namespacesFile .= " $exportedPrefix => ";
  145. $namespacesFile .= "array(".implode(', ', $exportedPaths)."),\n";
  146. }
  147. $namespacesFile .= ");\n";
  148. foreach ($autoloads['psr-4'] as $namespace => $paths) {
  149. $exportedPaths = array();
  150. foreach ($paths as $path) {
  151. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  152. }
  153. $exportedPrefix = var_export($namespace, true);
  154. $psr4File .= " $exportedPrefix => ";
  155. $psr4File .= "array(".implode(', ', $exportedPaths)."),\n";
  156. }
  157. $psr4File .= ");\n";
  158. $classmapFile = <<<EOF
  159. <?php
  160. // autoload_classmap.php @generated by Composer
  161. \$vendorDir = $vendorPathCode52;
  162. \$baseDir = $appBaseDirCode;
  163. return array(
  164. EOF;
  165. $targetDirLoader = null;
  166. $mainAutoload = $mainPackage->getAutoload();
  167. if ($mainPackage->getTargetDir() && !empty($mainAutoload['psr-0'])) {
  168. $levels = substr_count($filesystem->normalizePath($mainPackage->getTargetDir()), '/') + 1;
  169. $prefixes = implode(', ', array_map(function ($prefix) {
  170. return var_export($prefix, true);
  171. }, array_keys($mainAutoload['psr-0'])));
  172. $baseDirFromTargetDirCode = $filesystem->findShortestPathCode($targetDir, $basePath, true);
  173. $targetDirLoader = <<<EOF
  174. public static function autoload(\$class)
  175. {
  176. \$dir = $baseDirFromTargetDirCode . '/';
  177. \$prefixes = array($prefixes);
  178. foreach (\$prefixes as \$prefix) {
  179. if (0 !== strpos(\$class, \$prefix)) {
  180. continue;
  181. }
  182. \$path = \$dir . implode('/', array_slice(explode('\\\\', \$class), $levels)).'.php';
  183. if (!\$path = stream_resolve_include_path(\$path)) {
  184. return false;
  185. }
  186. require \$path;
  187. return true;
  188. }
  189. }
  190. EOF;
  191. }
  192. $blacklist = null;
  193. if (!empty($autoloads['exclude-from-classmap'])) {
  194. $blacklist = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
  195. }
  196. $classMap = array();
  197. if ($scanPsr0Packages) {
  198. $namespacesToScan = array();
  199. foreach (array('psr-0', 'psr-4') as $psrType) {
  200. foreach ($autoloads[$psrType] as $namespace => $paths) {
  201. $namespacesToScan[$namespace][] = array('paths' => $paths, 'type' => $psrType);
  202. }
  203. }
  204. krsort($namespacesToScan);
  205. foreach ($namespacesToScan as $namespace => $groups) {
  206. foreach ($groups as $group) {
  207. foreach ($group['paths'] as $dir) {
  208. $dir = $filesystem->normalizePath($filesystem->isAbsolutePath($dir) ? $dir : $basePath.'/'.$dir);
  209. if (!is_dir($dir)) {
  210. continue;
  211. }
  212. $namespaceFilter = $namespace === '' ? null : $namespace;
  213. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist, $namespaceFilter, $classMap);
  214. }
  215. }
  216. }
  217. }
  218. foreach ($autoloads['classmap'] as $dir) {
  219. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist, null, $classMap);
  220. }
  221. ksort($classMap);
  222. foreach ($classMap as $class => $code) {
  223. $classmapFile .= ' '.var_export($class, true).' => '.$code;
  224. }
  225. $classmapFile .= ");\n";
  226. if (!$suffix) {
  227. if (!$config->get('autoloader-suffix') && is_readable($vendorPath.'/autoload.php')) {
  228. $content = file_get_contents($vendorPath.'/autoload.php');
  229. if (preg_match('{ComposerAutoloaderInit([^:\s]+)::}', $content, $match)) {
  230. $suffix = $match[1];
  231. }
  232. }
  233. if (!$suffix) {
  234. $suffix = $config->get('autoloader-suffix') ?: md5(uniqid('', true));
  235. }
  236. }
  237. file_put_contents($targetDir.'/autoload_namespaces.php', $namespacesFile);
  238. file_put_contents($targetDir.'/autoload_psr4.php', $psr4File);
  239. file_put_contents($targetDir.'/autoload_classmap.php', $classmapFile);
  240. $includePathFilePath = $targetDir.'/include_paths.php';
  241. if ($includePathFileContents = $this->getIncludePathsFile($packageMap, $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  242. file_put_contents($includePathFilePath, $includePathFileContents);
  243. } elseif (file_exists($includePathFilePath)) {
  244. unlink($includePathFilePath);
  245. }
  246. $includeFilesFilePath = $targetDir.'/autoload_files.php';
  247. if ($includeFilesFileContents = $this->getIncludeFilesFile($autoloads['files'], $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  248. file_put_contents($includeFilesFilePath, $includeFilesFileContents);
  249. } elseif (file_exists($includeFilesFilePath)) {
  250. unlink($includeFilesFilePath);
  251. }
  252. file_put_contents($targetDir.'/autoload_static.php', $this->getStaticFile($suffix, $targetDir, $vendorPath, $basePath, $staticPhpVersion));
  253. file_put_contents($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
  254. file_put_contents($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, (bool) $includePathFileContents, $targetDirLoader, (bool) $includeFilesFileContents, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion));
  255. $this->safeCopy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
  256. $this->safeCopy(__DIR__.'/../../../LICENSE', $targetDir.'/LICENSE');
  257. if ($this->runScripts) {
  258. $this->eventDispatcher->dispatchScript(ScriptEvents::POST_AUTOLOAD_DUMP, $this->devMode, array(), array(
  259. 'optimize' => (bool) $scanPsr0Packages,
  260. ));
  261. }
  262. }
  263. private function addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist = null, $namespaceFilter = null, array $classMap = array())
  264. {
  265. foreach ($this->generateClassMap($dir, $blacklist, $namespaceFilter) as $class => $path) {
  266. $pathCode = $this->getPathCode($filesystem, $basePath, $vendorPath, $path).",\n";
  267. if (!isset($classMap[$class])) {
  268. $classMap[$class] = $pathCode;
  269. } elseif ($this->io && $classMap[$class] !== $pathCode && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($classMap[$class].' '.$path, '\\', '/'))) {
  270. $this->io->writeError(
  271. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  272. ' was found in both "'.str_replace(array('$vendorDir . \'', "',\n"), array($vendorPath, ''), $classMap[$class]).'" and "'.$path.'", the first will be used.</warning>'
  273. );
  274. }
  275. }
  276. return $classMap;
  277. }
  278. private function generateClassMap($dir, $blacklist = null, $namespaceFilter = null, $showAmbiguousWarning = true)
  279. {
  280. return ClassMapGenerator::createMap($dir, $blacklist, $showAmbiguousWarning ? $this->io : null, $namespaceFilter);
  281. }
  282. public function buildPackageMap(InstallationManager $installationManager, PackageInterface $mainPackage, array $packages)
  283. {
  284. $packageMap = array(array($mainPackage, ''));
  285. foreach ($packages as $package) {
  286. if ($package instanceof AliasPackage) {
  287. continue;
  288. }
  289. $this->validatePackage($package);
  290. $packageMap[] = array(
  291. $package,
  292. $installationManager->getInstallPath($package),
  293. );
  294. }
  295. return $packageMap;
  296. }
  297. protected function validatePackage(PackageInterface $package)
  298. {
  299. $autoload = $package->getAutoload();
  300. if (!empty($autoload['psr-4']) && null !== $package->getTargetDir()) {
  301. $name = $package->getName();
  302. $package->getTargetDir();
  303. throw new \InvalidArgumentException("PSR-4 autoloading is incompatible with the target-dir property, remove the target-dir in package '$name'.");
  304. }
  305. if (!empty($autoload['psr-4'])) {
  306. foreach ($autoload['psr-4'] as $namespace => $dirs) {
  307. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  308. throw new \InvalidArgumentException("psr-4 namespaces must end with a namespace separator, '$namespace' does not, use '$namespace\\'.");
  309. }
  310. }
  311. }
  312. }
  313. public function parseAutoloads(array $packageMap, PackageInterface $mainPackage, $filterOutRequireDevPackages = false)
  314. {
  315. $mainPackageMap = array_shift($packageMap);
  316. if ($filterOutRequireDevPackages) {
  317. $packageMap = $this->filterPackageMap($packageMap, $mainPackage);
  318. }
  319. $sortedPackageMap = $this->sortPackageMap($packageMap);
  320. $sortedPackageMap[] = $mainPackageMap;
  321. array_unshift($packageMap, $mainPackageMap);
  322. $psr0 = $this->parseAutoloadsType($packageMap, 'psr-0', $mainPackage);
  323. $psr4 = $this->parseAutoloadsType($packageMap, 'psr-4', $mainPackage);
  324. $classmap = $this->parseAutoloadsType(array_reverse($sortedPackageMap), 'classmap', $mainPackage);
  325. $files = $this->parseAutoloadsType($sortedPackageMap, 'files', $mainPackage);
  326. $exclude = $this->parseAutoloadsType($sortedPackageMap, 'exclude-from-classmap', $mainPackage);
  327. krsort($psr0);
  328. krsort($psr4);
  329. return array(
  330. 'psr-0' => $psr0,
  331. 'psr-4' => $psr4,
  332. 'classmap' => $classmap,
  333. 'files' => $files,
  334. 'exclude-from-classmap' => $exclude,
  335. );
  336. }
  337. public function createLoader(array $autoloads)
  338. {
  339. $loader = new ClassLoader();
  340. if (isset($autoloads['psr-0'])) {
  341. foreach ($autoloads['psr-0'] as $namespace => $path) {
  342. $loader->add($namespace, $path);
  343. }
  344. }
  345. if (isset($autoloads['psr-4'])) {
  346. foreach ($autoloads['psr-4'] as $namespace => $path) {
  347. $loader->addPsr4($namespace, $path);
  348. }
  349. }
  350. if (isset($autoloads['classmap'])) {
  351. $blacklist = null;
  352. if (!empty($autoloads['exclude-from-classmap'])) {
  353. $blacklist = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
  354. }
  355. foreach ($autoloads['classmap'] as $dir) {
  356. try {
  357. $loader->addClassMap($this->generateClassMap($dir, $blacklist, null, false));
  358. } catch (\RuntimeException $e) {
  359. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  360. }
  361. }
  362. }
  363. return $loader;
  364. }
  365. protected function getIncludePathsFile(array $packageMap, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
  366. {
  367. $includePaths = array();
  368. foreach ($packageMap as $item) {
  369. list($package, $installPath) = $item;
  370. if (null !== $package->getTargetDir() && strlen($package->getTargetDir()) > 0) {
  371. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  372. }
  373. foreach ($package->getIncludePaths() as $includePath) {
  374. $includePath = trim($includePath, '/');
  375. $includePaths[] = empty($installPath) ? $includePath : $installPath.'/'.$includePath;
  376. }
  377. }
  378. if (!$includePaths) {
  379. return;
  380. }
  381. $includePathsCode = '';
  382. foreach ($includePaths as $path) {
  383. $includePathsCode .= " " . $this->getPathCode($filesystem, $basePath, $vendorPath, $path) . ",\n";
  384. }
  385. return <<<EOF
  386. <?php
  387. // include_paths.php @generated by Composer
  388. \$vendorDir = $vendorPathCode;
  389. \$baseDir = $appBaseDirCode;
  390. return array(
  391. $includePathsCode);
  392. EOF;
  393. }
  394. protected function getIncludeFilesFile(array $files, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
  395. {
  396. $filesCode = '';
  397. foreach ($files as $fileIdentifier => $functionFile) {
  398. $filesCode .= ' ' . var_export($fileIdentifier, true) . ' => '
  399. . $this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile) . ",\n";
  400. }
  401. if (!$filesCode) {
  402. return false;
  403. }
  404. return <<<EOF
  405. <?php
  406. // autoload_files.php @generated by Composer
  407. \$vendorDir = $vendorPathCode;
  408. \$baseDir = $appBaseDirCode;
  409. return array(
  410. $filesCode);
  411. EOF;
  412. }
  413. protected function getPathCode(Filesystem $filesystem, $basePath, $vendorPath, $path)
  414. {
  415. if (!$filesystem->isAbsolutePath($path)) {
  416. $path = $basePath . '/' . $path;
  417. }
  418. $path = $filesystem->normalizePath($path);
  419. $baseDir = '';
  420. if (strpos($path.'/', $vendorPath.'/') === 0) {
  421. $path = substr($path, strlen($vendorPath));
  422. $baseDir = '$vendorDir';
  423. if ($path !== false) {
  424. $baseDir .= " . ";
  425. }
  426. } else {
  427. $path = $filesystem->normalizePath($filesystem->findShortestPath($basePath, $path, true));
  428. if (!$filesystem->isAbsolutePath($path)) {
  429. $baseDir = '$baseDir . ';
  430. $path = '/' . $path;
  431. }
  432. }
  433. if (preg_match('/\.phar.+$/', $path)) {
  434. $baseDir = "'phar://' . " . $baseDir;
  435. }
  436. return $baseDir . (($path !== false) ? var_export($path, true) : "");
  437. }
  438. protected function getAutoloadFile($vendorPathToTargetDirCode, $suffix)
  439. {
  440. $lastChar = $vendorPathToTargetDirCode[strlen($vendorPathToTargetDirCode) - 1];
  441. if ("'" === $lastChar || '"' === $lastChar) {
  442. $vendorPathToTargetDirCode = substr($vendorPathToTargetDirCode, 0, -1).'/autoload_real.php'.$lastChar;
  443. } else {
  444. $vendorPathToTargetDirCode .= " . '/autoload_real.php'";
  445. }
  446. return <<<AUTOLOAD
  447. <?php
  448. // autoload.php @generated by Composer
  449. require_once $vendorPathToTargetDirCode;
  450. return ComposerAutoloaderInit$suffix::getLoader();
  451. AUTOLOAD;
  452. }
  453. protected function getAutoloadRealFile($useClassMap, $useIncludePath, $targetDirLoader, $useIncludeFiles, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion = 70000)
  454. {
  455. $file = <<<HEADER
  456. <?php
  457. // autoload_real.php @generated by Composer
  458. class ComposerAutoloaderInit$suffix
  459. {
  460. private static \$loader;
  461. public static function loadClassLoader(\$class)
  462. {
  463. if ('Composer\\Autoload\\ClassLoader' === \$class) {
  464. require __DIR__ . '/ClassLoader.php';
  465. }
  466. }
  467. public static function getLoader()
  468. {
  469. if (null !== self::\$loader) {
  470. return self::\$loader;
  471. }
  472. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'), true, $prependAutoloader);
  473. self::\$loader = \$loader = new \\Composer\\Autoload\\ClassLoader();
  474. spl_autoload_unregister(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'));
  475. HEADER;
  476. if ($useIncludePath) {
  477. $file .= <<<'INCLUDE_PATH'
  478. $includePaths = require __DIR__ . '/include_paths.php';
  479. $includePaths[] = get_include_path();
  480. set_include_path(implode(PATH_SEPARATOR, $includePaths));
  481. INCLUDE_PATH;
  482. }
  483. $file .= <<<STATIC_INIT
  484. \$useStaticLoader = PHP_VERSION_ID >= $staticPhpVersion && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
  485. if (\$useStaticLoader) {
  486. require_once __DIR__ . '/autoload_static.php';
  487. call_user_func(\Composer\Autoload\ComposerStaticInit$suffix::getInitializer(\$loader));
  488. } else {
  489. STATIC_INIT;
  490. if (!$this->classMapAuthoritative) {
  491. $file .= <<<'PSR04'
  492. $map = require __DIR__ . '/autoload_namespaces.php';
  493. foreach ($map as $namespace => $path) {
  494. $loader->set($namespace, $path);
  495. }
  496. $map = require __DIR__ . '/autoload_psr4.php';
  497. foreach ($map as $namespace => $path) {
  498. $loader->setPsr4($namespace, $path);
  499. }
  500. PSR04;
  501. }
  502. if ($useClassMap) {
  503. $file .= <<<'CLASSMAP'
  504. $classMap = require __DIR__ . '/autoload_classmap.php';
  505. if ($classMap) {
  506. $loader->addClassMap($classMap);
  507. }
  508. CLASSMAP;
  509. }
  510. $file .= " }\n\n";
  511. if ($this->classMapAuthoritative) {
  512. $file .= <<<'CLASSMAPAUTHORITATIVE'
  513. $loader->setClassMapAuthoritative(true);
  514. CLASSMAPAUTHORITATIVE;
  515. }
  516. if ($this->apcu) {
  517. $apcuPrefix = substr(base64_encode(md5(uniqid('', true), true)), 0, -3);
  518. $file .= <<<APCU
  519. \$loader->setApcuPrefix('$apcuPrefix');
  520. APCU;
  521. }
  522. if ($useGlobalIncludePath) {
  523. $file .= <<<'INCLUDEPATH'
  524. $loader->setUseIncludePath(true);
  525. INCLUDEPATH;
  526. }
  527. if ($targetDirLoader) {
  528. $file .= <<<REGISTER_TARGET_DIR_AUTOLOAD
  529. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'autoload'), true, true);
  530. REGISTER_TARGET_DIR_AUTOLOAD;
  531. }
  532. $file .= <<<REGISTER_LOADER
  533. \$loader->register($prependAutoloader);
  534. REGISTER_LOADER;
  535. if ($useIncludeFiles) {
  536. $file .= <<<INCLUDE_FILES
  537. if (\$useStaticLoader) {
  538. \$includeFiles = Composer\Autoload\ComposerStaticInit$suffix::\$files;
  539. } else {
  540. \$includeFiles = require __DIR__ . '/autoload_files.php';
  541. }
  542. foreach (\$includeFiles as \$fileIdentifier => \$file) {
  543. composerRequire$suffix(\$fileIdentifier, \$file);
  544. }
  545. INCLUDE_FILES;
  546. }
  547. $file .= <<<METHOD_FOOTER
  548. return \$loader;
  549. }
  550. METHOD_FOOTER;
  551. $file .= $targetDirLoader;
  552. if ($useIncludeFiles) {
  553. return $file . <<<FOOTER
  554. }
  555. function composerRequire$suffix(\$fileIdentifier, \$file)
  556. {
  557. if (empty(\$GLOBALS['__composer_autoload_files'][\$fileIdentifier])) {
  558. require \$file;
  559. \$GLOBALS['__composer_autoload_files'][\$fileIdentifier] = true;
  560. }
  561. }
  562. FOOTER;
  563. }
  564. return $file . <<<FOOTER
  565. }
  566. FOOTER;
  567. }
  568. protected function getStaticFile($suffix, $targetDir, $vendorPath, $basePath, &$staticPhpVersion)
  569. {
  570. $staticPhpVersion = 50600;
  571. $file = <<<HEADER
  572. <?php
  573. // autoload_static.php @generated by Composer
  574. namespace Composer\Autoload;
  575. class ComposerStaticInit$suffix
  576. {
  577. HEADER;
  578. $loader = new ClassLoader();
  579. $map = require $targetDir . '/autoload_namespaces.php';
  580. foreach ($map as $namespace => $path) {
  581. $loader->set($namespace, $path);
  582. }
  583. $map = require $targetDir . '/autoload_psr4.php';
  584. foreach ($map as $namespace => $path) {
  585. $loader->setPsr4($namespace, $path);
  586. }
  587. $classMap = require $targetDir . '/autoload_classmap.php';
  588. if ($classMap) {
  589. $loader->addClassMap($classMap);
  590. }
  591. $filesystem = new Filesystem();
  592. $vendorPathCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";
  593. $appBaseDirCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
  594. $absoluteVendorPathCode = ' => ' . substr(var_export(rtrim($vendorDir, '\\/') . '/', true), 0, -1);
  595. $absoluteAppBaseDirCode = ' => ' . substr(var_export(rtrim($baseDir, '\\/') . '/', true), 0, -1);
  596. $initializer = '';
  597. $prefix = "\0Composer\Autoload\ClassLoader\0";
  598. $prefixLen = strlen($prefix);
  599. if (file_exists($targetDir . '/autoload_files.php')) {
  600. $maps = array('files' => require $targetDir . '/autoload_files.php');
  601. } else {
  602. $maps = array();
  603. }
  604. foreach ((array) $loader as $prop => $value) {
  605. if ($value && 0 === strpos($prop, $prefix)) {
  606. $maps[substr($prop, $prefixLen)] = $value;
  607. }
  608. }
  609. foreach ($maps as $prop => $value) {
  610. if (count($value) > 32767) {
  611. $staticPhpVersion = 70000;
  612. }
  613. $value = var_export($value, true);
  614. $value = str_replace($absoluteVendorPathCode, $vendorPathCode, $value);
  615. $value = str_replace($absoluteAppBaseDirCode, $appBaseDirCode, $value);
  616. $value = ltrim(preg_replace('/^ */m', ' $0$0', $value));
  617. $file .= sprintf(" public static $%s = %s;\n\n", $prop, $value);
  618. if ('files' !== $prop) {
  619. $initializer .= " \$loader->$prop = ComposerStaticInit$suffix::\$$prop;\n";
  620. }
  621. }
  622. return $file . <<<INITIALIZER
  623. public static function getInitializer(ClassLoader \$loader)
  624. {
  625. return \Closure::bind(function () use (\$loader) {
  626. $initializer
  627. }, null, ClassLoader::class);
  628. }
  629. }
  630. INITIALIZER;
  631. }
  632. protected function parseAutoloadsType(array $packageMap, $type, PackageInterface $mainPackage)
  633. {
  634. $autoloads = array();
  635. foreach ($packageMap as $item) {
  636. list($package, $installPath) = $item;
  637. $autoload = $package->getAutoload();
  638. if ($this->devMode && $package === $mainPackage) {
  639. $autoload = array_merge_recursive($autoload, $package->getDevAutoload());
  640. }
  641. if (!isset($autoload[$type]) || !is_array($autoload[$type])) {
  642. continue;
  643. }
  644. if (null !== $package->getTargetDir() && $package !== $mainPackage) {
  645. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  646. }
  647. foreach ($autoload[$type] as $namespace => $paths) {
  648. foreach ((array) $paths as $path) {
  649. if (($type === 'files' || $type === 'classmap' || $type === 'exclude-from-classmap') && $package->getTargetDir() && !is_readable($installPath.'/'.$path)) {
  650. if ($package === $mainPackage) {
  651. $targetDir = str_replace('\\<dirsep\\>', '[\\\\/]', preg_quote(str_replace(array('/', '\\'), '<dirsep>', $package->getTargetDir())));
  652. $path = ltrim(preg_replace('{^'.$targetDir.'}', '', ltrim($path, '\\/')), '\\/');
  653. } else {
  654. $path = $package->getTargetDir() . '/' . $path;
  655. }
  656. }
  657. if ($type === 'exclude-from-classmap') {
  658. $path = preg_replace('{/+}', '/', preg_quote(trim(strtr($path, '\\', '/'), '/')));
  659. $path = str_replace('\\*\\*', '.+?', $path);
  660. $path = str_replace('\\*', '[^/]+?', $path);
  661. $updir = null;
  662. $path = preg_replace_callback(
  663. '{^((?:(?:\\\\\\.){1,2}+/)+)}',
  664. function ($matches) use (&$updir) {
  665. if (isset($matches[1])) {
  666. $updir = str_replace('\\.', '.', $matches[1]);
  667. }
  668. return '';
  669. },
  670. $path
  671. );
  672. if (empty($installPath)) {
  673. $installPath = strtr(getcwd(), '\\', '/');
  674. }
  675. $resolvedPath = realpath($installPath . '/' . $updir);
  676. $autoloads[] = preg_quote(strtr($resolvedPath, '\\', '/')) . '/' . $path;
  677. continue;
  678. }
  679. $relativePath = empty($installPath) ? (empty($path) ? '.' : $path) : $installPath.'/'.$path;
  680. if ($type === 'files') {
  681. $autoloads[$this->getFileIdentifier($package, $path)] = $relativePath;
  682. continue;
  683. } elseif ($type === 'classmap') {
  684. $autoloads[] = $relativePath;
  685. continue;
  686. }
  687. $autoloads[$namespace][] = $relativePath;
  688. }
  689. }
  690. }
  691. return $autoloads;
  692. }
  693. protected function getFileIdentifier(PackageInterface $package, $path)
  694. {
  695. return md5($package->getName() . ':' . $path);
  696. }
  697. protected function filterPackageMap(array $packageMap, PackageInterface $mainPackage)
  698. {
  699. $packages = array();
  700. $include = array();
  701. foreach ($packageMap as $item) {
  702. $package = $item[0];
  703. $name = $package->getName();
  704. $packages[$name] = $package;
  705. }
  706. $add = function (PackageInterface $package) use (&$add, $packages, &$include) {
  707. foreach ($package->getRequires() as $link) {
  708. $target = $link->getTarget();
  709. if (!isset($include[$target])) {
  710. $include[$target] = true;
  711. if (isset($packages[$target])) {
  712. $add($packages[$target]);
  713. }
  714. }
  715. }
  716. };
  717. $add($mainPackage);
  718. return array_filter(
  719. $packageMap,
  720. function ($item) use ($include) {
  721. $package = $item[0];
  722. $name = $package->getName();
  723. return isset($include[$name]);
  724. }
  725. );
  726. }
  727. protected function sortPackageMap(array $packageMap)
  728. {
  729. $packages = array();
  730. $paths = array();
  731. $usageList = array();
  732. foreach ($packageMap as $item) {
  733. list($package, $path) = $item;
  734. $name = $package->getName();
  735. $packages[$name] = $package;
  736. $paths[$name] = $path;
  737. foreach (array_merge($package->getRequires(), $package->getDevRequires()) as $link) {
  738. $target = $link->getTarget();
  739. $usageList[$target][] = $name;
  740. }
  741. }
  742. $computing = array();
  743. $computed = array();
  744. $computeImportance = function ($name) use (&$computeImportance, &$computing, &$computed, $usageList) {
  745. if (isset($computed[$name])) {
  746. return $computed[$name];
  747. }
  748. if (isset($computing[$name])) {
  749. return 0;
  750. }
  751. $computing[$name] = true;
  752. $weight = 0;
  753. if (isset($usageList[$name])) {
  754. foreach ($usageList[$name] as $user) {
  755. $weight -= 1 - $computeImportance($user);
  756. }
  757. }
  758. unset($computing[$name]);
  759. $computed[$name] = $weight;
  760. return $weight;
  761. };
  762. $weightList = array();
  763. foreach ($packages as $name => $package) {
  764. $weight = $computeImportance($name);
  765. $weightList[$name] = $weight;
  766. }
  767. $stable_sort = function (&$array) {
  768. static $transform, $restore;
  769. $i = 0;
  770. if (!$transform) {
  771. $transform = function (&$v, $k) use (&$i) {
  772. $v = array($v, ++$i, $k, $v);
  773. };
  774. $restore = function (&$v, $k) {
  775. $v = $v[3];
  776. };
  777. }
  778. array_walk($array, $transform);
  779. asort($array);
  780. array_walk($array, $restore);
  781. };
  782. $stable_sort($weightList);
  783. $sortedPackageMap = array();
  784. foreach (array_keys($weightList) as $name) {
  785. $sortedPackageMap[] = array($packages[$name], $paths[$name]);
  786. }
  787. return $sortedPackageMap;
  788. }
  789. protected function safeCopy($source, $target)
  790. {
  791. $source = fopen($source, 'r');
  792. $target = fopen($target, 'w+');
  793. stream_copy_to_stream($source, $target);
  794. fclose($source);
  795. fclose($target);
  796. }
  797. }
  798. <?php
  799. namespace Composer\Autoload;
  800. use Symfony\Component\Finder\Finder;
  801. use Composer\IO\IOInterface;
  802. use Composer\Util\Filesystem;
  803. class ClassMapGenerator
  804. {
  805. public static function dump($dirs, $file)
  806. {
  807. $maps = array();
  808. foreach ($dirs as $dir) {
  809. $maps = array_merge($maps, static::createMap($dir));
  810. }
  811. file_put_contents($file, sprintf('<?php return %s;', var_export($maps, true)));
  812. }
  813. public static function createMap($path, $blacklist = null, IOInterface $io = null, $namespace = null)
  814. {
  815. if (is_string($path)) {
  816. if (is_file($path)) {
  817. $path = array(new \SplFileInfo($path));
  818. } elseif (is_dir($path)) {
  819. $path = Finder::create()->files()->followLinks()->name('/\.(php|inc|hh)$/')->in($path);
  820. } else {
  821. throw new \RuntimeException(
  822. 'Could not scan for classes inside "'.$path.
  823. '" which does not appear to be a file nor a folder'
  824. );
  825. }
  826. }
  827. $map = array();
  828. $filesystem = new Filesystem();
  829. $cwd = realpath(getcwd());
  830. foreach ($path as $file) {
  831. $filePath = $file->getPathname();
  832. if (!in_array(pathinfo($filePath, PATHINFO_EXTENSION), array('php', 'inc', 'hh'))) {
  833. continue;
  834. }
  835. if (!$filesystem->isAbsolutePath($filePath)) {
  836. $filePath = $cwd . '/' . $filePath;
  837. $filePath = $filesystem->normalizePath($filePath);
  838. } else {
  839. $filePath = preg_replace('{[\\\\/]{2,}}', '/', $filePath);
  840. }
  841. if ($blacklist && preg_match($blacklist, strtr(realpath($filePath), '\\', '/'))) {
  842. continue;
  843. }
  844. if ($blacklist && preg_match($blacklist, strtr($filePath, '\\', '/'))) {
  845. continue;
  846. }
  847. $classes = self::findClasses($filePath);
  848. foreach ($classes as $class) {
  849. if (null !== $namespace && 0 !== strpos($class, $namespace)) {
  850. continue;
  851. }
  852. if (!isset($map[$class])) {
  853. $map[$class] = $filePath;
  854. } elseif ($io && $map[$class] !== $filePath && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($map[$class].' '.$filePath, '\\', '/'))) {
  855. $io->writeError(
  856. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  857. ' was found in both "'.$map[$class].'" and "'.$filePath.'", the first will be used.</warning>'
  858. );
  859. }
  860. }
  861. }
  862. return $map;
  863. }
  864. private static function findClasses($path)
  865. {
  866. $extraTypes = PHP_VERSION_ID < 50400 ? '' : '|trait';
  867. if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '3.3', '>=')) {
  868. $extraTypes .= '|enum';
  869. }
  870. $contents = @php_strip_whitespace($path);
  871. if (!$contents) {
  872. if (!file_exists($path)) {
  873. $message = 'File at "%s" does not exist, check your classmap definitions';
  874. } elseif (!is_readable($path)) {
  875. $message = 'File at "%s" is not readable, check its permissions';
  876. } elseif ('' === trim(file_get_contents($path))) {
  877. return array();
  878. } else {
  879. $message = 'File at "%s" could not be parsed as PHP, it may be binary or corrupted';
  880. }
  881. $error = error_get_last();
  882. if (isset($error['message'])) {
  883. $message .= PHP_EOL . 'The following message may be helpful:' . PHP_EOL . $error['message'];
  884. }
  885. throw new \RuntimeException(sprintf($message, $path));
  886. }
  887. if (!preg_match('{\b(?:class|interface'.$extraTypes.')\s}i', $contents)) {
  888. return array();
  889. }
  890. $contents = preg_replace('{<<<\s*(\'?)(\w+)\\1(?:\r\n|\n|\r)(?:.*?)(?:\r\n|\n|\r)\\2(?=\r\n|\n|\r|;)}s', 'null', $contents);
  891. $contents = preg_replace('{"[^"\\\\]*+(\\\\.[^"\\\\]*+)*+"|\'[^\'\\\\]*+(\\\\.[^\'\\\\]*+)*+\'}s', 'null', $contents);
  892. if (substr($contents, 0, 2) !== '<?') {
  893. $contents = preg_replace('{^.+?<\?}s', '<?', $contents, 1, $replacements);
  894. if ($replacements === 0) {
  895. return array();
  896. }
  897. }
  898. $contents = preg_replace('{\?>.+<\?}s', '?><?', $contents);
  899. $pos = strrpos($contents, '?>');
  900. if (false !== $pos && false === strpos(substr($contents, $pos), '<?')) {
  901. $contents = substr($contents, 0, $pos);
  902. }
  903. if (preg_match('{(<\?)(?!(php|hh))}i', $contents)) {
  904. $contents = preg_replace('{//.* | /\*(?:[^*]++|\*(?!/))*\*/}x', '', $contents);
  905. }
  906. preg_match_all('{
  907. (?:
  908. \b(?<![\$:>])(?P<type>class|interface'.$extraTypes.') \s++ (?P<name>[a-zA-Z_\x7f-\xff:][a-zA-Z0-9_\x7f-\xff:\-]*+)
  909. | \b(?<![\$:>])(?P<ns>namespace) (?P<nsname>\s++[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\s*+\\\\\s*+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)*+)? \s*+ [\{;]
  910. )
  911. }ix', $contents, $matches);
  912. $classes = array();
  913. $namespace = '';
  914. for ($i = 0, $len = count($matches['type']); $i < $len; $i++) {
  915. if (!empty($matches['ns'][$i])) {
  916. $namespace = str_replace(array(' ', "\t", "\r", "\n"), '', $matches['nsname'][$i]) . '\\';
  917. } else {
  918. $name = $matches['name'][$i];
  919. if ($name === 'extends' || $name === 'implements') {
  920. continue;
  921. }
  922. if ($name[0] === ':') {
  923. $name = 'xhp'.substr(str_replace(array('-', ':'), array('_', '__'), $name), 1);
  924. } elseif ($matches['type'][$i] === 'enum') {
  925. $name = rtrim($name, ':');
  926. }
  927. $classes[] = ltrim($namespace . $name, '\\');
  928. }
  929. }
  930. return $classes;
  931. }
  932. }
  933. <?php
  934. namespace Composer;
  935. use Composer\IO\IOInterface;
  936. use Composer\Util\Filesystem;
  937. use Composer\Util\Silencer;
  938. use Symfony\Component\Finder\Finder;
  939. class Cache
  940. {
  941. private static $cacheCollected = false;
  942. private $io;
  943. private $root;
  944. private $enabled = true;
  945. private $whitelist;
  946. private $filesystem;
  947. public function __construct(IOInterface $io, $cacheDir, $whitelist = 'a-z0-9.', Filesystem $filesystem = null)
  948. {
  949. $this->io = $io;
  950. $this->root = rtrim($cacheDir, '/\\') . '/';
  951. $this->whitelist = $whitelist;
  952. $this->filesystem = $filesystem ?: new Filesystem();
  953. if (preg_match('{(^|[\\\\/])(\$null|NUL|/dev/null)([\\\\/]|$)}', $cacheDir)) {
  954. $this->enabled = false;
  955. return;
  956. }
  957. if (
  958. (!is_dir($this->root) && !Silencer::call('mkdir', $this->root, 0777, true))
  959. || !is_writable($this->root)
  960. ) {
  961. $this->io->writeError('<warning>Cannot create cache directory ' . $this->root . ', or directory is not writable. Proceeding without cache</warning>');
  962. $this->enabled = false;
  963. }
  964. }
  965. public function isEnabled()
  966. {
  967. return $this->enabled;
  968. }
  969. public function getRoot()
  970. {
  971. return $this->root;
  972. }
  973. public function read($file)
  974. {
  975. if ($this->enabled) {
  976. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  977. if (file_exists($this->root . $file)) {
  978. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  979. return file_get_contents($this->root . $file);
  980. }
  981. }
  982. return false;
  983. }
  984. public function write($file, $contents)
  985. {
  986. if ($this->enabled) {
  987. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  988. $this->io->writeError('Writing '.$this->root . $file.' into cache', true, IOInterface::DEBUG);
  989. try {
  990. return file_put_contents($this->root . $file, $contents);
  991. } catch (\ErrorException $e) {
  992. $this->io->writeError('<warning>Failed to write into cache: '.$e->getMessage().'</warning>', true, IOInterface::DEBUG);
  993. if (preg_match('{^file_put_contents\(\): Only ([0-9]+) of ([0-9]+) bytes written}', $e->getMessage(), $m)) {
  994. unlink($this->root . $file);
  995. $message = sprintf(
  996. '<warning>Writing %1$s into cache failed after %2$u of %3$u bytes written, only %4$u bytes of free space available</warning>',
  997. $this->root . $file,
  998. $m[1],
  999. $m[2],
  1000. @disk_free_space($this->root . dirname($file))
  1001. );
  1002. $this->io->writeError($message);
  1003. return false;
  1004. }
  1005. throw $e;
  1006. }
  1007. }
  1008. return false;
  1009. }
  1010. public function copyFrom($file, $source)
  1011. {
  1012. if ($this->enabled) {
  1013. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1014. $this->filesystem->ensureDirectoryExists(dirname($this->root . $file));
  1015. if (!file_exists($source)) {
  1016. $this->io->writeError('<error>'.$source.' does not exist, can not write into cache</error>');
  1017. } elseif ($this->io->isDebug()) {
  1018. $this->io->writeError('Writing '.$this->root . $file.' into cache from '.$source);
  1019. }
  1020. return copy($source, $this->root . $file);
  1021. }
  1022. return false;
  1023. }
  1024. public function copyTo($file, $target)
  1025. {
  1026. if ($this->enabled) {
  1027. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1028. if (file_exists($this->root . $file)) {
  1029. try {
  1030. touch($this->root . $file, filemtime($this->root . $file), time());
  1031. } catch (\ErrorException $e) {
  1032. Silencer::call('touch', $this->root . $file);
  1033. }
  1034. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  1035. return copy($this->root . $file, $target);
  1036. }
  1037. }
  1038. return false;
  1039. }
  1040. public function gcIsNecessary()
  1041. {
  1042. return (!self::$cacheCollected && !mt_rand(0, 50));
  1043. }
  1044. public function remove($file)
  1045. {
  1046. if ($this->enabled) {
  1047. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1048. if (file_exists($this->root . $file)) {
  1049. return $this->filesystem->unlink($this->root . $file);
  1050. }
  1051. }
  1052. return false;
  1053. }
  1054. public function clear()
  1055. {
  1056. if ($this->enabled) {
  1057. return $this->filesystem->removeDirectory($this->root);
  1058. }
  1059. return false;
  1060. }
  1061. public function gc($ttl, $maxSize)
  1062. {
  1063. if ($this->enabled) {
  1064. $expire = new \DateTime();
  1065. $expire->modify('-'.$ttl.' seconds');
  1066. $finder = $this->getFinder()->date('until '.$expire->format('Y-m-d H:i:s'));
  1067. foreach ($finder as $file) {
  1068. $this->filesystem->unlink($file->getPathname());
  1069. }
  1070. $totalSize = $this->filesystem->size($this->root);
  1071. if ($totalSize > $maxSize) {
  1072. $iterator = $this->getFinder()->sortByAccessedTime()->getIterator();
  1073. while ($totalSize > $maxSize && $iterator->valid()) {
  1074. $filepath = $iterator->current()->getPathname();
  1075. $totalSize -= $this->filesystem->size($filepath);
  1076. $this->filesystem->unlink($filepath);
  1077. $iterator->next();
  1078. }
  1079. }
  1080. self::$cacheCollected = true;
  1081. return true;
  1082. }
  1083. return false;
  1084. }
  1085. public function sha1($file)
  1086. {
  1087. if ($this->enabled) {
  1088. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1089. if (file_exists($this->root . $file)) {
  1090. return sha1_file($this->root . $file);
  1091. }
  1092. }
  1093. return false;
  1094. }
  1095. public function sha256($file)
  1096. {
  1097. if ($this->enabled) {
  1098. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1099. if (file_exists($this->root . $file)) {
  1100. return hash_file('sha256', $this->root . $file);
  1101. }
  1102. }
  1103. return false;
  1104. }
  1105. protected function getFinder()
  1106. {
  1107. return Finder::create()->in($this->root)->files();
  1108. }
  1109. }
  1110. <?php
  1111. namespace Composer\Command;
  1112. use Symfony\Component\Console\Input\InputInterface;
  1113. use Symfony\Component\Console\Output\OutputInterface;
  1114. class AboutCommand extends BaseCommand
  1115. {
  1116. protected function configure()
  1117. {
  1118. $this
  1119. ->setName('about')
  1120. ->setDescription('Shows the short information about Composer.')
  1121. ->setHelp(
  1122. <<<EOT
  1123. <info>php composer.phar about</info>
  1124. EOT
  1125. )
  1126. ;
  1127. }
  1128. protected function execute(InputInterface $input, OutputInterface $output)
  1129. {
  1130. $this->getIO()->write(
  1131. <<<EOT
  1132. <info>Composer - Package Management for PHP</info>
  1133. <comment>Composer is a dependency manager tracking local dependencies of your projects and libraries.
  1134. See https://getcomposer.org/ for more information.</comment>
  1135. EOT
  1136. );
  1137. }
  1138. }
  1139. <?php
  1140. namespace Composer\Command;
  1141. use Composer\Factory;
  1142. use Composer\IO\IOInterface;
  1143. use Composer\Config;
  1144. use Composer\Composer;
  1145. use Composer\Repository\CompositeRepository;
  1146. use Composer\Repository\RepositoryFactory;
  1147. use Composer\Script\ScriptEvents;
  1148. use Composer\Plugin\CommandEvent;
  1149. use Composer\Plugin\PluginEvents;
  1150. use Composer\Util\Filesystem;
  1151. use Symfony\Component\Console\Input\InputArgument;
  1152. use Symfony\Component\Console\Input\InputInterface;
  1153. use Symfony\Component\Console\Input\InputOption;
  1154. use Symfony\Component\Console\Output\OutputInterface;
  1155. class ArchiveCommand extends BaseCommand
  1156. {
  1157. protected function configure()
  1158. {
  1159. $this
  1160. ->setName('archive')
  1161. ->setDescription('Creates an archive of this composer package.')
  1162. ->setDefinition(array(
  1163. new InputArgument('package', InputArgument::OPTIONAL, 'The package to archive instead of the current project'),
  1164. new InputArgument('version', InputArgument::OPTIONAL, 'A version constraint to find the package to archive'),
  1165. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the resulting archive: tar or zip'),
  1166. new InputOption('dir', null, InputOption::VALUE_REQUIRED, 'Write the archive to this directory'),
  1167. new InputOption('file', null, InputOption::VALUE_REQUIRED, 'Write the archive with the given file name.'
  1168. .' Note that the format will be appended.'),
  1169. new InputOption('ignore-filters', false, InputOption::VALUE_NONE, 'Ignore filters when saving package'),
  1170. ))
  1171. ->setHelp(
  1172. <<<EOT
  1173. The <info>archive</info> command creates an archive of the specified format
  1174. containing the files and directories of the Composer project or the specified
  1175. package in the specified version and writes it to the specified directory.
  1176. <info>php composer.phar archive [--format=zip] [--dir=/foo] [package [version]]</info>
  1177. EOT
  1178. )
  1179. ;
  1180. }
  1181. protected function execute(InputInterface $input, OutputInterface $output)
  1182. {
  1183. $config = Factory::createConfig();
  1184. $composer = $this->getComposer(false);
  1185. if ($composer) {
  1186. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'archive', $input, $output);
  1187. $eventDispatcher = $composer->getEventDispatcher();
  1188. $eventDispatcher->dispatch($commandEvent->getName(), $commandEvent);
  1189. $eventDispatcher->dispatchScript(ScriptEvents::PRE_ARCHIVE_CMD);
  1190. }
  1191. if (null === $input->getOption('format')) {
  1192. $input->setOption('format', $config->get('archive-format'));
  1193. }
  1194. if (null === $input->getOption('dir')) {
  1195. $input->setOption('dir', $config->get('archive-dir'));
  1196. }
  1197. $returnCode = $this->archive(
  1198. $this->getIO(),
  1199. $config,
  1200. $input->getArgument('package'),
  1201. $input->getArgument('version'),
  1202. $input->getOption('format'),
  1203. $input->getOption('dir'),
  1204. $input->getOption('file'),
  1205. $input->getOption('ignore-filters'),
  1206. $composer
  1207. );
  1208. if (0 === $returnCode && $composer) {
  1209. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ARCHIVE_CMD);
  1210. }
  1211. return $returnCode;
  1212. }
  1213. protected function archive(IOInterface $io, Config $config, $packageName = null, $version = null, $format = 'tar', $dest = '.', $fileName = null, $ignoreFilters = false, Composer $composer = null)
  1214. {
  1215. if ($composer) {
  1216. $archiveManager = $composer->getArchiveManager();
  1217. } else {
  1218. $factory = new Factory;
  1219. $downloadManager = $factory->createDownloadManager($io, $config);
  1220. $archiveManager = $factory->createArchiveManager($config, $downloadManager);
  1221. }
  1222. if ($packageName) {
  1223. $package = $this->selectPackage($io, $packageName, $version);
  1224. if (!$package) {
  1225. return 1;
  1226. }
  1227. } else {
  1228. $package = $this->getComposer()->getPackage();
  1229. }
  1230. $io->writeError('<info>Creating the archive into "'.$dest.'".</info>');
  1231. $packagePath = $archiveManager->archive($package, $format, $dest, $fileName, $ignoreFilters);
  1232. $fs = new Filesystem;
  1233. $shortPath = $fs->findShortestPath(getcwd(), $packagePath, true);
  1234. $io->writeError('Created: ', false);
  1235. $io->write(strlen($shortPath) < strlen($packagePath) ? $shortPath : $packagePath);
  1236. return 0;
  1237. }
  1238. protected function selectPackage(IOInterface $io, $packageName, $version = null)
  1239. {
  1240. $io->writeError('<info>Searching for the specified package.</info>');
  1241. if ($composer = $this->getComposer(false)) {
  1242. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  1243. $repo = new CompositeRepository(array_merge(array($localRepo), $composer->getRepositoryManager()->getRepositories()));
  1244. } else {
  1245. $defaultRepos = RepositoryFactory::defaultRepos($this->getIO());
  1246. $io->writeError('No composer.json found in the current directory, searching packages from ' . implode(', ', array_keys($defaultRepos)));
  1247. $repo = new CompositeRepository($defaultRepos);
  1248. }
  1249. $packages = $repo->findPackages($packageName, $version);
  1250. if (count($packages) > 1) {
  1251. $package = reset($packages);
  1252. $io->writeError('<info>Found multiple matches, selected '.$package->getPrettyString().'.</info>');
  1253. $io->writeError('Alternatives were '.implode(', ', array_map(function ($p) {
  1254. return $p->getPrettyString();
  1255. }, $packages)).'.');
  1256. $io->writeError('<comment>Please use a more specific constraint to pick a different package.</comment>');
  1257. } elseif ($packages) {
  1258. $package = reset($packages);
  1259. $io->writeError('<info>Found an exact match '.$package->getPrettyString().'.</info>');
  1260. } else {
  1261. $io->writeError('<error>Could not find a package matching '.$packageName.'.</error>');
  1262. return false;
  1263. }
  1264. return $package;
  1265. }
  1266. }
  1267. <?php
  1268. namespace Composer\Command;
  1269. use Composer\Composer;
  1270. use Composer\Config;
  1271. use Composer\Console\Application;
  1272. use Composer\Factory;
  1273. use Composer\IO\IOInterface;
  1274. use Composer\IO\NullIO;
  1275. use Composer\Plugin\PreCommandRunEvent;
  1276. use Composer\Plugin\PluginEvents;
  1277. use Symfony\Component\Console\Input\InputInterface;
  1278. use Symfony\Component\Console\Output\OutputInterface;
  1279. use Symfony\Component\Console\Command\Command;
  1280. abstract class BaseCommand extends Command
  1281. {
  1282. private $composer;
  1283. private $io;
  1284. public function getComposer($required = true, $disablePlugins = null)
  1285. {
  1286. if (null === $this->composer) {
  1287. $application = $this->getApplication();
  1288. if ($application instanceof Application) {
  1289. $this->composer = $application->getComposer($required, $disablePlugins);
  1290. } elseif ($required) {
  1291. throw new \RuntimeException(
  1292. 'Could not create a Composer\Composer instance, you must inject '.
  1293. 'one if this command is not used with a Composer\Console\Application instance'
  1294. );
  1295. }
  1296. }
  1297. return $this->composer;
  1298. }
  1299. public function setComposer(Composer $composer)
  1300. {
  1301. $this->composer = $composer;
  1302. }
  1303. public function resetComposer()
  1304. {
  1305. $this->composer = null;
  1306. $this->getApplication()->resetComposer();
  1307. }
  1308. public function isProxyCommand()
  1309. {
  1310. return false;
  1311. }
  1312. public function getIO()
  1313. {
  1314. if (null === $this->io) {
  1315. $application = $this->getApplication();
  1316. if ($application instanceof Application) {
  1317. $this->io = $application->getIO();
  1318. } else {
  1319. $this->io = new NullIO();
  1320. }
  1321. }
  1322. return $this->io;
  1323. }
  1324. public function setIO(IOInterface $io)
  1325. {
  1326. $this->io = $io;
  1327. }
  1328. protected function initialize(InputInterface $input, OutputInterface $output)
  1329. {
  1330. $disablePlugins = $input->hasParameterOption('--no-plugins');
  1331. $composer = $this->getComposer(false, $disablePlugins);
  1332. if (null === $composer) {
  1333. $composer = Factory::createGlobal($this->getIO(), $disablePlugins);
  1334. }
  1335. if ($composer) {
  1336. $preCommandRunEvent = new PreCommandRunEvent(PluginEvents::PRE_COMMAND_RUN, $input, $this->getName());
  1337. $composer->getEventDispatcher()->dispatch($preCommandRunEvent->getName(), $preCommandRunEvent);
  1338. }
  1339. if (true === $input->hasParameterOption(array('--no-ansi')) && $input->hasOption('no-progress')) {
  1340. $input->setOption('no-progress', true);
  1341. }
  1342. parent::initialize($input, $output);
  1343. }
  1344. protected function getPreferredInstallOptions(Config $config, InputInterface $input, $keepVcsRequiresPreferSource = false)
  1345. {
  1346. $preferSource = false;
  1347. $preferDist = false;
  1348. switch ($config->get('preferred-install')) {
  1349. case 'source':
  1350. $preferSource = true;
  1351. break;
  1352. case 'dist':
  1353. $preferDist = true;
  1354. break;
  1355. case 'auto':
  1356. default:
  1357. break;
  1358. }
  1359. if ($input->getOption('prefer-source') || $input->getOption('prefer-dist') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'))) {
  1360. $preferSource = $input->getOption('prefer-source') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'));
  1361. $preferDist = $input->getOption('prefer-dist');
  1362. }
  1363. return array($preferSource, $preferDist);
  1364. }
  1365. }
  1366. <?php
  1367. namespace Composer\Command;
  1368. use Composer\DependencyResolver\Pool;
  1369. use Composer\Package\Link;
  1370. use Composer\Package\PackageInterface;
  1371. use Composer\Repository\ArrayRepository;
  1372. use Composer\Repository\CompositeRepository;
  1373. use Composer\Repository\PlatformRepository;
  1374. use Composer\Repository\RepositoryFactory;
  1375. use Composer\Plugin\CommandEvent;
  1376. use Composer\Plugin\PluginEvents;
  1377. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  1378. use Composer\Package\Version\VersionParser;
  1379. use Symfony\Component\Console\Helper\Table;
  1380. use Symfony\Component\Console\Input\InputArgument;
  1381. use Symfony\Component\Console\Input\InputInterface;
  1382. use Symfony\Component\Console\Input\InputOption;
  1383. use Symfony\Component\Console\Output\OutputInterface;
  1384. class BaseDependencyCommand extends BaseCommand
  1385. {
  1386. const ARGUMENT_PACKAGE = 'package';
  1387. const ARGUMENT_CONSTRAINT = 'constraint';
  1388. const OPTION_RECURSIVE = 'recursive';
  1389. const OPTION_TREE = 'tree';
  1390. protected $colors;
  1391. protected function configure()
  1392. {
  1393. $this->setDefinition(array(
  1394. new InputArgument(self::ARGUMENT_PACKAGE, InputArgument::REQUIRED, 'Package to inspect'),
  1395. new InputArgument(self::ARGUMENT_CONSTRAINT, InputArgument::OPTIONAL, 'Optional version constraint', '*'),
  1396. new InputOption(self::OPTION_RECURSIVE, 'r', InputOption::VALUE_NONE, 'Recursively resolves up to the root package'),
  1397. new InputOption(self::OPTION_TREE, 't', InputOption::VALUE_NONE, 'Prints the results as a nested tree'),
  1398. ));
  1399. }
  1400. protected function doExecute(InputInterface $input, OutputInterface $output, $inverted = false)
  1401. {
  1402. $composer = $this->getComposer();
  1403. $commandEvent = new CommandEvent(PluginEvents::COMMAND, $this->getName(), $input, $output);
  1404. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  1405. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  1406. $repository = new CompositeRepository(array(
  1407. new ArrayRepository(array($composer->getPackage())),
  1408. $composer->getRepositoryManager()->getLocalRepository(),
  1409. new PlatformRepository(array(), $platformOverrides),
  1410. ));
  1411. $pool = new Pool();
  1412. $pool->addRepository($repository);
  1413. list($needle, $textConstraint) = array_pad(
  1414. explode(':', $input->getArgument(self::ARGUMENT_PACKAGE)),
  1415. 2,
  1416. $input->getArgument(self::ARGUMENT_CONSTRAINT)
  1417. );
  1418. $packages = $pool->whatProvides(strtolower($needle));
  1419. if (empty($packages)) {
  1420. throw new \InvalidArgumentException(sprintf('Could not find package "%s" in your project', $needle));
  1421. }
  1422. if (!$repository->findPackage($needle, $textConstraint)) {
  1423. $defaultRepos = new CompositeRepository(RepositoryFactory::defaultRepos($this->getIO()));
  1424. if ($match = $defaultRepos->findPackage($needle, $textConstraint)) {
  1425. $repository->addRepository(new ArrayRepository(array(clone $match)));
  1426. }
  1427. }
  1428. $needles = array($needle);
  1429. if ($inverted) {
  1430. foreach ($packages as $package) {
  1431. $needles = array_merge($needles, array_map(function (Link $link) {
  1432. return $link->getTarget();
  1433. }, $package->getReplaces()));
  1434. }
  1435. }
  1436. if ('*' !== $textConstraint) {
  1437. $versionParser = new VersionParser();
  1438. $constraint = $versionParser->parseConstraints($textConstraint);
  1439. } else {
  1440. $constraint = null;
  1441. }
  1442. $renderTree = $input->getOption(self::OPTION_TREE);
  1443. $recursive = $renderTree || $input->getOption(self::OPTION_RECURSIVE);
  1444. $results = $repository->getDependents($needles, $constraint, $inverted, $recursive);
  1445. if (empty($results)) {
  1446. $extra = (null !== $constraint) ? sprintf(' in versions %smatching %s', $inverted ? 'not ' : '', $textConstraint) : '';
  1447. $this->getIO()->writeError(sprintf(
  1448. '<info>There is no installed package depending on "%s"%s</info>',
  1449. $needle,
  1450. $extra
  1451. ));
  1452. } elseif ($renderTree) {
  1453. $this->initStyles($output);
  1454. $root = $packages[0];
  1455. $this->getIO()->write(sprintf('<info>%s</info> %s %s', $root->getPrettyName(), $root->getPrettyVersion(), $root->getDescription()));
  1456. $this->printTree($results);
  1457. } else {
  1458. $this->printTable($output, $results);
  1459. }
  1460. return 0;
  1461. }
  1462. protected function printTable(OutputInterface $output, $results)
  1463. {
  1464. $table = array();
  1465. $doubles = array();
  1466. do {
  1467. $queue = array();
  1468. $rows = array();
  1469. foreach ($results as $result) {
  1470. list($package, $link, $children) = $result;
  1471. $unique = (string) $link;
  1472. if (isset($doubles[$unique])) {
  1473. continue;
  1474. }
  1475. $doubles[$unique] = true;
  1476. $version = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '-' : $package->getPrettyVersion();
  1477. $rows[] = array($package->getPrettyName(), $version, $link->getDescription(), sprintf('%s (%s)', $link->getTarget(), $link->getPrettyConstraint()));
  1478. if ($children) {
  1479. $queue = array_merge($queue, $children);
  1480. }
  1481. }
  1482. $results = $queue;
  1483. $table = array_merge($rows, $table);
  1484. } while (!empty($results));
  1485. $renderer = new Table($output);
  1486. $renderer->setStyle('compact');
  1487. $rendererStyle = $renderer->getStyle();
  1488. $rendererStyle->setVerticalBorderChar('');
  1489. $rendererStyle->setCellRowContentFormat('%s ');
  1490. $renderer->setRows($table)->render();
  1491. }
  1492. protected function initStyles(OutputInterface $output)
  1493. {
  1494. $this->colors = array(
  1495. 'green',
  1496. 'yellow',
  1497. 'cyan',
  1498. 'magenta',
  1499. 'blue',
  1500. );
  1501. foreach ($this->colors as $color) {
  1502. $style = new OutputFormatterStyle($color);
  1503. $output->getFormatter()->setStyle($color, $style);
  1504. }
  1505. }
  1506. protected function printTree($results, $prefix = '', $level = 1)
  1507. {
  1508. $count = count($results);
  1509. $idx = 0;
  1510. foreach ($results as $result) {
  1511. list($package, $link, $children) = $result;
  1512. $color = $this->colors[$level % count($this->colors)];
  1513. $prevColor = $this->colors[($level - 1) % count($this->colors)];
  1514. $isLast = (++$idx == $count);
  1515. $versionText = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '' : $package->getPrettyVersion();
  1516. $packageText = rtrim(sprintf('<%s>%s</%1$s> %s', $color, $package->getPrettyName(), $versionText));
  1517. $linkText = sprintf('%s <%s>%s</%2$s> %s', $link->getDescription(), $prevColor, $link->getTarget(), $link->getPrettyConstraint());
  1518. $circularWarn = $children === false ? '(circular dependency aborted here)' : '';
  1519. $this->writeTreeLine(rtrim(sprintf("%s%s%s (%s) %s", $prefix, $isLast ? '└──' : '├──', $packageText, $linkText, $circularWarn)));
  1520. if ($children) {
  1521. $this->printTree($children, $prefix . ($isLast ? ' ' : '│ '), $level + 1);
  1522. }
  1523. }
  1524. }
  1525. private function writeTreeLine($line)
  1526. {
  1527. $io = $this->getIO();
  1528. if (!$io->isDecorated()) {
  1529. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  1530. }
  1531. $io->write($line);
  1532. }
  1533. }
  1534. <?php
  1535. namespace Composer\Command;
  1536. use Composer\Package\Link;
  1537. use Composer\Package\PackageInterface;
  1538. use Composer\Semver\Constraint\Constraint;
  1539. use Symfony\Component\Console\Helper\Table;
  1540. use Symfony\Component\Console\Input\InputInterface;
  1541. use Symfony\Component\Console\Output\OutputInterface;
  1542. use Composer\Repository\PlatformRepository;
  1543. class CheckPlatformReqsCommand extends BaseCommand
  1544. {
  1545. protected function configure()
  1546. {
  1547. $this->setName('check-platform-reqs')
  1548. ->setDescription('Check that platform requirements are satisfied.')
  1549. ->setHelp(
  1550. <<<EOT
  1551. Checks that your PHP and extensions versions match the platform requirements of the installed packages.
  1552. <info>php composer.phar check-platform-reqs</info>
  1553. EOT
  1554. );
  1555. }
  1556. protected function execute(InputInterface $input, OutputInterface $output)
  1557. {
  1558. $composer = $this->getComposer();
  1559. $repos = $composer->getRepositoryManager()->getLocalRepository();
  1560. $allPackages = array_merge(array($composer->getPackage()), $repos->getPackages());
  1561. $requires = $composer->getPackage()->getDevRequires();
  1562. foreach ($requires as $require => $link) {
  1563. $requires[$require] = array($link);
  1564. }
  1565. foreach ($allPackages as $package) {
  1566. foreach ($package->getRequires() as $require => $link) {
  1567. $requires[$require][] = $link;
  1568. }
  1569. }
  1570. ksort($requires);
  1571. $platformRepo = new PlatformRepository(array(), array());
  1572. $currentPlatformPackages = $platformRepo->getPackages();
  1573. $currentPlatformPackageMap = array();
  1574. foreach ($currentPlatformPackages as $currentPlatformPackage) {
  1575. $currentPlatformPackageMap[$currentPlatformPackage->getName()] = $currentPlatformPackage;
  1576. }
  1577. $results = array();
  1578. $exitCode = 0;
  1579. foreach ($requires as $require => $links) {
  1580. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $require)) {
  1581. if (isset($currentPlatformPackageMap[$require])) {
  1582. $pass = true;
  1583. $version = $currentPlatformPackageMap[$require]->getVersion();
  1584. foreach ($links as $link) {
  1585. if (!$link->getConstraint()->matches(new Constraint('=', $version))) {
  1586. $results[] = array(
  1587. $currentPlatformPackageMap[$require]->getPrettyName(),
  1588. $currentPlatformPackageMap[$require]->getPrettyVersion(),
  1589. $link,
  1590. '<error>failed</error>',
  1591. );
  1592. $pass = false;
  1593. $exitCode = max($exitCode, 1);
  1594. }
  1595. }
  1596. if ($pass) {
  1597. $results[] = array(
  1598. $currentPlatformPackageMap[$require]->getPrettyName(),
  1599. $currentPlatformPackageMap[$require]->getPrettyVersion(),
  1600. null,
  1601. '<info>success</info>',
  1602. );
  1603. }
  1604. } else {
  1605. $results[] = array(
  1606. $require,
  1607. 'n/a',
  1608. $links[0],
  1609. '<error>missing</error>',
  1610. );
  1611. $exitCode = max($exitCode, 2);
  1612. }
  1613. }
  1614. }
  1615. $this->printTable($output, $results);
  1616. return $exitCode;
  1617. }
  1618. protected function printTable(OutputInterface $output, $results)
  1619. {
  1620. $table = array();
  1621. $rows = array();
  1622. foreach ($results as $result) {
  1623. list($platformPackage, $version, $link, $status) = $result;
  1624. $rows[] = array(
  1625. $platformPackage,
  1626. $version,
  1627. $link ? sprintf('%s %s %s (%s)', $link->getSource(), $link->getDescription(), $link->getTarget(), $link->getPrettyConstraint()) : '',
  1628. $status,
  1629. );
  1630. }
  1631. $table = array_merge($rows, $table);
  1632. $renderer = new Table($output);
  1633. $renderer->setStyle('compact');
  1634. $rendererStyle = $renderer->getStyle();
  1635. $rendererStyle->setVerticalBorderChar('');
  1636. $rendererStyle->setCellRowContentFormat('%s ');
  1637. $renderer->setRows($table)->render();
  1638. }
  1639. }
  1640. <?php
  1641. namespace Composer\Command;
  1642. use Composer\Cache;
  1643. use Composer\Factory;
  1644. use Symfony\Component\Console\Input\InputInterface;
  1645. use Symfony\Component\Console\Output\OutputInterface;
  1646. class ClearCacheCommand extends BaseCommand
  1647. {
  1648. protected function configure()
  1649. {
  1650. $this
  1651. ->setName('clear-cache')
  1652. ->setAliases(array('clearcache'))
  1653. ->setDescription('Clears composer\'s internal package cache.')
  1654. ->setHelp(
  1655. <<<EOT
  1656. The <info>clear-cache</info> deletes all cached packages from composer's
  1657. cache directory.
  1658. EOT
  1659. )
  1660. ;
  1661. }
  1662. protected function execute(InputInterface $input, OutputInterface $output)
  1663. {
  1664. $config = Factory::createConfig();
  1665. $io = $this->getIO();
  1666. $cachePaths = array(
  1667. 'cache-vcs-dir' => $config->get('cache-vcs-dir'),
  1668. 'cache-repo-dir' => $config->get('cache-repo-dir'),
  1669. 'cache-files-dir' => $config->get('cache-files-dir'),
  1670. 'cache-dir' => $config->get('cache-dir'),
  1671. );
  1672. foreach ($cachePaths as $key => $cachePath) {
  1673. $cachePath = realpath($cachePath);
  1674. if (!$cachePath) {
  1675. $io->writeError("<info>Cache directory does not exist ($key): $cachePath</info>");
  1676. continue;
  1677. }
  1678. $cache = new Cache($io, $cachePath);
  1679. if (!$cache->isEnabled()) {
  1680. $io->writeError("<info>Cache is not enabled ($key): $cachePath</info>");
  1681. continue;
  1682. }
  1683. $io->writeError("<info>Clearing cache ($key): $cachePath</info>");
  1684. $cache->clear();
  1685. }
  1686. $io->writeError('<info>All caches cleared.</info>');
  1687. }
  1688. }
  1689. <?php
  1690. namespace Composer\Command;
  1691. use Composer\Util\Platform;
  1692. use Composer\Util\Silencer;
  1693. use Symfony\Component\Console\Input\InputInterface;
  1694. use Symfony\Component\Console\Input\InputArgument;
  1695. use Symfony\Component\Console\Input\InputOption;
  1696. use Symfony\Component\Console\Output\OutputInterface;
  1697. use Composer\Config;
  1698. use Composer\Config\JsonConfigSource;
  1699. use Composer\Factory;
  1700. use Composer\Json\JsonFile;
  1701. use Composer\Semver\VersionParser;
  1702. use Composer\Package\BasePackage;
  1703. class ConfigCommand extends BaseCommand
  1704. {
  1705. protected $config;
  1706. protected $configFile;
  1707. protected $configSource;
  1708. protected $authConfigFile;
  1709. protected $authConfigSource;
  1710. protected function configure()
  1711. {
  1712. $this
  1713. ->setName('config')
  1714. ->setDescription('Sets config options.')
  1715. ->setDefinition(array(
  1716. new InputOption('global', 'g', InputOption::VALUE_NONE, 'Apply command to the global config file'),
  1717. new InputOption('editor', 'e', InputOption::VALUE_NONE, 'Open editor'),
  1718. new InputOption('auth', 'a', InputOption::VALUE_NONE, 'Affect auth config file (only used for --editor)'),
  1719. new InputOption('unset', null, InputOption::VALUE_NONE, 'Unset the given setting-key'),
  1720. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List configuration settings'),
  1721. new InputOption('file', 'f', InputOption::VALUE_REQUIRED, 'If you want to choose a different composer.json or config.json'),
  1722. new InputOption('absolute', null, InputOption::VALUE_NONE, 'Returns absolute paths when fetching *-dir config values instead of relative'),
  1723. new InputArgument('setting-key', null, 'Setting key'),
  1724. new InputArgument('setting-value', InputArgument::IS_ARRAY, 'Setting value'),
  1725. ))
  1726. ->setHelp(
  1727. <<<EOT
  1728. This command allows you to edit composer config settings and repositories
  1729. in either the local composer.json file or the global config.json file.
  1730. Additionally it lets you edit most properties in the local composer.json.
  1731. To set a config setting:
  1732. <comment>%command.full_name% bin-dir bin/</comment>
  1733. To read a config setting:
  1734. <comment>%command.full_name% bin-dir</comment>
  1735. Outputs: <info>bin</info>
  1736. To edit the global config.json file:
  1737. <comment>%command.full_name% --global</comment>
  1738. To add a repository:
  1739. <comment>%command.full_name% repositories.foo vcs https://bar.com</comment>
  1740. To remove a repository (repo is a short alias for repositories):
  1741. <comment>%command.full_name% --unset repo.foo</comment>
  1742. To disable packagist:
  1743. <comment>%command.full_name% repo.packagist false</comment>
  1744. You can alter repositories in the global config.json file by passing in the
  1745. <info>--global</info> option.
  1746. To edit the file in an external editor:
  1747. <comment>%command.full_name% --editor</comment>
  1748. To choose your editor you can set the "EDITOR" env variable.
  1749. To get a list of configuration values in the file:
  1750. <comment>%command.full_name% --list</comment>
  1751. You can always pass more than one option. As an example, if you want to edit the
  1752. global config.json file.
  1753. <comment>%command.full_name% --editor --global</comment>
  1754. EOT
  1755. )
  1756. ;
  1757. }
  1758. protected function initialize(InputInterface $input, OutputInterface $output)
  1759. {
  1760. parent::initialize($input, $output);
  1761. if ($input->getOption('global') && null !== $input->getOption('file')) {
  1762. throw new \RuntimeException('--file and --global can not be combined');
  1763. }
  1764. $io = $this->getIO();
  1765. $this->config = Factory::createConfig($io);
  1766. $configFile = $input->getOption('global')
  1767. ? ($this->config->get('home') . '/config.json')
  1768. : ($input->getOption('file') ?: Factory::getComposerFile());
  1769. if (
  1770. ($configFile === 'composer.json' || $configFile === './composer.json')
  1771. && !file_exists($configFile)
  1772. && realpath(getcwd()) === realpath($this->config->get('home'))
  1773. ) {
  1774. file_put_contents($configFile, "{\n}\n");
  1775. }
  1776. $this->configFile = new JsonFile($configFile, null, $io);
  1777. $this->configSource = new JsonConfigSource($this->configFile);
  1778. $authConfigFile = $input->getOption('global')
  1779. ? ($this->config->get('home') . '/auth.json')
  1780. : dirname(realpath($configFile)) . '/auth.json';
  1781. $this->authConfigFile = new JsonFile($authConfigFile, null, $io);
  1782. $this->authConfigSource = new JsonConfigSource($this->authConfigFile, true);
  1783. if ($input->getOption('global') && !$this->configFile->exists()) {
  1784. touch($this->configFile->getPath());
  1785. $this->configFile->write(array('config' => new \ArrayObject));
  1786. Silencer::call('chmod', $this->configFile->getPath(), 0600);
  1787. }
  1788. if ($input->getOption('global') && !$this->authConfigFile->exists()) {
  1789. touch($this->authConfigFile->getPath());
  1790. $this->authConfigFile->write(array('bitbucket-oauth' => new \ArrayObject, 'github-oauth' => new \ArrayObject, 'gitlab-oauth' => new \ArrayObject, 'gitlab-token' => new \ArrayObject, 'http-basic' => new \ArrayObject));
  1791. Silencer::call('chmod', $this->authConfigFile->getPath(), 0600);
  1792. }
  1793. if (!$this->configFile->exists()) {
  1794. throw new \RuntimeException(sprintf('File "%s" cannot be found in the current directory', $configFile));
  1795. }
  1796. }
  1797. protected function execute(InputInterface $input, OutputInterface $output)
  1798. {
  1799. if ($input->getOption('editor')) {
  1800. $editor = escapeshellcmd(getenv('EDITOR'));
  1801. if (!$editor) {
  1802. if (Platform::isWindows()) {
  1803. $editor = 'notepad';
  1804. } else {
  1805. foreach (array('editor', 'vim', 'vi', 'nano', 'pico', 'ed') as $candidate) {
  1806. if (exec('which '.$candidate)) {
  1807. $editor = $candidate;
  1808. break;
  1809. }
  1810. }
  1811. }
  1812. }
  1813. $file = $input->getOption('auth') ? $this->authConfigFile->getPath() : $this->configFile->getPath();
  1814. system($editor . ' ' . $file . (Platform::isWindows() ? '' : ' > `tty`'));
  1815. return 0;
  1816. }
  1817. if (!$input->getOption('global')) {
  1818. $this->config->merge($this->configFile->read());
  1819. $this->config->merge(array('config' => $this->authConfigFile->exists() ? $this->authConfigFile->read() : array()));
  1820. }
  1821. if ($input->getOption('list')) {
  1822. $this->listConfiguration($this->config->all(), $this->config->raw(), $output);
  1823. return 0;
  1824. }
  1825. $settingKey = $input->getArgument('setting-key');
  1826. if (!$settingKey) {
  1827. return 0;
  1828. }
  1829. if (array() !== $input->getArgument('setting-value') && $input->getOption('unset')) {
  1830. throw new \RuntimeException('You can not combine a setting value with --unset');
  1831. }
  1832. if (array() === $input->getArgument('setting-value') && !$input->getOption('unset')) {
  1833. $properties = array('name', 'type', 'description', 'homepage', 'version', 'minimum-stability', 'prefer-stable', 'keywords', 'license', 'extra');
  1834. $rawData = $this->configFile->read();
  1835. $data = $this->config->all();
  1836. if (preg_match('/^repos?(?:itories)?(?:\.(.+))?/', $settingKey, $matches)) {
  1837. if (!isset($matches[1]) || $matches[1] === '') {
  1838. $value = isset($data['repositories']) ? $data['repositories'] : array();
  1839. } else {
  1840. if (!isset($data['repositories'][$matches[1]])) {
  1841. throw new \InvalidArgumentException('There is no '.$matches[1].' repository defined');
  1842. }
  1843. $value = $data['repositories'][$matches[1]];
  1844. }
  1845. } elseif (strpos($settingKey, '.')) {
  1846. $bits = explode('.', $settingKey);
  1847. if ($bits[0] === 'extra') {
  1848. $data = $rawData;
  1849. } else {
  1850. $data = $data['config'];
  1851. }
  1852. $match = false;
  1853. foreach ($bits as $bit) {
  1854. $key = isset($key) ? $key.'.'.$bit : $bit;
  1855. $match = false;
  1856. if (isset($data[$key])) {
  1857. $match = true;
  1858. $data = $data[$key];
  1859. unset($key);
  1860. }
  1861. }
  1862. if (!$match) {
  1863. throw new \RuntimeException($settingKey.' is not defined.');
  1864. }
  1865. $value = $data;
  1866. } elseif (isset($data['config'][$settingKey])) {
  1867. $value = $this->config->get($settingKey, $input->getOption('absolute') ? 0 : Config::RELATIVE_PATHS);
  1868. } elseif (in_array($settingKey, $properties, true) && isset($rawData[$settingKey])) {
  1869. $value = $rawData[$settingKey];
  1870. } else {
  1871. throw new \RuntimeException($settingKey.' is not defined');
  1872. }
  1873. if (is_array($value)) {
  1874. $value = json_encode($value);
  1875. }
  1876. $this->getIO()->write($value);
  1877. return 0;
  1878. }
  1879. $values = $input->getArgument('setting-value');
  1880. $booleanValidator = function ($val) {
  1881. return in_array($val, array('true', 'false', '1', '0'), true);
  1882. };
  1883. $booleanNormalizer = function ($val) {
  1884. return $val !== 'false' && (bool) $val;
  1885. };
  1886. $uniqueConfigValues = array(
  1887. 'process-timeout' => array('is_numeric', 'intval'),
  1888. 'use-include-path' => array($booleanValidator, $booleanNormalizer),
  1889. 'preferred-install' => array(
  1890. function ($val) {
  1891. return in_array($val, array('auto', 'source', 'dist'), true);
  1892. },
  1893. function ($val) {
  1894. return $val;
  1895. },
  1896. ),
  1897. 'store-auths' => array(
  1898. function ($val) {
  1899. return in_array($val, array('true', 'false', 'prompt'), true);
  1900. },
  1901. function ($val) {
  1902. if ('prompt' === $val) {
  1903. return 'prompt';
  1904. }
  1905. return $val !== 'false' && (bool) $val;
  1906. },
  1907. ),
  1908. 'notify-on-install' => array($booleanValidator, $booleanNormalizer),
  1909. 'vendor-dir' => array('is_string', function ($val) {
  1910. return $val;
  1911. }),
  1912. 'bin-dir' => array('is_string', function ($val) {
  1913. return $val;
  1914. }),
  1915. 'archive-dir' => array('is_string', function ($val) {
  1916. return $val;
  1917. }),
  1918. 'archive-format' => array('is_string', function ($val) {
  1919. return $val;
  1920. }),
  1921. 'data-dir' => array('is_string', function ($val) {
  1922. return $val;
  1923. }),
  1924. 'cache-dir' => array('is_string', function ($val) {
  1925. return $val;
  1926. }),
  1927. 'cache-files-dir' => array('is_string', function ($val) {
  1928. return $val;
  1929. }),
  1930. 'cache-repo-dir' => array('is_string', function ($val) {
  1931. return $val;
  1932. }),
  1933. 'cache-vcs-dir' => array('is_string', function ($val) {
  1934. return $val;
  1935. }),
  1936. 'cache-ttl' => array('is_numeric', 'intval'),
  1937. 'cache-files-ttl' => array('is_numeric', 'intval'),
  1938. 'cache-files-maxsize' => array(
  1939. function ($val) {
  1940. return preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $val) > 0;
  1941. },
  1942. function ($val) {
  1943. return $val;
  1944. },
  1945. ),
  1946. 'bin-compat' => array(
  1947. function ($val) {
  1948. return in_array($val, array('auto', 'full'));
  1949. },
  1950. function ($val) {
  1951. return $val;
  1952. },
  1953. ),
  1954. 'discard-changes' => array(
  1955. function ($val) {
  1956. return in_array($val, array('stash', 'true', 'false', '1', '0'), true);
  1957. },
  1958. function ($val) {
  1959. if ('stash' === $val) {
  1960. return 'stash';
  1961. }
  1962. return $val !== 'false' && (bool) $val;
  1963. },
  1964. ),
  1965. 'autoloader-suffix' => array('is_string', function ($val) {
  1966. return $val === 'null' ? null : $val;
  1967. }),
  1968. 'sort-packages' => array($booleanValidator, $booleanNormalizer),
  1969. 'optimize-autoloader' => array($booleanValidator, $booleanNormalizer),
  1970. 'classmap-authoritative' => array($booleanValidator, $booleanNormalizer),
  1971. 'apcu-autoloader' => array($booleanValidator, $booleanNormalizer),
  1972. 'prepend-autoloader' => array($booleanValidator, $booleanNormalizer),
  1973. 'disable-tls' => array($booleanValidator, $booleanNormalizer),
  1974. 'secure-http' => array($booleanValidator, $booleanNormalizer),
  1975. 'cafile' => array(
  1976. function ($val) {
  1977. return file_exists($val) && is_readable($val);
  1978. },
  1979. function ($val) {
  1980. return $val === 'null' ? null : $val;
  1981. },
  1982. ),
  1983. 'capath' => array(
  1984. function ($val) {
  1985. return is_dir($val) && is_readable($val);
  1986. },
  1987. function ($val) {
  1988. return $val === 'null' ? null : $val;
  1989. },
  1990. ),
  1991. 'github-expose-hostname' => array($booleanValidator, $booleanNormalizer),
  1992. 'htaccess-protect' => array($booleanValidator, $booleanNormalizer),
  1993. );
  1994. $multiConfigValues = array(
  1995. 'github-protocols' => array(
  1996. function ($vals) {
  1997. if (!is_array($vals)) {
  1998. return 'array expected';
  1999. }
  2000. foreach ($vals as $val) {
  2001. if (!in_array($val, array('git', 'https', 'ssh'))) {
  2002. return 'valid protocols include: git, https, ssh';
  2003. }
  2004. }
  2005. return true;
  2006. },
  2007. function ($vals) {
  2008. return $vals;
  2009. },
  2010. ),
  2011. 'github-domains' => array(
  2012. function ($vals) {
  2013. if (!is_array($vals)) {
  2014. return 'array expected';
  2015. }
  2016. return true;
  2017. },
  2018. function ($vals) {
  2019. return $vals;
  2020. },
  2021. ),
  2022. 'gitlab-domains' => array(
  2023. function ($vals) {
  2024. if (!is_array($vals)) {
  2025. return 'array expected';
  2026. }
  2027. return true;
  2028. },
  2029. function ($vals) {
  2030. return $vals;
  2031. },
  2032. ),
  2033. );
  2034. if ($input->getOption('unset') && (isset($uniqueConfigValues[$settingKey]) || isset($multiConfigValues[$settingKey]))) {
  2035. return $this->configSource->removeConfigSetting($settingKey);
  2036. }
  2037. if (isset($uniqueConfigValues[$settingKey])) {
  2038. return $this->handleSingleValue($settingKey, $uniqueConfigValues[$settingKey], $values, 'addConfigSetting');
  2039. }
  2040. if (isset($multiConfigValues[$settingKey])) {
  2041. return $this->handleMultiValue($settingKey, $multiConfigValues[$settingKey], $values, 'addConfigSetting');
  2042. }
  2043. $uniqueProps = array(
  2044. 'name' => array('is_string', function ($val) {
  2045. return $val;
  2046. }),
  2047. 'type' => array('is_string', function ($val) {
  2048. return $val;
  2049. }),
  2050. 'description' => array('is_string', function ($val) {
  2051. return $val;
  2052. }),
  2053. 'homepage' => array('is_string', function ($val) {
  2054. return $val;
  2055. }),
  2056. 'version' => array('is_string', function ($val) {
  2057. return $val;
  2058. }),
  2059. 'minimum-stability' => array(
  2060. function ($val) {
  2061. return isset(BasePackage::$stabilities[VersionParser::normalizeStability($val)]);
  2062. },
  2063. function ($val) {
  2064. return VersionParser::normalizeStability($val);
  2065. },
  2066. ),
  2067. 'prefer-stable' => array($booleanValidator, $booleanNormalizer),
  2068. );
  2069. $multiProps = array(
  2070. 'keywords' => array(
  2071. function ($vals) {
  2072. if (!is_array($vals)) {
  2073. return 'array expected';
  2074. }
  2075. return true;
  2076. },
  2077. function ($vals) {
  2078. return $vals;
  2079. },
  2080. ),
  2081. 'license' => array(
  2082. function ($vals) {
  2083. if (!is_array($vals)) {
  2084. return 'array expected';
  2085. }
  2086. return true;
  2087. },
  2088. function ($vals) {
  2089. return $vals;
  2090. },
  2091. ),
  2092. );
  2093. if ($input->getOption('global') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]) || substr($settingKey, 0, 6) === 'extra.')) {
  2094. throw new \InvalidArgumentException('The '.$settingKey.' property can not be set in the global config.json file. Use `composer global config` to apply changes to the global composer.json');
  2095. }
  2096. if ($input->getOption('unset') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]))) {
  2097. return $this->configSource->removeProperty($settingKey);
  2098. }
  2099. if (isset($uniqueProps[$settingKey])) {
  2100. return $this->handleSingleValue($settingKey, $uniqueProps[$settingKey], $values, 'addProperty');
  2101. }
  2102. if (isset($multiProps[$settingKey])) {
  2103. return $this->handleMultiValue($settingKey, $multiProps[$settingKey], $values, 'addProperty');
  2104. }
  2105. if (preg_match('/^repos?(?:itories)?\.(.+)/', $settingKey, $matches)) {
  2106. if ($input->getOption('unset')) {
  2107. return $this->configSource->removeRepository($matches[1]);
  2108. }
  2109. if (2 === count($values)) {
  2110. return $this->configSource->addRepository($matches[1], array(
  2111. 'type' => $values[0],
  2112. 'url' => $values[1],
  2113. ));
  2114. }
  2115. if (1 === count($values)) {
  2116. $value = strtolower($values[0]);
  2117. if (true === $booleanValidator($value)) {
  2118. if (false === $booleanNormalizer($value)) {
  2119. return $this->configSource->addRepository($matches[1], false);
  2120. }
  2121. } else {
  2122. $value = JsonFile::parseJson($values[0]);
  2123. return $this->configSource->addRepository($matches[1], $value);
  2124. }
  2125. }
  2126. throw new \RuntimeException('You must pass the type and a url. Example: php composer.phar config repositories.foo vcs https://bar.com');
  2127. }
  2128. if (preg_match('/^extra\.(.+)/', $settingKey, $matches)) {
  2129. if ($input->getOption('unset')) {
  2130. return $this->configSource->removeProperty($settingKey);
  2131. }
  2132. return $this->configSource->addProperty($settingKey, $values[0]);
  2133. }
  2134. if (preg_match('/^platform\.(.+)/', $settingKey, $matches)) {
  2135. if ($input->getOption('unset')) {
  2136. return $this->configSource->removeConfigSetting($settingKey);
  2137. }
  2138. return $this->configSource->addConfigSetting($settingKey, $values[0]);
  2139. }
  2140. if ($settingKey === 'platform' && $input->getOption('unset')) {
  2141. return $this->configSource->removeConfigSetting($settingKey);
  2142. }
  2143. if (preg_match('/^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic)\.(.+)/', $settingKey, $matches)) {
  2144. if ($input->getOption('unset')) {
  2145. $this->authConfigSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2146. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2147. return;
  2148. }
  2149. if ($matches[1] === 'bitbucket-oauth') {
  2150. if (2 !== count($values)) {
  2151. throw new \RuntimeException('Expected two arguments (consumer-key, consumer-secret), got '.count($values));
  2152. }
  2153. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2154. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('consumer-key' => $values[0], 'consumer-secret' => $values[1]));
  2155. } elseif (in_array($matches[1], array('github-oauth', 'gitlab-oauth', 'gitlab-token'), true)) {
  2156. if (1 !== count($values)) {
  2157. throw new \RuntimeException('Too many arguments, expected only one token');
  2158. }
  2159. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2160. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], $values[0]);
  2161. } elseif ($matches[1] === 'http-basic') {
  2162. if (2 !== count($values)) {
  2163. throw new \RuntimeException('Expected two arguments (username, password), got '.count($values));
  2164. }
  2165. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2166. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('username' => $values[0], 'password' => $values[1]));
  2167. }
  2168. return;
  2169. }
  2170. if (preg_match('/^scripts\.(.+)/', $settingKey, $matches)) {
  2171. if ($input->getOption('unset')) {
  2172. return $this->configSource->removeProperty($settingKey);
  2173. }
  2174. return $this->configSource->addProperty($settingKey, count($values) > 1 ? $values : $values[0]);
  2175. }
  2176. throw new \InvalidArgumentException('Setting '.$settingKey.' does not exist or is not supported by this command');
  2177. }
  2178. protected function handleSingleValue($key, array $callbacks, array $values, $method)
  2179. {
  2180. list($validator, $normalizer) = $callbacks;
  2181. if (1 !== count($values)) {
  2182. throw new \RuntimeException('You can only pass one value. Example: php composer.phar config process-timeout 300');
  2183. }
  2184. if (true !== $validation = $validator($values[0])) {
  2185. throw new \RuntimeException(sprintf(
  2186. '"%s" is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  2187. $values[0]
  2188. ));
  2189. }
  2190. return call_user_func(array($this->configSource, $method), $key, $normalizer($values[0]));
  2191. }
  2192. protected function handleMultiValue($key, array $callbacks, array $values, $method)
  2193. {
  2194. list($validator, $normalizer) = $callbacks;
  2195. if (true !== $validation = $validator($values)) {
  2196. throw new \RuntimeException(sprintf(
  2197. '%s is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  2198. json_encode($values)
  2199. ));
  2200. }
  2201. return call_user_func(array($this->configSource, $method), $key, $normalizer($values));
  2202. }
  2203. protected function listConfiguration(array $contents, array $rawContents, OutputInterface $output, $k = null)
  2204. {
  2205. $origK = $k;
  2206. $io = $this->getIO();
  2207. foreach ($contents as $key => $value) {
  2208. if ($k === null && !in_array($key, array('config', 'repositories'))) {
  2209. continue;
  2210. }
  2211. $rawVal = isset($rawContents[$key]) ? $rawContents[$key] : null;
  2212. if (is_array($value) && (!is_numeric(key($value)) || ($key === 'repositories' && null === $k))) {
  2213. $k .= preg_replace('{^config\.}', '', $key . '.');
  2214. $this->listConfiguration($value, $rawVal, $output, $k);
  2215. $k = $origK;
  2216. continue;
  2217. }
  2218. if (is_array($value)) {
  2219. $value = array_map(function ($val) {
  2220. return is_array($val) ? json_encode($val) : $val;
  2221. }, $value);
  2222. $value = '['.implode(', ', $value).']';
  2223. }
  2224. if (is_bool($value)) {
  2225. $value = var_export($value, true);
  2226. }
  2227. if (is_string($rawVal) && $rawVal != $value) {
  2228. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $rawVal . ' (' . $value . ')</info>');
  2229. } else {
  2230. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $value . '</info>');
  2231. }
  2232. }
  2233. }
  2234. }
  2235. <?php
  2236. namespace Composer\Command;
  2237. use Composer\Config;
  2238. use Composer\Factory;
  2239. use Composer\Installer;
  2240. use Composer\Installer\ProjectInstaller;
  2241. use Composer\Installer\InstallationManager;
  2242. use Composer\Installer\SuggestedPackagesReporter;
  2243. use Composer\IO\IOInterface;
  2244. use Composer\Package\BasePackage;
  2245. use Composer\DependencyResolver\Pool;
  2246. use Composer\DependencyResolver\Operation\InstallOperation;
  2247. use Composer\Package\Version\VersionSelector;
  2248. use Composer\Package\AliasPackage;
  2249. use Composer\Repository\RepositoryFactory;
  2250. use Composer\Repository\CompositeRepository;
  2251. use Composer\Repository\PlatformRepository;
  2252. use Composer\Repository\InstalledFilesystemRepository;
  2253. use Composer\Script\ScriptEvents;
  2254. use Composer\Util\Silencer;
  2255. use Symfony\Component\Console\Input\InputArgument;
  2256. use Symfony\Component\Console\Input\InputInterface;
  2257. use Symfony\Component\Console\Input\InputOption;
  2258. use Symfony\Component\Console\Output\OutputInterface;
  2259. use Symfony\Component\Finder\Finder;
  2260. use Composer\Json\JsonFile;
  2261. use Composer\Config\JsonConfigSource;
  2262. use Composer\Util\Filesystem;
  2263. use Composer\Package\Version\VersionParser;
  2264. class CreateProjectCommand extends BaseCommand
  2265. {
  2266. protected $suggestedPackagesReporter;
  2267. protected function configure()
  2268. {
  2269. $this
  2270. ->setName('create-project')
  2271. ->setDescription('Creates new project from a package into given directory.')
  2272. ->setDefinition(array(
  2273. new InputArgument('package', InputArgument::OPTIONAL, 'Package name to be installed'),
  2274. new InputArgument('directory', InputArgument::OPTIONAL, 'Directory where the files should be created'),
  2275. new InputArgument('version', InputArgument::OPTIONAL, 'Version, will default to latest'),
  2276. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum-stability allowed (unless a version is specified).'),
  2277. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  2278. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  2279. new InputOption('repository', null, InputOption::VALUE_REQUIRED, 'Pick a different repository (as url or json config) to look for the package.'),
  2280. new InputOption('repository-url', null, InputOption::VALUE_REQUIRED, 'DEPRECATED: Use --repository instead.'),
  2281. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  2282. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  2283. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  2284. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Whether to prevent execution of all defined scripts in the root package.'),
  2285. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  2286. new InputOption('no-secure-http', null, InputOption::VALUE_NONE, 'Disable the secure-http config option temporarily while installing the root package. Use at your own risk. Using this flag is a bad idea.'),
  2287. new InputOption('keep-vcs', null, InputOption::VALUE_NONE, 'Whether to prevent deleting the vcs folder.'),
  2288. new InputOption('remove-vcs', null, InputOption::VALUE_NONE, 'Whether to force deletion of the vcs folder without prompting.'),
  2289. new InputOption('no-install', null, InputOption::VALUE_NONE, 'Whether to skip installation of the package dependencies.'),
  2290. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  2291. ))
  2292. ->setHelp(
  2293. <<<EOT
  2294. The <info>create-project</info> command creates a new project from a given
  2295. package into a new directory. If executed without params and in a directory
  2296. with a composer.json file it installs the packages for the current project.
  2297. You can use this command to bootstrap new projects or setup a clean
  2298. version-controlled installation for developers of your project.
  2299. <info>php composer.phar create-project vendor/project target-directory [version]</info>
  2300. You can also specify the version with the package name using = or : as separator.
  2301. <info>php composer.phar create-project vendor/project:version target-directory</info>
  2302. To install unstable packages, either specify the version you want, or use the
  2303. --stability=dev (where dev can be one of RC, beta, alpha or dev).
  2304. To setup a developer workable version you should create the project using the source
  2305. controlled code by appending the <info>'--prefer-source'</info> flag.
  2306. To install a package from another repository than the default one you
  2307. can pass the <info>'--repository=https://myrepository.org'</info> flag.
  2308. EOT
  2309. )
  2310. ;
  2311. }
  2312. protected function execute(InputInterface $input, OutputInterface $output)
  2313. {
  2314. $config = Factory::createConfig();
  2315. $io = $this->getIO();
  2316. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input, true);
  2317. if ($input->getOption('dev')) {
  2318. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  2319. }
  2320. if ($input->getOption('no-custom-installers')) {
  2321. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  2322. $input->setOption('no-plugins', true);
  2323. }
  2324. return $this->installProject(
  2325. $io,
  2326. $config,
  2327. $input,
  2328. $input->getArgument('package'),
  2329. $input->getArgument('directory'),
  2330. $input->getArgument('version'),
  2331. $input->getOption('stability'),
  2332. $preferSource,
  2333. $preferDist,
  2334. !$input->getOption('no-dev'),
  2335. $input->getOption('repository') ?: $input->getOption('repository-url'),
  2336. $input->getOption('no-plugins'),
  2337. $input->getOption('no-scripts'),
  2338. $input->getOption('no-progress'),
  2339. $input->getOption('no-install'),
  2340. $input->getOption('ignore-platform-reqs'),
  2341. !$input->getOption('no-secure-http')
  2342. );
  2343. }
  2344. public function installProject(IOInterface $io, Config $config, InputInterface $input, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repository = null, $disablePlugins = false, $noScripts = false, $noProgress = false, $noInstall = false, $ignorePlatformReqs = false, $secureHttp = true)
  2345. {
  2346. $oldCwd = getcwd();
  2347. $io->loadConfiguration($config);
  2348. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($io);
  2349. if ($packageName !== null) {
  2350. $installedFromVcs = $this->installRootPackage($io, $config, $packageName, $directory, $packageVersion, $stability, $preferSource, $preferDist, $installDevPackages, $repository, $disablePlugins, $noScripts, $noProgress, $ignorePlatformReqs, $secureHttp);
  2351. } else {
  2352. $installedFromVcs = false;
  2353. }
  2354. $composer = Factory::create($io, null, $disablePlugins);
  2355. $composer->getDownloadManager()->setOutputProgress(!$noProgress);
  2356. $fs = new Filesystem();
  2357. if ($noScripts === false) {
  2358. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ROOT_PACKAGE_INSTALL, $installDevPackages);
  2359. }
  2360. $config = $composer->getConfig();
  2361. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  2362. if ($noInstall === false) {
  2363. $installer = Installer::create($io, $composer);
  2364. $installer->setPreferSource($preferSource)
  2365. ->setPreferDist($preferDist)
  2366. ->setDevMode($installDevPackages)
  2367. ->setRunScripts(!$noScripts)
  2368. ->setIgnorePlatformRequirements($ignorePlatformReqs)
  2369. ->setSuggestedPackagesReporter($this->suggestedPackagesReporter)
  2370. ->setOptimizeAutoloader($config->get('optimize-autoloader'));
  2371. if ($disablePlugins) {
  2372. $installer->disablePlugins();
  2373. }
  2374. $status = $installer->run();
  2375. if (0 !== $status) {
  2376. return $status;
  2377. }
  2378. }
  2379. $hasVcs = $installedFromVcs;
  2380. if (
  2381. !$input->getOption('keep-vcs')
  2382. && $installedFromVcs
  2383. && (
  2384. $input->getOption('remove-vcs')
  2385. || !$io->isInteractive()
  2386. || $io->askConfirmation('<info>Do you want to remove the existing VCS (.git, .svn..) history?</info> [<comment>Y,n</comment>]? ', true)
  2387. )
  2388. ) {
  2389. $finder = new Finder();
  2390. $finder->depth(0)->directories()->in(getcwd())->ignoreVCS(false)->ignoreDotFiles(false);
  2391. foreach (array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg', '.fslckout', '_FOSSIL_') as $vcsName) {
  2392. $finder->name($vcsName);
  2393. }
  2394. try {
  2395. $dirs = iterator_to_array($finder);
  2396. unset($finder);
  2397. foreach ($dirs as $dir) {
  2398. if (!$fs->removeDirectory($dir)) {
  2399. throw new \RuntimeException('Could not remove '.$dir);
  2400. }
  2401. }
  2402. } catch (\Exception $e) {
  2403. $io->writeError('<error>An error occurred while removing the VCS metadata: '.$e->getMessage().'</error>');
  2404. }
  2405. $hasVcs = false;
  2406. }
  2407. if (!$hasVcs) {
  2408. $package = $composer->getPackage();
  2409. $configSource = new JsonConfigSource(new JsonFile('composer.json'));
  2410. foreach (BasePackage::$supportedLinkTypes as $type => $meta) {
  2411. foreach ($package->{'get'.$meta['method']}() as $link) {
  2412. if ($link->getPrettyConstraint() === 'self.version') {
  2413. $configSource->addLink($type, $link->getTarget(), $package->getPrettyVersion());
  2414. }
  2415. }
  2416. }
  2417. }
  2418. if ($noScripts === false) {
  2419. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_CREATE_PROJECT_CMD, $installDevPackages);
  2420. }
  2421. chdir($oldCwd);
  2422. $vendorComposerDir = $config->get('vendor-dir').'/composer';
  2423. if (is_dir($vendorComposerDir) && $fs->isDirEmpty($vendorComposerDir)) {
  2424. Silencer::call('rmdir', $vendorComposerDir);
  2425. $vendorDir = $config->get('vendor-dir');
  2426. if (is_dir($vendorDir) && $fs->isDirEmpty($vendorDir)) {
  2427. Silencer::call('rmdir', $vendorDir);
  2428. }
  2429. }
  2430. return 0;
  2431. }
  2432. protected function installRootPackage(IOInterface $io, Config $config, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repository = null, $disablePlugins = false, $noScripts = false, $noProgress = false, $ignorePlatformReqs = false, $secureHttp = true)
  2433. {
  2434. if (!$secureHttp) {
  2435. $config->merge(array('config' => array('secure-http' => false)));
  2436. }
  2437. if (null === $repository) {
  2438. $sourceRepo = new CompositeRepository(RepositoryFactory::defaultRepos($io, $config));
  2439. } else {
  2440. $sourceRepo = RepositoryFactory::fromString($io, $config, $repository, true);
  2441. }
  2442. $parser = new VersionParser();
  2443. $requirements = $parser->parseNameVersionPairs(array($packageName));
  2444. $name = strtolower($requirements[0]['name']);
  2445. if (!$packageVersion && isset($requirements[0]['version'])) {
  2446. $packageVersion = $requirements[0]['version'];
  2447. }
  2448. if (null === $stability) {
  2449. if (preg_match('{^[^,\s]*?@('.implode('|', array_keys(BasePackage::$stabilities)).')$}i', $packageVersion, $match)) {
  2450. $stability = $match[1];
  2451. } else {
  2452. $stability = VersionParser::parseStability($packageVersion);
  2453. }
  2454. }
  2455. $stability = VersionParser::normalizeStability($stability);
  2456. if (!isset(BasePackage::$stabilities[$stability])) {
  2457. throw new \InvalidArgumentException('Invalid stability provided ('.$stability.'), must be one of: '.implode(', ', array_keys(BasePackage::$stabilities)));
  2458. }
  2459. $pool = new Pool($stability);
  2460. $pool->addRepository($sourceRepo);
  2461. $phpVersion = null;
  2462. $prettyPhpVersion = null;
  2463. if (!$ignorePlatformReqs) {
  2464. $platformOverrides = $config->get('platform') ?: array();
  2465. $platform = new PlatformRepository(array(), $platformOverrides);
  2466. $phpPackage = $platform->findPackage('php', '*');
  2467. $phpVersion = $phpPackage->getVersion();
  2468. $prettyPhpVersion = $phpPackage->getPrettyVersion();
  2469. }
  2470. $versionSelector = new VersionSelector($pool);
  2471. $package = $versionSelector->findBestCandidate($name, $packageVersion, $phpVersion, $stability);
  2472. if (!$package) {
  2473. $errorMessage = "Could not find package $name with " . ($packageVersion ? "version $packageVersion" : "stability $stability");
  2474. if ($phpVersion && $versionSelector->findBestCandidate($name, $packageVersion, null, $stability)) {
  2475. throw new \InvalidArgumentException($errorMessage .' in a version installable using your PHP version '.$prettyPhpVersion.'.');
  2476. }
  2477. throw new \InvalidArgumentException($errorMessage .'.');
  2478. }
  2479. if (null === $directory) {
  2480. $parts = explode("/", $name, 2);
  2481. $directory = getcwd() . DIRECTORY_SEPARATOR . array_pop($parts);
  2482. }
  2483. if (function_exists('pcntl_async_signals')) {
  2484. @mkdir($directory, 0777, true);
  2485. if ($realDir = realpath($directory)) {
  2486. pcntl_async_signals(true);
  2487. pcntl_signal(SIGINT, function () use ($realDir) {
  2488. $fs = new Filesystem();
  2489. $fs->removeDirectory($realDir);
  2490. exit(130);
  2491. });
  2492. }
  2493. }
  2494. $io->writeError('<info>Installing ' . $package->getName() . ' (' . $package->getFullPrettyVersion(false) . ')</info>');
  2495. if ($disablePlugins) {
  2496. $io->writeError('<info>Plugins have been disabled.</info>');
  2497. }
  2498. if ($package instanceof AliasPackage) {
  2499. $package = $package->getAliasOf();
  2500. }
  2501. $dm = $this->createDownloadManager($io, $config);
  2502. $dm->setPreferSource($preferSource)
  2503. ->setPreferDist($preferDist)
  2504. ->setOutputProgress(!$noProgress);
  2505. $projectInstaller = new ProjectInstaller($directory, $dm);
  2506. $im = $this->createInstallationManager();
  2507. $im->addInstaller($projectInstaller);
  2508. $im->install(new InstalledFilesystemRepository(new JsonFile('php://memory')), new InstallOperation($package));
  2509. $im->notifyInstalls($io);
  2510. $this->suggestedPackagesReporter->addSuggestionsFromPackage($package);
  2511. $installedFromVcs = 'source' === $package->getInstallationSource();
  2512. $io->writeError('<info>Created project in ' . $directory . '</info>');
  2513. chdir($directory);
  2514. $_SERVER['COMPOSER_ROOT_VERSION'] = $package->getPrettyVersion();
  2515. putenv('COMPOSER_ROOT_VERSION='.$_SERVER['COMPOSER_ROOT_VERSION']);
  2516. return $installedFromVcs;
  2517. }
  2518. protected function createDownloadManager(IOInterface $io, Config $config)
  2519. {
  2520. $factory = new Factory();
  2521. return $factory->createDownloadManager($io, $config);
  2522. }
  2523. protected function createInstallationManager()
  2524. {
  2525. return new InstallationManager();
  2526. }
  2527. }
  2528. <?php
  2529. namespace Composer\Command;
  2530. use Symfony\Component\Console\Input\InputInterface;
  2531. use Symfony\Component\Console\Output\OutputInterface;
  2532. class DependsCommand extends BaseDependencyCommand
  2533. {
  2534. protected function configure()
  2535. {
  2536. parent::configure();
  2537. $this
  2538. ->setName('depends')
  2539. ->setAliases(array('why'))
  2540. ->setDescription('Shows which packages cause the given package to be installed.')
  2541. ->setHelp(
  2542. <<<EOT
  2543. Displays detailed information about where a package is referenced.
  2544. <info>php composer.phar depends composer/composer</info>
  2545. EOT
  2546. )
  2547. ;
  2548. }
  2549. protected function execute(InputInterface $input, OutputInterface $output)
  2550. {
  2551. return parent::doExecute($input, $output, false);
  2552. }
  2553. }
  2554. <?php
  2555. namespace Composer\Command;
  2556. use Composer\Composer;
  2557. use Composer\Factory;
  2558. use Composer\Config;
  2559. use Composer\Downloader\TransportException;
  2560. use Composer\Repository\PlatformRepository;
  2561. use Composer\Plugin\CommandEvent;
  2562. use Composer\Plugin\PluginEvents;
  2563. use Composer\Util\ConfigValidator;
  2564. use Composer\Util\IniHelper;
  2565. use Composer\Util\ProcessExecutor;
  2566. use Composer\Util\RemoteFilesystem;
  2567. use Composer\Util\StreamContextFactory;
  2568. use Composer\SelfUpdate\Keys;
  2569. use Composer\SelfUpdate\Versions;
  2570. use Composer\IO\NullIO;
  2571. use Symfony\Component\Console\Input\InputInterface;
  2572. use Symfony\Component\Console\Output\OutputInterface;
  2573. class DiagnoseCommand extends BaseCommand
  2574. {
  2575. protected $rfs;
  2576. protected $process;
  2577. protected $exitCode = 0;
  2578. protected function configure()
  2579. {
  2580. $this
  2581. ->setName('diagnose')
  2582. ->setDescription('Diagnoses the system to identify common errors.')
  2583. ->setHelp(
  2584. <<<EOT
  2585. The <info>diagnose</info> command checks common errors to help debugging problems.
  2586. The process exit code will be 1 in case of warnings and 2 for errors.
  2587. EOT
  2588. )
  2589. ;
  2590. }
  2591. protected function execute(InputInterface $input, OutputInterface $output)
  2592. {
  2593. $composer = $this->getComposer(false);
  2594. $io = $this->getIO();
  2595. if ($composer) {
  2596. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'diagnose', $input, $output);
  2597. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  2598. $io->write('Checking composer.json: ', false);
  2599. $this->outputResult($this->checkComposerSchema());
  2600. }
  2601. if ($composer) {
  2602. $config = $composer->getConfig();
  2603. } else {
  2604. $config = Factory::createConfig();
  2605. }
  2606. $config->merge(array('config' => array('secure-http' => false)));
  2607. $config->prohibitUrlByConfig('http://repo.packagist.org', new NullIO);
  2608. $this->rfs = Factory::createRemoteFilesystem($io, $config);
  2609. $this->process = new ProcessExecutor($io);
  2610. $io->write('Checking platform settings: ', false);
  2611. $this->outputResult($this->checkPlatform());
  2612. $io->write('Checking git settings: ', false);
  2613. $this->outputResult($this->checkGit());
  2614. $io->write('Checking http connectivity to packagist: ', false);
  2615. $this->outputResult($this->checkHttp('http', $config));
  2616. $io->write('Checking https connectivity to packagist: ', false);
  2617. $this->outputResult($this->checkHttp('https', $config));
  2618. $opts = stream_context_get_options(StreamContextFactory::getContext('http://example.org'));
  2619. if (!empty($opts['http']['proxy'])) {
  2620. $io->write('Checking HTTP proxy: ', false);
  2621. $this->outputResult($this->checkHttpProxy());
  2622. $io->write('Checking HTTP proxy support for request_fulluri: ', false);
  2623. $this->outputResult($this->checkHttpProxyFullUriRequestParam());
  2624. $io->write('Checking HTTPS proxy support for request_fulluri: ', false);
  2625. $this->outputResult($this->checkHttpsProxyFullUriRequestParam());
  2626. }
  2627. if ($oauth = $config->get('github-oauth')) {
  2628. foreach ($oauth as $domain => $token) {
  2629. $io->write('Checking '.$domain.' oauth access: ', false);
  2630. $this->outputResult($this->checkGithubOauth($domain, $token));
  2631. }
  2632. } else {
  2633. $io->write('Checking github.com rate limit: ', false);
  2634. try {
  2635. $rate = $this->getGithubRateLimit('github.com');
  2636. $this->outputResult(true);
  2637. if (10 > $rate['remaining']) {
  2638. $io->write('<warning>WARNING</warning>');
  2639. $io->write(sprintf(
  2640. '<comment>Github has a rate limit on their API. '
  2641. . 'You currently have <options=bold>%u</options=bold> '
  2642. . 'out of <options=bold>%u</options=bold> requests left.' . PHP_EOL
  2643. . 'See https://developer.github.com/v3/#rate-limiting and also' . PHP_EOL
  2644. . ' https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens</comment>',
  2645. $rate['remaining'],
  2646. $rate['limit']
  2647. ));
  2648. }
  2649. } catch (\Exception $e) {
  2650. if ($e instanceof TransportException && $e->getCode() === 401) {
  2651. $this->outputResult('<comment>The oauth token for github.com seems invalid, run "composer config --global --unset github-oauth.github.com" to remove it</comment>');
  2652. } else {
  2653. $this->outputResult($e);
  2654. }
  2655. }
  2656. }
  2657. $io->write('Checking disk free space: ', false);
  2658. $this->outputResult($this->checkDiskSpace($config));
  2659. if ('phar:' === substr(__FILE__, 0, 5)) {
  2660. $io->write('Checking pubkeys: ', false);
  2661. $this->outputResult($this->checkPubKeys($config));
  2662. $io->write('Checking composer version: ', false);
  2663. $this->outputResult($this->checkVersion($config));
  2664. }
  2665. $io->write(sprintf('Composer version: <comment>%s</comment>', Composer::VERSION));
  2666. $platformOverrides = $config->get('platform') ?: array();
  2667. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  2668. $phpPkg = $platformRepo->findPackage('php', '*');
  2669. $phpVersion = $phpPkg->getPrettyVersion();
  2670. if (false !== strpos($phpPkg->getDescription(), 'overridden')) {
  2671. $phpVersion .= ' - ' . $phpPkg->getDescription();
  2672. }
  2673. $io->write(sprintf('PHP version: <comment>%s</comment>', $phpVersion));
  2674. if (defined('PHP_BINARY')) {
  2675. $io->write(sprintf('PHP binary path: <comment>%s</comment>', PHP_BINARY));
  2676. }
  2677. return $this->exitCode;
  2678. }
  2679. private function checkComposerSchema()
  2680. {
  2681. $validator = new ConfigValidator($this->getIO());
  2682. list($errors, , $warnings) = $validator->validate(Factory::getComposerFile());
  2683. if ($errors || $warnings) {
  2684. $messages = array(
  2685. 'error' => $errors,
  2686. 'warning' => $warnings,
  2687. );
  2688. $output = '';
  2689. foreach ($messages as $style => $msgs) {
  2690. foreach ($msgs as $msg) {
  2691. $output .= '<' . $style . '>' . $msg . '</' . $style . '>' . PHP_EOL;
  2692. }
  2693. }
  2694. return rtrim($output);
  2695. }
  2696. return true;
  2697. }
  2698. private function checkGit()
  2699. {
  2700. $this->process->execute('git config color.ui', $output);
  2701. if (strtolower(trim($output)) === 'always') {
  2702. return '<comment>Your git color.ui setting is set to always, this is known to create issues. Use "git config --global color.ui true" to set it correctly.</comment>';
  2703. }
  2704. return true;
  2705. }
  2706. private function checkHttp($proto, Config $config)
  2707. {
  2708. $disableTls = false;
  2709. $result = array();
  2710. if ($proto === 'https' && $config->get('disable-tls') === true) {
  2711. $disableTls = true;
  2712. $result[] = '<warning>Composer is configured to disable SSL/TLS protection. This will leave remote HTTPS requests vulnerable to Man-In-The-Middle attacks.</warning>';
  2713. }
  2714. if ($proto === 'https' && !extension_loaded('openssl') && !$disableTls) {
  2715. $result[] = '<error>Composer is configured to use SSL/TLS protection but the openssl extension is not available.</error>';
  2716. }
  2717. try {
  2718. $this->rfs->getContents('packagist.org', $proto . '://repo.packagist.org/packages.json', false);
  2719. } catch (TransportException $e) {
  2720. if (false !== strpos($e->getMessage(), 'cafile')) {
  2721. $result[] = '<error>[' . get_class($e) . '] ' . $e->getMessage() . '</error>';
  2722. $result[] = '<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>';
  2723. $result[] = '<error>You can alternatively disable this error, at your own risk, by enabling the \'disable-tls\' option.</error>';
  2724. } else {
  2725. array_unshift($result, '[' . get_class($e) . '] ' . $e->getMessage());
  2726. }
  2727. }
  2728. if (count($result) > 0) {
  2729. return $result;
  2730. }
  2731. return true;
  2732. }
  2733. private function checkHttpProxy()
  2734. {
  2735. $protocol = extension_loaded('openssl') ? 'https' : 'http';
  2736. try {
  2737. $json = json_decode($this->rfs->getContents('packagist.org', $protocol . '://repo.packagist.org/packages.json', false), true);
  2738. $hash = reset($json['provider-includes']);
  2739. $hash = $hash['sha256'];
  2740. $path = str_replace('%hash%', $hash, key($json['provider-includes']));
  2741. $provider = $this->rfs->getContents('packagist.org', $protocol . '://repo.packagist.org/'.$path, false);
  2742. if (hash('sha256', $provider) !== $hash) {
  2743. return 'It seems that your proxy is modifying http traffic on the fly';
  2744. }
  2745. } catch (\Exception $e) {
  2746. return $e;
  2747. }
  2748. return true;
  2749. }
  2750. private function checkHttpProxyFullUriRequestParam()
  2751. {
  2752. $url = 'http://repo.packagist.org/packages.json';
  2753. try {
  2754. $this->rfs->getContents('packagist.org', $url, false);
  2755. } catch (TransportException $e) {
  2756. try {
  2757. $this->rfs->getContents('packagist.org', $url, false, array('http' => array('request_fulluri' => false)));
  2758. } catch (TransportException $e) {
  2759. return 'Unable to assess the situation, maybe packagist.org is down ('.$e->getMessage().')';
  2760. }
  2761. return 'It seems there is a problem with your proxy server, try setting the "HTTP_PROXY_REQUEST_FULLURI" and "HTTPS_PROXY_REQUEST_FULLURI" environment variables to "false"';
  2762. }
  2763. return true;
  2764. }
  2765. private function checkHttpsProxyFullUriRequestParam()
  2766. {
  2767. if (!extension_loaded('openssl')) {
  2768. return 'You need the openssl extension installed for this check';
  2769. }
  2770. $url = 'https://api.github.com/repos/Seldaek/jsonlint/zipball/1.0.0';
  2771. try {
  2772. $this->rfs->getContents('github.com', $url, false);
  2773. } catch (TransportException $e) {
  2774. try {
  2775. $this->rfs->getContents('github.com', $url, false, array('http' => array('request_fulluri' => false)));
  2776. } catch (TransportException $e) {
  2777. return 'Unable to assess the situation, maybe github is down ('.$e->getMessage().')';
  2778. }
  2779. return 'It seems there is a problem with your proxy server, try setting the "HTTPS_PROXY_REQUEST_FULLURI" environment variable to "false"';
  2780. }
  2781. return true;
  2782. }
  2783. private function checkGithubOauth($domain, $token)
  2784. {
  2785. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  2786. try {
  2787. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/' : 'https://'.$domain.'/api/v3/';
  2788. return $this->rfs->getContents($domain, $url, false, array(
  2789. 'retry-auth-failure' => false,
  2790. )) ? true : 'Unexpected error';
  2791. } catch (\Exception $e) {
  2792. if ($e instanceof TransportException && $e->getCode() === 401) {
  2793. return '<comment>The oauth token for '.$domain.' seems invalid, run "composer config --global --unset github-oauth.'.$domain.'" to remove it</comment>';
  2794. }
  2795. return $e;
  2796. }
  2797. }
  2798. private function getGithubRateLimit($domain, $token = null)
  2799. {
  2800. if ($token) {
  2801. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  2802. }
  2803. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/rate_limit' : 'https://'.$domain.'/api/rate_limit';
  2804. $json = $this->rfs->getContents($domain, $url, false, array('retry-auth-failure' => false));
  2805. $data = json_decode($json, true);
  2806. return $data['resources']['core'];
  2807. }
  2808. private function checkDiskSpace($config)
  2809. {
  2810. $minSpaceFree = 1024 * 1024;
  2811. if ((($df = @disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  2812. || (($df = @disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  2813. ) {
  2814. return '<error>The disk hosting '.$dir.' is full</error>';
  2815. }
  2816. return true;
  2817. }
  2818. private function checkPubKeys($config)
  2819. {
  2820. $home = $config->get('home');
  2821. $errors = array();
  2822. $io = $this->getIO();
  2823. if (file_exists($home.'/keys.tags.pub') && file_exists($home.'/keys.dev.pub')) {
  2824. $io->write('');
  2825. }
  2826. if (file_exists($home.'/keys.tags.pub')) {
  2827. $io->write('Tags Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.tags.pub'));
  2828. } else {
  2829. $errors[] = '<error>Missing pubkey for tags verification</error>';
  2830. }
  2831. if (file_exists($home.'/keys.dev.pub')) {
  2832. $io->write('Dev Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.dev.pub'));
  2833. } else {
  2834. $errors[] = '<error>Missing pubkey for dev verification</error>';
  2835. }
  2836. if ($errors) {
  2837. $errors[] = '<error>Run composer self-update --update-keys to set them up</error>';
  2838. }
  2839. return $errors ?: true;
  2840. }
  2841. private function checkVersion($config)
  2842. {
  2843. $versionsUtil = new Versions($config, $this->rfs);
  2844. $latest = $versionsUtil->getLatest();
  2845. if (Composer::VERSION !== $latest['version'] && Composer::VERSION !== '@package_version@') {
  2846. return '<comment>You are not running the latest '.$versionsUtil->getChannel().' version, run `composer self-update` to update ('.Composer::VERSION.' => '.$latest['version'].')</comment>';
  2847. }
  2848. return true;
  2849. }
  2850. private function outputResult($result)
  2851. {
  2852. $io = $this->getIO();
  2853. if (true === $result) {
  2854. $io->write('<info>OK</info>');
  2855. return;
  2856. }
  2857. $hadError = false;
  2858. if ($result instanceof \Exception) {
  2859. $result = '<error>['.get_class($result).'] '.$result->getMessage().'</error>';
  2860. }
  2861. if (!$result) {
  2862. $hadError = true;
  2863. } else {
  2864. if (!is_array($result)) {
  2865. $result = array($result);
  2866. }
  2867. foreach ($result as $message) {
  2868. if (false !== strpos($message, '<error>')) {
  2869. $hadError = true;
  2870. }
  2871. }
  2872. }
  2873. if ($hadError) {
  2874. $io->write('<error>FAIL</error>');
  2875. $this->exitCode = 2;
  2876. } else {
  2877. $io->write('<warning>WARNING</warning>');
  2878. $this->exitCode = 1;
  2879. }
  2880. if ($result) {
  2881. foreach ($result as $message) {
  2882. $io->write($message);
  2883. }
  2884. }
  2885. }
  2886. private function checkPlatform()
  2887. {
  2888. $output = '';
  2889. $out = function ($msg, $style) use (&$output) {
  2890. $output .= '<'.$style.'>'.$msg.'</'.$style.'>'.PHP_EOL;
  2891. };
  2892. $errors = array();
  2893. $warnings = array();
  2894. $displayIniMessage = false;
  2895. $iniMessage = PHP_EOL.PHP_EOL.IniHelper::getMessage();
  2896. $iniMessage .= PHP_EOL.'If you can not modify the ini file, you can also run `php -d option=value` to modify ini values on the fly. You can use -d multiple times.';
  2897. if (!function_exists('json_decode')) {
  2898. $errors['json'] = true;
  2899. }
  2900. if (!extension_loaded('Phar')) {
  2901. $errors['phar'] = true;
  2902. }
  2903. if (!extension_loaded('filter')) {
  2904. $errors['filter'] = true;
  2905. }
  2906. if (!extension_loaded('hash')) {
  2907. $errors['hash'] = true;
  2908. }
  2909. if (!extension_loaded('iconv') && !extension_loaded('mbstring')) {
  2910. $errors['iconv_mbstring'] = true;
  2911. }
  2912. if (!filter_var(ini_get('allow_url_fopen'), FILTER_VALIDATE_BOOLEAN)) {
  2913. $errors['allow_url_fopen'] = true;
  2914. }
  2915. if (extension_loaded('ionCube Loader') && ioncube_loader_iversion() < 40009) {
  2916. $errors['ioncube'] = ioncube_loader_version();
  2917. }
  2918. if (PHP_VERSION_ID < 50302) {
  2919. $errors['php'] = PHP_VERSION;
  2920. }
  2921. if (!isset($errors['php']) && PHP_VERSION_ID < 50304) {
  2922. $warnings['php'] = PHP_VERSION;
  2923. }
  2924. if (!extension_loaded('openssl')) {
  2925. $errors['openssl'] = true;
  2926. }
  2927. if (extension_loaded('openssl') && OPENSSL_VERSION_NUMBER < 0x1000100f) {
  2928. $warnings['openssl_version'] = true;
  2929. }
  2930. if (!defined('HHVM_VERSION') && !extension_loaded('apcu') && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) {
  2931. $warnings['apc_cli'] = true;
  2932. }
  2933. if (!extension_loaded('zlib')) {
  2934. $warnings['zlib'] = true;
  2935. }
  2936. ob_start();
  2937. phpinfo(INFO_GENERAL);
  2938. $phpinfo = ob_get_clean();
  2939. if (preg_match('{Configure Command(?: *</td><td class="v">| *=> *)(.*?)(?:</td>|$)}m', $phpinfo, $match)) {
  2940. $configure = $match[1];
  2941. if (false !== strpos($configure, '--enable-sigchild')) {
  2942. $warnings['sigchild'] = true;
  2943. }
  2944. if (false !== strpos($configure, '--with-curlwrappers')) {
  2945. $warnings['curlwrappers'] = true;
  2946. }
  2947. }
  2948. if (filter_var(ini_get('xdebug.profiler_enabled'), FILTER_VALIDATE_BOOLEAN)) {
  2949. $warnings['xdebug_profile'] = true;
  2950. } elseif (extension_loaded('xdebug')) {
  2951. $warnings['xdebug_loaded'] = true;
  2952. }
  2953. if (!empty($errors)) {
  2954. foreach ($errors as $error => $current) {
  2955. switch ($error) {
  2956. case 'json':
  2957. $text = PHP_EOL."The json extension is missing.".PHP_EOL;
  2958. $text .= "Install it or recompile php without --disable-json";
  2959. break;
  2960. case 'phar':
  2961. $text = PHP_EOL."The phar extension is missing.".PHP_EOL;
  2962. $text .= "Install it or recompile php without --disable-phar";
  2963. break;
  2964. case 'filter':
  2965. $text = PHP_EOL."The filter extension is missing.".PHP_EOL;
  2966. $text .= "Install it or recompile php without --disable-filter";
  2967. break;
  2968. case 'hash':
  2969. $text = PHP_EOL."The hash extension is missing.".PHP_EOL;
  2970. $text .= "Install it or recompile php without --disable-hash";
  2971. break;
  2972. case 'iconv_mbstring':
  2973. $text = PHP_EOL."The iconv OR mbstring extension is required and both are missing.".PHP_EOL;
  2974. $text .= "Install either of them or recompile php without --disable-iconv";
  2975. break;
  2976. case 'unicode':
  2977. $text = PHP_EOL."The detect_unicode setting must be disabled.".PHP_EOL;
  2978. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  2979. $text .= " detect_unicode = Off";
  2980. $displayIniMessage = true;
  2981. break;
  2982. case 'suhosin':
  2983. $text = PHP_EOL."The suhosin.executor.include.whitelist setting is incorrect.".PHP_EOL;
  2984. $text .= "Add the following to the end of your `php.ini` or suhosin.ini (Example path [for Debian]: /etc/php5/cli/conf.d/suhosin.ini):".PHP_EOL;
  2985. $text .= " suhosin.executor.include.whitelist = phar ".$current;
  2986. $displayIniMessage = true;
  2987. break;
  2988. case 'php':
  2989. $text = PHP_EOL."Your PHP ({$current}) is too old, you must upgrade to PHP 5.3.2 or higher.";
  2990. break;
  2991. case 'allow_url_fopen':
  2992. $text = PHP_EOL."The allow_url_fopen setting is incorrect.".PHP_EOL;
  2993. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  2994. $text .= " allow_url_fopen = On";
  2995. $displayIniMessage = true;
  2996. break;
  2997. case 'ioncube':
  2998. $text = PHP_EOL."Your ionCube Loader extension ($current) is incompatible with Phar files.".PHP_EOL;
  2999. $text .= "Upgrade to ionCube 4.0.9 or higher or remove this line (path may be different) from your `php.ini` to disable it:".PHP_EOL;
  3000. $text .= " zend_extension = /usr/lib/php5/20090626+lfs/ioncube_loader_lin_5.3.so";
  3001. $displayIniMessage = true;
  3002. break;
  3003. case 'openssl':
  3004. $text = PHP_EOL."The openssl extension is missing, which means that secure HTTPS transfers are impossible.".PHP_EOL;
  3005. $text .= "If possible you should enable it or recompile php with --with-openssl";
  3006. break;
  3007. }
  3008. $out($text, 'error');
  3009. }
  3010. $output .= PHP_EOL;
  3011. }
  3012. if (!empty($warnings)) {
  3013. foreach ($warnings as $warning => $current) {
  3014. switch ($warning) {
  3015. case 'apc_cli':
  3016. $text = "The apc.enable_cli setting is incorrect.".PHP_EOL;
  3017. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  3018. $text .= " apc.enable_cli = Off";
  3019. $displayIniMessage = true;
  3020. break;
  3021. case 'zlib':
  3022. $text = 'The zlib extension is not loaded, this can slow down Composer a lot.'.PHP_EOL;
  3023. $text .= 'If possible, enable it or recompile php with --with-zlib'.PHP_EOL;
  3024. $displayIniMessage = true;
  3025. break;
  3026. case 'sigchild':
  3027. $text = "PHP was compiled with --enable-sigchild which can cause issues on some platforms.".PHP_EOL;
  3028. $text .= "Recompile it without this flag if possible, see also:".PHP_EOL;
  3029. $text .= " https://bugs.php.net/bug.php?id=22999";
  3030. break;
  3031. case 'curlwrappers':
  3032. $text = "PHP was compiled with --with-curlwrappers which will cause issues with HTTP authentication and GitHub.".PHP_EOL;
  3033. $text .= " Recompile it without this flag if possible";
  3034. break;
  3035. case 'php':
  3036. $text = "Your PHP ({$current}) is quite old, upgrading to PHP 5.3.4 or higher is recommended.".PHP_EOL;
  3037. $text .= " Composer works with 5.3.2+ for most people, but there might be edge case issues.";
  3038. break;
  3039. case 'openssl_version':
  3040. $opensslVersion = strstr(trim(strstr(OPENSSL_VERSION_TEXT, ' ')), ' ', true);
  3041. $opensslVersion = $opensslVersion ?: OPENSSL_VERSION_TEXT;
  3042. $text = "The OpenSSL library ({$opensslVersion}) used by PHP does not support TLSv1.2 or TLSv1.1.".PHP_EOL;
  3043. $text .= "If possible you should upgrade OpenSSL to version 1.0.1 or above.";
  3044. break;
  3045. case 'xdebug_loaded':
  3046. $text = "The xdebug extension is loaded, this can slow down Composer a little.".PHP_EOL;
  3047. $text .= " Disabling it when using Composer is recommended.";
  3048. break;
  3049. case 'xdebug_profile':
  3050. $text = "The xdebug.profiler_enabled setting is enabled, this can slow down Composer a lot.".PHP_EOL;
  3051. $text .= "Add the following to the end of your `php.ini` to disable it:".PHP_EOL;
  3052. $text .= " xdebug.profiler_enabled = 0";
  3053. $displayIniMessage = true;
  3054. break;
  3055. }
  3056. $out($text, 'comment');
  3057. }
  3058. }
  3059. if ($displayIniMessage) {
  3060. $out($iniMessage, 'comment');
  3061. }
  3062. return !$warnings && !$errors ? true : $output;
  3063. }
  3064. }
  3065. <?php
  3066. namespace Composer\Command;
  3067. use Composer\Plugin\CommandEvent;
  3068. use Composer\Plugin\PluginEvents;
  3069. use Symfony\Component\Console\Input\InputInterface;
  3070. use Symfony\Component\Console\Input\InputOption;
  3071. use Symfony\Component\Console\Output\OutputInterface;
  3072. class DumpAutoloadCommand extends BaseCommand
  3073. {
  3074. protected function configure()
  3075. {
  3076. $this
  3077. ->setName('dump-autoload')
  3078. ->setAliases(array('dumpautoload'))
  3079. ->setDescription('Dumps the autoloader.')
  3080. ->setDefinition(array(
  3081. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  3082. new InputOption('optimize', 'o', InputOption::VALUE_NONE, 'Optimizes PSR0 and PSR4 packages to be loaded with classmaps too, good for production.'),
  3083. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize`.'),
  3084. new InputOption('apcu', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  3085. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables autoload-dev rules.'),
  3086. ))
  3087. ->setHelp(
  3088. <<<EOT
  3089. <info>php composer.phar dump-autoload</info>
  3090. EOT
  3091. )
  3092. ;
  3093. }
  3094. protected function execute(InputInterface $input, OutputInterface $output)
  3095. {
  3096. $composer = $this->getComposer();
  3097. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'dump-autoload', $input, $output);
  3098. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3099. $installationManager = $composer->getInstallationManager();
  3100. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  3101. $package = $composer->getPackage();
  3102. $config = $composer->getConfig();
  3103. $optimize = $input->getOption('optimize') || $config->get('optimize-autoloader');
  3104. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  3105. $apcu = $input->getOption('apcu') || $config->get('apcu-autoloader');
  3106. if ($authoritative) {
  3107. $this->getIO()->writeError('<info>Generating optimized autoload files (authoritative)</info>');
  3108. } elseif ($optimize) {
  3109. $this->getIO()->writeError('<info>Generating optimized autoload files</info>');
  3110. } else {
  3111. $this->getIO()->writeError('<info>Generating autoload files</info>');
  3112. }
  3113. $generator = $composer->getAutoloadGenerator();
  3114. $generator->setDevMode(!$input->getOption('no-dev'));
  3115. $generator->setClassMapAuthoritative($authoritative);
  3116. $generator->setApcu($apcu);
  3117. $generator->setRunScripts(!$input->getOption('no-scripts'));
  3118. $generator->dump($config, $localRepo, $package, $installationManager, 'composer', $optimize);
  3119. }
  3120. }
  3121. <?php
  3122. namespace Composer\Command;
  3123. use Symfony\Component\Console\Input\InputInterface;
  3124. use Symfony\Component\Console\Input\InputOption;
  3125. use Symfony\Component\Console\Output\OutputInterface;
  3126. use Symfony\Component\Console\Input\InputArgument;
  3127. class ExecCommand extends BaseCommand
  3128. {
  3129. protected function configure()
  3130. {
  3131. $this
  3132. ->setName('exec')
  3133. ->setDescription('Executes a vendored binary/script.')
  3134. ->setDefinition(array(
  3135. new InputOption('list', 'l', InputOption::VALUE_NONE),
  3136. new InputArgument('binary', InputArgument::OPTIONAL, 'The binary to run, e.g. phpunit'),
  3137. new InputArgument(
  3138. 'args',
  3139. InputArgument::IS_ARRAY | InputArgument::OPTIONAL,
  3140. 'Arguments to pass to the binary. Use <info>--</info> to separate from composer arguments'
  3141. ),
  3142. ))
  3143. ;
  3144. }
  3145. protected function execute(InputInterface $input, OutputInterface $output)
  3146. {
  3147. $composer = $this->getComposer();
  3148. $binDir = $composer->getConfig()->get('bin-dir');
  3149. if ($input->getOption('list') || !$input->getArgument('binary')) {
  3150. $bins = glob($binDir . '/*');
  3151. $bins = array_merge($bins, array_map(function ($e) {
  3152. return "$e (local)";
  3153. }, $composer->getPackage()->getBinaries()));
  3154. if (!$bins) {
  3155. throw new \RuntimeException("No binaries found in composer.json or in bin-dir ($binDir)");
  3156. }
  3157. $this->getIO()->write(
  3158. <<<EOT
  3159. <comment>Available binaries:</comment>
  3160. EOT
  3161. );
  3162. foreach ($bins as $bin) {
  3163. if (isset($previousBin) && $bin === $previousBin.'.bat') {
  3164. continue;
  3165. }
  3166. $previousBin = $bin;
  3167. $bin = basename($bin);
  3168. $this->getIO()->write(
  3169. <<<EOT
  3170. <info>- $bin</info>
  3171. EOT
  3172. );
  3173. }
  3174. return 0;
  3175. }
  3176. $binary = $input->getArgument('binary');
  3177. $dispatcher = $composer->getEventDispatcher();
  3178. $dispatcher->addListener('__exec_command', $binary);
  3179. if ($output->getVerbosity() === OutputInterface::VERBOSITY_NORMAL) {
  3180. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  3181. }
  3182. return $dispatcher->dispatchScript('__exec_command', true, $input->getArgument('args'));
  3183. }
  3184. }
  3185. <?php
  3186. namespace Composer\Command;
  3187. use Composer\Factory;
  3188. use Composer\Util\Filesystem;
  3189. use Symfony\Component\Console\Input\InputInterface;
  3190. use Symfony\Component\Console\Input\InputArgument;
  3191. use Symfony\Component\Console\Input\StringInput;
  3192. use Symfony\Component\Console\Output\OutputInterface;
  3193. class GlobalCommand extends BaseCommand
  3194. {
  3195. protected function configure()
  3196. {
  3197. $this
  3198. ->setName('global')
  3199. ->setDescription('Allows running commands in the global composer dir ($COMPOSER_HOME).')
  3200. ->setDefinition(array(
  3201. new InputArgument('command-name', InputArgument::REQUIRED, ''),
  3202. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  3203. ))
  3204. ->setHelp(
  3205. <<<EOT
  3206. Use this command as a wrapper to run other Composer commands
  3207. within the global context of COMPOSER_HOME.
  3208. You can use this to install CLI utilities globally, all you need
  3209. is to add the COMPOSER_HOME/vendor/bin dir to your PATH env var.
  3210. COMPOSER_HOME is c:\Users\<user>\AppData\Roaming\Composer on Windows
  3211. and /home/<user>/.composer on unix systems.
  3212. If your system uses freedesktop.org standards, then it will first check
  3213. XDG_CONFIG_HOME or default to /home/<user>/.config/composer
  3214. Note: This path may vary depending on customizations to bin-dir in
  3215. composer.json or the environmental variable COMPOSER_BIN_DIR.
  3216. EOT
  3217. )
  3218. ;
  3219. }
  3220. public function run(InputInterface $input, OutputInterface $output)
  3221. {
  3222. $tokens = preg_split('{\s+}', $input->__toString());
  3223. $args = array();
  3224. foreach ($tokens as $token) {
  3225. if ($token && $token[0] !== '-') {
  3226. $args[] = $token;
  3227. if (count($args) >= 2) {
  3228. break;
  3229. }
  3230. }
  3231. }
  3232. if (count($args) < 2) {
  3233. return parent::run($input, $output);
  3234. }
  3235. $config = Factory::createConfig();
  3236. $home = $config->get('home');
  3237. if (!is_dir($home)) {
  3238. $fs = new Filesystem();
  3239. $fs->ensureDirectoryExists($home);
  3240. if (!is_dir($home)) {
  3241. throw new \RuntimeException('Could not create home directory');
  3242. }
  3243. }
  3244. try {
  3245. chdir($home);
  3246. } catch (\Exception $e) {
  3247. throw new \RuntimeException('Could not switch to home directory "'.$home.'"', 0, $e);
  3248. }
  3249. $this->getIO()->writeError('<info>Changed current directory to '.$home.'</info>');
  3250. $input = new StringInput(preg_replace('{\bg(?:l(?:o(?:b(?:a(?:l)?)?)?)?)?\b}', '', $input->__toString(), 1));
  3251. $this->getApplication()->resetComposer();
  3252. return $this->getApplication()->run($input, $output);
  3253. }
  3254. public function isProxyCommand()
  3255. {
  3256. return true;
  3257. }
  3258. }
  3259. <?php
  3260. namespace Composer\Command;
  3261. use Composer\Package\CompletePackageInterface;
  3262. use Composer\Repository\RepositoryInterface;
  3263. use Composer\Repository\ArrayRepository;
  3264. use Composer\Repository\RepositoryFactory;
  3265. use Composer\Util\Platform;
  3266. use Composer\Util\ProcessExecutor;
  3267. use Symfony\Component\Console\Input\InputArgument;
  3268. use Symfony\Component\Console\Input\InputOption;
  3269. use Symfony\Component\Console\Input\InputInterface;
  3270. use Symfony\Component\Console\Output\OutputInterface;
  3271. class HomeCommand extends BaseCommand
  3272. {
  3273. protected function configure()
  3274. {
  3275. $this
  3276. ->setName('browse')
  3277. ->setAliases(array('home'))
  3278. ->setDescription('Opens the package\'s repository URL or homepage in your browser.')
  3279. ->setDefinition(array(
  3280. new InputArgument('packages', InputArgument::IS_ARRAY, 'Package(s) to browse to.'),
  3281. new InputOption('homepage', 'H', InputOption::VALUE_NONE, 'Open the homepage instead of the repository URL.'),
  3282. new InputOption('show', 's', InputOption::VALUE_NONE, 'Only show the homepage or repository URL.'),
  3283. ))
  3284. ->setHelp(
  3285. <<<EOT
  3286. The home command opens or shows a package's repository URL or
  3287. homepage in your default browser.
  3288. To open the homepage by default, use -H or --homepage.
  3289. To show instead of open the repository or homepage URL, use -s or --show.
  3290. EOT
  3291. );
  3292. }
  3293. protected function execute(InputInterface $input, OutputInterface $output)
  3294. {
  3295. $repos = $this->initializeRepos();
  3296. $io = $this->getIO();
  3297. $return = 0;
  3298. $packages = $input->getArgument('packages');
  3299. if (!$packages) {
  3300. $io->writeError('No package specified, opening homepage for the root package');
  3301. $packages = array($this->getComposer()->getPackage()->getName());
  3302. }
  3303. foreach ($packages as $packageName) {
  3304. $handled = false;
  3305. $packageExists = false;
  3306. foreach ($repos as $repo) {
  3307. foreach ($repo->findPackages($packageName) as $package) {
  3308. $packageExists = true;
  3309. if ($package instanceof CompletePackageInterface && $this->handlePackage($package, $input->getOption('homepage'), $input->getOption('show'))) {
  3310. $handled = true;
  3311. break 2;
  3312. }
  3313. }
  3314. }
  3315. if (!$packageExists) {
  3316. $return = 1;
  3317. $io->writeError('<warning>Package '.$packageName.' not found</warning>');
  3318. }
  3319. if (!$handled) {
  3320. $return = 1;
  3321. $io->writeError('<warning>'.($input->getOption('homepage') ? 'Invalid or missing homepage' : 'Invalid or missing repository URL').' for '.$packageName.'</warning>');
  3322. }
  3323. }
  3324. return $return;
  3325. }
  3326. private function handlePackage(CompletePackageInterface $package, $showHomepage, $showOnly)
  3327. {
  3328. $support = $package->getSupport();
  3329. $url = isset($support['source']) ? $support['source'] : $package->getSourceUrl();
  3330. if (!$url || $showHomepage) {
  3331. $url = $package->getHomepage();
  3332. }
  3333. if (!$url || !filter_var($url, FILTER_VALIDATE_URL)) {
  3334. return false;
  3335. }
  3336. if ($showOnly) {
  3337. $this->getIO()->write(sprintf('<info>%s</info>', $url));
  3338. } else {
  3339. $this->openBrowser($url);
  3340. }
  3341. return true;
  3342. }
  3343. private function openBrowser($url)
  3344. {
  3345. $url = ProcessExecutor::escape($url);
  3346. $process = new ProcessExecutor($this->getIO());
  3347. if (Platform::isWindows()) {
  3348. return $process->execute('start "web" explorer "' . $url . '"', $output);
  3349. }
  3350. $linux = $process->execute('which xdg-open', $output);
  3351. $osx = $process->execute('which open', $output);
  3352. if (0 === $linux) {
  3353. $process->execute('xdg-open ' . $url, $output);
  3354. } elseif (0 === $osx) {
  3355. $process->execute('open ' . $url, $output);
  3356. } else {
  3357. $this->getIO()->writeError('No suitable browser opening command found, open yourself: ' . $url);
  3358. }
  3359. }
  3360. private function initializeRepos()
  3361. {
  3362. $composer = $this->getComposer(false);
  3363. if ($composer) {
  3364. return array_merge(
  3365. array(new ArrayRepository(array($composer->getPackage()))),
  3366. array($composer->getRepositoryManager()->getLocalRepository()),
  3367. $composer->getRepositoryManager()->getRepositories()
  3368. );
  3369. }
  3370. return RepositoryFactory::defaultRepos($this->getIO());
  3371. }
  3372. }
  3373. <?php
  3374. namespace Composer\Command;
  3375. use Composer\DependencyResolver\Pool;
  3376. use Composer\Factory;
  3377. use Composer\Json\JsonFile;
  3378. use Composer\Package\BasePackage;
  3379. use Composer\Package\Version\VersionParser;
  3380. use Composer\Package\Version\VersionSelector;
  3381. use Composer\Repository\CompositeRepository;
  3382. use Composer\Repository\PlatformRepository;
  3383. use Composer\Repository\RepositoryFactory;
  3384. use Composer\Util\ProcessExecutor;
  3385. use Symfony\Component\Console\Input\InputInterface;
  3386. use Symfony\Component\Console\Input\InputOption;
  3387. use Symfony\Component\Console\Output\OutputInterface;
  3388. use Symfony\Component\Process\ExecutableFinder;
  3389. use Symfony\Component\Process\Process;
  3390. class InitCommand extends BaseCommand
  3391. {
  3392. protected $repos;
  3393. private $gitConfig;
  3394. private $pools;
  3395. protected function configure()
  3396. {
  3397. $this
  3398. ->setName('init')
  3399. ->setDescription('Creates a basic composer.json file in current directory.')
  3400. ->setDefinition(array(
  3401. new InputOption('name', null, InputOption::VALUE_REQUIRED, 'Name of the package'),
  3402. new InputOption('description', null, InputOption::VALUE_REQUIRED, 'Description of package'),
  3403. new InputOption('author', null, InputOption::VALUE_REQUIRED, 'Author name of package'),
  3404. new InputOption('type', null, InputOption::VALUE_OPTIONAL, 'Type of package (e.g. library, project, metapackage, composer-plugin)'),
  3405. new InputOption('homepage', null, InputOption::VALUE_REQUIRED, 'Homepage of package'),
  3406. new InputOption('require', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Package to require with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
  3407. new InputOption('require-dev', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Package to require for development with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
  3408. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum stability (empty or one of: '.implode(', ', array_keys(BasePackage::$stabilities)).')'),
  3409. new InputOption('license', 'l', InputOption::VALUE_REQUIRED, 'License of package'),
  3410. new InputOption('repository', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Add custom repositories, either by URL or using JSON arrays'),
  3411. ))
  3412. ->setHelp(
  3413. <<<EOT
  3414. The <info>init</info> command creates a basic composer.json file
  3415. in the current directory.
  3416. <info>php composer.phar init</info>
  3417. EOT
  3418. )
  3419. ;
  3420. }
  3421. protected function execute(InputInterface $input, OutputInterface $output)
  3422. {
  3423. $io = $this->getIO();
  3424. $whitelist = array('name', 'description', 'author', 'type', 'homepage', 'require', 'require-dev', 'stability', 'license');
  3425. $options = array_filter(array_intersect_key($input->getOptions(), array_flip($whitelist)));
  3426. if (isset($options['author'])) {
  3427. $options['authors'] = $this->formatAuthors($options['author']);
  3428. unset($options['author']);
  3429. }
  3430. $repositories = $input->getOption('repository');
  3431. if ($repositories) {
  3432. $config = Factory::createConfig($io);
  3433. foreach ($repositories as $repo) {
  3434. $options['repositories'][] = RepositoryFactory::configFromString($io, $config, $repo);
  3435. }
  3436. }
  3437. if (isset($options['stability'])) {
  3438. $options['minimum-stability'] = $options['stability'];
  3439. unset($options['stability']);
  3440. }
  3441. $options['require'] = isset($options['require']) ? $this->formatRequirements($options['require']) : new \stdClass;
  3442. if (array() === $options['require']) {
  3443. $options['require'] = new \stdClass;
  3444. }
  3445. if (isset($options['require-dev'])) {
  3446. $options['require-dev'] = $this->formatRequirements($options['require-dev']);
  3447. if (array() === $options['require-dev']) {
  3448. $options['require-dev'] = new \stdClass;
  3449. }
  3450. }
  3451. $file = new JsonFile(Factory::getComposerFile());
  3452. $json = $file->encode($options);
  3453. if ($input->isInteractive()) {
  3454. $io->writeError(array('', $json, ''));
  3455. if (!$io->askConfirmation('Do you confirm generation [<comment>yes</comment>]? ', true)) {
  3456. $io->writeError('<error>Command aborted</error>');
  3457. return 1;
  3458. }
  3459. }
  3460. $file->write($options);
  3461. if ($input->isInteractive() && is_dir('.git')) {
  3462. $ignoreFile = realpath('.gitignore');
  3463. if (false === $ignoreFile) {
  3464. $ignoreFile = realpath('.') . '/.gitignore';
  3465. }
  3466. if (!$this->hasVendorIgnore($ignoreFile)) {
  3467. $question = 'Would you like the <info>vendor</info> directory added to your <info>.gitignore</info> [<comment>yes</comment>]? ';
  3468. if ($io->askConfirmation($question, true)) {
  3469. $this->addVendorIgnore($ignoreFile);
  3470. }
  3471. }
  3472. }
  3473. }
  3474. protected function interact(InputInterface $input, OutputInterface $output)
  3475. {
  3476. $git = $this->getGitConfig();
  3477. $io = $this->getIO();
  3478. $formatter = $this->getHelperSet()->get('formatter');
  3479. $repositories = $input->getOption('repository');
  3480. if ($repositories) {
  3481. $config = Factory::createConfig($io);
  3482. $repos = array(new PlatformRepository);
  3483. foreach ($repositories as $repo) {
  3484. $repos[] = RepositoryFactory::fromString($io, $config, $repo);
  3485. }
  3486. $repos[] = RepositoryFactory::createRepo($io, $config, array(
  3487. 'type' => 'composer',
  3488. 'url' => 'https://repo.packagist.org',
  3489. ));
  3490. $this->repos = new CompositeRepository($repos);
  3491. unset($repos, $config, $repositories);
  3492. }
  3493. $io->writeError(array(
  3494. '',
  3495. $formatter->formatBlock('Welcome to the Composer config generator', 'bg=blue;fg=white', true),
  3496. '',
  3497. ));
  3498. $io->writeError(array(
  3499. '',
  3500. 'This command will guide you through creating your composer.json config.',
  3501. '',
  3502. ));
  3503. $cwd = realpath(".");
  3504. if (!$name = $input->getOption('name')) {
  3505. $name = basename($cwd);
  3506. $name = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
  3507. $name = strtolower($name);
  3508. if (!empty($_SERVER['COMPOSER_DEFAULT_VENDOR'])) {
  3509. $name = $_SERVER['COMPOSER_DEFAULT_VENDOR'] . '/' . $name;
  3510. } elseif (isset($git['github.user'])) {
  3511. $name = $git['github.user'] . '/' . $name;
  3512. } elseif (!empty($_SERVER['USERNAME'])) {
  3513. $name = $_SERVER['USERNAME'] . '/' . $name;
  3514. } elseif (!empty($_SERVER['USER'])) {
  3515. $name = $_SERVER['USER'] . '/' . $name;
  3516. } elseif (get_current_user()) {
  3517. $name = get_current_user() . '/' . $name;
  3518. } else {
  3519. $name = $name . '/' . $name;
  3520. }
  3521. $name = strtolower($name);
  3522. } else {
  3523. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}', $name)) {
  3524. throw new \InvalidArgumentException(
  3525. 'The package name '.$name.' is invalid, it should be lowercase and have a vendor name, a forward slash, and a package name, matching: [a-z0-9_.-]+/[a-z0-9_.-]+'
  3526. );
  3527. }
  3528. }
  3529. $name = $io->askAndValidate(
  3530. 'Package name (<vendor>/<name>) [<comment>'.$name.'</comment>]: ',
  3531. function ($value) use ($name) {
  3532. if (null === $value) {
  3533. return $name;
  3534. }
  3535. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}', $value)) {
  3536. throw new \InvalidArgumentException(
  3537. 'The package name '.$value.' is invalid, it should be lowercase and have a vendor name, a forward slash, and a package name, matching: [a-z0-9_.-]+/[a-z0-9_.-]+'
  3538. );
  3539. }
  3540. return $value;
  3541. },
  3542. null,
  3543. $name
  3544. );
  3545. $input->setOption('name', $name);
  3546. $description = $input->getOption('description') ?: false;
  3547. $description = $io->ask(
  3548. 'Description [<comment>'.$description.'</comment>]: ',
  3549. $description
  3550. );
  3551. $input->setOption('description', $description);
  3552. if (null === $author = $input->getOption('author')) {
  3553. if (!empty($_SERVER['COMPOSER_DEFAULT_AUTHOR'])) {
  3554. $author_name = $_SERVER['COMPOSER_DEFAULT_AUTHOR'];
  3555. } elseif (isset($git['user.name'])) {
  3556. $author_name = $git['user.name'];
  3557. }
  3558. if (!empty($_SERVER['COMPOSER_DEFAULT_EMAIL'])) {
  3559. $author_email = $_SERVER['COMPOSER_DEFAULT_EMAIL'];
  3560. } elseif (isset($git['user.email'])) {
  3561. $author_email = $git['user.email'];
  3562. }
  3563. if (isset($author_name) && isset($author_email)) {
  3564. $author = sprintf('%s <%s>', $author_name, $author_email);
  3565. }
  3566. }
  3567. $self = $this;
  3568. $author = $io->askAndValidate(
  3569. 'Author [<comment>'.$author.'</comment>, n to skip]: ',
  3570. function ($value) use ($self, $author) {
  3571. if ($value === 'n' || $value === 'no') {
  3572. return;
  3573. }
  3574. $value = $value ?: $author;
  3575. $author = $self->parseAuthorString($value);
  3576. return sprintf('%s <%s>', $author['name'], $author['email']);
  3577. },
  3578. null,
  3579. $author
  3580. );
  3581. $input->setOption('author', $author);
  3582. $minimumStability = $input->getOption('stability') ?: null;
  3583. $minimumStability = $io->askAndValidate(
  3584. 'Minimum Stability [<comment>'.$minimumStability.'</comment>]: ',
  3585. function ($value) use ($minimumStability) {
  3586. if (null === $value) {
  3587. return $minimumStability;
  3588. }
  3589. if (!isset(BasePackage::$stabilities[$value])) {
  3590. throw new \InvalidArgumentException(
  3591. 'Invalid minimum stability "'.$value.'". Must be empty or one of: '.
  3592. implode(', ', array_keys(BasePackage::$stabilities))
  3593. );
  3594. }
  3595. return $value;
  3596. },
  3597. null,
  3598. $minimumStability
  3599. );
  3600. $input->setOption('stability', $minimumStability);
  3601. $type = $input->getOption('type') ?: false;
  3602. $type = $io->ask(
  3603. 'Package Type (e.g. library, project, metapackage, composer-plugin) [<comment>'.$type.'</comment>]: ',
  3604. $type
  3605. );
  3606. $input->setOption('type', $type);
  3607. if (null === $license = $input->getOption('license')) {
  3608. if (!empty($_SERVER['COMPOSER_DEFAULT_LICENSE'])) {
  3609. $license = $_SERVER['COMPOSER_DEFAULT_LICENSE'];
  3610. }
  3611. }
  3612. $license = $io->ask(
  3613. 'License [<comment>'.$license.'</comment>]: ',
  3614. $license
  3615. );
  3616. $input->setOption('license', $license);
  3617. $io->writeError(array('', 'Define your dependencies.', ''));
  3618. $repos = $this->getRepos();
  3619. $preferredStability = $minimumStability ?: 'stable';
  3620. $phpVersion = $repos->findPackage('php', '*')->getPrettyVersion();
  3621. $question = 'Would you like to define your dependencies (require) interactively [<comment>yes</comment>]? ';
  3622. $require = $input->getOption('require');
  3623. $requirements = array();
  3624. if ($require || $io->askConfirmation($question, true)) {
  3625. $requirements = $this->determineRequirements($input, $output, $require, $phpVersion, $preferredStability);
  3626. }
  3627. $input->setOption('require', $requirements);
  3628. $question = 'Would you like to define your dev dependencies (require-dev) interactively [<comment>yes</comment>]? ';
  3629. $requireDev = $input->getOption('require-dev');
  3630. $devRequirements = array();
  3631. if ($requireDev || $io->askConfirmation($question, true)) {
  3632. $devRequirements = $this->determineRequirements($input, $output, $requireDev, $phpVersion, $preferredStability);
  3633. }
  3634. $input->setOption('require-dev', $devRequirements);
  3635. }
  3636. public function parseAuthorString($author)
  3637. {
  3638. if (preg_match('/^(?P<name>[- .,\p{L}\p{N}\p{Mn}\'’"()]+) <(?P<email>.+?)>$/u', $author, $match)) {
  3639. if ($this->isValidEmail($match['email'])) {
  3640. return array(
  3641. 'name' => trim($match['name']),
  3642. 'email' => $match['email'],
  3643. );
  3644. }
  3645. }
  3646. throw new \InvalidArgumentException(
  3647. 'Invalid author string. Must be in the format: '.
  3648. 'John Smith <john@example.com>'
  3649. );
  3650. }
  3651. protected function findPackages($name)
  3652. {
  3653. return $this->getRepos()->search($name);
  3654. }
  3655. protected function getRepos()
  3656. {
  3657. if (!$this->repos) {
  3658. $this->repos = new CompositeRepository(array_merge(
  3659. array(new PlatformRepository),
  3660. RepositoryFactory::defaultRepos($this->getIO())
  3661. ));
  3662. }
  3663. return $this->repos;
  3664. }
  3665. protected function determineRequirements(InputInterface $input, OutputInterface $output, $requires = array(), $phpVersion = null, $preferredStability = 'stable')
  3666. {
  3667. if ($requires) {
  3668. $requires = $this->normalizeRequirements($requires);
  3669. $result = array();
  3670. $io = $this->getIO();
  3671. foreach ($requires as $requirement) {
  3672. if (!isset($requirement['version'])) {
  3673. list($name, $version) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $phpVersion, $preferredStability);
  3674. $requirement['version'] = $version;
  3675. $requirement['name'] = $name;
  3676. $io->writeError(sprintf(
  3677. 'Using version <info>%s</info> for <info>%s</info>',
  3678. $requirement['version'],
  3679. $requirement['name']
  3680. ));
  3681. } else {
  3682. list($name, $version) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $phpVersion, $preferredStability, $requirement['version'], 'dev');
  3683. $requirement['name'] = $name;
  3684. }
  3685. $result[] = $requirement['name'] . ' ' . $requirement['version'];
  3686. }
  3687. return $result;
  3688. }
  3689. $versionParser = new VersionParser();
  3690. $io = $this->getIO();
  3691. while (null !== $package = $io->ask('Search for a package: ')) {
  3692. $matches = $this->findPackages($package);
  3693. if (count($matches)) {
  3694. $exactMatch = null;
  3695. $choices = array();
  3696. foreach ($matches as $position => $foundPackage) {
  3697. $abandoned = '';
  3698. if (isset($foundPackage['abandoned'])) {
  3699. if (is_string($foundPackage['abandoned'])) {
  3700. $replacement = sprintf('Use %s instead', $foundPackage['abandoned']);
  3701. } else {
  3702. $replacement = 'No replacement was suggested';
  3703. }
  3704. $abandoned = sprintf('<warning>Abandoned. %s.</warning>', $replacement);
  3705. }
  3706. $choices[] = sprintf(' <info>%5s</info> %s %s', "[$position]", $foundPackage['name'], $abandoned);
  3707. if ($foundPackage['name'] === $package) {
  3708. $exactMatch = true;
  3709. break;
  3710. }
  3711. }
  3712. if (!$exactMatch) {
  3713. $io->writeError(array(
  3714. '',
  3715. sprintf('Found <info>%s</info> packages matching <info>%s</info>', count($matches), $package),
  3716. '',
  3717. ));
  3718. $io->writeError($choices);
  3719. $io->writeError('');
  3720. $validator = function ($selection) use ($matches, $versionParser) {
  3721. if ('' === $selection) {
  3722. return false;
  3723. }
  3724. if (is_numeric($selection) && isset($matches[(int) $selection])) {
  3725. $package = $matches[(int) $selection];
  3726. return $package['name'];
  3727. }
  3728. if (preg_match('{^\s*(?P<name>[\S/]+)(?:\s+(?P<version>\S+))?\s*$}', $selection, $packageMatches)) {
  3729. if (isset($packageMatches['version'])) {
  3730. $versionParser->parseConstraints($packageMatches['version']);
  3731. return $packageMatches['name'].' '.$packageMatches['version'];
  3732. }
  3733. return $packageMatches['name'];
  3734. }
  3735. throw new \Exception('Not a valid selection');
  3736. };
  3737. $package = $io->askAndValidate(
  3738. 'Enter package # to add, or the complete package name if it is not listed: ',
  3739. $validator,
  3740. 3,
  3741. false
  3742. );
  3743. }
  3744. if (false !== $package && false === strpos($package, ' ')) {
  3745. $validator = function ($input) {
  3746. $input = trim($input);
  3747. return $input ?: false;
  3748. };
  3749. $constraint = $io->askAndValidate(
  3750. 'Enter the version constraint to require (or leave blank to use the latest version): ',
  3751. $validator,
  3752. 3,
  3753. false
  3754. );
  3755. if (false === $constraint) {
  3756. list($name, $constraint) = $this->findBestVersionAndNameForPackage($input, $package, $phpVersion, $preferredStability);
  3757. $io->writeError(sprintf(
  3758. 'Using version <info>%s</info> for <info>%s</info>',
  3759. $constraint,
  3760. $package
  3761. ));
  3762. }
  3763. $package .= ' '.$constraint;
  3764. }
  3765. if (false !== $package) {
  3766. $requires[] = $package;
  3767. }
  3768. }
  3769. }
  3770. return $requires;
  3771. }
  3772. protected function formatAuthors($author)
  3773. {
  3774. return array($this->parseAuthorString($author));
  3775. }
  3776. protected function formatRequirements(array $requirements)
  3777. {
  3778. $requires = array();
  3779. $requirements = $this->normalizeRequirements($requirements);
  3780. foreach ($requirements as $requirement) {
  3781. $requires[$requirement['name']] = $requirement['version'];
  3782. }
  3783. return $requires;
  3784. }
  3785. protected function getGitConfig()
  3786. {
  3787. if (null !== $this->gitConfig) {
  3788. return $this->gitConfig;
  3789. }
  3790. $finder = new ExecutableFinder();
  3791. $gitBin = $finder->find('git');
  3792. $cmd = new Process(sprintf('%s config -l', ProcessExecutor::escape($gitBin)));
  3793. $cmd->run();
  3794. if ($cmd->isSuccessful()) {
  3795. $this->gitConfig = array();
  3796. preg_match_all('{^([^=]+)=(.*)$}m', $cmd->getOutput(), $matches, PREG_SET_ORDER);
  3797. foreach ($matches as $match) {
  3798. $this->gitConfig[$match[1]] = $match[2];
  3799. }
  3800. return $this->gitConfig;
  3801. }
  3802. return $this->gitConfig = array();
  3803. }
  3804. protected function hasVendorIgnore($ignoreFile, $vendor = 'vendor')
  3805. {
  3806. if (!file_exists($ignoreFile)) {
  3807. return false;
  3808. }
  3809. $pattern = sprintf('{^/?%s(/\*?)?$}', preg_quote($vendor));
  3810. $lines = file($ignoreFile, FILE_IGNORE_NEW_LINES);
  3811. foreach ($lines as $line) {
  3812. if (preg_match($pattern, $line)) {
  3813. return true;
  3814. }
  3815. }
  3816. return false;
  3817. }
  3818. protected function normalizeRequirements(array $requirements)
  3819. {
  3820. $parser = new VersionParser();
  3821. return $parser->parseNameVersionPairs($requirements);
  3822. }
  3823. protected function addVendorIgnore($ignoreFile, $vendor = '/vendor/')
  3824. {
  3825. $contents = "";
  3826. if (file_exists($ignoreFile)) {
  3827. $contents = file_get_contents($ignoreFile);
  3828. if ("\n" !== substr($contents, 0, -1)) {
  3829. $contents .= "\n";
  3830. }
  3831. }
  3832. file_put_contents($ignoreFile, $contents . $vendor. "\n");
  3833. }
  3834. protected function isValidEmail($email)
  3835. {
  3836. if (!function_exists('filter_var')) {
  3837. return true;
  3838. }
  3839. if (PHP_VERSION_ID < 50303) {
  3840. return true;
  3841. }
  3842. return false !== filter_var($email, FILTER_VALIDATE_EMAIL);
  3843. }
  3844. private function getPool(InputInterface $input, $minimumStability = null)
  3845. {
  3846. $key = $minimumStability ?: 'default';
  3847. if (!isset($this->pools[$key])) {
  3848. $this->pools[$key] = $pool = new Pool($minimumStability ?: $this->getMinimumStability($input));
  3849. $pool->addRepository($this->getRepos());
  3850. }
  3851. return $this->pools[$key];
  3852. }
  3853. private function getMinimumStability(InputInterface $input)
  3854. {
  3855. if ($input->hasOption('stability')) {
  3856. return $input->getOption('stability') ?: 'stable';
  3857. }
  3858. $file = Factory::getComposerFile();
  3859. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  3860. if (!empty($composer['minimum-stability'])) {
  3861. return $composer['minimum-stability'];
  3862. }
  3863. }
  3864. return 'stable';
  3865. }
  3866. private function findBestVersionAndNameForPackage(InputInterface $input, $name, $phpVersion, $preferredStability = 'stable', $requiredVersion = null, $minimumStability = null)
  3867. {
  3868. $versionSelector = new VersionSelector($this->getPool($input, $minimumStability));
  3869. $package = $versionSelector->findBestCandidate($name, $requiredVersion, $phpVersion, $preferredStability);
  3870. if ($input->hasOption('ignore-platform-reqs') && $input->getOption('ignore-platform-reqs')) {
  3871. $phpVersion = null;
  3872. $package = $versionSelector->findBestCandidate($name, $requiredVersion, $phpVersion, $preferredStability);
  3873. }
  3874. if (!$package) {
  3875. if ($phpVersion && $versionSelector->findBestCandidate($name, $requiredVersion, null, $preferredStability)) {
  3876. throw new \InvalidArgumentException(sprintf(
  3877. 'Package %s at version %s has a PHP requirement incompatible with your PHP version (%s)',
  3878. $name,
  3879. $requiredVersion,
  3880. $phpVersion
  3881. ));
  3882. }
  3883. if ($requiredVersion && $versionSelector->findBestCandidate($name, null, $phpVersion, $preferredStability)) {
  3884. throw new \InvalidArgumentException(sprintf(
  3885. 'Could not find package %s in a version matching %s',
  3886. $name,
  3887. $requiredVersion
  3888. ));
  3889. }
  3890. if ($phpVersion && $versionSelector->findBestCandidate($name)) {
  3891. throw new \InvalidArgumentException(sprintf(
  3892. 'Could not find package %s in any version matching your PHP version (%s)',
  3893. $name,
  3894. $phpVersion
  3895. ));
  3896. }
  3897. $similar = $this->findSimilar($name);
  3898. if ($similar) {
  3899. if ($requiredVersion === null && in_array($name, $similar, true)) {
  3900. throw new \InvalidArgumentException(sprintf(
  3901. 'Could not find a version of package %s matching your minimum-stability (%s). Require it with an explicit version constraint allowing its desired stability.',
  3902. $name,
  3903. $this->getMinimumStability($input)
  3904. ));
  3905. }
  3906. throw new \InvalidArgumentException(sprintf(
  3907. "Could not find package %s.\n\nDid you mean " . (count($similar) > 1 ? 'one of these' : 'this') . "?\n %s",
  3908. $name,
  3909. implode("\n ", $similar)
  3910. ));
  3911. }
  3912. throw new \InvalidArgumentException(sprintf(
  3913. 'Could not find a matching version of package %s. Check the package spelling, your version constraint and that the package is available in a stability which matches your minimum-stability (%s).',
  3914. $name,
  3915. $this->getMinimumStability($input)
  3916. ));
  3917. }
  3918. return array(
  3919. $package->getPrettyName(),
  3920. $versionSelector->findRecommendedRequireVersion($package),
  3921. );
  3922. }
  3923. private function findSimilar($package)
  3924. {
  3925. try {
  3926. $results = $this->repos->search($package);
  3927. } catch (\Exception $e) {
  3928. return array();
  3929. }
  3930. $similarPackages = array();
  3931. foreach ($results as $result) {
  3932. $similarPackages[$result['name']] = levenshtein($package, $result['name']);
  3933. }
  3934. asort($similarPackages);
  3935. return array_keys(array_slice($similarPackages, 0, 5));
  3936. }
  3937. }
  3938. <?php
  3939. namespace Composer\Command;
  3940. use Composer\Installer;
  3941. use Composer\Plugin\CommandEvent;
  3942. use Composer\Plugin\PluginEvents;
  3943. use Symfony\Component\Console\Input\InputInterface;
  3944. use Symfony\Component\Console\Input\InputOption;
  3945. use Symfony\Component\Console\Input\InputArgument;
  3946. use Symfony\Component\Console\Output\OutputInterface;
  3947. class InstallCommand extends BaseCommand
  3948. {
  3949. protected function configure()
  3950. {
  3951. $this
  3952. ->setName('install')
  3953. ->setAliases(array('i'))
  3954. ->setDescription('Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.')
  3955. ->setDefinition(array(
  3956. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  3957. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  3958. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  3959. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  3960. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  3961. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  3962. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  3963. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  3964. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  3965. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  3966. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  3967. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  3968. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  3969. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  3970. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  3971. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Should not be provided, use composer require instead to add a given package to composer.json.'),
  3972. ))
  3973. ->setHelp(
  3974. <<<EOT
  3975. The <info>install</info> command reads the composer.lock file from
  3976. the current directory, processes it, and downloads and installs all the
  3977. libraries and dependencies outlined in that file. If the file does not
  3978. exist it will look for composer.json and do the same.
  3979. <info>php composer.phar install</info>
  3980. EOT
  3981. )
  3982. ;
  3983. }
  3984. protected function execute(InputInterface $input, OutputInterface $output)
  3985. {
  3986. $io = $this->getIO();
  3987. if ($args = $input->getArgument('packages')) {
  3988. $io->writeError('<error>Invalid argument '.implode(' ', $args).'. Use "composer require '.implode(' ', $args).'" instead to add packages to your composer.json.</error>');
  3989. return 1;
  3990. }
  3991. if ($input->getOption('no-custom-installers')) {
  3992. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  3993. $input->setOption('no-plugins', true);
  3994. }
  3995. if ($input->getOption('dev')) {
  3996. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  3997. }
  3998. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  3999. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4000. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'install', $input, $output);
  4001. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4002. $install = Installer::create($io, $composer);
  4003. $config = $composer->getConfig();
  4004. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  4005. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  4006. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  4007. $apcu = $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  4008. $install
  4009. ->setDryRun($input->getOption('dry-run'))
  4010. ->setVerbose($input->getOption('verbose'))
  4011. ->setPreferSource($preferSource)
  4012. ->setPreferDist($preferDist)
  4013. ->setDevMode(!$input->getOption('no-dev'))
  4014. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  4015. ->setRunScripts(!$input->getOption('no-scripts'))
  4016. ->setSkipSuggest($input->getOption('no-suggest'))
  4017. ->setOptimizeAutoloader($optimize)
  4018. ->setClassMapAuthoritative($authoritative)
  4019. ->setApcuAutoloader($apcu)
  4020. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4021. ;
  4022. if ($input->getOption('no-plugins')) {
  4023. $install->disablePlugins();
  4024. }
  4025. return $install->run();
  4026. }
  4027. }
  4028. <?php
  4029. namespace Composer\Command;
  4030. use Composer\Json\JsonFile;
  4031. use Composer\Plugin\CommandEvent;
  4032. use Composer\Plugin\PluginEvents;
  4033. use Composer\Package\PackageInterface;
  4034. use Composer\Repository\RepositoryInterface;
  4035. use Symfony\Component\Console\Helper\Table;
  4036. use Symfony\Component\Console\Input\InputInterface;
  4037. use Symfony\Component\Console\Input\InputOption;
  4038. use Symfony\Component\Console\Output\OutputInterface;
  4039. class LicensesCommand extends BaseCommand
  4040. {
  4041. protected function configure()
  4042. {
  4043. $this
  4044. ->setName('licenses')
  4045. ->setDescription('Shows information about licenses of dependencies.')
  4046. ->setDefinition(array(
  4047. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  4048. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables search in require-dev packages.'),
  4049. ))
  4050. ->setHelp(
  4051. <<<EOT
  4052. The license command displays detailed information about the licenses of
  4053. the installed dependencies.
  4054. EOT
  4055. )
  4056. ;
  4057. }
  4058. protected function execute(InputInterface $input, OutputInterface $output)
  4059. {
  4060. $composer = $this->getComposer();
  4061. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'licenses', $input, $output);
  4062. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4063. $root = $composer->getPackage();
  4064. $repo = $composer->getRepositoryManager()->getLocalRepository();
  4065. if ($input->getOption('no-dev')) {
  4066. $packages = $this->filterRequiredPackages($repo, $root);
  4067. } else {
  4068. $packages = $this->appendPackages($repo->getPackages(), array());
  4069. }
  4070. ksort($packages);
  4071. $io = $this->getIO();
  4072. switch ($format = $input->getOption('format')) {
  4073. case 'text':
  4074. $io->write('Name: <comment>'.$root->getPrettyName().'</comment>');
  4075. $io->write('Version: <comment>'.$root->getFullPrettyVersion().'</comment>');
  4076. $io->write('Licenses: <comment>'.(implode(', ', $root->getLicense()) ?: 'none').'</comment>');
  4077. $io->write('Dependencies:');
  4078. $io->write('');
  4079. $table = new Table($output);
  4080. $table->setStyle('compact');
  4081. $tableStyle = $table->getStyle();
  4082. $tableStyle->setVerticalBorderChar('');
  4083. $tableStyle->setCellRowContentFormat('%s ');
  4084. $table->setHeaders(array('Name', 'Version', 'License'));
  4085. foreach ($packages as $package) {
  4086. $table->addRow(array(
  4087. $package->getPrettyName(),
  4088. $package->getFullPrettyVersion(),
  4089. implode(', ', $package->getLicense()) ?: 'none',
  4090. ));
  4091. }
  4092. $table->render();
  4093. break;
  4094. case 'json':
  4095. $dependencies = array();
  4096. foreach ($packages as $package) {
  4097. $dependencies[$package->getPrettyName()] = array(
  4098. 'version' => $package->getFullPrettyVersion(),
  4099. 'license' => $package->getLicense(),
  4100. );
  4101. }
  4102. $io->write(JsonFile::encode(array(
  4103. 'name' => $root->getPrettyName(),
  4104. 'version' => $root->getFullPrettyVersion(),
  4105. 'license' => $root->getLicense(),
  4106. 'dependencies' => $dependencies,
  4107. )));
  4108. break;
  4109. default:
  4110. throw new \RuntimeException(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  4111. }
  4112. }
  4113. private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, $bucket = array())
  4114. {
  4115. $requires = array_keys($package->getRequires());
  4116. $packageListNames = array_keys($bucket);
  4117. $packages = array_filter(
  4118. $repo->getPackages(),
  4119. function ($package) use ($requires, $packageListNames) {
  4120. return in_array($package->getName(), $requires) && !in_array($package->getName(), $packageListNames);
  4121. }
  4122. );
  4123. $bucket = $this->appendPackages($packages, $bucket);
  4124. foreach ($packages as $package) {
  4125. $bucket = $this->filterRequiredPackages($repo, $package, $bucket);
  4126. }
  4127. return $bucket;
  4128. }
  4129. public function appendPackages(array $packages, array $bucket)
  4130. {
  4131. foreach ($packages as $package) {
  4132. $bucket[$package->getName()] = $package;
  4133. }
  4134. return $bucket;
  4135. }
  4136. }
  4137. <?php
  4138. namespace Composer\Command;
  4139. use Symfony\Component\Console\Input\InputInterface;
  4140. use Symfony\Component\Console\Input\InputArgument;
  4141. use Symfony\Component\Console\Input\ArrayInput;
  4142. use Symfony\Component\Console\Input\InputOption;
  4143. use Symfony\Component\Console\Output\OutputInterface;
  4144. class OutdatedCommand extends ShowCommand
  4145. {
  4146. protected function configure()
  4147. {
  4148. $this
  4149. ->setName('outdated')
  4150. ->setDescription('Shows a list of installed packages that have updates available, including their latest version.')
  4151. ->setDefinition(array(
  4152. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  4153. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show only packages that are outdated (this is the default, but present here for compat with `show`'),
  4154. new InputOption('all', 'a', InputOption::VALUE_NONE, 'Show all installed packages with their latest versions'),
  4155. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  4156. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  4157. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
  4158. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  4159. ))
  4160. ->setHelp(
  4161. <<<EOT
  4162. The outdated command is just a proxy for `composer show -l`
  4163. The color coding (or signage if you have ANSI colors disabled) for dependency versions is as such:
  4164. - <info>green</info> (=): Dependency is in the latest version and is up to date.
  4165. - <comment>yellow</comment> (~): Dependency has a new version available that includes backwards
  4166. compatibility breaks according to semver, so upgrade when you can but it
  4167. may involve work.
  4168. - <highlight>red</highlight> (!): Dependency has a new version that is semver-compatible and you should upgrade it.
  4169. EOT
  4170. )
  4171. ;
  4172. }
  4173. protected function execute(InputInterface $input, OutputInterface $output)
  4174. {
  4175. $args = array(
  4176. 'show',
  4177. '--latest' => true,
  4178. );
  4179. if (!$input->getOption('all')) {
  4180. $args['--outdated'] = true;
  4181. }
  4182. if ($input->getOption('direct')) {
  4183. $args['--direct'] = true;
  4184. }
  4185. if ($input->getArgument('package')) {
  4186. $args['package'] = $input->getArgument('package');
  4187. }
  4188. if ($input->getOption('strict')) {
  4189. $args['--strict'] = true;
  4190. }
  4191. if ($input->getOption('minor-only')) {
  4192. $args['--minor-only'] = true;
  4193. }
  4194. $args['--format'] = $input->getOption('format');
  4195. $input = new ArrayInput($args);
  4196. return $this->getApplication()->run($input, $output);
  4197. }
  4198. public function isProxyCommand()
  4199. {
  4200. return true;
  4201. }
  4202. }
  4203. <?php
  4204. namespace Composer\Command;
  4205. use Symfony\Component\Console\Input\InputInterface;
  4206. use Symfony\Component\Console\Output\OutputInterface;
  4207. class ProhibitsCommand extends BaseDependencyCommand
  4208. {
  4209. protected function configure()
  4210. {
  4211. parent::configure();
  4212. $this
  4213. ->setName('prohibits')
  4214. ->setAliases(array('why-not'))
  4215. ->setDescription('Shows which packages prevent the given package from being installed.')
  4216. ->setHelp(
  4217. <<<EOT
  4218. Displays detailed information about why a package cannot be installed.
  4219. <info>php composer.phar prohibits composer/composer</info>
  4220. EOT
  4221. )
  4222. ;
  4223. }
  4224. protected function execute(InputInterface $input, OutputInterface $output)
  4225. {
  4226. return parent::doExecute($input, $output, true);
  4227. }
  4228. }
  4229. <?php
  4230. namespace Composer\Command;
  4231. use Composer\Config\JsonConfigSource;
  4232. use Composer\Installer;
  4233. use Composer\Plugin\CommandEvent;
  4234. use Composer\Plugin\PluginEvents;
  4235. use Composer\Json\JsonFile;
  4236. use Composer\Factory;
  4237. use Symfony\Component\Console\Input\InputInterface;
  4238. use Symfony\Component\Console\Input\InputOption;
  4239. use Symfony\Component\Console\Input\InputArgument;
  4240. use Symfony\Component\Console\Output\OutputInterface;
  4241. class RemoveCommand extends BaseCommand
  4242. {
  4243. protected function configure()
  4244. {
  4245. $this
  4246. ->setName('remove')
  4247. ->setDescription('Removes a package from the require or require-dev.')
  4248. ->setDefinition(array(
  4249. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'Packages that should be removed.'),
  4250. new InputOption('dev', null, InputOption::VALUE_NONE, 'Removes a package from the require-dev section.'),
  4251. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4252. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  4253. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4254. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  4255. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated with explicit dependencies. (Deprecrated, is now default behavior)'),
  4256. new InputOption('no-update-with-dependencies', null, InputOption::VALUE_NONE, 'Does not allow inherited dependencies to be updated with explicit dependencies.'),
  4257. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4258. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4259. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4260. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4261. ))
  4262. ->setHelp(
  4263. <<<EOT
  4264. The <info>remove</info> command removes a package from the current
  4265. list of installed packages
  4266. <info>php composer.phar remove</info>
  4267. EOT
  4268. )
  4269. ;
  4270. }
  4271. protected function execute(InputInterface $input, OutputInterface $output)
  4272. {
  4273. $packages = $input->getArgument('packages');
  4274. $packages = array_map('strtolower', $packages);
  4275. $file = Factory::getComposerFile();
  4276. $jsonFile = new JsonFile($file);
  4277. $composer = $jsonFile->read();
  4278. $composerBackup = file_get_contents($jsonFile->getPath());
  4279. $json = new JsonConfigSource($jsonFile);
  4280. $type = $input->getOption('dev') ? 'require-dev' : 'require';
  4281. $altType = !$input->getOption('dev') ? 'require-dev' : 'require';
  4282. $io = $this->getIO();
  4283. if ($input->getOption('update-with-dependencies')) {
  4284. $io->writeError('<warning>You are using the deprecated option "update-with-dependencies". This is now default behaviour. The --no-update-with-dependencies option can be used to remove a package without its dependencies.</warning>');
  4285. }
  4286. foreach (array('require', 'require-dev') as $linkType) {
  4287. if (isset($composer[$linkType])) {
  4288. foreach ($composer[$linkType] as $name => $version) {
  4289. $composer[$linkType][strtolower($name)] = $name;
  4290. }
  4291. }
  4292. }
  4293. foreach ($packages as $package) {
  4294. if (isset($composer[$type][$package])) {
  4295. $json->removeLink($type, $composer[$type][$package]);
  4296. } elseif (isset($composer[$altType][$package])) {
  4297. $io->writeError('<warning>'.$composer[$altType][$package].' could not be found in '.$type.' but it is present in '.$altType.'</warning>');
  4298. if ($io->isInteractive()) {
  4299. if ($io->askConfirmation('Do you want to remove it from '.$altType.' [<comment>yes</comment>]? ', true)) {
  4300. $json->removeLink($altType, $composer[$altType][$package]);
  4301. }
  4302. }
  4303. } else {
  4304. $io->writeError('<warning>'.$package.' is not required in your composer.json and has not been removed</warning>');
  4305. }
  4306. }
  4307. if ($input->getOption('no-update')) {
  4308. return 0;
  4309. }
  4310. $this->resetComposer();
  4311. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4312. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4313. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'remove', $input, $output);
  4314. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4315. $install = Installer::create($io, $composer);
  4316. $updateDevMode = !$input->getOption('update-no-dev');
  4317. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  4318. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  4319. $apcu = $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  4320. $install
  4321. ->setVerbose($input->getOption('verbose'))
  4322. ->setDevMode($updateDevMode)
  4323. ->setOptimizeAutoloader($optimize)
  4324. ->setClassMapAuthoritative($authoritative)
  4325. ->setApcuAutoloader($apcu)
  4326. ->setUpdate(true)
  4327. ->setUpdateWhitelist($packages)
  4328. ->setWhitelistTransitiveDependencies(!$input->getOption('no-update-with-dependencies'))
  4329. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4330. ->setRunScripts(!$input->getOption('no-scripts'))
  4331. ;
  4332. $status = $install->run();
  4333. if ($status !== 0) {
  4334. $io->writeError("\n".'<error>Removal failed, reverting '.$file.' to its original content.</error>');
  4335. file_put_contents($jsonFile->getPath(), $composerBackup);
  4336. }
  4337. return $status;
  4338. }
  4339. }
  4340. <?php
  4341. namespace Composer\Command;
  4342. use Symfony\Component\Console\Input\InputInterface;
  4343. use Symfony\Component\Console\Input\InputArgument;
  4344. use Symfony\Component\Console\Input\InputOption;
  4345. use Symfony\Component\Console\Output\OutputInterface;
  4346. use Composer\Factory;
  4347. use Composer\Installer;
  4348. use Composer\Json\JsonFile;
  4349. use Composer\Json\JsonManipulator;
  4350. use Composer\Package\Version\VersionParser;
  4351. use Composer\Plugin\CommandEvent;
  4352. use Composer\Plugin\PluginEvents;
  4353. use Composer\Repository\CompositeRepository;
  4354. use Composer\Repository\PlatformRepository;
  4355. class RequireCommand extends InitCommand
  4356. {
  4357. protected function configure()
  4358. {
  4359. $this
  4360. ->setName('require')
  4361. ->setDescription('Adds required packages to your composer.json and installs them.')
  4362. ->setDefinition(array(
  4363. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Optional package name can also include a version constraint, e.g. foo/bar or foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
  4364. new InputOption('dev', null, InputOption::VALUE_NONE, 'Add requirement to require-dev.'),
  4365. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  4366. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  4367. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4368. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  4369. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  4370. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4371. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  4372. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated, except those that are root requirements.'),
  4373. new InputOption('update-with-all-dependencies', null, InputOption::VALUE_NONE, 'Allows all inherited dependencies to be updated, including those that are root requirements.'),
  4374. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4375. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  4376. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  4377. new InputOption('sort-packages', null, InputOption::VALUE_NONE, 'Sorts packages when adding/updating a new dependency'),
  4378. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4379. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4380. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4381. ))
  4382. ->setHelp(
  4383. <<<EOT
  4384. The require command adds required packages to your composer.json and installs them.
  4385. If you do not specify a package, composer will prompt you to search for a package, and given results, provide a list of
  4386. matches to require.
  4387. If you do not specify a version constraint, composer will choose a suitable one based on the available package versions.
  4388. If you do not want to install the new dependencies immediately you can call it with --no-update
  4389. EOT
  4390. )
  4391. ;
  4392. }
  4393. protected function execute(InputInterface $input, OutputInterface $output)
  4394. {
  4395. $file = Factory::getComposerFile();
  4396. $io = $this->getIO();
  4397. $newlyCreated = !file_exists($file);
  4398. if ($newlyCreated && !file_put_contents($file, "{\n}\n")) {
  4399. $io->writeError('<error>'.$file.' could not be created.</error>');
  4400. return 1;
  4401. }
  4402. if (!is_readable($file)) {
  4403. $io->writeError('<error>'.$file.' is not readable.</error>');
  4404. return 1;
  4405. }
  4406. if (!is_writable($file)) {
  4407. $io->writeError('<error>'.$file.' is not writable.</error>');
  4408. return 1;
  4409. }
  4410. if (filesize($file) === 0) {
  4411. file_put_contents($file, "{\n}\n");
  4412. }
  4413. $json = new JsonFile($file);
  4414. $composerBackup = file_get_contents($json->getPath());
  4415. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4416. $repos = $composer->getRepositoryManager()->getRepositories();
  4417. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  4418. $this->repos = new CompositeRepository(array_merge(
  4419. array(new PlatformRepository(array(), $platformOverrides)),
  4420. $repos
  4421. ));
  4422. if ($composer->getPackage()->getPreferStable()) {
  4423. $preferredStability = 'stable';
  4424. } else {
  4425. $preferredStability = $composer->getPackage()->getMinimumStability();
  4426. }
  4427. $phpVersion = $this->repos->findPackage('php', '*')->getPrettyVersion();
  4428. $requirements = $this->determineRequirements($input, $output, $input->getArgument('packages'), $phpVersion, $preferredStability);
  4429. $requireKey = $input->getOption('dev') ? 'require-dev' : 'require';
  4430. $removeKey = $input->getOption('dev') ? 'require' : 'require-dev';
  4431. $requirements = $this->formatRequirements($requirements);
  4432. $versionParser = new VersionParser();
  4433. foreach ($requirements as $constraint) {
  4434. $versionParser->parseConstraints($constraint);
  4435. }
  4436. $sortPackages = $input->getOption('sort-packages') || $composer->getConfig()->get('sort-packages');
  4437. if (!$this->updateFileCleanly($json, $requirements, $requireKey, $removeKey, $sortPackages)) {
  4438. $composerDefinition = $json->read();
  4439. foreach ($requirements as $package => $version) {
  4440. $composerDefinition[$requireKey][$package] = $version;
  4441. unset($composerDefinition[$removeKey][$package]);
  4442. }
  4443. $json->write($composerDefinition);
  4444. }
  4445. $io->writeError('<info>'.$file.' has been '.($newlyCreated ? 'created' : 'updated').'</info>');
  4446. if ($input->getOption('no-update')) {
  4447. return 0;
  4448. }
  4449. $updateDevMode = !$input->getOption('update-no-dev');
  4450. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  4451. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  4452. $apcu = $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  4453. $this->resetComposer();
  4454. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4455. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4456. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'require', $input, $output);
  4457. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4458. $install = Installer::create($io, $composer);
  4459. $install
  4460. ->setVerbose($input->getOption('verbose'))
  4461. ->setPreferSource($input->getOption('prefer-source'))
  4462. ->setPreferDist($input->getOption('prefer-dist'))
  4463. ->setDevMode($updateDevMode)
  4464. ->setRunScripts(!$input->getOption('no-scripts'))
  4465. ->setSkipSuggest($input->getOption('no-suggest'))
  4466. ->setOptimizeAutoloader($optimize)
  4467. ->setClassMapAuthoritative($authoritative)
  4468. ->setApcuAutoloader($apcu)
  4469. ->setUpdate(true)
  4470. ->setUpdateWhitelist(array_keys($requirements))
  4471. ->setWhitelistTransitiveDependencies($input->getOption('update-with-dependencies'))
  4472. ->setWhitelistAllDependencies($input->getOption('update-with-all-dependencies'))
  4473. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4474. ->setPreferStable($input->getOption('prefer-stable'))
  4475. ->setPreferLowest($input->getOption('prefer-lowest'))
  4476. ;
  4477. $status = $install->run();
  4478. if ($status !== 0) {
  4479. if ($newlyCreated) {
  4480. $io->writeError("\n".'<error>Installation failed, deleting '.$file.'.</error>');
  4481. unlink($json->getPath());
  4482. } else {
  4483. $io->writeError("\n".'<error>Installation failed, reverting '.$file.' to its original content.</error>');
  4484. file_put_contents($json->getPath(), $composerBackup);
  4485. }
  4486. }
  4487. return $status;
  4488. }
  4489. private function updateFileCleanly($json, array $new, $requireKey, $removeKey, $sortPackages)
  4490. {
  4491. $contents = file_get_contents($json->getPath());
  4492. $manipulator = new JsonManipulator($contents);
  4493. foreach ($new as $package => $constraint) {
  4494. if (!$manipulator->addLink($requireKey, $package, $constraint, $sortPackages)) {
  4495. return false;
  4496. }
  4497. if (!$manipulator->removeSubNode($removeKey, $package)) {
  4498. return false;
  4499. }
  4500. }
  4501. file_put_contents($json->getPath(), $manipulator->getContents());
  4502. return true;
  4503. }
  4504. protected function interact(InputInterface $input, OutputInterface $output)
  4505. {
  4506. return;
  4507. }
  4508. }
  4509. <?php
  4510. namespace Composer\Command;
  4511. use Composer\Script\Event as ScriptEvent;
  4512. use Composer\Script\ScriptEvents;
  4513. use Composer\Util\ProcessExecutor;
  4514. use Symfony\Component\Console\Input\InputInterface;
  4515. use Symfony\Component\Console\Input\InputOption;
  4516. use Symfony\Component\Console\Input\InputArgument;
  4517. use Symfony\Component\Console\Output\OutputInterface;
  4518. use Symfony\Component\Console\Helper\Table;
  4519. class RunScriptCommand extends BaseCommand
  4520. {
  4521. protected $scriptEvents = array(
  4522. ScriptEvents::PRE_INSTALL_CMD,
  4523. ScriptEvents::POST_INSTALL_CMD,
  4524. ScriptEvents::PRE_UPDATE_CMD,
  4525. ScriptEvents::POST_UPDATE_CMD,
  4526. ScriptEvents::PRE_STATUS_CMD,
  4527. ScriptEvents::POST_STATUS_CMD,
  4528. ScriptEvents::POST_ROOT_PACKAGE_INSTALL,
  4529. ScriptEvents::POST_CREATE_PROJECT_CMD,
  4530. ScriptEvents::PRE_ARCHIVE_CMD,
  4531. ScriptEvents::POST_ARCHIVE_CMD,
  4532. ScriptEvents::PRE_AUTOLOAD_DUMP,
  4533. ScriptEvents::POST_AUTOLOAD_DUMP,
  4534. );
  4535. protected function configure()
  4536. {
  4537. $this
  4538. ->setName('run-script')
  4539. ->setDescription('Runs the scripts defined in composer.json.')
  4540. ->setDefinition(array(
  4541. new InputArgument('script', InputArgument::OPTIONAL, 'Script name to run.'),
  4542. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  4543. new InputOption('timeout', null, InputOption::VALUE_REQUIRED, 'Sets script timeout in seconds, or 0 for never.'),
  4544. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  4545. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  4546. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List scripts.'),
  4547. ))
  4548. ->setHelp(
  4549. <<<EOT
  4550. The <info>run-script</info> command runs scripts defined in composer.json:
  4551. <info>php composer.phar run-script post-update-cmd</info>
  4552. EOT
  4553. )
  4554. ;
  4555. }
  4556. protected function execute(InputInterface $input, OutputInterface $output)
  4557. {
  4558. if ($input->getOption('list')) {
  4559. return $this->listScripts($output);
  4560. } elseif (!$input->getArgument('script')) {
  4561. throw new \RuntimeException('Missing required argument "script"');
  4562. }
  4563. $script = $input->getArgument('script');
  4564. if (!in_array($script, $this->scriptEvents)) {
  4565. if (defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  4566. throw new \InvalidArgumentException(sprintf('Script "%s" cannot be run with this command', $script));
  4567. }
  4568. }
  4569. $composer = $this->getComposer();
  4570. $devMode = $input->getOption('dev') || !$input->getOption('no-dev');
  4571. $event = new ScriptEvent($script, $composer, $this->getIO(), $devMode);
  4572. $hasListeners = $composer->getEventDispatcher()->hasEventListeners($event);
  4573. if (!$hasListeners) {
  4574. throw new \InvalidArgumentException(sprintf('Script "%s" is not defined in this package', $script));
  4575. }
  4576. $args = $input->getArgument('args');
  4577. if (null !== $timeout = $input->getOption('timeout')) {
  4578. if (!ctype_digit($timeout)) {
  4579. throw new \RuntimeException('Timeout value must be numeric and positive if defined, or 0 for forever');
  4580. }
  4581. ProcessExecutor::setTimeout((int) $timeout);
  4582. }
  4583. return $composer->getEventDispatcher()->dispatchScript($script, $devMode, $args);
  4584. }
  4585. protected function listScripts(OutputInterface $output)
  4586. {
  4587. $scripts = $this->getComposer()->getPackage()->getScripts();
  4588. if (!count($scripts)) {
  4589. return 0;
  4590. }
  4591. $io = $this->getIO();
  4592. $io->writeError('<info>scripts:</info>');
  4593. $table = array();
  4594. foreach ($scripts as $name => $script) {
  4595. $description = '';
  4596. try {
  4597. $cmd = $this->getApplication()->find($name);
  4598. if ($cmd instanceof ScriptAliasCommand) {
  4599. $description = $cmd->getDescription();
  4600. }
  4601. } catch (\Symfony\Component\Console\Exception\CommandNotFoundException $e) {
  4602. }
  4603. $table[] = array(' '.$name, $description);
  4604. }
  4605. $renderer = new Table($output);
  4606. $renderer->setStyle('compact');
  4607. $rendererStyle = $renderer->getStyle();
  4608. $rendererStyle->setVerticalBorderChar('');
  4609. $rendererStyle->setCellRowContentFormat('%s ');
  4610. $renderer->setRows($table)->render();
  4611. return 0;
  4612. }
  4613. }
  4614. <?php
  4615. namespace Composer\Command;
  4616. use Symfony\Component\Console\Input\InputInterface;
  4617. use Symfony\Component\Console\Input\InputOption;
  4618. use Symfony\Component\Console\Input\InputArgument;
  4619. use Symfony\Component\Console\Output\OutputInterface;
  4620. class ScriptAliasCommand extends BaseCommand
  4621. {
  4622. private $script;
  4623. private $description;
  4624. public function __construct($script, $description)
  4625. {
  4626. $this->script = $script;
  4627. $this->description = empty($description) ? 'Runs the '.$script.' script as defined in composer.json.' : $description;
  4628. parent::__construct();
  4629. }
  4630. protected function configure()
  4631. {
  4632. $this
  4633. ->setName($this->script)
  4634. ->setDescription($this->description)
  4635. ->setDefinition(array(
  4636. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  4637. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  4638. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  4639. ))
  4640. ->setHelp(
  4641. <<<EOT
  4642. The <info>run-script</info> command runs scripts defined in composer.json:
  4643. <info>php composer.phar run-script post-update-cmd</info>
  4644. EOT
  4645. )
  4646. ;
  4647. }
  4648. protected function execute(InputInterface $input, OutputInterface $output)
  4649. {
  4650. $composer = $this->getComposer();
  4651. $args = $input->getArguments();
  4652. return $composer->getEventDispatcher()->dispatchScript($this->script, $input->getOption('dev') || !$input->getOption('no-dev'), $args['args']);
  4653. }
  4654. }
  4655. <?php
  4656. namespace Composer\Command;
  4657. use Composer\Factory;
  4658. use Symfony\Component\Console\Input\InputInterface;
  4659. use Symfony\Component\Console\Input\InputArgument;
  4660. use Symfony\Component\Console\Input\InputOption;
  4661. use Symfony\Component\Console\Output\OutputInterface;
  4662. use Composer\Repository\CompositeRepository;
  4663. use Composer\Repository\PlatformRepository;
  4664. use Composer\Repository\RepositoryInterface;
  4665. use Composer\Plugin\CommandEvent;
  4666. use Composer\Plugin\PluginEvents;
  4667. class SearchCommand extends BaseCommand
  4668. {
  4669. protected $matches;
  4670. protected $lowMatches = array();
  4671. protected $tokens;
  4672. protected $output;
  4673. protected $onlyName;
  4674. protected function configure()
  4675. {
  4676. $this
  4677. ->setName('search')
  4678. ->setDescription('Searches for packages.')
  4679. ->setDefinition(array(
  4680. new InputOption('only-name', 'N', InputOption::VALUE_NONE, 'Search only in name'),
  4681. new InputOption('type', 't', InputOption::VALUE_REQUIRED, 'Search for a specific package type'),
  4682. new InputArgument('tokens', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'tokens to search for'),
  4683. ))
  4684. ->setHelp(
  4685. <<<EOT
  4686. The search command searches for packages by its name
  4687. <info>php composer.phar search symfony composer</info>
  4688. EOT
  4689. )
  4690. ;
  4691. }
  4692. protected function execute(InputInterface $input, OutputInterface $output)
  4693. {
  4694. $platformRepo = new PlatformRepository;
  4695. $io = $this->getIO();
  4696. if (!($composer = $this->getComposer(false))) {
  4697. $composer = Factory::create($this->getIO(), array(), $input->hasParameterOption('--no-plugins'));
  4698. }
  4699. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  4700. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  4701. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  4702. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'search', $input, $output);
  4703. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4704. $onlyName = $input->getOption('only-name');
  4705. $type = $input->getOption('type') ?: null;
  4706. $flags = $onlyName ? RepositoryInterface::SEARCH_NAME : RepositoryInterface::SEARCH_FULLTEXT;
  4707. $results = $repos->search(implode(' ', $input->getArgument('tokens')), $flags, $type);
  4708. foreach ($results as $result) {
  4709. $io->write($result['name'] . (isset($result['description']) ? ' '. $result['description'] : ''));
  4710. }
  4711. }
  4712. }
  4713. <?php
  4714. namespace Composer\Command;
  4715. use Composer\Composer;
  4716. use Composer\Factory;
  4717. use Composer\Config;
  4718. use Composer\Util\Filesystem;
  4719. use Composer\SelfUpdate\Keys;
  4720. use Composer\SelfUpdate\Versions;
  4721. use Composer\IO\IOInterface;
  4722. use Composer\Downloader\FilesystemException;
  4723. use Symfony\Component\Console\Input\InputInterface;
  4724. use Symfony\Component\Console\Input\InputOption;
  4725. use Symfony\Component\Console\Input\InputArgument;
  4726. use Symfony\Component\Console\Output\OutputInterface;
  4727. use Symfony\Component\Finder\Finder;
  4728. class SelfUpdateCommand extends BaseCommand
  4729. {
  4730. const HOMEPAGE = 'getcomposer.org';
  4731. const OLD_INSTALL_EXT = '-old.phar';
  4732. protected function configure()
  4733. {
  4734. $this
  4735. ->setName('self-update')
  4736. ->setAliases(array('selfupdate'))
  4737. ->setDescription('Updates composer.phar to the latest version.')
  4738. ->setDefinition(array(
  4739. new InputOption('rollback', 'r', InputOption::VALUE_NONE, 'Revert to an older installation of composer'),
  4740. new InputOption('clean-backups', null, InputOption::VALUE_NONE, 'Delete old backups during an update. This makes the current version of composer the only backup available after the update'),
  4741. new InputArgument('version', InputArgument::OPTIONAL, 'The version to update to'),
  4742. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4743. new InputOption('update-keys', null, InputOption::VALUE_NONE, 'Prompt user for a key update'),
  4744. new InputOption('stable', null, InputOption::VALUE_NONE, 'Force an update to the stable channel'),
  4745. new InputOption('preview', null, InputOption::VALUE_NONE, 'Force an update to the preview channel'),
  4746. new InputOption('snapshot', null, InputOption::VALUE_NONE, 'Force an update to the snapshot channel'),
  4747. new InputOption('set-channel-only', null, InputOption::VALUE_NONE, 'Only store the channel as the default one and then exit'),
  4748. ))
  4749. ->setHelp(
  4750. <<<EOT
  4751. The <info>self-update</info> command checks getcomposer.org for newer
  4752. versions of composer and if found, installs the latest.
  4753. <info>php composer.phar self-update</info>
  4754. EOT
  4755. )
  4756. ;
  4757. }
  4758. protected function execute(InputInterface $input, OutputInterface $output)
  4759. {
  4760. $config = Factory::createConfig();
  4761. if ($config->get('disable-tls') === true) {
  4762. $baseUrl = 'http://' . self::HOMEPAGE;
  4763. } else {
  4764. $baseUrl = 'https://' . self::HOMEPAGE;
  4765. }
  4766. $io = $this->getIO();
  4767. $remoteFilesystem = Factory::createRemoteFilesystem($io, $config);
  4768. $versionsUtil = new Versions($config, $remoteFilesystem);
  4769. foreach (array('stable', 'preview', 'snapshot') as $channel) {
  4770. if ($input->getOption($channel)) {
  4771. $versionsUtil->setChannel($channel);
  4772. }
  4773. }
  4774. if ($input->getOption('set-channel-only')) {
  4775. return 0;
  4776. }
  4777. $cacheDir = $config->get('cache-dir');
  4778. $rollbackDir = $config->get('data-dir');
  4779. $home = $config->get('home');
  4780. $localFilename = realpath($_SERVER['argv'][0]) ?: $_SERVER['argv'][0];
  4781. if ($input->getOption('update-keys')) {
  4782. return $this->fetchKeys($io, $config);
  4783. }
  4784. $tmpDir = is_writable(dirname($localFilename)) ? dirname($localFilename) : $cacheDir;
  4785. if (!is_writable($tmpDir)) {
  4786. throw new FilesystemException('Composer update failed: the "'.$tmpDir.'" directory used to download the temp file could not be written');
  4787. }
  4788. if (function_exists('posix_getpwuid') && function_exists('posix_geteuid')) {
  4789. $composeUser = posix_getpwuid(posix_geteuid());
  4790. $homeOwner = posix_getpwuid(fileowner($home));
  4791. if (isset($composeUser['name']) && isset($homeOwner['name']) && $composeUser['name'] !== $homeOwner['name']) {
  4792. $io->writeError('<warning>You are running composer as "'.$composeUser['name'].'", while "'.$home.'" is owned by "'.$homeOwner['name'].'"</warning>');
  4793. }
  4794. }
  4795. if ($input->getOption('rollback')) {
  4796. return $this->rollback($output, $rollbackDir, $localFilename);
  4797. }
  4798. $latest = $versionsUtil->getLatest();
  4799. $latestVersion = $latest['version'];
  4800. $updateVersion = $input->getArgument('version') ?: $latestVersion;
  4801. if (preg_match('{^[0-9a-f]{40}$}', $updateVersion) && $updateVersion !== $latestVersion) {
  4802. $io->writeError('<error>You can not update to a specific SHA-1 as those phars are not available for download</error>');
  4803. return 1;
  4804. }
  4805. if (Composer::VERSION === $updateVersion) {
  4806. $io->writeError(sprintf('<info>You are already using composer version %s (%s channel).</info>', $updateVersion, $versionsUtil->getChannel()));
  4807. if ($input->getOption('clean-backups')) {
  4808. $this->cleanBackups($rollbackDir, $this->getLastBackupVersion($rollbackDir));
  4809. }
  4810. return 0;
  4811. }
  4812. $tempFilename = $tmpDir . '/' . basename($localFilename, '.phar').'-temp.phar';
  4813. $backupFile = sprintf(
  4814. '%s/%s-%s%s',
  4815. $rollbackDir,
  4816. strtr(Composer::RELEASE_DATE, ' :', '_-'),
  4817. preg_replace('{^([0-9a-f]{7})[0-9a-f]{33}$}', '$1', Composer::VERSION),
  4818. self::OLD_INSTALL_EXT
  4819. );
  4820. $updatingToTag = !preg_match('{^[0-9a-f]{40}$}', $updateVersion);
  4821. $io->write(sprintf("Updating to version <info>%s</info> (%s channel).", $updateVersion, $versionsUtil->getChannel()));
  4822. $remoteFilename = $baseUrl . ($updatingToTag ? "/download/{$updateVersion}/composer.phar" : '/composer.phar');
  4823. $signature = $remoteFilesystem->getContents(self::HOMEPAGE, $remoteFilename.'.sig', false);
  4824. $io->writeError(' ', false);
  4825. $remoteFilesystem->copy(self::HOMEPAGE, $remoteFilename, $tempFilename, !$input->getOption('no-progress'));
  4826. $io->writeError('');
  4827. if (!file_exists($tempFilename) || !$signature) {
  4828. $io->writeError('<error>The download of the new composer version failed for an unexpected reason</error>');
  4829. return 1;
  4830. }
  4831. if (!extension_loaded('openssl') && $config->get('disable-tls')) {
  4832. $io->writeError('<warning>Skipping phar signature verification as you have disabled OpenSSL via config.disable-tls</warning>');
  4833. } else {
  4834. if (!extension_loaded('openssl')) {
  4835. throw new \RuntimeException('The openssl extension is required for phar signatures to be verified but it is not available. '
  4836. . 'If you can not enable the openssl extension, you can disable this error, at your own risk, by setting the \'disable-tls\' option to true.');
  4837. }
  4838. $sigFile = 'file://'.$home.'/' . ($updatingToTag ? 'keys.tags.pub' : 'keys.dev.pub');
  4839. if (!file_exists($sigFile)) {
  4840. file_put_contents(
  4841. $home.'/keys.dev.pub',
  4842. <<<DEVPUBKEY
  4843. -----BEGIN PUBLIC KEY-----
  4844. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnBDHjZS6e0ZMoK3xTD7f
  4845. FNCzlXjX/Aie2dit8QXA03pSrOTbaMnxON3hUL47Lz3g1SC6YJEMVHr0zYq4elWi
  4846. i3ecFEgzLcj+pZM5X6qWu2Ozz4vWx3JYo1/a/HYdOuW9e3lwS8VtS0AVJA+U8X0A
  4847. hZnBmGpltHhO8hPKHgkJtkTUxCheTcbqn4wGHl8Z2SediDcPTLwqezWKUfrYzu1f
  4848. o/j3WFwFs6GtK4wdYtiXr+yspBZHO3y1udf8eFFGcb2V3EaLOrtfur6XQVizjOuk
  4849. 8lw5zzse1Qp/klHqbDRsjSzJ6iL6F4aynBc6Euqt/8ccNAIz0rLjLhOraeyj4eNn
  4850. 8iokwMKiXpcrQLTKH+RH1JCuOVxQ436bJwbSsp1VwiqftPQieN+tzqy+EiHJJmGf
  4851. TBAbWcncicCk9q2md+AmhNbvHO4PWbbz9TzC7HJb460jyWeuMEvw3gNIpEo2jYa9
  4852. pMV6cVqnSa+wOc0D7pC9a6bne0bvLcm3S+w6I5iDB3lZsb3A9UtRiSP7aGSo7D72
  4853. 8tC8+cIgZcI7k9vjvOqH+d7sdOU2yPCnRY6wFh62/g8bDnUpr56nZN1G89GwM4d4
  4854. r/TU7BQQIzsZgAiqOGXvVklIgAMiV0iucgf3rNBLjjeNEwNSTTG9F0CtQ+7JLwaE
  4855. wSEuAuRm+pRqi8BRnQ/GKUcCAwEAAQ==
  4856. -----END PUBLIC KEY-----
  4857. DEVPUBKEY
  4858. );
  4859. file_put_contents(
  4860. $home.'/keys.tags.pub',
  4861. <<<TAGSPUBKEY
  4862. -----BEGIN PUBLIC KEY-----
  4863. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0Vi/2K6apCVj76nCnCl2
  4864. MQUPdK+A9eqkYBacXo2wQBYmyVlXm2/n/ZsX6pCLYPQTHyr5jXbkQzBw8SKqPdlh
  4865. vA7NpbMeNCz7wP/AobvUXM8xQuXKbMDTY2uZ4O7sM+PfGbptKPBGLe8Z8d2sUnTO
  4866. bXtX6Lrj13wkRto7st/w/Yp33RHe9SlqkiiS4MsH1jBkcIkEHsRaveZzedUaxY0M
  4867. mba0uPhGUInpPzEHwrYqBBEtWvP97t2vtfx8I5qv28kh0Y6t+jnjL1Urid2iuQZf
  4868. noCMFIOu4vksK5HxJxxrN0GOmGmwVQjOOtxkwikNiotZGPR4KsVj8NnBrLX7oGuM
  4869. nQvGciiu+KoC2r3HDBrpDeBVdOWxDzT5R4iI0KoLzFh2pKqwbY+obNPS2bj+2dgJ
  4870. rV3V5Jjry42QOCBN3c88wU1PKftOLj2ECpewY6vnE478IipiEu7EAdK8Zwj2LmTr
  4871. RKQUSa9k7ggBkYZWAeO/2Ag0ey3g2bg7eqk+sHEq5ynIXd5lhv6tC5PBdHlWipDK
  4872. tl2IxiEnejnOmAzGVivE1YGduYBjN+mjxDVy8KGBrjnz1JPgAvgdwJ2dYw4Rsc/e
  4873. TzCFWGk/HM6a4f0IzBWbJ5ot0PIi4amk07IotBXDWwqDiQTwyuGCym5EqWQ2BD95
  4874. RGv89BPD+2DLnJysngsvVaUCAwEAAQ==
  4875. -----END PUBLIC KEY-----
  4876. TAGSPUBKEY
  4877. );
  4878. }
  4879. $pubkeyid = openssl_pkey_get_public($sigFile);
  4880. $algo = defined('OPENSSL_ALGO_SHA384') ? OPENSSL_ALGO_SHA384 : 'SHA384';
  4881. if (!in_array('sha384', array_map('strtolower', openssl_get_md_methods()))) {
  4882. throw new \RuntimeException('SHA384 is not supported by your openssl extension, could not verify the phar file integrity');
  4883. }
  4884. $signature = json_decode($signature, true);
  4885. $signature = base64_decode($signature['sha384']);
  4886. $verified = 1 === openssl_verify(file_get_contents($tempFilename), $signature, $pubkeyid, $algo);
  4887. openssl_free_key($pubkeyid);
  4888. if (!$verified) {
  4889. throw new \RuntimeException('The phar signature did not match the file you downloaded, this means your public keys are outdated or that the phar file is corrupt/has been modified');
  4890. }
  4891. }
  4892. if ($input->getOption('clean-backups')) {
  4893. $this->cleanBackups($rollbackDir);
  4894. }
  4895. if ($err = $this->setLocalPhar($localFilename, $tempFilename, $backupFile)) {
  4896. @unlink($tempFilename);
  4897. $io->writeError('<error>The file is corrupted ('.$err->getMessage().').</error>');
  4898. $io->writeError('<error>Please re-run the self-update command to try again.</error>');
  4899. return 1;
  4900. }
  4901. if (file_exists($backupFile)) {
  4902. $io->writeError(sprintf(
  4903. 'Use <info>composer self-update --rollback</info> to return to version <comment>%s</comment>',
  4904. Composer::VERSION
  4905. ));
  4906. } else {
  4907. $io->writeError('<warning>A backup of the current version could not be written to '.$backupFile.', no rollback possible</warning>');
  4908. }
  4909. }
  4910. protected function fetchKeys(IOInterface $io, Config $config)
  4911. {
  4912. if (!$io->isInteractive()) {
  4913. throw new \RuntimeException('Public keys can not be fetched in non-interactive mode, please run Composer interactively');
  4914. }
  4915. $io->write('Open <info>https://composer.github.io/pubkeys.html</info> to find the latest keys');
  4916. $validator = function ($value) {
  4917. if (!preg_match('{^-----BEGIN PUBLIC KEY-----$}', trim($value))) {
  4918. throw new \UnexpectedValueException('Invalid input');
  4919. }
  4920. return trim($value)."\n";
  4921. };
  4922. $devKey = '';
  4923. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $devKey, $match)) {
  4924. $devKey = $io->askAndValidate('Enter Dev / Snapshot Public Key (including lines with -----): ', $validator);
  4925. while ($line = $io->ask('')) {
  4926. $devKey .= trim($line)."\n";
  4927. if (trim($line) === '-----END PUBLIC KEY-----') {
  4928. break;
  4929. }
  4930. }
  4931. }
  4932. file_put_contents($keyPath = $config->get('home').'/keys.dev.pub', $match[0]);
  4933. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  4934. $tagsKey = '';
  4935. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $tagsKey, $match)) {
  4936. $tagsKey = $io->askAndValidate('Enter Tags Public Key (including lines with -----): ', $validator);
  4937. while ($line = $io->ask('')) {
  4938. $tagsKey .= trim($line)."\n";
  4939. if (trim($line) === '-----END PUBLIC KEY-----') {
  4940. break;
  4941. }
  4942. }
  4943. }
  4944. file_put_contents($keyPath = $config->get('home').'/keys.tags.pub', $match[0]);
  4945. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  4946. $io->write('Public keys stored in '.$config->get('home'));
  4947. }
  4948. protected function rollback(OutputInterface $output, $rollbackDir, $localFilename)
  4949. {
  4950. $rollbackVersion = $this->getLastBackupVersion($rollbackDir);
  4951. if (!$rollbackVersion) {
  4952. throw new \UnexpectedValueException('Composer rollback failed: no installation to roll back to in "'.$rollbackDir.'"');
  4953. }
  4954. $oldFile = $rollbackDir . '/' . $rollbackVersion . self::OLD_INSTALL_EXT;
  4955. if (!is_file($oldFile)) {
  4956. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be found');
  4957. }
  4958. if (!is_readable($oldFile)) {
  4959. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be read');
  4960. }
  4961. $io = $this->getIO();
  4962. $io->writeError(sprintf("Rolling back to version <info>%s</info>.", $rollbackVersion));
  4963. if ($err = $this->setLocalPhar($localFilename, $oldFile)) {
  4964. $io->writeError('<error>The backup file was corrupted ('.$err->getMessage().').</error>');
  4965. return 1;
  4966. }
  4967. return 0;
  4968. }
  4969. protected function setLocalPhar($localFilename, $newFilename, $backupTarget = null)
  4970. {
  4971. try {
  4972. @chmod($newFilename, fileperms($localFilename));
  4973. if (!ini_get('phar.readonly')) {
  4974. $phar = new \Phar($newFilename);
  4975. unset($phar);
  4976. }
  4977. if ($backupTarget && file_exists($localFilename)) {
  4978. @copy($localFilename, $backupTarget);
  4979. }
  4980. rename($newFilename, $localFilename);
  4981. return null;
  4982. } catch (\Exception $e) {
  4983. if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) {
  4984. throw $e;
  4985. }
  4986. return $e;
  4987. }
  4988. }
  4989. protected function cleanBackups($rollbackDir, $except = null)
  4990. {
  4991. $finder = $this->getOldInstallationFinder($rollbackDir);
  4992. $io = $this->getIO();
  4993. $fs = new Filesystem;
  4994. foreach ($finder as $file) {
  4995. if ($except && $file->getBasename(self::OLD_INSTALL_EXT) === $except) {
  4996. continue;
  4997. }
  4998. $file = (string) $file;
  4999. $io->writeError('<info>Removing: '.$file.'</info>');
  5000. $fs->remove($file);
  5001. }
  5002. }
  5003. protected function getLastBackupVersion($rollbackDir)
  5004. {
  5005. $finder = $this->getOldInstallationFinder($rollbackDir);
  5006. $finder->sortByName();
  5007. $files = iterator_to_array($finder);
  5008. if (count($files)) {
  5009. return basename(end($files), self::OLD_INSTALL_EXT);
  5010. }
  5011. return false;
  5012. }
  5013. protected function getOldInstallationFinder($rollbackDir)
  5014. {
  5015. $finder = Finder::create()
  5016. ->depth(0)
  5017. ->files()
  5018. ->name('*' . self::OLD_INSTALL_EXT)
  5019. ->in($rollbackDir);
  5020. return $finder;
  5021. }
  5022. }
  5023. <?php
  5024. namespace Composer\Command;
  5025. use Composer\Composer;
  5026. use Composer\DependencyResolver\DefaultPolicy;
  5027. use Composer\DependencyResolver\Pool;
  5028. use Composer\Json\JsonFile;
  5029. use Composer\Package\BasePackage;
  5030. use Composer\Package\CompletePackageInterface;
  5031. use Composer\Package\PackageInterface;
  5032. use Composer\Package\Version\VersionParser;
  5033. use Composer\Package\Version\VersionSelector;
  5034. use Composer\Plugin\CommandEvent;
  5035. use Composer\Plugin\PluginEvents;
  5036. use Composer\Repository\ArrayRepository;
  5037. use Composer\Repository\ComposerRepository;
  5038. use Composer\Repository\CompositeRepository;
  5039. use Composer\Repository\PlatformRepository;
  5040. use Composer\Repository\RepositoryFactory;
  5041. use Composer\Repository\RepositoryInterface;
  5042. use Composer\Semver\Constraint\ConstraintInterface;
  5043. use Composer\Semver\Semver;
  5044. use Composer\Spdx\SpdxLicenses;
  5045. use Composer\Util\Platform;
  5046. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  5047. use Symfony\Component\Console\Input\InputArgument;
  5048. use Symfony\Component\Console\Input\InputInterface;
  5049. use Symfony\Component\Console\Input\InputOption;
  5050. use Symfony\Component\Console\Output\OutputInterface;
  5051. use Symfony\Component\Console\Terminal;
  5052. class ShowCommand extends BaseCommand
  5053. {
  5054. protected $versionParser;
  5055. protected $colors;
  5056. private $pool;
  5057. protected function configure()
  5058. {
  5059. $this
  5060. ->setName('show')
  5061. ->setAliases(array('info'))
  5062. ->setDescription('Shows information about packages.')
  5063. ->setDefinition(array(
  5064. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  5065. new InputArgument('version', InputArgument::OPTIONAL, 'Version or version constraint to inspect'),
  5066. new InputOption('all', null, InputOption::VALUE_NONE, 'List all packages'),
  5067. new InputOption('installed', 'i', InputOption::VALUE_NONE, 'List installed packages only (enabled by default, only present for BC).'),
  5068. new InputOption('platform', 'p', InputOption::VALUE_NONE, 'List platform packages only'),
  5069. new InputOption('available', 'a', InputOption::VALUE_NONE, 'List available packages only'),
  5070. new InputOption('self', 's', InputOption::VALUE_NONE, 'Show the root package information'),
  5071. new InputOption('name-only', 'N', InputOption::VALUE_NONE, 'List package names only'),
  5072. new InputOption('path', 'P', InputOption::VALUE_NONE, 'Show package paths'),
  5073. new InputOption('tree', 't', InputOption::VALUE_NONE, 'List the dependencies as a tree'),
  5074. new InputOption('latest', 'l', InputOption::VALUE_NONE, 'Show the latest version'),
  5075. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show the latest version but only for packages that are outdated'),
  5076. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
  5077. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  5078. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  5079. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  5080. ))
  5081. ->setHelp(
  5082. <<<EOT
  5083. The show command displays detailed information about a package, or
  5084. lists all packages available.
  5085. EOT
  5086. )
  5087. ;
  5088. }
  5089. protected function execute(InputInterface $input, OutputInterface $output)
  5090. {
  5091. $this->versionParser = new VersionParser;
  5092. if ($input->getOption('tree')) {
  5093. $this->initStyles($output);
  5094. }
  5095. $composer = $this->getComposer(false);
  5096. $io = $this->getIO();
  5097. if ($input->getOption('installed')) {
  5098. $io->writeError('<warning>You are using the deprecated option "installed". Only installed packages are shown by default now. The --all option can be used to show all packages.</warning>');
  5099. }
  5100. if ($input->getOption('outdated')) {
  5101. $input->setOption('latest', true);
  5102. }
  5103. if ($input->getOption('direct') && ($input->getOption('all') || $input->getOption('available') || $input->getOption('platform'))) {
  5104. $io->writeError('The --direct (-D) option is not usable in combination with --all, --platform (-p) or --available (-a)');
  5105. return 1;
  5106. }
  5107. if ($input->getOption('tree') && ($input->getOption('all') || $input->getOption('available'))) {
  5108. $io->writeError('The --tree (-t) option is not usable in combination with --all or --available (-a)');
  5109. return 1;
  5110. }
  5111. if ($input->getOption('tree') && $input->getOption('latest')) {
  5112. $io->writeError('The --tree (-t) option is not usable in combination with --latest (-l)');
  5113. return 1;
  5114. }
  5115. $format = $input->getOption('format');
  5116. if (!in_array($format, array('text', 'json'))) {
  5117. $io->writeError(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  5118. return 1;
  5119. }
  5120. $platformOverrides = array();
  5121. if ($composer) {
  5122. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  5123. }
  5124. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  5125. $phpVersion = $platformRepo->findPackage('php', '*')->getVersion();
  5126. if ($input->getOption('self')) {
  5127. $package = $this->getComposer()->getPackage();
  5128. $repos = $installedRepo = new ArrayRepository(array($package));
  5129. } elseif ($input->getOption('platform')) {
  5130. $repos = $installedRepo = $platformRepo;
  5131. } elseif ($input->getOption('available')) {
  5132. $installedRepo = $platformRepo;
  5133. if ($composer) {
  5134. $repos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
  5135. } else {
  5136. $defaultRepos = RepositoryFactory::defaultRepos($io);
  5137. $repos = new CompositeRepository($defaultRepos);
  5138. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  5139. }
  5140. } elseif ($input->getOption('all') && $composer) {
  5141. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  5142. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  5143. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  5144. } elseif ($input->getOption('all')) {
  5145. $defaultRepos = RepositoryFactory::defaultRepos($io);
  5146. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  5147. $installedRepo = $platformRepo;
  5148. $repos = new CompositeRepository(array_merge(array($installedRepo), $defaultRepos));
  5149. } else {
  5150. $repos = $installedRepo = $this->getComposer()->getRepositoryManager()->getLocalRepository();
  5151. $rootPkg = $this->getComposer()->getPackage();
  5152. if (!$installedRepo->getPackages() && ($rootPkg->getRequires() || $rootPkg->getDevRequires())) {
  5153. $io->writeError('<warning>No dependencies installed. Try running composer install or update.</warning>');
  5154. }
  5155. }
  5156. if ($composer) {
  5157. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'show', $input, $output);
  5158. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5159. }
  5160. if ($input->getOption('latest') && null === $composer) {
  5161. $io->writeError('No composer.json found in the current directory, disabling "latest" option');
  5162. $input->setOption('latest', false);
  5163. }
  5164. $packageFilter = $input->getArgument('package');
  5165. if (($packageFilter && false === strpos($packageFilter, '*')) || !empty($package)) {
  5166. if (empty($package)) {
  5167. list($package, $versions) = $this->getPackage($installedRepo, $repos, $input->getArgument('package'), $input->getArgument('version'));
  5168. if (empty($package)) {
  5169. $options = $input->getOptions();
  5170. if (!isset($options['working-dir']) || !file_exists('composer.json')) {
  5171. throw new \InvalidArgumentException('Package ' . $packageFilter . ' not found');
  5172. }
  5173. $io->writeError('Package ' . $packageFilter . ' not found in ' . $options['working-dir'] . '/composer.json');
  5174. return 1;
  5175. }
  5176. } else {
  5177. $versions = array($package->getPrettyVersion() => $package->getVersion());
  5178. }
  5179. $exitCode = 0;
  5180. if ($input->getOption('tree')) {
  5181. $arrayTree = $this->generatePackageTree($package, $installedRepo, $repos);
  5182. if ('json' === $format) {
  5183. $io->write(JsonFile::encode(array('installed' => array($arrayTree))));
  5184. } else {
  5185. $this->displayPackageTree(array($arrayTree));
  5186. }
  5187. } else {
  5188. $latestPackage = null;
  5189. if ($input->getOption('latest')) {
  5190. $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion);
  5191. }
  5192. if ($input->getOption('outdated') && $input->getOption('strict') && $latestPackage && $latestPackage->getFullPrettyVersion() !== $package->getFullPrettyVersion() && !$latestPackage->isAbandoned()) {
  5193. $exitCode = 1;
  5194. }
  5195. if ($input->getOption('path')) {
  5196. $io->write($package->getName(), false);
  5197. $io->write(' ' . strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n"));
  5198. return $exitCode;
  5199. }
  5200. $this->printMeta($package, $versions, $installedRepo, $latestPackage ?: null);
  5201. $this->printLinks($package, 'requires');
  5202. $this->printLinks($package, 'devRequires', 'requires (dev)');
  5203. if ($package->getSuggests()) {
  5204. $io->write("\n<info>suggests</info>");
  5205. foreach ($package->getSuggests() as $suggested => $reason) {
  5206. $io->write($suggested . ' <comment>' . $reason . '</comment>');
  5207. }
  5208. }
  5209. $this->printLinks($package, 'provides');
  5210. $this->printLinks($package, 'conflicts');
  5211. $this->printLinks($package, 'replaces');
  5212. }
  5213. return $exitCode;
  5214. }
  5215. if ($input->getOption('tree')) {
  5216. $rootRequires = $this->getRootRequires();
  5217. $packages = $installedRepo->getPackages();
  5218. usort($packages, 'strcmp');
  5219. $arrayTree = array();
  5220. foreach ($packages as $package) {
  5221. if (in_array($package->getName(), $rootRequires, true)) {
  5222. $arrayTree[] = $this->generatePackageTree($package, $installedRepo, $repos);
  5223. }
  5224. }
  5225. if ('json' === $format) {
  5226. $io->write(JsonFile::encode(array('installed' => $arrayTree)));
  5227. } else {
  5228. $this->displayPackageTree($arrayTree);
  5229. }
  5230. return 0;
  5231. }
  5232. if ($repos instanceof CompositeRepository) {
  5233. $repos = $repos->getRepositories();
  5234. } elseif (!is_array($repos)) {
  5235. $repos = array($repos);
  5236. }
  5237. $packages = array();
  5238. if (null !== $packageFilter) {
  5239. $packageFilter = '{^'.str_replace('\\*', '.*?', preg_quote($packageFilter)).'$}i';
  5240. }
  5241. $packageListFilter = array();
  5242. if ($input->getOption('direct')) {
  5243. $packageListFilter = $this->getRootRequires();
  5244. }
  5245. if (class_exists('Symfony\Component\Console\Terminal')) {
  5246. $terminal = new Terminal();
  5247. $width = $terminal->getWidth();
  5248. } else {
  5249. list($width) = $this->getApplication()->getTerminalDimensions();
  5250. }
  5251. if (null === $width) {
  5252. $width = PHP_INT_MAX;
  5253. }
  5254. if (Platform::isWindows()) {
  5255. $width--;
  5256. } else {
  5257. $width = max(80, $width);
  5258. }
  5259. if ($input->getOption('path') && null === $composer) {
  5260. $io->writeError('No composer.json found in the current directory, disabling "path" option');
  5261. $input->setOption('path', false);
  5262. }
  5263. foreach ($repos as $repo) {
  5264. if ($repo === $platformRepo) {
  5265. $type = 'platform';
  5266. } elseif (
  5267. $repo === $installedRepo
  5268. || ($installedRepo instanceof CompositeRepository && in_array($repo, $installedRepo->getRepositories(), true))
  5269. ) {
  5270. $type = 'installed';
  5271. } else {
  5272. $type = 'available';
  5273. }
  5274. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  5275. foreach ($repo->getProviderNames() as $name) {
  5276. if (!$packageFilter || preg_match($packageFilter, $name)) {
  5277. $packages[$type][$name] = $name;
  5278. }
  5279. }
  5280. } else {
  5281. foreach ($repo->getPackages() as $package) {
  5282. if (!isset($packages[$type][$package->getName()])
  5283. || !is_object($packages[$type][$package->getName()])
  5284. || version_compare($packages[$type][$package->getName()]->getVersion(), $package->getVersion(), '<')
  5285. ) {
  5286. if (!$packageFilter || preg_match($packageFilter, $package->getName())) {
  5287. if (!$packageListFilter || in_array($package->getName(), $packageListFilter, true)) {
  5288. $packages[$type][$package->getName()] = $package;
  5289. }
  5290. }
  5291. }
  5292. }
  5293. }
  5294. }
  5295. $showAllTypes = $input->getOption('all');
  5296. $showLatest = $input->getOption('latest');
  5297. $showMinorOnly = $input->getOption('minor-only');
  5298. $indent = $showAllTypes ? ' ' : '';
  5299. $latestPackages = array();
  5300. $exitCode = 0;
  5301. $viewData = array();
  5302. $viewMetaData = array();
  5303. foreach (array('platform' => true, 'available' => false, 'installed' => true) as $type => $showVersion) {
  5304. if (isset($packages[$type])) {
  5305. ksort($packages[$type]);
  5306. $nameLength = $versionLength = $latestLength = 0;
  5307. if ($showLatest && $showVersion) {
  5308. foreach ($packages[$type] as $package) {
  5309. if (is_object($package)) {
  5310. $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion, $showMinorOnly);
  5311. if ($latestPackage === false) {
  5312. continue;
  5313. }
  5314. $latestPackages[$package->getPrettyName()] = $latestPackage;
  5315. }
  5316. }
  5317. }
  5318. $writePath = !$input->getOption('name-only') && $input->getOption('path');
  5319. $writeVersion = !$input->getOption('name-only') && !$input->getOption('path') && $showVersion;
  5320. $writeLatest = $writeVersion && $showLatest;
  5321. $writeDescription = !$input->getOption('name-only') && !$input->getOption('path');
  5322. $hasOutdatedPackages = false;
  5323. $viewData[$type] = array();
  5324. foreach ($packages[$type] as $package) {
  5325. $packageViewData = array();
  5326. if (is_object($package)) {
  5327. $latestPackage = null;
  5328. if ($showLatest && isset($latestPackages[$package->getPrettyName()])) {
  5329. $latestPackage = $latestPackages[$package->getPrettyName()];
  5330. }
  5331. if ($input->getOption('outdated') && $latestPackage && $latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion() && !$latestPackage->isAbandoned()) {
  5332. continue;
  5333. } elseif ($input->getOption('outdated') || $input->getOption('strict')) {
  5334. $hasOutdatedPackages = true;
  5335. }
  5336. $packageViewData['name'] = $package->getPrettyName();
  5337. $nameLength = max($nameLength, strlen($package->getPrettyName()));
  5338. if ($writeVersion) {
  5339. $packageViewData['version'] = $package->getFullPrettyVersion();
  5340. $versionLength = max($versionLength, strlen($package->getFullPrettyVersion()));
  5341. }
  5342. if ($writeLatest && $latestPackage) {
  5343. $packageViewData['latest'] = $latestPackage->getFullPrettyVersion();
  5344. $packageViewData['latest-status'] = $this->getUpdateStatus($latestPackage, $package);
  5345. $latestLength = max($latestLength, strlen($latestPackage->getFullPrettyVersion()));
  5346. }
  5347. if ($writeDescription) {
  5348. $packageViewData['description'] = $package->getDescription();
  5349. }
  5350. if ($writePath) {
  5351. $packageViewData['path'] = strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n");
  5352. }
  5353. if ($latestPackage && $latestPackage->isAbandoned()) {
  5354. $replacement = is_string($latestPackage->getReplacementPackage())
  5355. ? 'Use ' . $latestPackage->getReplacementPackage() . ' instead'
  5356. : 'No replacement was suggested';
  5357. $packageWarning = sprintf(
  5358. 'Package %s is abandoned, you should avoid using it. %s.',
  5359. $package->getPrettyName(),
  5360. $replacement
  5361. );
  5362. $packageViewData['warning'] = $packageWarning;
  5363. }
  5364. } else {
  5365. $packageViewData['name'] = $package;
  5366. $nameLength = max($nameLength, strlen($package));
  5367. }
  5368. $viewData[$type][] = $packageViewData;
  5369. }
  5370. $viewMetaData[$type] = array(
  5371. 'nameLength' => $nameLength,
  5372. 'versionLength' => $versionLength,
  5373. 'latestLength' => $latestLength,
  5374. );
  5375. if ($input->getOption('strict') && $hasOutdatedPackages) {
  5376. $exitCode = 1;
  5377. break;
  5378. }
  5379. }
  5380. }
  5381. if ('json' === $format) {
  5382. $io->write(JsonFile::encode($viewData));
  5383. } else {
  5384. foreach ($viewData as $type => $packages) {
  5385. $nameLength = $viewMetaData[$type]['nameLength'];
  5386. $versionLength = $viewMetaData[$type]['versionLength'];
  5387. $latestLength = $viewMetaData[$type]['latestLength'];
  5388. $writeVersion = $nameLength + $versionLength + 3 <= $width;
  5389. $writeLatest = $nameLength + $versionLength + $latestLength + 3 <= $width;
  5390. $writeDescription = $nameLength + $versionLength + $latestLength + 24 <= $width;
  5391. if ($writeLatest && !$io->isDecorated()) {
  5392. $latestLength += 2;
  5393. }
  5394. if ($showAllTypes) {
  5395. if ('available' === $type) {
  5396. $io->write('<comment>' . $type . '</comment>:');
  5397. } else {
  5398. $io->write('<info>' . $type . '</info>:');
  5399. }
  5400. }
  5401. foreach ($packages as $package) {
  5402. $io->write($indent . str_pad($package['name'], $nameLength, ' '), false);
  5403. if (isset($package['version']) && $writeVersion) {
  5404. $io->write(' ' . str_pad($package['version'], $versionLength, ' '), false);
  5405. }
  5406. if (isset($package['latest']) && $writeLatest) {
  5407. $latestVersion = $package['latest'];
  5408. $updateStatus = $package['latest-status'];
  5409. $style = $this->updateStatusToVersionStyle($updateStatus);
  5410. if (!$io->isDecorated()) {
  5411. $latestVersion = str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('=', '!', '~'), $updateStatus) . ' ' . $latestVersion;
  5412. }
  5413. $io->write(' <' . $style . '>' . str_pad($latestVersion, $latestLength, ' ') . '</' . $style . '>', false);
  5414. }
  5415. if (isset($package['description']) && $writeDescription) {
  5416. $description = strtok($package['description'], "\r\n");
  5417. $remaining = $width - $nameLength - $versionLength - 4;
  5418. if ($writeLatest) {
  5419. $remaining -= $latestLength;
  5420. }
  5421. if (strlen($description) > $remaining) {
  5422. $description = substr($description, 0, $remaining - 3) . '...';
  5423. }
  5424. $io->write(' ' . $description, false);
  5425. }
  5426. if (isset($package['path'])) {
  5427. $io->write(' ' . $package['path'], false);
  5428. }
  5429. $io->write('');
  5430. if (isset($package['warning'])) {
  5431. $io->writeError('<warning>' . $package['warning'] . '</warning>');
  5432. }
  5433. }
  5434. if ($showAllTypes) {
  5435. $io->write('');
  5436. }
  5437. }
  5438. }
  5439. return $exitCode;
  5440. }
  5441. protected function getRootRequires()
  5442. {
  5443. $rootPackage = $this->getComposer()->getPackage();
  5444. return array_map(
  5445. 'strtolower',
  5446. array_keys(array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()))
  5447. );
  5448. }
  5449. protected function getVersionStyle(PackageInterface $latestPackage, PackageInterface $package)
  5450. {
  5451. return $this->updateStatusToVersionStyle($this->getUpdateStatus($latestPackage, $package));
  5452. }
  5453. protected function getPackage(RepositoryInterface $installedRepo, RepositoryInterface $repos, $name, $version = null)
  5454. {
  5455. $name = strtolower($name);
  5456. $constraint = is_string($version) ? $this->versionParser->parseConstraints($version) : $version;
  5457. $policy = new DefaultPolicy();
  5458. $pool = new Pool('dev');
  5459. $pool->addRepository($repos);
  5460. $matchedPackage = null;
  5461. $versions = array();
  5462. $matches = $pool->whatProvides($name, $constraint);
  5463. foreach ($matches as $index => $package) {
  5464. if ($package->getName() !== $name) {
  5465. unset($matches[$index]);
  5466. continue;
  5467. }
  5468. if (null === $version && $installedRepo->hasPackage($package)) {
  5469. $matchedPackage = $package;
  5470. }
  5471. $versions[$package->getPrettyVersion()] = $package->getVersion();
  5472. $matches[$index] = $package->getId();
  5473. }
  5474. if (!$matchedPackage && $matches && $preferred = $policy->selectPreferredPackages($pool, array(), $matches)) {
  5475. $matchedPackage = $pool->literalToPackage($preferred[0]);
  5476. }
  5477. return array($matchedPackage, $versions);
  5478. }
  5479. protected function printMeta(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo, PackageInterface $latestPackage = null)
  5480. {
  5481. $io = $this->getIO();
  5482. $io->write('<info>name</info> : ' . $package->getPrettyName());
  5483. $io->write('<info>descrip.</info> : ' . $package->getDescription());
  5484. $io->write('<info>keywords</info> : ' . implode(', ', $package->getKeywords() ?: array()));
  5485. $this->printVersions($package, $versions, $installedRepo);
  5486. if ($latestPackage) {
  5487. $style = $this->getVersionStyle($latestPackage, $package);
  5488. $io->write('<info>latest</info> : <'.$style.'>' . $latestPackage->getPrettyVersion() . '</'.$style.'>');
  5489. } else {
  5490. $latestPackage = $package;
  5491. }
  5492. $io->write('<info>type</info> : ' . $package->getType());
  5493. $this->printLicenses($package);
  5494. $io->write('<info>source</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getSourceType(), $package->getSourceUrl(), $package->getSourceReference()));
  5495. $io->write('<info>dist</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getDistType(), $package->getDistUrl(), $package->getDistReference()));
  5496. if ($installedRepo->hasPackage($package)) {
  5497. $io->write('<info>path</info> : ' . sprintf('%s', realpath($this->getComposer()->getInstallationManager()->getInstallPath($package))));
  5498. }
  5499. $io->write('<info>names</info> : ' . implode(', ', $package->getNames()));
  5500. if ($latestPackage->isAbandoned()) {
  5501. $replacement = ($latestPackage->getReplacementPackage() !== null)
  5502. ? ' The author suggests using the ' . $latestPackage->getReplacementPackage(). ' package instead.'
  5503. : null;
  5504. $io->writeError(
  5505. sprintf('<warning>Attention: This package is abandoned and no longer maintained.%s</warning>', $replacement)
  5506. );
  5507. }
  5508. if ($package->getSupport()) {
  5509. $io->write("\n<info>support</info>");
  5510. foreach ($package->getSupport() as $type => $value) {
  5511. $io->write('<comment>' . $type . '</comment> : '.$value);
  5512. }
  5513. }
  5514. if ($package->getAutoload()) {
  5515. $io->write("\n<info>autoload</info>");
  5516. foreach ($package->getAutoload() as $type => $autoloads) {
  5517. $io->write('<comment>' . $type . '</comment>');
  5518. if ($type === 'psr-0') {
  5519. foreach ($autoloads as $name => $path) {
  5520. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  5521. }
  5522. } elseif ($type === 'psr-4') {
  5523. foreach ($autoloads as $name => $path) {
  5524. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  5525. }
  5526. } elseif ($type === 'classmap') {
  5527. $io->write(implode(', ', $autoloads));
  5528. }
  5529. }
  5530. if ($package->getIncludePaths()) {
  5531. $io->write('<comment>include-path</comment>');
  5532. $io->write(implode(', ', $package->getIncludePaths()));
  5533. }
  5534. }
  5535. }
  5536. protected function printVersions(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo)
  5537. {
  5538. uasort($versions, 'version_compare');
  5539. $versions = array_keys(array_reverse($versions));
  5540. if ($installedRepo->hasPackage($package)) {
  5541. $installedVersion = $package->getPrettyVersion();
  5542. $key = array_search($installedVersion, $versions);
  5543. if (false !== $key) {
  5544. $versions[$key] = '<info>* ' . $installedVersion . '</info>';
  5545. }
  5546. }
  5547. $versions = implode(', ', $versions);
  5548. $this->getIO()->write('<info>versions</info> : ' . $versions);
  5549. }
  5550. protected function printLinks(CompletePackageInterface $package, $linkType, $title = null)
  5551. {
  5552. $title = $title ?: $linkType;
  5553. $io = $this->getIO();
  5554. if ($links = $package->{'get'.ucfirst($linkType)}()) {
  5555. $io->write("\n<info>" . $title . "</info>");
  5556. foreach ($links as $link) {
  5557. $io->write($link->getTarget() . ' <comment>' . $link->getPrettyConstraint() . '</comment>');
  5558. }
  5559. }
  5560. }
  5561. protected function printLicenses(CompletePackageInterface $package)
  5562. {
  5563. $spdxLicenses = new SpdxLicenses();
  5564. $licenses = $package->getLicense();
  5565. $io = $this->getIO();
  5566. foreach ($licenses as $licenseId) {
  5567. $license = $spdxLicenses->getLicenseByIdentifier($licenseId);
  5568. if (!$license) {
  5569. $out = $licenseId;
  5570. } else {
  5571. if ($license[1] === true) {
  5572. $out = sprintf('%s (%s) (OSI approved) %s', $license[0], $licenseId, $license[2]);
  5573. } else {
  5574. $out = sprintf('%s (%s) %s', $license[0], $licenseId, $license[2]);
  5575. }
  5576. }
  5577. $io->write('<info>license</info> : ' . $out);
  5578. }
  5579. }
  5580. protected function initStyles(OutputInterface $output)
  5581. {
  5582. $this->colors = array(
  5583. 'green',
  5584. 'yellow',
  5585. 'cyan',
  5586. 'magenta',
  5587. 'blue',
  5588. );
  5589. foreach ($this->colors as $color) {
  5590. $style = new OutputFormatterStyle($color);
  5591. $output->getFormatter()->setStyle($color, $style);
  5592. }
  5593. }
  5594. protected function displayPackageTree(array $arrayTree)
  5595. {
  5596. $io = $this->getIO();
  5597. foreach ($arrayTree as $package) {
  5598. $io->write(sprintf('<info>%s</info>', $package['name']), false);
  5599. $io->write(' ' . $package['version'], false);
  5600. $io->write(' ' . strtok($package['description'], "\r\n"));
  5601. if (isset($package['requires'])) {
  5602. $requires = $package['requires'];
  5603. $treeBar = '├';
  5604. $j = 0;
  5605. $total = count($requires);
  5606. foreach ($requires as $require) {
  5607. $requireName = $require['name'];
  5608. $j++;
  5609. if ($j === $total) {
  5610. $treeBar = 'â””';
  5611. }
  5612. $level = 1;
  5613. $color = $this->colors[$level];
  5614. $info = sprintf(
  5615. '%s──<%s>%s</%s> %s',
  5616. $treeBar,
  5617. $color,
  5618. $requireName,
  5619. $color,
  5620. $require['version']
  5621. );
  5622. $this->writeTreeLine($info);
  5623. $treeBar = str_replace('â””', ' ', $treeBar);
  5624. $packagesInTree = array($package['name'], $requireName);
  5625. $this->displayTree($require, $packagesInTree, $treeBar, $level + 1);
  5626. }
  5627. }
  5628. }
  5629. }
  5630. protected function generatePackageTree(
  5631. PackageInterface $package,
  5632. RepositoryInterface $installedRepo,
  5633. RepositoryInterface $distantRepos
  5634. ) {
  5635. if (is_object($package)) {
  5636. $requires = $package->getRequires();
  5637. ksort($requires);
  5638. $children = array();
  5639. foreach ($requires as $requireName => $require) {
  5640. $packagesInTree = array($package->getName(), $requireName);
  5641. $treeChildDesc = array(
  5642. 'name' => $requireName,
  5643. 'version' => $require->getPrettyConstraint(),
  5644. );
  5645. $deepChildren = $this->addTree($requireName, $require, $installedRepo, $distantRepos, $packagesInTree);
  5646. if ($deepChildren) {
  5647. $treeChildDesc['requires'] = $deepChildren;
  5648. }
  5649. $children[] = $treeChildDesc;
  5650. }
  5651. $tree = array(
  5652. 'name' => $package->getPrettyName(),
  5653. 'version' => $package->getPrettyVersion(),
  5654. 'description' => $package->getDescription(),
  5655. );
  5656. if ($children) {
  5657. $tree['requires'] = $children;
  5658. }
  5659. return $tree;
  5660. }
  5661. }
  5662. protected function displayTree(
  5663. $package,
  5664. array $packagesInTree,
  5665. $previousTreeBar = '├',
  5666. $level = 1
  5667. ) {
  5668. $previousTreeBar = str_replace('├', '│', $previousTreeBar);
  5669. if (isset($package['requires'])) {
  5670. $requires = $package['requires'];
  5671. $treeBar = $previousTreeBar . ' ├';
  5672. $i = 0;
  5673. $total = count($requires);
  5674. foreach ($requires as $require) {
  5675. $currentTree = $packagesInTree;
  5676. $i++;
  5677. if ($i === $total) {
  5678. $treeBar = $previousTreeBar . ' â””';
  5679. }
  5680. $colorIdent = $level % count($this->colors);
  5681. $color = $this->colors[$colorIdent];
  5682. $circularWarn = in_array(
  5683. $require['name'],
  5684. $currentTree,
  5685. true
  5686. ) ? '(circular dependency aborted here)' : '';
  5687. $info = rtrim(sprintf(
  5688. '%s──<%s>%s</%s> %s %s',
  5689. $treeBar,
  5690. $color,
  5691. $require['name'],
  5692. $color,
  5693. $require['version'],
  5694. $circularWarn
  5695. ));
  5696. $this->writeTreeLine($info);
  5697. $treeBar = str_replace('â””', ' ', $treeBar);
  5698. $currentTree[] = $require['name'];
  5699. $this->displayTree($require, $currentTree, $treeBar, $level + 1);
  5700. }
  5701. }
  5702. }
  5703. protected function addTree(
  5704. $name,
  5705. $package,
  5706. RepositoryInterface $installedRepo,
  5707. RepositoryInterface $distantRepos,
  5708. array $packagesInTree
  5709. ) {
  5710. $children = array();
  5711. list($package, $versions) = $this->getPackage(
  5712. $installedRepo,
  5713. $distantRepos,
  5714. $name,
  5715. $package->getPrettyConstraint() === 'self.version' ? $package->getConstraint() : $package->getPrettyConstraint()
  5716. );
  5717. if (is_object($package)) {
  5718. $requires = $package->getRequires();
  5719. ksort($requires);
  5720. foreach ($requires as $requireName => $require) {
  5721. $currentTree = $packagesInTree;
  5722. $treeChildDesc = array(
  5723. 'name' => $requireName,
  5724. 'version' => $require->getPrettyConstraint(),
  5725. );
  5726. if (!in_array($requireName, $currentTree, true)) {
  5727. $currentTree[] = $requireName;
  5728. $deepChildren = $this->addTree($requireName, $require, $installedRepo, $distantRepos, $currentTree);
  5729. if ($deepChildren) {
  5730. $treeChildDesc['requires'] = $deepChildren;
  5731. }
  5732. }
  5733. $children[] = $treeChildDesc;
  5734. }
  5735. }
  5736. return $children;
  5737. }
  5738. private function updateStatusToVersionStyle($updateStatus)
  5739. {
  5740. return str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('info', 'highlight', 'comment'), $updateStatus);
  5741. }
  5742. private function getUpdateStatus(PackageInterface $latestPackage, PackageInterface $package)
  5743. {
  5744. if ($latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion()) {
  5745. return 'up-to-date';
  5746. }
  5747. $constraint = $package->getVersion();
  5748. if (0 !== strpos($constraint, 'dev-')) {
  5749. $constraint = '^'.$constraint;
  5750. }
  5751. if ($latestPackage->getVersion() && Semver::satisfies($latestPackage->getVersion(), $constraint)) {
  5752. return 'semver-safe-update';
  5753. }
  5754. return 'update-possible';
  5755. }
  5756. private function writeTreeLine($line)
  5757. {
  5758. $io = $this->getIO();
  5759. if (!$io->isDecorated()) {
  5760. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  5761. }
  5762. $io->write($line);
  5763. }
  5764. private function findLatestPackage(PackageInterface $package, Composer $composer, $phpVersion, $minorOnly = false)
  5765. {
  5766. $name = $package->getName();
  5767. $versionSelector = new VersionSelector($this->getPool($composer));
  5768. $stability = $composer->getPackage()->getMinimumStability();
  5769. $flags = $composer->getPackage()->getStabilityFlags();
  5770. if (isset($flags[$name])) {
  5771. $stability = array_search($flags[$name], BasePackage::$stabilities, true);
  5772. }
  5773. $bestStability = $stability;
  5774. if ($composer->getPackage()->getPreferStable()) {
  5775. $bestStability = $package->getStability();
  5776. }
  5777. $targetVersion = null;
  5778. if (0 === strpos($package->getVersion(), 'dev-')) {
  5779. $targetVersion = $package->getVersion();
  5780. }
  5781. if ($targetVersion === null && $minorOnly) {
  5782. $targetVersion = '^' . $package->getVersion();
  5783. }
  5784. return $versionSelector->findBestCandidate($name, $targetVersion, $phpVersion, $bestStability);
  5785. }
  5786. private function getPool(Composer $composer)
  5787. {
  5788. if (!$this->pool) {
  5789. $this->pool = new Pool($composer->getPackage()->getMinimumStability(), $composer->getPackage()->getStabilityFlags());
  5790. $this->pool->addRepository(new CompositeRepository($composer->getRepositoryManager()->getRepositories()));
  5791. }
  5792. return $this->pool;
  5793. }
  5794. }
  5795. <?php
  5796. namespace Composer\Command;
  5797. use Symfony\Component\Console\Input\InputInterface;
  5798. use Symfony\Component\Console\Input\InputOption;
  5799. use Symfony\Component\Console\Output\OutputInterface;
  5800. use Composer\Downloader\ChangeReportInterface;
  5801. use Composer\Downloader\DvcsDownloaderInterface;
  5802. use Composer\Downloader\VcsCapableDownloaderInterface;
  5803. use Composer\Package\Dumper\ArrayDumper;
  5804. use Composer\Package\Version\VersionGuesser;
  5805. use Composer\Package\Version\VersionParser;
  5806. use Composer\Plugin\CommandEvent;
  5807. use Composer\Plugin\PluginEvents;
  5808. use Composer\Script\ScriptEvents;
  5809. use Composer\Util\ProcessExecutor;
  5810. class StatusCommand extends BaseCommand
  5811. {
  5812. const EXIT_CODE_ERRORS = 1;
  5813. const EXIT_CODE_UNPUSHED_CHANGES = 2;
  5814. const EXIT_CODE_VERSION_CHANGES = 4;
  5815. protected function configure()
  5816. {
  5817. $this
  5818. ->setName('status')
  5819. ->setDescription('Shows a list of locally modified packages, for packages installed from source.')
  5820. ->setDefinition(array(
  5821. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Show modified files for each directory that contains changes.'),
  5822. ))
  5823. ->setHelp(
  5824. <<<EOT
  5825. The status command displays a list of dependencies that have
  5826. been modified locally.
  5827. EOT
  5828. )
  5829. ;
  5830. }
  5831. protected function execute(InputInterface $input, OutputInterface $output)
  5832. {
  5833. $composer = $this->getComposer();
  5834. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'status', $input, $output);
  5835. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5836. $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
  5837. $dm = $composer->getDownloadManager();
  5838. $im = $composer->getInstallationManager();
  5839. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::PRE_STATUS_CMD, true);
  5840. $errors = array();
  5841. $io = $this->getIO();
  5842. $unpushedChanges = array();
  5843. $vcsVersionChanges = array();
  5844. $parser = new VersionParser;
  5845. $guesser = new VersionGuesser($composer->getConfig(), new ProcessExecutor($io), $parser);
  5846. $dumper = new ArrayDumper;
  5847. foreach ($installedRepo->getCanonicalPackages() as $package) {
  5848. $downloader = $dm->getDownloaderForInstalledPackage($package);
  5849. $targetDir = $im->getInstallPath($package);
  5850. if ($downloader instanceof ChangeReportInterface) {
  5851. if (is_link($targetDir)) {
  5852. $errors[$targetDir] = $targetDir . ' is a symbolic link.';
  5853. }
  5854. if ($changes = $downloader->getLocalChanges($package, $targetDir)) {
  5855. $errors[$targetDir] = $changes;
  5856. }
  5857. }
  5858. if ($downloader instanceof VcsCapableDownloaderInterface) {
  5859. if ($currentRef = $downloader->getVcsReference($package, $targetDir)) {
  5860. switch ($package->getInstallationSource()) {
  5861. case 'source':
  5862. $previousRef = $package->getSourceReference();
  5863. break;
  5864. case 'dist':
  5865. $previousRef = $package->getDistReference();
  5866. break;
  5867. default:
  5868. $previousRef = null;
  5869. }
  5870. $currentVersion = $guesser->guessVersion($dumper->dump($package), $targetDir);
  5871. if ($previousRef && $currentVersion && $currentVersion['commit'] !== $previousRef) {
  5872. $vcsVersionChanges[$targetDir] = array(
  5873. 'previous' => array(
  5874. 'version' => $package->getPrettyVersion(),
  5875. 'ref' => $previousRef,
  5876. ),
  5877. 'current' => array(
  5878. 'version' => $currentVersion['pretty_version'],
  5879. 'ref' => $currentVersion['commit'],
  5880. ),
  5881. );
  5882. }
  5883. }
  5884. }
  5885. if ($downloader instanceof DvcsDownloaderInterface) {
  5886. if ($unpushed = $downloader->getUnpushedChanges($package, $targetDir)) {
  5887. $unpushedChanges[$targetDir] = $unpushed;
  5888. }
  5889. }
  5890. }
  5891. if (!$errors && !$unpushedChanges && !$vcsVersionChanges) {
  5892. $io->writeError('<info>No local changes</info>');
  5893. return 0;
  5894. }
  5895. if ($errors) {
  5896. $io->writeError('<error>You have changes in the following dependencies:</error>');
  5897. foreach ($errors as $path => $changes) {
  5898. if ($input->getOption('verbose')) {
  5899. $indentedChanges = implode("\n", array_map(function ($line) {
  5900. return ' ' . ltrim($line);
  5901. }, explode("\n", $changes)));
  5902. $io->write('<info>'.$path.'</info>:');
  5903. $io->write($indentedChanges);
  5904. } else {
  5905. $io->write($path);
  5906. }
  5907. }
  5908. }
  5909. if ($unpushedChanges) {
  5910. $io->writeError('<warning>You have unpushed changes on the current branch in the following dependencies:</warning>');
  5911. foreach ($unpushedChanges as $path => $changes) {
  5912. if ($input->getOption('verbose')) {
  5913. $indentedChanges = implode("\n", array_map(function ($line) {
  5914. return ' ' . ltrim($line);
  5915. }, explode("\n", $changes)));
  5916. $io->write('<info>'.$path.'</info>:');
  5917. $io->write($indentedChanges);
  5918. } else {
  5919. $io->write($path);
  5920. }
  5921. }
  5922. }
  5923. if ($vcsVersionChanges) {
  5924. $io->writeError('<warning>You have version variations in the following dependencies:</warning>');
  5925. foreach ($vcsVersionChanges as $path => $changes) {
  5926. if ($input->getOption('verbose')) {
  5927. $currentVersion = $changes['current']['version'] ?: $changes['current']['ref'];
  5928. $previousVersion = $changes['previous']['version'] ?: $changes['previous']['ref'];
  5929. if ($io->isVeryVerbose()) {
  5930. $currentVersion .= sprintf(' (%s)', $changes['current']['ref']);
  5931. $previousVersion .= sprintf(' (%s)', $changes['previous']['ref']);
  5932. }
  5933. $io->write('<info>'.$path.'</info>:');
  5934. $io->write(sprintf(' From <comment>%s</comment> to <comment>%s</comment>', $previousVersion, $currentVersion));
  5935. } else {
  5936. $io->write($path);
  5937. }
  5938. }
  5939. }
  5940. if (($errors || $unpushedChanges || $vcsVersionChanges) && !$input->getOption('verbose')) {
  5941. $io->writeError('Use --verbose (-v) to see a list of files');
  5942. }
  5943. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_STATUS_CMD, true);
  5944. return ($errors ? self::EXIT_CODE_ERRORS : 0) + ($unpushedChanges ? self::EXIT_CODE_UNPUSHED_CHANGES : 0) + ($vcsVersionChanges ? self::EXIT_CODE_VERSION_CHANGES : 0);
  5945. }
  5946. }
  5947. <?php
  5948. namespace Composer\Command;
  5949. use Composer\Repository\PlatformRepository;
  5950. use Symfony\Component\Console\Input\InputArgument;
  5951. use Symfony\Component\Console\Input\InputInterface;
  5952. use Symfony\Component\Console\Input\InputOption;
  5953. use Symfony\Component\Console\Output\OutputInterface;
  5954. class SuggestsCommand extends BaseCommand
  5955. {
  5956. protected function configure()
  5957. {
  5958. $this
  5959. ->setName('suggests')
  5960. ->setDescription('Shows package suggestions.')
  5961. ->setDefinition(array(
  5962. new InputOption('by-package', null, InputOption::VALUE_NONE, 'Groups output by suggesting package'),
  5963. new InputOption('by-suggestion', null, InputOption::VALUE_NONE, 'Groups output by suggested package'),
  5964. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Exclude suggestions from require-dev packages'),
  5965. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that you want to list suggestions from.'),
  5966. ))
  5967. ->setHelp(
  5968. <<<EOT
  5969. The <info>%command.name%</info> command shows a sorted list of suggested packages.
  5970. Enabling <info>-v</info> implies <info>--by-package --by-suggestion</info>, showing both lists.
  5971. EOT
  5972. )
  5973. ;
  5974. }
  5975. protected function execute(InputInterface $input, OutputInterface $output)
  5976. {
  5977. $lock = $this->getComposer()->getLocker()->getLockData();
  5978. if (empty($lock)) {
  5979. throw new \RuntimeException('Lockfile seems to be empty?');
  5980. }
  5981. $packages = $lock['packages'];
  5982. if (!$input->getOption('no-dev')) {
  5983. $packages += $lock['packages-dev'];
  5984. }
  5985. $filter = $input->getArgument('packages');
  5986. $installed = array();
  5987. foreach ($packages as $package) {
  5988. $installed[] = $package['name'];
  5989. if (!empty($package['provide'])) {
  5990. $installed = array_merge($installed, array_keys($package['provide']));
  5991. }
  5992. if (!empty($package['replace'])) {
  5993. $installed = array_merge($installed, array_keys($package['replace']));
  5994. }
  5995. }
  5996. $installed = array_flip($installed);
  5997. ksort($installed);
  5998. $platform = new PlatformRepository(array(), $this->getComposer()->getConfig()->get('platform') ?: array());
  5999. $suggesters = array();
  6000. $suggested = array();
  6001. foreach ($packages as $package) {
  6002. $packageName = $package['name'];
  6003. if ((!empty($filter) && !in_array($packageName, $filter)) || empty($package['suggest'])) {
  6004. continue;
  6005. }
  6006. foreach ($package['suggest'] as $suggestion => $reason) {
  6007. if (false === strpos('/', $suggestion) && null !== $platform->findPackage($suggestion, '*')) {
  6008. continue;
  6009. }
  6010. if (!isset($installed[$suggestion])) {
  6011. $suggesters[$packageName][$suggestion] = $reason;
  6012. $suggested[$suggestion][$packageName] = $reason;
  6013. }
  6014. }
  6015. }
  6016. ksort($suggesters);
  6017. ksort($suggested);
  6018. $mode = 0;
  6019. $io = $this->getIO();
  6020. if ($input->getOption('by-package') || $io->isVerbose()) {
  6021. $mode |= 1;
  6022. }
  6023. if ($input->getOption('by-suggestion')) {
  6024. $mode |= 2;
  6025. }
  6026. if ($mode === 0) {
  6027. foreach (array_keys($suggested) as $suggestion) {
  6028. $io->write(sprintf('<info>%s</info>', $suggestion));
  6029. }
  6030. return;
  6031. }
  6032. if ($mode & 1) {
  6033. foreach ($suggesters as $suggester => $suggestions) {
  6034. $io->write(sprintf('<comment>%s</comment> suggests:', $suggester));
  6035. foreach ($suggestions as $suggestion => $reason) {
  6036. $io->write(sprintf(' - <info>%s</info>: %s', $suggestion, $reason ?: '*'));
  6037. }
  6038. $io->write('');
  6039. }
  6040. }
  6041. if ($mode & 2) {
  6042. if ($mode & 1) {
  6043. $io->write(str_repeat('-', 78));
  6044. }
  6045. foreach ($suggested as $suggestion => $suggesters) {
  6046. $io->write(sprintf('<comment>%s</comment> is suggested by:', $suggestion));
  6047. foreach ($suggesters as $suggester => $reason) {
  6048. $io->write(sprintf(' - <info>%s</info>: %s', $suggester, $reason ?: '*'));
  6049. }
  6050. $io->write('');
  6051. }
  6052. }
  6053. }
  6054. }
  6055. <?php
  6056. namespace Composer\Command;
  6057. use Composer\Composer;
  6058. use Composer\Installer;
  6059. use Composer\IO\IOInterface;
  6060. use Composer\Plugin\CommandEvent;
  6061. use Composer\Plugin\PluginEvents;
  6062. use Symfony\Component\Console\Helper\Table;
  6063. use Symfony\Component\Console\Input\InputInterface;
  6064. use Symfony\Component\Console\Input\InputOption;
  6065. use Symfony\Component\Console\Input\InputArgument;
  6066. use Symfony\Component\Console\Output\OutputInterface;
  6067. use Symfony\Component\Console\Question\Question;
  6068. class UpdateCommand extends BaseCommand
  6069. {
  6070. protected function configure()
  6071. {
  6072. $this
  6073. ->setName('update')
  6074. ->setAliases(array('u', 'upgrade'))
  6075. ->setDescription('Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file.')
  6076. ->setDefinition(array(
  6077. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that should be updated, if not provided all packages are.'),
  6078. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  6079. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  6080. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  6081. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  6082. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  6083. new InputOption('lock', null, InputOption::VALUE_NONE, 'Only updates the lock file hash to suppress warning about the lock file being out of date.'),
  6084. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  6085. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  6086. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  6087. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  6088. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  6089. new InputOption('with-dependencies', null, InputOption::VALUE_NONE, 'Add also dependencies of whitelisted packages to the whitelist, except those defined in root package.'),
  6090. new InputOption('with-all-dependencies', null, InputOption::VALUE_NONE, 'Add also all dependencies of whitelisted packages to the whitelist, including those defined in root package.'),
  6091. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  6092. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump.'),
  6093. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  6094. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  6095. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  6096. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  6097. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  6098. new InputOption('interactive', 'i', InputOption::VALUE_NONE, 'Interactive interface with autocompletion to select the packages to update.'),
  6099. new InputOption('root-reqs', null, InputOption::VALUE_NONE, 'Restricts the update to your first degree dependencies.'),
  6100. ))
  6101. ->setHelp(
  6102. <<<EOT
  6103. The <info>update</info> command reads the composer.json file from the
  6104. current directory, processes it, and updates, removes or installs all the
  6105. dependencies.
  6106. <info>php composer.phar update</info>
  6107. To limit the update operation to a few packages, you can list the package(s)
  6108. you want to update as such:
  6109. <info>php composer.phar update vendor/package1 foo/mypackage [...]</info>
  6110. You may also use an asterisk (*) pattern to limit the update operation to package(s)
  6111. from a specific vendor:
  6112. <info>php composer.phar update vendor/package1 foo/* [...]</info>
  6113. To select packages names interactively with auto-completion use <info>-i</info>.
  6114. EOT
  6115. )
  6116. ;
  6117. }
  6118. protected function execute(InputInterface $input, OutputInterface $output)
  6119. {
  6120. $io = $this->getIO();
  6121. if ($input->getOption('no-custom-installers')) {
  6122. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  6123. $input->setOption('no-plugins', true);
  6124. }
  6125. if ($input->getOption('dev')) {
  6126. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  6127. }
  6128. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  6129. $packages = $input->getArgument('packages');
  6130. if ($input->getOption('interactive')) {
  6131. $packages = $this->getPackagesInteractively($io, $input, $output, $composer, $packages);
  6132. }
  6133. if ($input->getOption('root-reqs')) {
  6134. $require = array_keys($composer->getPackage()->getRequires());
  6135. if (!$input->getOption('no-dev')) {
  6136. $requireDev = array_keys($composer->getPackage()->getDevRequires());
  6137. $require = array_merge($require, $requireDev);
  6138. }
  6139. if (!empty($packages)) {
  6140. $packages = array_intersect($packages, $require);
  6141. } else {
  6142. $packages = $require;
  6143. }
  6144. }
  6145. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  6146. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'update', $input, $output);
  6147. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  6148. $install = Installer::create($io, $composer);
  6149. $config = $composer->getConfig();
  6150. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  6151. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  6152. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  6153. $apcu = $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  6154. $install
  6155. ->setDryRun($input->getOption('dry-run'))
  6156. ->setVerbose($input->getOption('verbose'))
  6157. ->setPreferSource($preferSource)
  6158. ->setPreferDist($preferDist)
  6159. ->setDevMode(!$input->getOption('no-dev'))
  6160. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  6161. ->setRunScripts(!$input->getOption('no-scripts'))
  6162. ->setSkipSuggest($input->getOption('no-suggest'))
  6163. ->setOptimizeAutoloader($optimize)
  6164. ->setClassMapAuthoritative($authoritative)
  6165. ->setApcuAutoloader($apcu)
  6166. ->setUpdate(true)
  6167. ->setUpdateWhitelist($input->getOption('lock') ? array('lock') : $packages)
  6168. ->setWhitelistTransitiveDependencies($input->getOption('with-dependencies'))
  6169. ->setWhitelistAllDependencies($input->getOption('with-all-dependencies'))
  6170. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  6171. ->setPreferStable($input->getOption('prefer-stable'))
  6172. ->setPreferLowest($input->getOption('prefer-lowest'))
  6173. ;
  6174. if ($input->getOption('no-plugins')) {
  6175. $install->disablePlugins();
  6176. }
  6177. return $install->run();
  6178. }
  6179. private function getPackagesInteractively(IOInterface $io, InputInterface $input, OutputInterface $output, Composer $composer, array $packages)
  6180. {
  6181. if (!$input->isInteractive()) {
  6182. throw new \InvalidArgumentException('--interactive cannot be used in non-interactive terminals.');
  6183. }
  6184. $requires = array_merge(
  6185. $composer->getPackage()->getRequires(),
  6186. $composer->getPackage()->getDevRequires()
  6187. );
  6188. $autocompleterValues = array();
  6189. foreach ($requires as $require) {
  6190. $target = $require->getTarget();
  6191. $autocompleterValues[strtolower($target)] = $target;
  6192. }
  6193. $installedPackages = $composer->getRepositoryManager()->getLocalRepository()->getPackages();
  6194. foreach ($installedPackages as $package) {
  6195. $autocompleterValues[$package->getName()] = $package->getPrettyName();
  6196. }
  6197. $helper = $this->getHelper('question');
  6198. $question = new Question('<comment>Enter package name: </comment>', null);
  6199. $io->writeError('<info>Press enter without value to end submission</info>');
  6200. do {
  6201. $autocompleterValues = array_diff($autocompleterValues, $packages);
  6202. $question->setAutocompleterValues($autocompleterValues);
  6203. $addedPackage = $helper->ask($input, $output, $question);
  6204. if (!is_string($addedPackage) || empty($addedPackage)) {
  6205. break;
  6206. }
  6207. $addedPackage = strtolower($addedPackage);
  6208. if (!in_array($addedPackage, $packages)) {
  6209. $packages[] = $addedPackage;
  6210. }
  6211. } while (true);
  6212. $packages = array_filter($packages);
  6213. if (!$packages) {
  6214. throw new \InvalidArgumentException('You must enter minimum one package.');
  6215. }
  6216. $table = new Table($output);
  6217. $table->setHeaders(array('Selected packages'));
  6218. foreach ($packages as $package) {
  6219. $table->addRow(array($package));
  6220. }
  6221. $table->render();
  6222. if ($io->askConfirmation(sprintf(
  6223. 'Would you like to continue and update the above package%s [<comment>yes</comment>]? ',
  6224. 1 === count($packages) ? '' : 's'
  6225. ), true)) {
  6226. return $packages;
  6227. }
  6228. throw new \RuntimeException('Installation aborted.');
  6229. }
  6230. }
  6231. <?php
  6232. namespace Composer\Command;
  6233. use Composer\Factory;
  6234. use Composer\Package\Loader\ValidatingArrayLoader;
  6235. use Composer\Plugin\CommandEvent;
  6236. use Composer\Plugin\PluginEvents;
  6237. use Composer\Util\ConfigValidator;
  6238. use Symfony\Component\Console\Input\InputArgument;
  6239. use Symfony\Component\Console\Input\InputInterface;
  6240. use Symfony\Component\Console\Input\InputOption;
  6241. use Symfony\Component\Console\Output\OutputInterface;
  6242. class ValidateCommand extends BaseCommand
  6243. {
  6244. protected function configure()
  6245. {
  6246. $this
  6247. ->setName('validate')
  6248. ->setDescription('Validates a composer.json and composer.lock.')
  6249. ->setDefinition(array(
  6250. new InputOption('no-check-all', null, InputOption::VALUE_NONE, 'Do not make a complete validation'),
  6251. new InputOption('no-check-lock', null, InputOption::VALUE_NONE, 'Do not check if lock file is up to date'),
  6252. new InputOption('no-check-publish', null, InputOption::VALUE_NONE, 'Do not check for publish errors'),
  6253. new InputOption('with-dependencies', 'A', InputOption::VALUE_NONE, 'Also validate the composer.json of all installed dependencies'),
  6254. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code for warnings as well as errors'),
  6255. new InputArgument('file', InputArgument::OPTIONAL, 'path to composer.json file'),
  6256. ))
  6257. ->setHelp(
  6258. <<<EOT
  6259. The validate command validates a given composer.json and composer.lock
  6260. Exit codes in case of errors are:
  6261. 1 validation warning(s), only when --strict is given
  6262. 2 validation error(s)
  6263. 3 file unreadable or missing
  6264. EOT
  6265. );
  6266. }
  6267. protected function execute(InputInterface $input, OutputInterface $output)
  6268. {
  6269. $file = $input->getArgument('file') ?: Factory::getComposerFile();
  6270. $io = $this->getIO();
  6271. if (!file_exists($file)) {
  6272. $io->writeError('<error>' . $file . ' not found.</error>');
  6273. return 3;
  6274. }
  6275. if (!is_readable($file)) {
  6276. $io->writeError('<error>' . $file . ' is not readable.</error>');
  6277. return 3;
  6278. }
  6279. $validator = new ConfigValidator($io);
  6280. $checkAll = $input->getOption('no-check-all') ? 0 : ValidatingArrayLoader::CHECK_ALL;
  6281. $checkPublish = !$input->getOption('no-check-publish');
  6282. $checkLock = !$input->getOption('no-check-lock');
  6283. $isStrict = $input->getOption('strict');
  6284. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  6285. $lockErrors = array();
  6286. $composer = Factory::create($io, $file, $input->hasParameterOption('--no-plugins'));
  6287. $locker = $composer->getLocker();
  6288. if ($locker->isLocked() && !$locker->isFresh()) {
  6289. $lockErrors[] = 'The lock file is not up to date with the latest changes in composer.json, it is recommended that you run `composer update`.';
  6290. }
  6291. $this->outputResult($io, $file, $errors, $warnings, $checkPublish, $publishErrors, $checkLock, $lockErrors, true);
  6292. $exitCode = $errors || ($publishErrors && $checkPublish) || ($lockErrors && $checkLock) ? 2 : ($isStrict && $warnings ? 1 : 0);
  6293. if ($input->getOption('with-dependencies')) {
  6294. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  6295. foreach ($localRepo->getPackages() as $package) {
  6296. $path = $composer->getInstallationManager()->getInstallPath($package);
  6297. $file = $path . '/composer.json';
  6298. if (is_dir($path) && file_exists($file)) {
  6299. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  6300. $this->outputResult($io, $package->getPrettyName(), $errors, $warnings, $checkPublish, $publishErrors);
  6301. $depCode = $errors || ($publishErrors && $checkPublish) ? 2 : ($isStrict && $warnings ? 1 : 0);
  6302. $exitCode = max($depCode, $exitCode);
  6303. }
  6304. }
  6305. }
  6306. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'validate', $input, $output);
  6307. $eventCode = $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  6308. $exitCode = max($eventCode, $exitCode);
  6309. return $exitCode;
  6310. }
  6311. private function outputResult($io, $name, &$errors, &$warnings, $checkPublish = false, $publishErrors = array(), $checkLock = false, $lockErrors = array(), $printSchemaUrl = false)
  6312. {
  6313. if (!$errors && !$publishErrors && !$warnings) {
  6314. $io->write('<info>' . $name . ' is valid</info>');
  6315. } elseif (!$errors && !$publishErrors) {
  6316. $io->writeError('<info>' . $name . ' is valid, but with a few warnings</info>');
  6317. if ($printSchemaUrl) {
  6318. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  6319. }
  6320. } elseif (!$errors) {
  6321. $io->writeError('<info>' . $name . ' is valid for simple usage with composer but has</info>');
  6322. $io->writeError('<info>strict errors that make it unable to be published as a package:</info>');
  6323. if ($printSchemaUrl) {
  6324. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  6325. }
  6326. } else {
  6327. $io->writeError('<error>' . $name . ' is invalid, the following errors/warnings were found:</error>');
  6328. }
  6329. if ($checkPublish) {
  6330. $errors = array_merge($errors, $publishErrors);
  6331. } else {
  6332. $warnings = array_merge($warnings, $publishErrors);
  6333. }
  6334. if ($checkLock) {
  6335. $errors = array_merge($errors, $lockErrors);
  6336. } else {
  6337. $warnings = array_merge($warnings, $lockErrors);
  6338. }
  6339. $messages = array(
  6340. 'error' => $errors,
  6341. 'warning' => $warnings,
  6342. );
  6343. foreach ($messages as $style => $msgs) {
  6344. foreach ($msgs as $msg) {
  6345. $io->writeError('<' . $style . '>' . $msg . '</' . $style . '>');
  6346. }
  6347. }
  6348. }
  6349. }
  6350. <?php
  6351. namespace Composer;
  6352. use Composer\Package\RootPackageInterface;
  6353. use Composer\Package\Locker;
  6354. use Composer\Repository\RepositoryManager;
  6355. use Composer\Installer\InstallationManager;
  6356. use Composer\Plugin\PluginManager;
  6357. use Composer\Downloader\DownloadManager;
  6358. use Composer\EventDispatcher\EventDispatcher;
  6359. use Composer\Autoload\AutoloadGenerator;
  6360. use Composer\Package\Archiver\ArchiveManager;
  6361. class Composer
  6362. {
  6363. const VERSION = '1.7.3';
  6364. const BRANCH_ALIAS_VERSION = '';
  6365. const RELEASE_DATE = '2018-11-01 10:05:06';
  6366. private $package;
  6367. private $locker;
  6368. private $repositoryManager;
  6369. private $downloadManager;
  6370. private $installationManager;
  6371. private $pluginManager;
  6372. private $config;
  6373. private $eventDispatcher;
  6374. private $autoloadGenerator;
  6375. private $archiveManager;
  6376. public function setPackage(RootPackageInterface $package)
  6377. {
  6378. $this->package = $package;
  6379. }
  6380. public function getPackage()
  6381. {
  6382. return $this->package;
  6383. }
  6384. public function setConfig(Config $config)
  6385. {
  6386. $this->config = $config;
  6387. }
  6388. public function getConfig()
  6389. {
  6390. return $this->config;
  6391. }
  6392. public function setLocker(Locker $locker)
  6393. {
  6394. $this->locker = $locker;
  6395. }
  6396. public function getLocker()
  6397. {
  6398. return $this->locker;
  6399. }
  6400. public function setRepositoryManager(RepositoryManager $manager)
  6401. {
  6402. $this->repositoryManager = $manager;
  6403. }
  6404. public function getRepositoryManager()
  6405. {
  6406. return $this->repositoryManager;
  6407. }
  6408. public function setDownloadManager(DownloadManager $manager)
  6409. {
  6410. $this->downloadManager = $manager;
  6411. }
  6412. public function getDownloadManager()
  6413. {
  6414. return $this->downloadManager;
  6415. }
  6416. public function setArchiveManager(ArchiveManager $manager)
  6417. {
  6418. $this->archiveManager = $manager;
  6419. }
  6420. public function getArchiveManager()
  6421. {
  6422. return $this->archiveManager;
  6423. }
  6424. public function setInstallationManager(InstallationManager $manager)
  6425. {
  6426. $this->installationManager = $manager;
  6427. }
  6428. public function getInstallationManager()
  6429. {
  6430. return $this->installationManager;
  6431. }
  6432. public function setPluginManager(PluginManager $manager)
  6433. {
  6434. $this->pluginManager = $manager;
  6435. }
  6436. public function getPluginManager()
  6437. {
  6438. return $this->pluginManager;
  6439. }
  6440. public function setEventDispatcher(EventDispatcher $eventDispatcher)
  6441. {
  6442. $this->eventDispatcher = $eventDispatcher;
  6443. }
  6444. public function getEventDispatcher()
  6445. {
  6446. return $this->eventDispatcher;
  6447. }
  6448. public function setAutoloadGenerator(AutoloadGenerator $autoloadGenerator)
  6449. {
  6450. $this->autoloadGenerator = $autoloadGenerator;
  6451. }
  6452. public function getAutoloadGenerator()
  6453. {
  6454. return $this->autoloadGenerator;
  6455. }
  6456. }
  6457. <?php
  6458. namespace Composer;
  6459. use Composer\Config\ConfigSourceInterface;
  6460. use Composer\Downloader\TransportException;
  6461. use Composer\IO\IOInterface;
  6462. use Composer\Util\Platform;
  6463. class Config
  6464. {
  6465. const RELATIVE_PATHS = 1;
  6466. public static $defaultConfig = array(
  6467. 'process-timeout' => 300,
  6468. 'use-include-path' => false,
  6469. 'preferred-install' => 'auto',
  6470. 'notify-on-install' => true,
  6471. 'github-protocols' => array('https', 'ssh', 'git'),
  6472. 'vendor-dir' => 'vendor',
  6473. 'bin-dir' => '{$vendor-dir}/bin',
  6474. 'cache-dir' => '{$home}/cache',
  6475. 'data-dir' => '{$home}',
  6476. 'cache-files-dir' => '{$cache-dir}/files',
  6477. 'cache-repo-dir' => '{$cache-dir}/repo',
  6478. 'cache-vcs-dir' => '{$cache-dir}/vcs',
  6479. 'cache-ttl' => 15552000,
  6480. 'cache-files-ttl' => null,
  6481. 'cache-files-maxsize' => '300MiB',
  6482. 'bin-compat' => 'auto',
  6483. 'discard-changes' => false,
  6484. 'autoloader-suffix' => null,
  6485. 'sort-packages' => false,
  6486. 'optimize-autoloader' => false,
  6487. 'classmap-authoritative' => false,
  6488. 'apcu-autoloader' => false,
  6489. 'prepend-autoloader' => true,
  6490. 'github-domains' => array('github.com'),
  6491. 'bitbucket-expose-hostname' => true,
  6492. 'disable-tls' => false,
  6493. 'secure-http' => true,
  6494. 'cafile' => null,
  6495. 'capath' => null,
  6496. 'github-expose-hostname' => true,
  6497. 'gitlab-domains' => array('gitlab.com'),
  6498. 'store-auths' => 'prompt',
  6499. 'platform' => array(),
  6500. 'archive-format' => 'tar',
  6501. 'archive-dir' => '.',
  6502. 'htaccess-protect' => true,
  6503. );
  6504. public static $defaultRepositories = array(
  6505. 'packagist.org' => array(
  6506. 'type' => 'composer',
  6507. 'url' => 'https?://repo.packagist.org',
  6508. 'allow_ssl_downgrade' => true,
  6509. ),
  6510. );
  6511. private $config;
  6512. private $baseDir;
  6513. private $repositories;
  6514. private $configSource;
  6515. private $authConfigSource;
  6516. private $useEnvironment;
  6517. private $warnedHosts = array();
  6518. public function __construct($useEnvironment = true, $baseDir = null)
  6519. {
  6520. $this->config = static::$defaultConfig;
  6521. $this->repositories = static::$defaultRepositories;
  6522. $this->useEnvironment = (bool) $useEnvironment;
  6523. $this->baseDir = $baseDir;
  6524. }
  6525. public function setConfigSource(ConfigSourceInterface $source)
  6526. {
  6527. $this->configSource = $source;
  6528. }
  6529. public function getConfigSource()
  6530. {
  6531. return $this->configSource;
  6532. }
  6533. public function setAuthConfigSource(ConfigSourceInterface $source)
  6534. {
  6535. $this->authConfigSource = $source;
  6536. }
  6537. public function getAuthConfigSource()
  6538. {
  6539. return $this->authConfigSource;
  6540. }
  6541. public function merge($config)
  6542. {
  6543. if (!empty($config['config']) && is_array($config['config'])) {
  6544. foreach ($config['config'] as $key => $val) {
  6545. if (in_array($key, array('bitbucket-oauth', 'github-oauth', 'gitlab-oauth', 'gitlab-token', 'http-basic')) && isset($this->config[$key])) {
  6546. $this->config[$key] = array_merge($this->config[$key], $val);
  6547. } elseif ('preferred-install' === $key && isset($this->config[$key])) {
  6548. if (is_array($val) || is_array($this->config[$key])) {
  6549. if (is_string($val)) {
  6550. $val = array('*' => $val);
  6551. }
  6552. if (is_string($this->config[$key])) {
  6553. $this->config[$key] = array('*' => $this->config[$key]);
  6554. }
  6555. $this->config[$key] = array_merge($this->config[$key], $val);
  6556. if (isset($this->config[$key]['*'])) {
  6557. $wildcard = $this->config[$key]['*'];
  6558. unset($this->config[$key]['*']);
  6559. $this->config[$key]['*'] = $wildcard;
  6560. }
  6561. } else {
  6562. $this->config[$key] = $val;
  6563. }
  6564. } else {
  6565. $this->config[$key] = $val;
  6566. }
  6567. }
  6568. }
  6569. if (!empty($config['repositories']) && is_array($config['repositories'])) {
  6570. $this->repositories = array_reverse($this->repositories, true);
  6571. $newRepos = array_reverse($config['repositories'], true);
  6572. foreach ($newRepos as $name => $repository) {
  6573. if (false === $repository) {
  6574. $this->disableRepoByName($name);
  6575. continue;
  6576. }
  6577. if (is_array($repository) && 1 === count($repository) && false === current($repository)) {
  6578. $this->disableRepoByName(key($repository));
  6579. continue;
  6580. }
  6581. if (is_int($name)) {
  6582. $this->repositories[] = $repository;
  6583. } else {
  6584. if ($name === 'packagist') {
  6585. $this->repositories[$name . '.org'] = $repository;
  6586. } else {
  6587. $this->repositories[$name] = $repository;
  6588. }
  6589. }
  6590. }
  6591. $this->repositories = array_reverse($this->repositories, true);
  6592. }
  6593. }
  6594. public function getRepositories()
  6595. {
  6596. return $this->repositories;
  6597. }
  6598. public function get($key, $flags = 0)
  6599. {
  6600. switch ($key) {
  6601. case 'vendor-dir':
  6602. case 'bin-dir':
  6603. case 'process-timeout':
  6604. case 'data-dir':
  6605. case 'cache-dir':
  6606. case 'cache-files-dir':
  6607. case 'cache-repo-dir':
  6608. case 'cache-vcs-dir':
  6609. case 'cafile':
  6610. case 'capath':
  6611. case 'htaccess-protect':
  6612. $env = 'COMPOSER_' . strtoupper(strtr($key, '-', '_'));
  6613. $val = $this->getComposerEnv($env);
  6614. $val = rtrim((string) $this->process(false !== $val ? $val : $this->config[$key], $flags), '/\\');
  6615. $val = Platform::expandPath($val);
  6616. if (substr($key, -4) !== '-dir') {
  6617. return $val;
  6618. }
  6619. return (($flags & self::RELATIVE_PATHS) == self::RELATIVE_PATHS) ? $val : $this->realpath($val);
  6620. case 'cache-ttl':
  6621. return (int) $this->config[$key];
  6622. case 'cache-files-maxsize':
  6623. if (!preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $this->config[$key], $matches)) {
  6624. throw new \RuntimeException(
  6625. "Could not parse the value of 'cache-files-maxsize': {$this->config[$key]}"
  6626. );
  6627. }
  6628. $size = $matches[1];
  6629. if (isset($matches[2])) {
  6630. switch (strtolower($matches[2])) {
  6631. case 'g':
  6632. $size *= 1024;
  6633. case 'm':
  6634. $size *= 1024;
  6635. case 'k':
  6636. $size *= 1024;
  6637. break;
  6638. }
  6639. }
  6640. return $size;
  6641. case 'cache-files-ttl':
  6642. if (isset($this->config[$key])) {
  6643. return (int) $this->config[$key];
  6644. }
  6645. return (int) $this->config['cache-ttl'];
  6646. case 'home':
  6647. $val = preg_replace('#^(\$HOME|~)(/|$)#', rtrim(getenv('HOME') ?: getenv('USERPROFILE'), '/\\') . '/', $this->config[$key]);
  6648. return rtrim($this->process($val, $flags), '/\\');
  6649. case 'bin-compat':
  6650. $value = $this->getComposerEnv('COMPOSER_BIN_COMPAT') ?: $this->config[$key];
  6651. if (!in_array($value, array('auto', 'full'))) {
  6652. throw new \RuntimeException(
  6653. "Invalid value for 'bin-compat': {$value}. Expected auto, full"
  6654. );
  6655. }
  6656. return $value;
  6657. case 'discard-changes':
  6658. if ($env = $this->getComposerEnv('COMPOSER_DISCARD_CHANGES')) {
  6659. if (!in_array($env, array('stash', 'true', 'false', '1', '0'), true)) {
  6660. throw new \RuntimeException(
  6661. "Invalid value for COMPOSER_DISCARD_CHANGES: {$env}. Expected 1, 0, true, false or stash"
  6662. );
  6663. }
  6664. if ('stash' === $env) {
  6665. return 'stash';
  6666. }
  6667. return $env !== 'false' && (bool) $env;
  6668. }
  6669. if (!in_array($this->config[$key], array(true, false, 'stash'), true)) {
  6670. throw new \RuntimeException(
  6671. "Invalid value for 'discard-changes': {$this->config[$key]}. Expected true, false or stash"
  6672. );
  6673. }
  6674. return $this->config[$key];
  6675. case 'github-protocols':
  6676. $protos = $this->config['github-protocols'];
  6677. if ($this->config['secure-http'] && false !== ($index = array_search('git', $protos))) {
  6678. unset($protos[$index]);
  6679. }
  6680. if (reset($protos) === 'http') {
  6681. throw new \RuntimeException('The http protocol for github is not available anymore, update your config\'s github-protocols to use "https", "git" or "ssh"');
  6682. }
  6683. return $protos;
  6684. case 'disable-tls':
  6685. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  6686. case 'secure-http':
  6687. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  6688. default:
  6689. if (!isset($this->config[$key])) {
  6690. return null;
  6691. }
  6692. return $this->process($this->config[$key], $flags);
  6693. }
  6694. }
  6695. public function all($flags = 0)
  6696. {
  6697. $all = array(
  6698. 'repositories' => $this->getRepositories(),
  6699. );
  6700. foreach (array_keys($this->config) as $key) {
  6701. $all['config'][$key] = $this->get($key, $flags);
  6702. }
  6703. return $all;
  6704. }
  6705. public function raw()
  6706. {
  6707. return array(
  6708. 'repositories' => $this->getRepositories(),
  6709. 'config' => $this->config,
  6710. );
  6711. }
  6712. public function has($key)
  6713. {
  6714. return array_key_exists($key, $this->config);
  6715. }
  6716. private function process($value, $flags)
  6717. {
  6718. $config = $this;
  6719. if (!is_string($value)) {
  6720. return $value;
  6721. }
  6722. return preg_replace_callback('#\{\$(.+)\}#', function ($match) use ($config, $flags) {
  6723. return $config->get($match[1], $flags);
  6724. }, $value);
  6725. }
  6726. private function realpath($path)
  6727. {
  6728. if (preg_match('{^(?:/|[a-z]:|[a-z0-9.]+://)}i', $path)) {
  6729. return $path;
  6730. }
  6731. return $this->baseDir . '/' . $path;
  6732. }
  6733. private function getComposerEnv($var)
  6734. {
  6735. if ($this->useEnvironment) {
  6736. return getenv($var);
  6737. }
  6738. return false;
  6739. }
  6740. private function disableRepoByName($name)
  6741. {
  6742. if (isset($this->repositories[$name])) {
  6743. unset($this->repositories[$name]);
  6744. } elseif ($name === 'packagist') {
  6745. unset($this->repositories['packagist.org']);
  6746. }
  6747. }
  6748. public function prohibitUrlByConfig($url, IOInterface $io = null)
  6749. {
  6750. if (false === filter_var($url, FILTER_VALIDATE_URL)) {
  6751. return;
  6752. }
  6753. $scheme = parse_url($url, PHP_URL_SCHEME);
  6754. if (in_array($scheme, array('http', 'git', 'ftp', 'svn'))) {
  6755. if ($this->get('secure-http')) {
  6756. throw new TransportException("Your configuration does not allow connections to $url. See https://getcomposer.org/doc/06-config.md#secure-http for details.");
  6757. } elseif ($io) {
  6758. $host = parse_url($url, PHP_URL_HOST);
  6759. if (!isset($this->warnedHosts[$host])) {
  6760. $io->writeError("<warning>Warning: Accessing $host over $scheme which is an insecure protocol.</warning>");
  6761. }
  6762. $this->warnedHosts[$host] = true;
  6763. }
  6764. }
  6765. }
  6766. }
  6767. <?php
  6768. namespace Composer\Config;
  6769. interface ConfigSourceInterface
  6770. {
  6771. public function addRepository($name, $config);
  6772. public function removeRepository($name);
  6773. public function addConfigSetting($name, $value);
  6774. public function removeConfigSetting($name);
  6775. public function addProperty($name, $value);
  6776. public function removeProperty($name);
  6777. public function addLink($type, $name, $value);
  6778. public function removeLink($type, $name);
  6779. public function getName();
  6780. }
  6781. <?php
  6782. namespace Composer\Config;
  6783. use Composer\Json\JsonFile;
  6784. use Composer\Json\JsonManipulator;
  6785. use Composer\Util\Silencer;
  6786. class JsonConfigSource implements ConfigSourceInterface
  6787. {
  6788. private $file;
  6789. private $authConfig;
  6790. public function __construct(JsonFile $file, $authConfig = false)
  6791. {
  6792. $this->file = $file;
  6793. $this->authConfig = $authConfig;
  6794. }
  6795. public function getName()
  6796. {
  6797. return $this->file->getPath();
  6798. }
  6799. public function addRepository($name, $config)
  6800. {
  6801. $this->manipulateJson('addRepository', $name, $config, function (&$config, $repo, $repoConfig) {
  6802. if (isset($config['repositories'])) {
  6803. foreach ($config['repositories'] as $index => $val) {
  6804. if ($index === $repo) {
  6805. continue;
  6806. }
  6807. if (is_numeric($index) && ($val === array('packagist' => false) || $val === array('packagist.org' => false))) {
  6808. unset($config['repositories'][$index]);
  6809. $config['repositories']['packagist.org'] = false;
  6810. break;
  6811. }
  6812. }
  6813. }
  6814. $config['repositories'][$repo] = $repoConfig;
  6815. });
  6816. }
  6817. public function removeRepository($name)
  6818. {
  6819. $this->manipulateJson('removeRepository', $name, function (&$config, $repo) {
  6820. unset($config['repositories'][$repo]);
  6821. });
  6822. }
  6823. public function addConfigSetting($name, $value)
  6824. {
  6825. $authConfig = $this->authConfig;
  6826. $this->manipulateJson('addConfigSetting', $name, $value, function (&$config, $key, $val) use ($authConfig) {
  6827. if (preg_match('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic|platform)\.}', $key)) {
  6828. list($key, $host) = explode('.', $key, 2);
  6829. if ($authConfig) {
  6830. $config[$key][$host] = $val;
  6831. } else {
  6832. $config['config'][$key][$host] = $val;
  6833. }
  6834. } else {
  6835. $config['config'][$key] = $val;
  6836. }
  6837. });
  6838. }
  6839. public function removeConfigSetting($name)
  6840. {
  6841. $authConfig = $this->authConfig;
  6842. $this->manipulateJson('removeConfigSetting', $name, function (&$config, $key) use ($authConfig) {
  6843. if (preg_match('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic|platform)\.}', $key)) {
  6844. list($key, $host) = explode('.', $key, 2);
  6845. if ($authConfig) {
  6846. unset($config[$key][$host]);
  6847. } else {
  6848. unset($config['config'][$key][$host]);
  6849. }
  6850. } else {
  6851. unset($config['config'][$key]);
  6852. }
  6853. });
  6854. }
  6855. public function addProperty($name, $value)
  6856. {
  6857. $this->manipulateJson('addProperty', $name, $value, function (&$config, $key, $val) {
  6858. if (substr($key, 0, 6) === 'extra.' || substr($key, 0, 8) === 'scripts.') {
  6859. $bits = explode('.', $key);
  6860. $last = array_pop($bits);
  6861. $arr = &$config[reset($bits)];
  6862. foreach ($bits as $bit) {
  6863. if (!isset($arr[$bit])) {
  6864. $arr[$bit] = array();
  6865. }
  6866. $arr = &$arr[$bit];
  6867. }
  6868. $arr[$last] = $val;
  6869. } else {
  6870. $config[$key] = $val;
  6871. }
  6872. });
  6873. }
  6874. public function removeProperty($name)
  6875. {
  6876. $authConfig = $this->authConfig;
  6877. $this->manipulateJson('removeProperty', $name, function (&$config, $key) {
  6878. if (substr($key, 0, 6) === 'extra.' || substr($key, 0, 8) === 'scripts.') {
  6879. $bits = explode('.', $key);
  6880. $last = array_pop($bits);
  6881. $arr = &$config[reset($bits)];
  6882. foreach ($bits as $bit) {
  6883. if (!isset($arr[$bit])) {
  6884. return;
  6885. }
  6886. $arr = &$arr[$bit];
  6887. }
  6888. unset($arr[$last]);
  6889. } else {
  6890. unset($config[$key]);
  6891. }
  6892. });
  6893. }
  6894. public function addLink($type, $name, $value)
  6895. {
  6896. $this->manipulateJson('addLink', $type, $name, $value, function (&$config, $type, $name, $value) {
  6897. $config[$type][$name] = $value;
  6898. });
  6899. }
  6900. public function removeLink($type, $name)
  6901. {
  6902. $this->manipulateJson('removeSubNode', $type, $name, function (&$config, $type, $name) {
  6903. unset($config[$type][$name]);
  6904. });
  6905. }
  6906. protected function manipulateJson($method, $args, $fallback)
  6907. {
  6908. $args = func_get_args();
  6909. array_shift($args);
  6910. $fallback = array_pop($args);
  6911. if ($this->file->exists()) {
  6912. if (!is_writable($this->file->getPath())) {
  6913. throw new \RuntimeException(sprintf('The file "%s" is not writable.', $this->file->getPath()));
  6914. }
  6915. if (!is_readable($this->file->getPath())) {
  6916. throw new \RuntimeException(sprintf('The file "%s" is not readable.', $this->file->getPath()));
  6917. }
  6918. $contents = file_get_contents($this->file->getPath());
  6919. } elseif ($this->authConfig) {
  6920. $contents = "{\n}\n";
  6921. } else {
  6922. $contents = "{\n \"config\": {\n }\n}\n";
  6923. }
  6924. $manipulator = new JsonManipulator($contents);
  6925. $newFile = !$this->file->exists();
  6926. if ($this->authConfig && $method === 'addConfigSetting') {
  6927. $method = 'addSubNode';
  6928. list($mainNode, $name) = explode('.', $args[0], 2);
  6929. $args = array($mainNode, $name, $args[1]);
  6930. } elseif ($this->authConfig && $method === 'removeConfigSetting') {
  6931. $method = 'removeSubNode';
  6932. list($mainNode, $name) = explode('.', $args[0], 2);
  6933. $args = array($mainNode, $name);
  6934. }
  6935. if (call_user_func_array(array($manipulator, $method), $args)) {
  6936. file_put_contents($this->file->getPath(), $manipulator->getContents());
  6937. } else {
  6938. $config = $this->file->read();
  6939. $this->arrayUnshiftRef($args, $config);
  6940. call_user_func_array($fallback, $args);
  6941. $this->file->write($config);
  6942. }
  6943. if ($newFile) {
  6944. Silencer::call('chmod', $this->file->getPath(), 0600);
  6945. }
  6946. }
  6947. private function arrayUnshiftRef(&$array, &$value)
  6948. {
  6949. $return = array_unshift($array, '');
  6950. $array[0] = &$value;
  6951. return $return;
  6952. }
  6953. }
  6954. <?php
  6955. namespace Composer\Console;
  6956. use Composer\IO\NullIO;
  6957. use Composer\Util\Platform;
  6958. use Composer\Util\Silencer;
  6959. use Symfony\Component\Console\Application as BaseApplication;
  6960. use Symfony\Component\Console\Input\InputInterface;
  6961. use Symfony\Component\Console\Input\InputOption;
  6962. use Symfony\Component\Console\Output\OutputInterface;
  6963. use Composer\Command;
  6964. use Composer\Composer;
  6965. use Composer\Factory;
  6966. use Composer\IO\IOInterface;
  6967. use Composer\IO\ConsoleIO;
  6968. use Composer\Json\JsonValidationException;
  6969. use Composer\Util\ErrorHandler;
  6970. use Composer\EventDispatcher\ScriptExecutionException;
  6971. use Composer\Exception\NoSslException;
  6972. class Application extends BaseApplication
  6973. {
  6974. protected $composer;
  6975. protected $io;
  6976. private static $logo = ' ______
  6977. / ____/___ ____ ___ ____ ____ ________ _____
  6978. / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
  6979. / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
  6980. \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
  6981. /_/
  6982. ';
  6983. private $hasPluginCommands = false;
  6984. private $disablePluginsByDefault = false;
  6985. public function __construct()
  6986. {
  6987. static $shutdownRegistered = false;
  6988. if (function_exists('ini_set') && extension_loaded('xdebug')) {
  6989. ini_set('xdebug.show_exception_trace', false);
  6990. ini_set('xdebug.scream', false);
  6991. }
  6992. if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
  6993. date_default_timezone_set(Silencer::call('date_default_timezone_get'));
  6994. }
  6995. if (!$shutdownRegistered) {
  6996. $shutdownRegistered = true;
  6997. register_shutdown_function(function () {
  6998. $lastError = error_get_last();
  6999. if ($lastError && $lastError['message'] &&
  7000. (strpos($lastError['message'], 'Allowed memory') !== false ||
  7001. strpos($lastError['message'], 'exceeded memory') !== false )) {
  7002. echo "\n". 'Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.';
  7003. }
  7004. });
  7005. }
  7006. $this->io = new NullIO();
  7007. parent::__construct('Composer', Composer::VERSION);
  7008. }
  7009. public function run(InputInterface $input = null, OutputInterface $output = null)
  7010. {
  7011. if (null === $output) {
  7012. $output = Factory::createOutput();
  7013. }
  7014. return parent::run($input, $output);
  7015. }
  7016. public function doRun(InputInterface $input, OutputInterface $output)
  7017. {
  7018. $this->disablePluginsByDefault = $input->hasParameterOption('--no-plugins');
  7019. $io = $this->io = new ConsoleIO($input, $output, $this->getHelperSet());
  7020. ErrorHandler::register($io);
  7021. if ($newWorkDir = $this->getNewWorkingDir($input)) {
  7022. $oldWorkingDir = getcwd();
  7023. chdir($newWorkDir);
  7024. $io->writeError('Changed CWD to ' . getcwd(), true, IOInterface::DEBUG);
  7025. }
  7026. $commandName = '';
  7027. if ($name = $this->getCommandName($input)) {
  7028. try {
  7029. $commandName = $this->find($name)->getName();
  7030. } catch (\InvalidArgumentException $e) {
  7031. }
  7032. }
  7033. if ($io->isInteractive() && !$newWorkDir && !in_array($commandName, array('', 'list', 'init', 'about', 'help', 'diagnose', 'self-update', 'global', 'create-project'), true) && !file_exists(Factory::getComposerFile())) {
  7034. $dir = dirname(getcwd());
  7035. $home = realpath(getenv('HOME') ?: getenv('USERPROFILE') ?: '/');
  7036. while (dirname($dir) !== $dir && $dir !== $home) {
  7037. if (file_exists($dir.'/'.Factory::getComposerFile())) {
  7038. if ($io->askConfirmation('<info>No composer.json in current directory, do you want to use the one at '.$dir.'?</info> [<comment>Y,n</comment>]? ', true)) {
  7039. $oldWorkingDir = getcwd();
  7040. chdir($dir);
  7041. }
  7042. break;
  7043. }
  7044. $dir = dirname($dir);
  7045. }
  7046. }
  7047. if (!$this->disablePluginsByDefault && !$this->hasPluginCommands && 'global' !== $commandName) {
  7048. try {
  7049. foreach ($this->getPluginCommands() as $command) {
  7050. if ($this->has($command->getName())) {
  7051. $io->writeError('<warning>Plugin command '.$command->getName().' ('.get_class($command).') would override a Composer command and has been skipped</warning>');
  7052. } else {
  7053. $this->add($command);
  7054. }
  7055. }
  7056. } catch (NoSslException $e) {
  7057. }
  7058. $this->hasPluginCommands = true;
  7059. }
  7060. $isProxyCommand = false;
  7061. if ($name = $this->getCommandName($input)) {
  7062. try {
  7063. $command = $this->find($name);
  7064. $commandName = $command->getName();
  7065. $isProxyCommand = ($command instanceof Command\BaseCommand && $command->isProxyCommand());
  7066. } catch (\InvalidArgumentException $e) {
  7067. }
  7068. }
  7069. if (!$isProxyCommand) {
  7070. $io->writeError(sprintf(
  7071. 'Running %s (%s) with %s on %s',
  7072. Composer::VERSION,
  7073. Composer::RELEASE_DATE,
  7074. defined('HHVM_VERSION') ? 'HHVM '.HHVM_VERSION : 'PHP '.PHP_VERSION,
  7075. function_exists('php_uname') ? php_uname('s') . ' / ' . php_uname('r') : 'Unknown OS'
  7076. ), true, IOInterface::DEBUG);
  7077. if (PHP_VERSION_ID < 50302) {
  7078. $io->writeError('<warning>Composer only officially supports PHP 5.3.2 and above, you will most likely encounter problems with your PHP '.PHP_VERSION.', upgrading is strongly recommended.</warning>');
  7079. }
  7080. if (extension_loaded('xdebug') && !getenv('COMPOSER_DISABLE_XDEBUG_WARN')) {
  7081. $io->writeError('<warning>You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug</warning>');
  7082. }
  7083. if (defined('COMPOSER_DEV_WARNING_TIME') && $commandName !== 'self-update' && $commandName !== 'selfupdate' && time() > COMPOSER_DEV_WARNING_TIME) {
  7084. $io->writeError(sprintf('<warning>Warning: This development build of composer is over 60 days old. It is recommended to update it by running "%s self-update" to get the latest version.</warning>', $_SERVER['PHP_SELF']));
  7085. }
  7086. if (getenv('COMPOSER_NO_INTERACTION')) {
  7087. $input->setInteractive(false);
  7088. }
  7089. if (!Platform::isWindows() && function_exists('exec') && !getenv('COMPOSER_ALLOW_SUPERUSER')) {
  7090. if (function_exists('posix_getuid') && posix_getuid() === 0) {
  7091. if ($commandName !== 'self-update' && $commandName !== 'selfupdate') {
  7092. $io->writeError('<warning>Do not run Composer as root/super user! See https://getcomposer.org/root for details</warning>');
  7093. }
  7094. if ($uid = (int) getenv('SUDO_UID')) {
  7095. Silencer::call('exec', "sudo -u \\#{$uid} sudo -K > /dev/null 2>&1");
  7096. }
  7097. }
  7098. Silencer::call('exec', 'sudo -K > /dev/null 2>&1');
  7099. }
  7100. Silencer::call(function () use ($io) {
  7101. $tempfile = sys_get_temp_dir() . '/temp-' . md5(microtime());
  7102. if (!(file_put_contents($tempfile, __FILE__) && (file_get_contents($tempfile) == __FILE__) && unlink($tempfile) && !file_exists($tempfile))) {
  7103. $io->writeError(sprintf('<error>PHP temp directory (%s) does not exist or is not writable to Composer. Set sys_temp_dir in your php.ini</error>', sys_get_temp_dir()));
  7104. }
  7105. });
  7106. $file = Factory::getComposerFile();
  7107. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  7108. if (isset($composer['scripts']) && is_array($composer['scripts'])) {
  7109. foreach ($composer['scripts'] as $script => $dummy) {
  7110. if (!defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  7111. if ($this->has($script)) {
  7112. $io->writeError('<warning>A script named '.$script.' would override a Composer command and has been skipped</warning>');
  7113. } else {
  7114. $description = null;
  7115. if (isset($composer['scripts-descriptions'][$script])) {
  7116. $description = $composer['scripts-descriptions'][$script];
  7117. }
  7118. $this->add(new Command\ScriptAliasCommand($script, $description));
  7119. }
  7120. }
  7121. }
  7122. }
  7123. }
  7124. }
  7125. try {
  7126. if ($input->hasParameterOption('--profile')) {
  7127. $startTime = microtime(true);
  7128. $this->io->enableDebugging($startTime);
  7129. }
  7130. $result = parent::doRun($input, $output);
  7131. if (isset($oldWorkingDir)) {
  7132. chdir($oldWorkingDir);
  7133. }
  7134. if (isset($startTime)) {
  7135. $io->writeError('<info>Memory usage: '.round(memory_get_usage() / 1024 / 1024, 2).'MB (peak: '.round(memory_get_peak_usage() / 1024 / 1024, 2).'MB), time: '.round(microtime(true) - $startTime, 2).'s');
  7136. }
  7137. restore_error_handler();
  7138. return $result;
  7139. } catch (ScriptExecutionException $e) {
  7140. return $e->getCode();
  7141. } catch (\Exception $e) {
  7142. $this->hintCommonErrors($e);
  7143. restore_error_handler();
  7144. throw $e;
  7145. }
  7146. }
  7147. private function getNewWorkingDir(InputInterface $input)
  7148. {
  7149. $workingDir = $input->getParameterOption(array('--working-dir', '-d'));
  7150. if (false !== $workingDir && !is_dir($workingDir)) {
  7151. throw new \RuntimeException('Invalid working directory specified, '.$workingDir.' does not exist.');
  7152. }
  7153. return $workingDir;
  7154. }
  7155. private function hintCommonErrors($exception)
  7156. {
  7157. $io = $this->getIO();
  7158. Silencer::suppress();
  7159. try {
  7160. $composer = $this->getComposer(false, true);
  7161. if ($composer) {
  7162. $config = $composer->getConfig();
  7163. $minSpaceFree = 1024 * 1024;
  7164. if ((($df = disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  7165. || (($df = disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  7166. || (($df = disk_free_space($dir = sys_get_temp_dir())) !== false && $df < $minSpaceFree)
  7167. ) {
  7168. $io->writeError('<error>The disk hosting '.$dir.' is full, this may be the cause of the following exception</error>', true, IOInterface::QUIET);
  7169. }
  7170. }
  7171. } catch (\Exception $e) {
  7172. }
  7173. Silencer::restore();
  7174. if (Platform::isWindows() && false !== strpos($exception->getMessage(), 'The system cannot find the path specified')) {
  7175. $io->writeError('<error>The following exception may be caused by a stale entry in your cmd.exe AutoRun</error>', true, IOInterface::QUIET);
  7176. $io->writeError('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#-the-system-cannot-find-the-path-specified-windows- for details</error>', true, IOInterface::QUIET);
  7177. }
  7178. if (false !== strpos($exception->getMessage(), 'fork failed - Cannot allocate memory')) {
  7179. $io->writeError('<error>The following exception is caused by a lack of memory or swap, or not having swap configured</error>', true, IOInterface::QUIET);
  7180. $io->writeError('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details</error>', true, IOInterface::QUIET);
  7181. }
  7182. }
  7183. public function getComposer($required = true, $disablePlugins = null)
  7184. {
  7185. if (null === $disablePlugins) {
  7186. $disablePlugins = $this->disablePluginsByDefault;
  7187. }
  7188. if (null === $this->composer) {
  7189. try {
  7190. $this->composer = Factory::create($this->io, null, $disablePlugins);
  7191. } catch (\InvalidArgumentException $e) {
  7192. if ($required) {
  7193. $this->io->writeError($e->getMessage());
  7194. exit(1);
  7195. }
  7196. } catch (JsonValidationException $e) {
  7197. $errors = ' - ' . implode(PHP_EOL . ' - ', $e->getErrors());
  7198. $message = $e->getMessage() . ':' . PHP_EOL . $errors;
  7199. throw new JsonValidationException($message);
  7200. }
  7201. }
  7202. return $this->composer;
  7203. }
  7204. public function resetComposer()
  7205. {
  7206. $this->composer = null;
  7207. }
  7208. public function getIO()
  7209. {
  7210. return $this->io;
  7211. }
  7212. public function getHelp()
  7213. {
  7214. return self::$logo . parent::getHelp();
  7215. }
  7216. protected function getDefaultCommands()
  7217. {
  7218. $commands = array_merge(parent::getDefaultCommands(), array(
  7219. new Command\AboutCommand(),
  7220. new Command\ConfigCommand(),
  7221. new Command\DependsCommand(),
  7222. new Command\ProhibitsCommand(),
  7223. new Command\InitCommand(),
  7224. new Command\InstallCommand(),
  7225. new Command\CreateProjectCommand(),
  7226. new Command\UpdateCommand(),
  7227. new Command\SearchCommand(),
  7228. new Command\ValidateCommand(),
  7229. new Command\ShowCommand(),
  7230. new Command\SuggestsCommand(),
  7231. new Command\RequireCommand(),
  7232. new Command\DumpAutoloadCommand(),
  7233. new Command\StatusCommand(),
  7234. new Command\ArchiveCommand(),
  7235. new Command\DiagnoseCommand(),
  7236. new Command\RunScriptCommand(),
  7237. new Command\LicensesCommand(),
  7238. new Command\GlobalCommand(),
  7239. new Command\ClearCacheCommand(),
  7240. new Command\RemoveCommand(),
  7241. new Command\HomeCommand(),
  7242. new Command\ExecCommand(),
  7243. new Command\OutdatedCommand(),
  7244. new Command\CheckPlatformReqsCommand(),
  7245. ));
  7246. if ('phar:' === substr(__FILE__, 0, 5)) {
  7247. $commands[] = new Command\SelfUpdateCommand();
  7248. }
  7249. return $commands;
  7250. }
  7251. public function getLongVersion()
  7252. {
  7253. if (Composer::BRANCH_ALIAS_VERSION) {
  7254. return sprintf(
  7255. '<info>%s</info> version <comment>%s (%s)</comment> %s',
  7256. $this->getName(),
  7257. Composer::BRANCH_ALIAS_VERSION,
  7258. $this->getVersion(),
  7259. Composer::RELEASE_DATE
  7260. );
  7261. }
  7262. return parent::getLongVersion() . ' ' . Composer::RELEASE_DATE;
  7263. }
  7264. protected function getDefaultInputDefinition()
  7265. {
  7266. $definition = parent::getDefaultInputDefinition();
  7267. $definition->addOption(new InputOption('--profile', null, InputOption::VALUE_NONE, 'Display timing and memory usage information'));
  7268. $definition->addOption(new InputOption('--no-plugins', null, InputOption::VALUE_NONE, 'Whether to disable plugins.'));
  7269. $definition->addOption(new InputOption('--working-dir', '-d', InputOption::VALUE_REQUIRED, 'If specified, use the given directory as working directory.'));
  7270. return $definition;
  7271. }
  7272. private function getPluginCommands()
  7273. {
  7274. $commands = array();
  7275. $composer = $this->getComposer(false, false);
  7276. if (null === $composer) {
  7277. $composer = Factory::createGlobal($this->io, false);
  7278. }
  7279. if (null !== $composer) {
  7280. $pm = $composer->getPluginManager();
  7281. foreach ($pm->getPluginCapabilities('Composer\Plugin\Capability\CommandProvider', array('composer' => $composer, 'io' => $this->io)) as $capability) {
  7282. $newCommands = $capability->getCommands();
  7283. if (!is_array($newCommands)) {
  7284. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' failed to return an array from getCommands');
  7285. }
  7286. foreach ($newCommands as $command) {
  7287. if (!$command instanceof Command\BaseCommand) {
  7288. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' returned an invalid value, we expected an array of Composer\Command\BaseCommand objects');
  7289. }
  7290. }
  7291. $commands = array_merge($commands, $newCommands);
  7292. }
  7293. }
  7294. return $commands;
  7295. }
  7296. }
  7297. <?php
  7298. namespace Composer\Console;
  7299. use Symfony\Component\Console\Formatter\OutputFormatter;
  7300. class HtmlOutputFormatter extends OutputFormatter
  7301. {
  7302. private static $availableForegroundColors = array(
  7303. 30 => 'black',
  7304. 31 => 'red',
  7305. 32 => 'green',
  7306. 33 => 'yellow',
  7307. 34 => 'blue',
  7308. 35 => 'magenta',
  7309. 36 => 'cyan',
  7310. 37 => 'white',
  7311. );
  7312. private static $availableBackgroundColors = array(
  7313. 40 => 'black',
  7314. 41 => 'red',
  7315. 42 => 'green',
  7316. 43 => 'yellow',
  7317. 44 => 'blue',
  7318. 45 => 'magenta',
  7319. 46 => 'cyan',
  7320. 47 => 'white',
  7321. );
  7322. private static $availableOptions = array(
  7323. 1 => 'bold',
  7324. 4 => 'underscore',
  7325. );
  7326. public function __construct(array $styles = array())
  7327. {
  7328. parent::__construct(true, $styles);
  7329. }
  7330. public function format($message)
  7331. {
  7332. $formatted = parent::format($message);
  7333. $clearEscapeCodes = '(?:39|49|0|22|24|25|27|28)';
  7334. return preg_replace_callback("{\033\[([0-9;]+)m(.*?)\033\[(?:".$clearEscapeCodes.";)*?".$clearEscapeCodes."m}s", array($this, 'formatHtml'), $formatted);
  7335. }
  7336. private function formatHtml($matches)
  7337. {
  7338. $out = '<span style="';
  7339. foreach (explode(';', $matches[1]) as $code) {
  7340. if (isset(self::$availableForegroundColors[$code])) {
  7341. $out .= 'color:'.self::$availableForegroundColors[$code].';';
  7342. } elseif (isset(self::$availableBackgroundColors[$code])) {
  7343. $out .= 'background-color:'.self::$availableBackgroundColors[$code].';';
  7344. } elseif (isset(self::$availableOptions[$code])) {
  7345. switch (self::$availableOptions[$code]) {
  7346. case 'bold':
  7347. $out .= 'font-weight:bold;';
  7348. break;
  7349. case 'underscore':
  7350. $out .= 'text-decoration:underline;';
  7351. break;
  7352. }
  7353. }
  7354. }
  7355. return $out.'">'.$matches[2].'</span>';
  7356. }
  7357. }
  7358. <?php
  7359. namespace Composer\DependencyResolver;
  7360. class Decisions implements \Iterator, \Countable
  7361. {
  7362. const DECISION_LITERAL = 0;
  7363. const DECISION_REASON = 1;
  7364. protected $pool;
  7365. protected $decisionMap;
  7366. protected $decisionQueue = array();
  7367. public function __construct($pool)
  7368. {
  7369. $this->pool = $pool;
  7370. $this->decisionMap = array();
  7371. }
  7372. public function decide($literal, $level, $why)
  7373. {
  7374. $this->addDecision($literal, $level);
  7375. $this->decisionQueue[] = array(
  7376. self::DECISION_LITERAL => $literal,
  7377. self::DECISION_REASON => $why,
  7378. );
  7379. }
  7380. public function satisfy($literal)
  7381. {
  7382. $packageId = abs($literal);
  7383. return (
  7384. $literal > 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 ||
  7385. $literal < 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0
  7386. );
  7387. }
  7388. public function conflict($literal)
  7389. {
  7390. $packageId = abs($literal);
  7391. return (
  7392. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 && $literal < 0) ||
  7393. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0 && $literal > 0)
  7394. );
  7395. }
  7396. public function decided($literalOrPackageId)
  7397. {
  7398. return !empty($this->decisionMap[abs($literalOrPackageId)]);
  7399. }
  7400. public function undecided($literalOrPackageId)
  7401. {
  7402. return empty($this->decisionMap[abs($literalOrPackageId)]);
  7403. }
  7404. public function decidedInstall($literalOrPackageId)
  7405. {
  7406. $packageId = abs($literalOrPackageId);
  7407. return isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0;
  7408. }
  7409. public function decisionLevel($literalOrPackageId)
  7410. {
  7411. $packageId = abs($literalOrPackageId);
  7412. if (isset($this->decisionMap[$packageId])) {
  7413. return abs($this->decisionMap[$packageId]);
  7414. }
  7415. return 0;
  7416. }
  7417. public function decisionRule($literalOrPackageId)
  7418. {
  7419. $packageId = abs($literalOrPackageId);
  7420. foreach ($this->decisionQueue as $i => $decision) {
  7421. if ($packageId === abs($decision[self::DECISION_LITERAL])) {
  7422. return $decision[self::DECISION_REASON];
  7423. }
  7424. }
  7425. return null;
  7426. }
  7427. public function atOffset($queueOffset)
  7428. {
  7429. return $this->decisionQueue[$queueOffset];
  7430. }
  7431. public function validOffset($queueOffset)
  7432. {
  7433. return $queueOffset >= 0 && $queueOffset < count($this->decisionQueue);
  7434. }
  7435. public function lastReason()
  7436. {
  7437. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_REASON];
  7438. }
  7439. public function lastLiteral()
  7440. {
  7441. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_LITERAL];
  7442. }
  7443. public function reset()
  7444. {
  7445. while ($decision = array_pop($this->decisionQueue)) {
  7446. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  7447. }
  7448. }
  7449. public function resetToOffset($offset)
  7450. {
  7451. while (count($this->decisionQueue) > $offset + 1) {
  7452. $decision = array_pop($this->decisionQueue);
  7453. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  7454. }
  7455. }
  7456. public function revertLast()
  7457. {
  7458. $this->decisionMap[abs($this->lastLiteral())] = 0;
  7459. array_pop($this->decisionQueue);
  7460. }
  7461. public function count()
  7462. {
  7463. return count($this->decisionQueue);
  7464. }
  7465. public function rewind()
  7466. {
  7467. end($this->decisionQueue);
  7468. }
  7469. public function current()
  7470. {
  7471. return current($this->decisionQueue);
  7472. }
  7473. public function key()
  7474. {
  7475. return key($this->decisionQueue);
  7476. }
  7477. public function next()
  7478. {
  7479. return prev($this->decisionQueue);
  7480. }
  7481. public function valid()
  7482. {
  7483. return false !== current($this->decisionQueue);
  7484. }
  7485. public function isEmpty()
  7486. {
  7487. return count($this->decisionQueue) === 0;
  7488. }
  7489. protected function addDecision($literal, $level)
  7490. {
  7491. $packageId = abs($literal);
  7492. $previousDecision = isset($this->decisionMap[$packageId]) ? $this->decisionMap[$packageId] : null;
  7493. if ($previousDecision != 0) {
  7494. $literalString = $this->pool->literalToString($literal);
  7495. $package = $this->pool->literalToPackage($literal);
  7496. throw new SolverBugException(
  7497. "Trying to decide $literalString on level $level, even though $package was previously decided as ".(int) $previousDecision."."
  7498. );
  7499. }
  7500. if ($literal > 0) {
  7501. $this->decisionMap[$packageId] = $level;
  7502. } else {
  7503. $this->decisionMap[$packageId] = -$level;
  7504. }
  7505. }
  7506. }
  7507. <?php
  7508. namespace Composer\DependencyResolver;
  7509. use Composer\Package\PackageInterface;
  7510. use Composer\Package\AliasPackage;
  7511. use Composer\Package\BasePackage;
  7512. use Composer\Semver\Constraint\Constraint;
  7513. class DefaultPolicy implements PolicyInterface
  7514. {
  7515. private $preferStable;
  7516. private $preferLowest;
  7517. public function __construct($preferStable = false, $preferLowest = false)
  7518. {
  7519. $this->preferStable = $preferStable;
  7520. $this->preferLowest = $preferLowest;
  7521. }
  7522. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator)
  7523. {
  7524. if ($this->preferStable && ($stabA = $a->getStability()) !== ($stabB = $b->getStability())) {
  7525. return BasePackage::$stabilities[$stabA] < BasePackage::$stabilities[$stabB];
  7526. }
  7527. $constraint = new Constraint($operator, $b->getVersion());
  7528. $version = new Constraint('==', $a->getVersion());
  7529. return $constraint->matchSpecific($version, true);
  7530. }
  7531. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package, $mustMatchName = false)
  7532. {
  7533. $packages = array();
  7534. foreach ($pool->whatProvides($package->getName(), null, $mustMatchName) as $candidate) {
  7535. if ($candidate !== $package) {
  7536. $packages[] = $candidate;
  7537. }
  7538. }
  7539. return $packages;
  7540. }
  7541. public function getPriority(Pool $pool, PackageInterface $package)
  7542. {
  7543. return $pool->getPriority($package->getRepository());
  7544. }
  7545. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null)
  7546. {
  7547. $packages = $this->groupLiteralsByNamePreferInstalled($pool, $installedMap, $literals);
  7548. foreach ($packages as &$literals) {
  7549. $policy = $this;
  7550. usort($literals, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  7551. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage, true);
  7552. });
  7553. }
  7554. foreach ($packages as &$literals) {
  7555. $literals = $this->pruneToHighestPriorityOrInstalled($pool, $installedMap, $literals);
  7556. $literals = $this->pruneToBestVersion($pool, $literals);
  7557. $literals = $this->pruneRemoteAliases($pool, $literals);
  7558. }
  7559. $selected = call_user_func_array('array_merge', $packages);
  7560. usort($selected, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  7561. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage);
  7562. });
  7563. return $selected;
  7564. }
  7565. protected function groupLiteralsByNamePreferInstalled(Pool $pool, array $installedMap, $literals)
  7566. {
  7567. $packages = array();
  7568. foreach ($literals as $literal) {
  7569. $packageName = $pool->literalToPackage($literal)->getName();
  7570. if (!isset($packages[$packageName])) {
  7571. $packages[$packageName] = array();
  7572. }
  7573. if (isset($installedMap[abs($literal)])) {
  7574. array_unshift($packages[$packageName], $literal);
  7575. } else {
  7576. $packages[$packageName][] = $literal;
  7577. }
  7578. }
  7579. return $packages;
  7580. }
  7581. public function compareByPriorityPreferInstalled(Pool $pool, array $installedMap, PackageInterface $a, PackageInterface $b, $requiredPackage = null, $ignoreReplace = false)
  7582. {
  7583. if ($a->getRepository() === $b->getRepository()) {
  7584. if ($a->getName() === $b->getName()) {
  7585. $aAliased = $a instanceof AliasPackage;
  7586. $bAliased = $b instanceof AliasPackage;
  7587. if ($aAliased && !$bAliased) {
  7588. return -1;
  7589. }
  7590. if (!$aAliased && $bAliased) {
  7591. return 1;
  7592. }
  7593. }
  7594. if (!$ignoreReplace) {
  7595. if ($this->replaces($a, $b)) {
  7596. return 1;
  7597. }
  7598. if ($this->replaces($b, $a)) {
  7599. return -1;
  7600. }
  7601. if ($requiredPackage && false !== ($pos = strpos($requiredPackage, '/'))) {
  7602. $requiredVendor = substr($requiredPackage, 0, $pos);
  7603. $aIsSameVendor = substr($a->getName(), 0, $pos) === $requiredVendor;
  7604. $bIsSameVendor = substr($b->getName(), 0, $pos) === $requiredVendor;
  7605. if ($bIsSameVendor !== $aIsSameVendor) {
  7606. return $aIsSameVendor ? -1 : 1;
  7607. }
  7608. }
  7609. }
  7610. if ($a->id === $b->id) {
  7611. return 0;
  7612. }
  7613. return ($a->id < $b->id) ? -1 : 1;
  7614. }
  7615. if (isset($installedMap[$a->id])) {
  7616. return -1;
  7617. }
  7618. if (isset($installedMap[$b->id])) {
  7619. return 1;
  7620. }
  7621. return ($this->getPriority($pool, $a) > $this->getPriority($pool, $b)) ? -1 : 1;
  7622. }
  7623. protected function replaces(PackageInterface $source, PackageInterface $target)
  7624. {
  7625. foreach ($source->getReplaces() as $link) {
  7626. if ($link->getTarget() === $target->getName()
  7627. ) {
  7628. return true;
  7629. }
  7630. }
  7631. return false;
  7632. }
  7633. protected function pruneToBestVersion(Pool $pool, $literals)
  7634. {
  7635. $operator = $this->preferLowest ? '<' : '>';
  7636. $bestLiterals = array($literals[0]);
  7637. $bestPackage = $pool->literalToPackage($literals[0]);
  7638. foreach ($literals as $i => $literal) {
  7639. if (0 === $i) {
  7640. continue;
  7641. }
  7642. $package = $pool->literalToPackage($literal);
  7643. if ($this->versionCompare($package, $bestPackage, $operator)) {
  7644. $bestPackage = $package;
  7645. $bestLiterals = array($literal);
  7646. } elseif ($this->versionCompare($package, $bestPackage, '==')) {
  7647. $bestLiterals[] = $literal;
  7648. }
  7649. }
  7650. return $bestLiterals;
  7651. }
  7652. protected function pruneToHighestPriorityOrInstalled(Pool $pool, array $installedMap, array $literals)
  7653. {
  7654. $selected = array();
  7655. $priority = null;
  7656. foreach ($literals as $literal) {
  7657. $package = $pool->literalToPackage($literal);
  7658. if (isset($installedMap[$package->id])) {
  7659. $selected[] = $literal;
  7660. continue;
  7661. }
  7662. if (null === $priority) {
  7663. $priority = $this->getPriority($pool, $package);
  7664. }
  7665. if ($this->getPriority($pool, $package) != $priority) {
  7666. break;
  7667. }
  7668. $selected[] = $literal;
  7669. }
  7670. return $selected;
  7671. }
  7672. protected function pruneRemoteAliases(Pool $pool, array $literals)
  7673. {
  7674. $hasLocalAlias = false;
  7675. foreach ($literals as $literal) {
  7676. $package = $pool->literalToPackage($literal);
  7677. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  7678. $hasLocalAlias = true;
  7679. break;
  7680. }
  7681. }
  7682. if (!$hasLocalAlias) {
  7683. return $literals;
  7684. }
  7685. $selected = array();
  7686. foreach ($literals as $literal) {
  7687. $package = $pool->literalToPackage($literal);
  7688. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  7689. $selected[] = $literal;
  7690. }
  7691. }
  7692. return $selected;
  7693. }
  7694. }
  7695. <?php
  7696. namespace Composer\DependencyResolver;
  7697. use Composer\Package\PackageInterface;
  7698. use Composer\Package\Link;
  7699. class GenericRule extends Rule
  7700. {
  7701. protected $literals;
  7702. public function __construct(array $literals, $reason, $reasonData, $job = null)
  7703. {
  7704. parent::__construct($reason, $reasonData, $job);
  7705. sort($literals);
  7706. $this->literals = $literals;
  7707. }
  7708. public function getLiterals()
  7709. {
  7710. return $this->literals;
  7711. }
  7712. public function getHash()
  7713. {
  7714. $data = unpack('ihash', md5(implode(',', $this->literals), true));
  7715. return $data['hash'];
  7716. }
  7717. public function equals(Rule $rule)
  7718. {
  7719. return $this->literals === $rule->getLiterals();
  7720. }
  7721. public function isAssertion()
  7722. {
  7723. return 1 === count($this->literals);
  7724. }
  7725. public function __toString()
  7726. {
  7727. $result = $this->isDisabled() ? 'disabled(' : '(';
  7728. foreach ($this->literals as $i => $literal) {
  7729. if ($i != 0) {
  7730. $result .= '|';
  7731. }
  7732. $result .= $literal;
  7733. }
  7734. $result .= ')';
  7735. return $result;
  7736. }
  7737. }
  7738. <?php
  7739. namespace Composer\DependencyResolver\Operation;
  7740. use Composer\Package\PackageInterface;
  7741. class InstallOperation extends SolverOperation
  7742. {
  7743. protected $package;
  7744. public function __construct(PackageInterface $package, $reason = null)
  7745. {
  7746. parent::__construct($reason);
  7747. $this->package = $package;
  7748. }
  7749. public function getPackage()
  7750. {
  7751. return $this->package;
  7752. }
  7753. public function getJobType()
  7754. {
  7755. return 'install';
  7756. }
  7757. public function __toString()
  7758. {
  7759. return 'Installing '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  7760. }
  7761. }
  7762. <?php
  7763. namespace Composer\DependencyResolver\Operation;
  7764. use Composer\Package\AliasPackage;
  7765. use Composer\Package\PackageInterface;
  7766. class MarkAliasInstalledOperation extends SolverOperation
  7767. {
  7768. protected $package;
  7769. public function __construct(AliasPackage $package, $reason = null)
  7770. {
  7771. parent::__construct($reason);
  7772. $this->package = $package;
  7773. }
  7774. public function getPackage()
  7775. {
  7776. return $this->package;
  7777. }
  7778. public function getJobType()
  7779. {
  7780. return 'markAliasInstalled';
  7781. }
  7782. public function __toString()
  7783. {
  7784. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as installed, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  7785. }
  7786. }
  7787. <?php
  7788. namespace Composer\DependencyResolver\Operation;
  7789. use Composer\Package\AliasPackage;
  7790. use Composer\Package\PackageInterface;
  7791. class MarkAliasUninstalledOperation extends SolverOperation
  7792. {
  7793. protected $package;
  7794. public function __construct(AliasPackage $package, $reason = null)
  7795. {
  7796. parent::__construct($reason);
  7797. $this->package = $package;
  7798. }
  7799. public function getPackage()
  7800. {
  7801. return $this->package;
  7802. }
  7803. public function getJobType()
  7804. {
  7805. return 'markAliasUninstalled';
  7806. }
  7807. public function __toString()
  7808. {
  7809. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as uninstalled, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  7810. }
  7811. }
  7812. <?php
  7813. namespace Composer\DependencyResolver\Operation;
  7814. interface OperationInterface
  7815. {
  7816. public function getJobType();
  7817. public function getReason();
  7818. public function __toString();
  7819. }
  7820. <?php
  7821. namespace Composer\DependencyResolver\Operation;
  7822. use Composer\Package\PackageInterface;
  7823. abstract class SolverOperation implements OperationInterface
  7824. {
  7825. protected $reason;
  7826. public function __construct($reason = null)
  7827. {
  7828. $this->reason = $reason;
  7829. }
  7830. public function getReason()
  7831. {
  7832. return $this->reason;
  7833. }
  7834. protected function formatVersion(PackageInterface $package)
  7835. {
  7836. return $package->getFullPrettyVersion();
  7837. }
  7838. }
  7839. <?php
  7840. namespace Composer\DependencyResolver\Operation;
  7841. use Composer\Package\PackageInterface;
  7842. class UninstallOperation extends SolverOperation
  7843. {
  7844. protected $package;
  7845. public function __construct(PackageInterface $package, $reason = null)
  7846. {
  7847. parent::__construct($reason);
  7848. $this->package = $package;
  7849. }
  7850. public function getPackage()
  7851. {
  7852. return $this->package;
  7853. }
  7854. public function getJobType()
  7855. {
  7856. return 'uninstall';
  7857. }
  7858. public function __toString()
  7859. {
  7860. return 'Uninstalling '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  7861. }
  7862. }
  7863. <?php
  7864. namespace Composer\DependencyResolver\Operation;
  7865. use Composer\Package\PackageInterface;
  7866. class UpdateOperation extends SolverOperation
  7867. {
  7868. protected $initialPackage;
  7869. protected $targetPackage;
  7870. public function __construct(PackageInterface $initial, PackageInterface $target, $reason = null)
  7871. {
  7872. parent::__construct($reason);
  7873. $this->initialPackage = $initial;
  7874. $this->targetPackage = $target;
  7875. }
  7876. public function getInitialPackage()
  7877. {
  7878. return $this->initialPackage;
  7879. }
  7880. public function getTargetPackage()
  7881. {
  7882. return $this->targetPackage;
  7883. }
  7884. public function getJobType()
  7885. {
  7886. return 'update';
  7887. }
  7888. public function __toString()
  7889. {
  7890. return 'Updating '.$this->initialPackage->getPrettyName().' ('.$this->formatVersion($this->initialPackage).') to '.
  7891. $this->targetPackage->getPrettyName(). ' ('.$this->formatVersion($this->targetPackage).')';
  7892. }
  7893. }
  7894. <?php
  7895. namespace Composer\DependencyResolver;
  7896. use Composer\Package\PackageInterface;
  7897. interface PolicyInterface
  7898. {
  7899. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator);
  7900. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package);
  7901. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null);
  7902. }
  7903. <?php
  7904. namespace Composer\DependencyResolver;
  7905. use Composer\Package\BasePackage;
  7906. use Composer\Package\AliasPackage;
  7907. use Composer\Package\Version\VersionParser;
  7908. use Composer\Semver\Constraint\ConstraintInterface;
  7909. use Composer\Semver\Constraint\Constraint;
  7910. use Composer\Semver\Constraint\EmptyConstraint;
  7911. use Composer\Repository\RepositoryInterface;
  7912. use Composer\Repository\CompositeRepository;
  7913. use Composer\Repository\ComposerRepository;
  7914. use Composer\Repository\InstalledRepositoryInterface;
  7915. use Composer\Repository\PlatformRepository;
  7916. use Composer\Package\PackageInterface;
  7917. class Pool implements \Countable
  7918. {
  7919. const MATCH_NAME = -1;
  7920. const MATCH_NONE = 0;
  7921. const MATCH = 1;
  7922. const MATCH_PROVIDE = 2;
  7923. const MATCH_REPLACE = 3;
  7924. const MATCH_FILTERED = 4;
  7925. protected $repositories = array();
  7926. protected $providerRepos = array();
  7927. protected $packages = array();
  7928. protected $packageByName = array();
  7929. protected $packageByExactName = array();
  7930. protected $acceptableStabilities;
  7931. protected $stabilityFlags;
  7932. protected $versionParser;
  7933. protected $providerCache = array();
  7934. protected $filterRequires;
  7935. protected $whitelist = null;
  7936. protected $id = 1;
  7937. public function __construct($minimumStability = 'stable', array $stabilityFlags = array(), array $filterRequires = array())
  7938. {
  7939. $this->versionParser = new VersionParser;
  7940. $this->acceptableStabilities = array();
  7941. foreach (BasePackage::$stabilities as $stability => $value) {
  7942. if ($value <= BasePackage::$stabilities[$minimumStability]) {
  7943. $this->acceptableStabilities[$stability] = $value;
  7944. }
  7945. }
  7946. $this->stabilityFlags = $stabilityFlags;
  7947. $this->filterRequires = $filterRequires;
  7948. foreach ($filterRequires as $name => $constraint) {
  7949. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  7950. unset($this->filterRequires[$name]);
  7951. }
  7952. }
  7953. }
  7954. public function setWhitelist($whitelist)
  7955. {
  7956. $this->whitelist = $whitelist;
  7957. $this->providerCache = array();
  7958. }
  7959. public function addRepository(RepositoryInterface $repo, $rootAliases = array())
  7960. {
  7961. if ($repo instanceof CompositeRepository) {
  7962. $repos = $repo->getRepositories();
  7963. } else {
  7964. $repos = array($repo);
  7965. }
  7966. foreach ($repos as $repo) {
  7967. $this->repositories[] = $repo;
  7968. $exempt = $repo instanceof PlatformRepository || $repo instanceof InstalledRepositoryInterface;
  7969. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  7970. $this->providerRepos[] = $repo;
  7971. $repo->setRootAliases($rootAliases);
  7972. $repo->resetPackageIds();
  7973. } else {
  7974. foreach ($repo->getPackages() as $package) {
  7975. $names = $package->getNames();
  7976. $stability = $package->getStability();
  7977. if ($exempt || $this->isPackageAcceptable($names, $stability)) {
  7978. $package->setId($this->id++);
  7979. $this->packages[] = $package;
  7980. $this->packageByExactName[$package->getName()][$package->id] = $package;
  7981. foreach ($names as $provided) {
  7982. $this->packageByName[$provided][] = $package;
  7983. }
  7984. $name = $package->getName();
  7985. if (isset($rootAliases[$name][$package->getVersion()])) {
  7986. $alias = $rootAliases[$name][$package->getVersion()];
  7987. if ($package instanceof AliasPackage) {
  7988. $package = $package->getAliasOf();
  7989. }
  7990. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  7991. $aliasPackage->setRootPackageAlias(true);
  7992. $aliasPackage->setId($this->id++);
  7993. $package->getRepository()->addPackage($aliasPackage);
  7994. $this->packages[] = $aliasPackage;
  7995. $this->packageByExactName[$aliasPackage->getName()][$aliasPackage->id] = $aliasPackage;
  7996. foreach ($aliasPackage->getNames() as $name) {
  7997. $this->packageByName[$name][] = $aliasPackage;
  7998. }
  7999. }
  8000. }
  8001. }
  8002. }
  8003. }
  8004. }
  8005. public function getPriority(RepositoryInterface $repo)
  8006. {
  8007. $priority = array_search($repo, $this->repositories, true);
  8008. if (false === $priority) {
  8009. throw new \RuntimeException("Could not determine repository priority. The repository was not registered in the pool.");
  8010. }
  8011. return -$priority;
  8012. }
  8013. public function packageById($id)
  8014. {
  8015. return $this->packages[$id - 1];
  8016. }
  8017. public function count()
  8018. {
  8019. return count($this->packages);
  8020. }
  8021. public function whatProvides($name, ConstraintInterface $constraint = null, $mustMatchName = false, $bypassFilters = false)
  8022. {
  8023. if ($bypassFilters) {
  8024. return $this->computeWhatProvides($name, $constraint, $mustMatchName, true);
  8025. }
  8026. $key = ((int) $mustMatchName).$constraint;
  8027. if (isset($this->providerCache[$name][$key])) {
  8028. return $this->providerCache[$name][$key];
  8029. }
  8030. return $this->providerCache[$name][$key] = $this->computeWhatProvides($name, $constraint, $mustMatchName, $bypassFilters);
  8031. }
  8032. private function computeWhatProvides($name, $constraint, $mustMatchName = false, $bypassFilters = false)
  8033. {
  8034. $candidates = array();
  8035. foreach ($this->providerRepos as $repo) {
  8036. foreach ($repo->whatProvides($this, $name, $bypassFilters) as $candidate) {
  8037. $candidates[] = $candidate;
  8038. if ($candidate->id < 1) {
  8039. $candidate->setId($this->id++);
  8040. $this->packages[$this->id - 2] = $candidate;
  8041. }
  8042. }
  8043. }
  8044. if ($mustMatchName) {
  8045. $candidates = array_filter($candidates, function ($candidate) use ($name) {
  8046. return $candidate->getName() == $name;
  8047. });
  8048. if (isset($this->packageByExactName[$name])) {
  8049. $candidates = array_merge($candidates, $this->packageByExactName[$name]);
  8050. }
  8051. } elseif (isset($this->packageByName[$name])) {
  8052. $candidates = array_merge($candidates, $this->packageByName[$name]);
  8053. }
  8054. $matches = $provideMatches = array();
  8055. $nameMatch = false;
  8056. foreach ($candidates as $candidate) {
  8057. $aliasOfCandidate = null;
  8058. if ($candidate instanceof AliasPackage) {
  8059. $aliasOfCandidate = $candidate->getAliasOf();
  8060. }
  8061. if ($this->whitelist !== null && !$bypassFilters && (
  8062. (!($candidate instanceof AliasPackage) && !isset($this->whitelist[$candidate->id])) ||
  8063. ($candidate instanceof AliasPackage && !isset($this->whitelist[$aliasOfCandidate->id]))
  8064. )) {
  8065. continue;
  8066. }
  8067. switch ($this->match($candidate, $name, $constraint, $bypassFilters)) {
  8068. case self::MATCH_NONE:
  8069. break;
  8070. case self::MATCH_NAME:
  8071. $nameMatch = true;
  8072. break;
  8073. case self::MATCH:
  8074. $nameMatch = true;
  8075. $matches[] = $candidate;
  8076. break;
  8077. case self::MATCH_PROVIDE:
  8078. $provideMatches[] = $candidate;
  8079. break;
  8080. case self::MATCH_REPLACE:
  8081. $matches[] = $candidate;
  8082. break;
  8083. case self::MATCH_FILTERED:
  8084. break;
  8085. default:
  8086. throw new \UnexpectedValueException('Unexpected match type');
  8087. }
  8088. }
  8089. if ($nameMatch) {
  8090. return $matches;
  8091. }
  8092. return array_merge($matches, $provideMatches);
  8093. }
  8094. public function literalToPackage($literal)
  8095. {
  8096. $packageId = abs($literal);
  8097. return $this->packageById($packageId);
  8098. }
  8099. public function literalToPrettyString($literal, $installedMap)
  8100. {
  8101. $package = $this->literalToPackage($literal);
  8102. if (isset($installedMap[$package->id])) {
  8103. $prefix = ($literal > 0 ? 'keep' : 'remove');
  8104. } else {
  8105. $prefix = ($literal > 0 ? 'install' : 'don\'t install');
  8106. }
  8107. return $prefix.' '.$package->getPrettyString();
  8108. }
  8109. public function isPackageAcceptable($name, $stability)
  8110. {
  8111. foreach ((array) $name as $n) {
  8112. if (!isset($this->stabilityFlags[$n]) && isset($this->acceptableStabilities[$stability])) {
  8113. return true;
  8114. }
  8115. if (isset($this->stabilityFlags[$n]) && BasePackage::$stabilities[$stability] <= $this->stabilityFlags[$n]) {
  8116. return true;
  8117. }
  8118. }
  8119. return false;
  8120. }
  8121. public function match($candidate, $name, ConstraintInterface $constraint = null, $bypassFilters)
  8122. {
  8123. $candidateName = $candidate->getName();
  8124. $candidateVersion = $candidate->getVersion();
  8125. $isDev = $candidate->getStability() === 'dev';
  8126. $isAlias = $candidate instanceof AliasPackage;
  8127. if (!$bypassFilters && !$isDev && !$isAlias && isset($this->filterRequires[$name])) {
  8128. $requireFilter = $this->filterRequires[$name];
  8129. } else {
  8130. $requireFilter = new EmptyConstraint;
  8131. }
  8132. if ($candidateName === $name) {
  8133. $pkgConstraint = new Constraint('==', $candidateVersion);
  8134. if ($constraint === null || $constraint->matches($pkgConstraint)) {
  8135. return $requireFilter->matches($pkgConstraint) ? self::MATCH : self::MATCH_FILTERED;
  8136. }
  8137. return self::MATCH_NAME;
  8138. }
  8139. $provides = $candidate->getProvides();
  8140. $replaces = $candidate->getReplaces();
  8141. if (isset($replaces[0]) || isset($provides[0])) {
  8142. foreach ($provides as $link) {
  8143. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  8144. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  8145. }
  8146. }
  8147. foreach ($replaces as $link) {
  8148. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  8149. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  8150. }
  8151. }
  8152. return self::MATCH_NONE;
  8153. }
  8154. if (isset($provides[$name]) && ($constraint === null || $constraint->matches($provides[$name]->getConstraint()))) {
  8155. return $requireFilter->matches($provides[$name]->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  8156. }
  8157. if (isset($replaces[$name]) && ($constraint === null || $constraint->matches($replaces[$name]->getConstraint()))) {
  8158. return $requireFilter->matches($replaces[$name]->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  8159. }
  8160. return self::MATCH_NONE;
  8161. }
  8162. }
  8163. <?php
  8164. namespace Composer\DependencyResolver;
  8165. use Composer\Package\CompletePackageInterface;
  8166. class Problem
  8167. {
  8168. protected $reasonSeen;
  8169. protected $reasons = array();
  8170. protected $section = 0;
  8171. protected $pool;
  8172. public function __construct(Pool $pool)
  8173. {
  8174. $this->pool = $pool;
  8175. }
  8176. public function addRule(Rule $rule)
  8177. {
  8178. $this->addReason(spl_object_hash($rule), array(
  8179. 'rule' => $rule,
  8180. 'job' => $rule->getJob(),
  8181. ));
  8182. }
  8183. public function getReasons()
  8184. {
  8185. return $this->reasons;
  8186. }
  8187. public function getPrettyString(array $installedMap = array())
  8188. {
  8189. $reasons = call_user_func_array('array_merge', array_reverse($this->reasons));
  8190. if (count($reasons) === 1) {
  8191. reset($reasons);
  8192. $reason = current($reasons);
  8193. $rule = $reason['rule'];
  8194. $job = $reason['job'];
  8195. if (isset($job['constraint'])) {
  8196. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8197. } else {
  8198. $packages = array();
  8199. }
  8200. if ($job && $job['cmd'] === 'install' && empty($packages)) {
  8201. if ($job['packageName'] === 'php' || $job['packageName'] === 'php-64bit' || $job['packageName'] === 'hhvm') {
  8202. $version = phpversion();
  8203. $available = $this->pool->whatProvides($job['packageName']);
  8204. if (count($available)) {
  8205. $firstAvailable = reset($available);
  8206. $version = $firstAvailable->getPrettyVersion();
  8207. $extra = $firstAvailable->getExtra();
  8208. if ($firstAvailable instanceof CompletePackageInterface && isset($extra['config.platform']) && $extra['config.platform'] === true) {
  8209. $version .= '; ' . $firstAvailable->getDescription();
  8210. }
  8211. }
  8212. $msg = "\n - This package requires ".$job['packageName'].$this->constraintToText($job['constraint']).' but ';
  8213. if (defined('HHVM_VERSION')) {
  8214. return $msg . 'your HHVM version does not satisfy that requirement.';
  8215. }
  8216. if ($job['packageName'] === 'hhvm') {
  8217. return $msg . 'you are running this with PHP and not HHVM.';
  8218. }
  8219. return $msg . 'your PHP version ('. $version .') does not satisfy that requirement.';
  8220. }
  8221. if (0 === stripos($job['packageName'], 'ext-')) {
  8222. if (false !== strpos($job['packageName'], ' ')) {
  8223. return "\n - The requested PHP extension ".$job['packageName'].' should be required as '.str_replace(' ', '-', $job['packageName']).'.';
  8224. }
  8225. $ext = substr($job['packageName'], 4);
  8226. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  8227. return "\n - The requested PHP extension ".$job['packageName'].$this->constraintToText($job['constraint']).' '.$error.'. Install or enable PHP\'s '.$ext.' extension.';
  8228. }
  8229. if (0 === stripos($job['packageName'], 'lib-')) {
  8230. if (strtolower($job['packageName']) === 'lib-icu') {
  8231. $error = extension_loaded('intl') ? 'has the wrong version installed, try upgrading the intl extension.' : 'is missing from your system, make sure the intl extension is loaded.';
  8232. return "\n - The requested linked library ".$job['packageName'].$this->constraintToText($job['constraint']).' '.$error;
  8233. }
  8234. return "\n - The requested linked library ".$job['packageName'].$this->constraintToText($job['constraint']).' has the wrong version installed or is missing from your system, make sure to load the extension providing it.';
  8235. }
  8236. if (!preg_match('{^[A-Za-z0-9_./-]+$}', $job['packageName'])) {
  8237. $illegalChars = preg_replace('{[A-Za-z0-9_./-]+}', '', $job['packageName']);
  8238. return "\n - The requested package ".$job['packageName'].' could not be found, it looks like its name is invalid, "'.$illegalChars.'" is not allowed in package names.';
  8239. }
  8240. if ($providers = $this->pool->whatProvides($job['packageName'], $job['constraint'], true, true)) {
  8241. return "\n - The requested package ".$job['packageName'].$this->constraintToText($job['constraint']).' is satisfiable by '.$this->getPackageList($providers).' but these conflict with your requirements or minimum-stability.';
  8242. }
  8243. if ($providers = $this->pool->whatProvides($job['packageName'], null, true, true)) {
  8244. return "\n - The requested package ".$job['packageName'].$this->constraintToText($job['constraint']).' exists as '.$this->getPackageList($providers).' but these are rejected by your constraint.';
  8245. }
  8246. return "\n - The requested package ".$job['packageName'].' could not be found in any version, there may be a typo in the package name.';
  8247. }
  8248. }
  8249. $messages = array();
  8250. foreach ($reasons as $reason) {
  8251. $rule = $reason['rule'];
  8252. $job = $reason['job'];
  8253. if ($job) {
  8254. $messages[] = $this->jobToText($job);
  8255. } elseif ($rule) {
  8256. if ($rule instanceof Rule) {
  8257. $messages[] = $rule->getPrettyString($this->pool, $installedMap);
  8258. }
  8259. }
  8260. }
  8261. return "\n - ".implode("\n - ", $messages);
  8262. }
  8263. protected function addReason($id, $reason)
  8264. {
  8265. if (!isset($this->reasonSeen[$id])) {
  8266. $this->reasonSeen[$id] = true;
  8267. $this->reasons[$this->section][] = $reason;
  8268. }
  8269. }
  8270. public function nextSection()
  8271. {
  8272. $this->section++;
  8273. }
  8274. protected function jobToText($job)
  8275. {
  8276. switch ($job['cmd']) {
  8277. case 'install':
  8278. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8279. if (!$packages) {
  8280. return 'No package found to satisfy install request for '.$job['packageName'].$this->constraintToText($job['constraint']);
  8281. }
  8282. return 'Installation request for '.$job['packageName'].$this->constraintToText($job['constraint']).' -> satisfiable by '.$this->getPackageList($packages).'.';
  8283. case 'update':
  8284. return 'Update request for '.$job['packageName'].$this->constraintToText($job['constraint']).'.';
  8285. case 'remove':
  8286. return 'Removal request for '.$job['packageName'].$this->constraintToText($job['constraint']).'';
  8287. }
  8288. if (isset($job['constraint'])) {
  8289. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8290. } else {
  8291. $packages = array();
  8292. }
  8293. return 'Job(cmd='.$job['cmd'].', target='.$job['packageName'].', packages=['.$this->getPackageList($packages).'])';
  8294. }
  8295. protected function getPackageList($packages)
  8296. {
  8297. $prepared = array();
  8298. foreach ($packages as $package) {
  8299. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  8300. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  8301. }
  8302. foreach ($prepared as $name => $package) {
  8303. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  8304. }
  8305. return implode(', ', $prepared);
  8306. }
  8307. protected function constraintToText($constraint)
  8308. {
  8309. return $constraint ? ' '.$constraint->getPrettyString() : '';
  8310. }
  8311. }
  8312. <?php
  8313. namespace Composer\DependencyResolver;
  8314. use Composer\Semver\Constraint\ConstraintInterface;
  8315. class Request
  8316. {
  8317. protected $jobs;
  8318. public function __construct()
  8319. {
  8320. $this->jobs = array();
  8321. }
  8322. public function install($packageName, ConstraintInterface $constraint = null)
  8323. {
  8324. $this->addJob($packageName, 'install', $constraint);
  8325. }
  8326. public function update($packageName, ConstraintInterface $constraint = null)
  8327. {
  8328. $this->addJob($packageName, 'update', $constraint);
  8329. }
  8330. public function remove($packageName, ConstraintInterface $constraint = null)
  8331. {
  8332. $this->addJob($packageName, 'remove', $constraint);
  8333. }
  8334. public function fix($packageName, ConstraintInterface $constraint = null)
  8335. {
  8336. $this->addJob($packageName, 'install', $constraint, true);
  8337. }
  8338. protected function addJob($packageName, $cmd, ConstraintInterface $constraint = null, $fixed = false)
  8339. {
  8340. $packageName = strtolower($packageName);
  8341. $this->jobs[] = array(
  8342. 'cmd' => $cmd,
  8343. 'packageName' => $packageName,
  8344. 'constraint' => $constraint,
  8345. 'fixed' => $fixed,
  8346. );
  8347. }
  8348. public function updateAll()
  8349. {
  8350. $this->jobs[] = array('cmd' => 'update-all');
  8351. }
  8352. public function getJobs()
  8353. {
  8354. return $this->jobs;
  8355. }
  8356. }
  8357. <?php
  8358. namespace Composer\DependencyResolver;
  8359. use Composer\Package\CompletePackage;
  8360. use Composer\Package\Link;
  8361. use Composer\Package\PackageInterface;
  8362. abstract class Rule
  8363. {
  8364. const RULE_INTERNAL_ALLOW_UPDATE = 1;
  8365. const RULE_JOB_INSTALL = 2;
  8366. const RULE_JOB_REMOVE = 3;
  8367. const RULE_PACKAGE_CONFLICT = 6;
  8368. const RULE_PACKAGE_REQUIRES = 7;
  8369. const RULE_PACKAGE_OBSOLETES = 8;
  8370. const RULE_INSTALLED_PACKAGE_OBSOLETES = 9;
  8371. const RULE_PACKAGE_SAME_NAME = 10;
  8372. const RULE_PACKAGE_IMPLICIT_OBSOLETES = 11;
  8373. const RULE_LEARNED = 12;
  8374. const RULE_PACKAGE_ALIAS = 13;
  8375. const BITFIELD_TYPE = 0;
  8376. const BITFIELD_REASON = 8;
  8377. const BITFIELD_DISABLED = 16;
  8378. protected $bitfield;
  8379. protected $job;
  8380. protected $reasonData;
  8381. public function __construct($reason, $reasonData, $job = null)
  8382. {
  8383. $this->reasonData = $reasonData;
  8384. if ($job) {
  8385. $this->job = $job;
  8386. }
  8387. $this->bitfield = (0 << self::BITFIELD_DISABLED) |
  8388. ($reason << self::BITFIELD_REASON) |
  8389. (255 << self::BITFIELD_TYPE);
  8390. }
  8391. abstract public function getLiterals();
  8392. abstract public function getHash();
  8393. public function getJob()
  8394. {
  8395. return $this->job;
  8396. }
  8397. abstract public function equals(Rule $rule);
  8398. public function getReason()
  8399. {
  8400. return ($this->bitfield & (255 << self::BITFIELD_REASON)) >> self::BITFIELD_REASON;
  8401. }
  8402. public function getReasonData()
  8403. {
  8404. return $this->reasonData;
  8405. }
  8406. public function getRequiredPackage()
  8407. {
  8408. if ($this->getReason() === self::RULE_JOB_INSTALL) {
  8409. return $this->reasonData;
  8410. }
  8411. if ($this->getReason() === self::RULE_PACKAGE_REQUIRES) {
  8412. return $this->reasonData->getTarget();
  8413. }
  8414. }
  8415. public function setType($type)
  8416. {
  8417. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_TYPE)) | ((255 & $type) << self::BITFIELD_TYPE);
  8418. }
  8419. public function getType()
  8420. {
  8421. return ($this->bitfield & (255 << self::BITFIELD_TYPE)) >> self::BITFIELD_TYPE;
  8422. }
  8423. public function disable()
  8424. {
  8425. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_DISABLED)) | (1 << self::BITFIELD_DISABLED);
  8426. }
  8427. public function enable()
  8428. {
  8429. $this->bitfield = $this->bitfield & ~(255 << self::BITFIELD_DISABLED);
  8430. }
  8431. public function isDisabled()
  8432. {
  8433. return (bool) (($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  8434. }
  8435. public function isEnabled()
  8436. {
  8437. return !(($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  8438. }
  8439. abstract public function isAssertion();
  8440. public function getPrettyString(Pool $pool, array $installedMap = array())
  8441. {
  8442. $literals = $this->getLiterals();
  8443. $ruleText = '';
  8444. foreach ($literals as $i => $literal) {
  8445. if ($i != 0) {
  8446. $ruleText .= '|';
  8447. }
  8448. $ruleText .= $pool->literalToPrettyString($literal, $installedMap);
  8449. }
  8450. switch ($this->getReason()) {
  8451. case self::RULE_INTERNAL_ALLOW_UPDATE:
  8452. return $ruleText;
  8453. case self::RULE_JOB_INSTALL:
  8454. return "Install command rule ($ruleText)";
  8455. case self::RULE_JOB_REMOVE:
  8456. return "Remove command rule ($ruleText)";
  8457. case self::RULE_PACKAGE_CONFLICT:
  8458. $package1 = $pool->literalToPackage($literals[0]);
  8459. $package2 = $pool->literalToPackage($literals[1]);
  8460. return $package1->getPrettyString().' conflicts with '.$this->formatPackagesUnique($pool, array($package2)).'.';
  8461. case self::RULE_PACKAGE_REQUIRES:
  8462. $sourceLiteral = array_shift($literals);
  8463. $sourcePackage = $pool->literalToPackage($sourceLiteral);
  8464. $requires = array();
  8465. foreach ($literals as $literal) {
  8466. $requires[] = $pool->literalToPackage($literal);
  8467. }
  8468. $text = $this->reasonData->getPrettyString($sourcePackage);
  8469. if ($requires) {
  8470. $text .= ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $requires) . '.';
  8471. } else {
  8472. $targetName = $this->reasonData->getTarget();
  8473. if ($targetName === 'php' || $targetName === 'php-64bit' || $targetName === 'hhvm') {
  8474. if (defined('HHVM_VERSION')) {
  8475. return $text . ' -> your HHVM version does not satisfy that requirement.';
  8476. }
  8477. if ($targetName === 'hhvm') {
  8478. return $text . ' -> you are running this with PHP and not HHVM.';
  8479. }
  8480. $packages = $pool->whatProvides($targetName);
  8481. $package = count($packages) ? current($packages) : phpversion();
  8482. if (!($package instanceof CompletePackage)) {
  8483. return $text . ' -> your PHP version ('.phpversion().') does not satisfy that requirement.';
  8484. }
  8485. $extra = $package->getExtra();
  8486. if (!empty($extra['config.platform'])) {
  8487. $text .= ' -> your PHP version ('.phpversion().') overridden by "config.platform.php" version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  8488. } else {
  8489. $text .= ' -> your PHP version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  8490. }
  8491. return $text;
  8492. }
  8493. if (0 === strpos($targetName, 'ext-')) {
  8494. $ext = substr($targetName, 4);
  8495. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  8496. return $text . ' -> the requested PHP extension '.$ext.' '.$error.'.';
  8497. }
  8498. if (0 === strpos($targetName, 'lib-')) {
  8499. $lib = substr($targetName, 4);
  8500. return $text . ' -> the requested linked library '.$lib.' has the wrong version installed or is missing from your system, make sure to have the extension providing it.';
  8501. }
  8502. if ($providers = $pool->whatProvides($targetName, $this->reasonData->getConstraint(), true, true)) {
  8503. return $text . ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $providers) .' but these conflict with your requirements or minimum-stability.';
  8504. }
  8505. return $text . ' -> no matching package found.';
  8506. }
  8507. return $text;
  8508. case self::RULE_PACKAGE_OBSOLETES:
  8509. return $ruleText;
  8510. case self::RULE_INSTALLED_PACKAGE_OBSOLETES:
  8511. return $ruleText;
  8512. case self::RULE_PACKAGE_SAME_NAME:
  8513. return 'Can only install one of: ' . $this->formatPackagesUnique($pool, $literals) . '.';
  8514. case self::RULE_PACKAGE_IMPLICIT_OBSOLETES:
  8515. return $ruleText;
  8516. case self::RULE_LEARNED:
  8517. return 'Conclusion: '.$ruleText;
  8518. case self::RULE_PACKAGE_ALIAS:
  8519. return $ruleText;
  8520. default:
  8521. return '('.$ruleText.')';
  8522. }
  8523. }
  8524. protected function formatPackagesUnique($pool, array $packages)
  8525. {
  8526. $prepared = array();
  8527. foreach ($packages as $package) {
  8528. if (!is_object($package)) {
  8529. $package = $pool->literalToPackage($package);
  8530. }
  8531. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  8532. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  8533. }
  8534. foreach ($prepared as $name => $package) {
  8535. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  8536. }
  8537. return implode(', ', $prepared);
  8538. }
  8539. }
  8540. <?php
  8541. namespace Composer\DependencyResolver;
  8542. use Composer\Package\PackageInterface;
  8543. use Composer\Package\Link;
  8544. class Rule2Literals extends Rule
  8545. {
  8546. protected $literal1;
  8547. protected $literal2;
  8548. public function __construct($literal1, $literal2, $reason, $reasonData, $job = null)
  8549. {
  8550. parent::__construct($reason, $reasonData, $job);
  8551. if ($literal1 < $literal2) {
  8552. $this->literal1 = $literal1;
  8553. $this->literal2 = $literal2;
  8554. } else {
  8555. $this->literal1 = $literal2;
  8556. $this->literal2 = $literal1;
  8557. }
  8558. }
  8559. public function getLiterals()
  8560. {
  8561. return array($this->literal1, $this->literal2);
  8562. }
  8563. public function getHash()
  8564. {
  8565. return $this->literal1.','.$this->literal2;
  8566. }
  8567. public function equals(Rule $rule)
  8568. {
  8569. if ($rule instanceof self) {
  8570. if ($this->literal1 !== $rule->literal1) {
  8571. return false;
  8572. }
  8573. if ($this->literal2 !== $rule->literal2) {
  8574. return false;
  8575. }
  8576. return true;
  8577. }
  8578. $literals = $rule->getLiterals();
  8579. if (2 != count($literals)) {
  8580. return false;
  8581. }
  8582. if ($this->literal1 !== $literals[0]) {
  8583. return false;
  8584. }
  8585. if ($this->literal2 !== $literals[1]) {
  8586. return false;
  8587. }
  8588. return true;
  8589. }
  8590. public function isAssertion()
  8591. {
  8592. return false;
  8593. }
  8594. public function __toString()
  8595. {
  8596. $result = $this->isDisabled() ? 'disabled(' : '(';
  8597. $result .= $this->literal1 . '|' . $this->literal2 . ')';
  8598. return $result;
  8599. }
  8600. }
  8601. <?php
  8602. namespace Composer\DependencyResolver;
  8603. class RuleSet implements \IteratorAggregate, \Countable
  8604. {
  8605. const TYPE_PACKAGE = 0;
  8606. const TYPE_JOB = 1;
  8607. const TYPE_LEARNED = 4;
  8608. public $ruleById;
  8609. protected static $types = array(
  8610. 255 => 'UNKNOWN',
  8611. self::TYPE_PACKAGE => 'PACKAGE',
  8612. self::TYPE_JOB => 'JOB',
  8613. self::TYPE_LEARNED => 'LEARNED',
  8614. );
  8615. protected $rules;
  8616. protected $nextRuleId;
  8617. protected $rulesByHash;
  8618. public function __construct()
  8619. {
  8620. $this->nextRuleId = 0;
  8621. foreach ($this->getTypes() as $type) {
  8622. $this->rules[$type] = array();
  8623. }
  8624. $this->rulesByHash = array();
  8625. }
  8626. public function add(Rule $rule, $type)
  8627. {
  8628. if (!isset(self::$types[$type])) {
  8629. throw new \OutOfBoundsException('Unknown rule type: ' . $type);
  8630. }
  8631. $hash = $rule->getHash();
  8632. if (isset($this->rulesByHash[$hash])) {
  8633. $potentialDuplicates = $this->rulesByHash[$hash];
  8634. if (is_array($potentialDuplicates)) {
  8635. foreach ($potentialDuplicates as $potentialDuplicate) {
  8636. if ($rule->equals($potentialDuplicate)) {
  8637. return;
  8638. }
  8639. }
  8640. } else {
  8641. if ($rule->equals($potentialDuplicates)) {
  8642. return;
  8643. }
  8644. }
  8645. }
  8646. if (!isset($this->rules[$type])) {
  8647. $this->rules[$type] = array();
  8648. }
  8649. $this->rules[$type][] = $rule;
  8650. $this->ruleById[$this->nextRuleId] = $rule;
  8651. $rule->setType($type);
  8652. $this->nextRuleId++;
  8653. if (!isset($this->rulesByHash[$hash])) {
  8654. $this->rulesByHash[$hash] = $rule;
  8655. } elseif (is_array($this->rulesByHash[$hash])) {
  8656. $this->rulesByHash[$hash][] = $rule;
  8657. } else {
  8658. $originalRule = $this->rulesByHash[$hash];
  8659. $this->rulesByHash[$hash] = array($originalRule, $rule);
  8660. }
  8661. }
  8662. public function count()
  8663. {
  8664. return $this->nextRuleId;
  8665. }
  8666. public function ruleById($id)
  8667. {
  8668. return $this->ruleById[$id];
  8669. }
  8670. public function getRules()
  8671. {
  8672. return $this->rules;
  8673. }
  8674. public function getIterator()
  8675. {
  8676. return new RuleSetIterator($this->getRules());
  8677. }
  8678. public function getIteratorFor($types)
  8679. {
  8680. if (!is_array($types)) {
  8681. $types = array($types);
  8682. }
  8683. $allRules = $this->getRules();
  8684. $rules = array();
  8685. foreach ($types as $type) {
  8686. $rules[$type] = $allRules[$type];
  8687. }
  8688. return new RuleSetIterator($rules);
  8689. }
  8690. public function getIteratorWithout($types)
  8691. {
  8692. if (!is_array($types)) {
  8693. $types = array($types);
  8694. }
  8695. $rules = $this->getRules();
  8696. foreach ($types as $type) {
  8697. unset($rules[$type]);
  8698. }
  8699. return new RuleSetIterator($rules);
  8700. }
  8701. public function getTypes()
  8702. {
  8703. $types = self::$types;
  8704. unset($types[255]);
  8705. return array_keys($types);
  8706. }
  8707. public function getPrettyString(Pool $pool = null)
  8708. {
  8709. $string = "\n";
  8710. foreach ($this->rules as $type => $rules) {
  8711. $string .= str_pad(self::$types[$type], 8, ' ') . ": ";
  8712. foreach ($rules as $rule) {
  8713. $string .= ($pool ? $rule->getPrettyString($pool) : $rule)."\n";
  8714. }
  8715. $string .= "\n\n";
  8716. }
  8717. return $string;
  8718. }
  8719. public function __toString()
  8720. {
  8721. return $this->getPrettyString(null);
  8722. }
  8723. }
  8724. <?php
  8725. namespace Composer\DependencyResolver;
  8726. use Composer\Package\PackageInterface;
  8727. use Composer\Package\AliasPackage;
  8728. use Composer\Repository\PlatformRepository;
  8729. class RuleSetGenerator
  8730. {
  8731. protected $policy;
  8732. protected $pool;
  8733. protected $rules;
  8734. protected $jobs;
  8735. protected $installedMap;
  8736. protected $whitelistedMap;
  8737. protected $addedMap;
  8738. protected $conflictAddedMap;
  8739. protected $addedPackages;
  8740. protected $addedPackagesByNames;
  8741. public function __construct(PolicyInterface $policy, Pool $pool)
  8742. {
  8743. $this->policy = $policy;
  8744. $this->pool = $pool;
  8745. }
  8746. protected function createRequireRule(PackageInterface $package, array $providers, $reason, $reasonData = null)
  8747. {
  8748. $literals = array(-$package->id);
  8749. foreach ($providers as $provider) {
  8750. if ($provider === $package) {
  8751. return null;
  8752. }
  8753. $literals[] = $provider->id;
  8754. }
  8755. return new GenericRule($literals, $reason, $reasonData);
  8756. }
  8757. protected function createInstallOneOfRule(array $packages, $reason, $job)
  8758. {
  8759. $literals = array();
  8760. foreach ($packages as $package) {
  8761. $literals[] = $package->id;
  8762. }
  8763. return new GenericRule($literals, $reason, $job['packageName'], $job);
  8764. }
  8765. protected function createRemoveRule(PackageInterface $package, $reason, $job)
  8766. {
  8767. return new GenericRule(array(-$package->id), $reason, $job['packageName'], $job);
  8768. }
  8769. protected function createRule2Literals(PackageInterface $issuer, PackageInterface $provider, $reason, $reasonData = null)
  8770. {
  8771. if ($issuer === $provider) {
  8772. return null;
  8773. }
  8774. return new Rule2Literals(-$issuer->id, -$provider->id, $reason, $reasonData);
  8775. }
  8776. private function addRule($type, Rule $newRule = null)
  8777. {
  8778. if (!$newRule) {
  8779. return;
  8780. }
  8781. $this->rules->add($newRule, $type);
  8782. }
  8783. protected function whitelistFromPackage(PackageInterface $package)
  8784. {
  8785. $workQueue = new \SplQueue;
  8786. $workQueue->enqueue($package);
  8787. while (!$workQueue->isEmpty()) {
  8788. $package = $workQueue->dequeue();
  8789. if (isset($this->whitelistedMap[$package->id])) {
  8790. continue;
  8791. }
  8792. $this->whitelistedMap[$package->id] = true;
  8793. foreach ($package->getRequires() as $link) {
  8794. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint(), true);
  8795. foreach ($possibleRequires as $require) {
  8796. $workQueue->enqueue($require);
  8797. }
  8798. }
  8799. $obsoleteProviders = $this->pool->whatProvides($package->getName(), null, true);
  8800. foreach ($obsoleteProviders as $provider) {
  8801. if ($provider === $package) {
  8802. continue;
  8803. }
  8804. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  8805. $workQueue->enqueue($provider);
  8806. }
  8807. }
  8808. }
  8809. }
  8810. protected function addRulesForPackage(PackageInterface $package, $ignorePlatformReqs)
  8811. {
  8812. $workQueue = new \SplQueue;
  8813. $workQueue->enqueue($package);
  8814. while (!$workQueue->isEmpty()) {
  8815. $package = $workQueue->dequeue();
  8816. if (isset($this->addedMap[$package->id])) {
  8817. continue;
  8818. }
  8819. $this->addedMap[$package->id] = true;
  8820. $this->addedPackages[] = $package;
  8821. foreach ($package->getNames() as $name) {
  8822. $this->addedPackagesByNames[$name][] = $package;
  8823. }
  8824. foreach ($package->getRequires() as $link) {
  8825. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  8826. continue;
  8827. }
  8828. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  8829. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRequireRule($package, $possibleRequires, Rule::RULE_PACKAGE_REQUIRES, $link));
  8830. foreach ($possibleRequires as $require) {
  8831. $workQueue->enqueue($require);
  8832. }
  8833. }
  8834. $packageName = $package->getName();
  8835. $obsoleteProviders = $this->pool->whatProvides($packageName, null);
  8836. foreach ($obsoleteProviders as $provider) {
  8837. if ($provider === $package) {
  8838. continue;
  8839. }
  8840. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  8841. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRequireRule($package, array($provider), Rule::RULE_PACKAGE_ALIAS, $package));
  8842. } elseif (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  8843. $reason = ($packageName == $provider->getName()) ? Rule::RULE_PACKAGE_SAME_NAME : Rule::RULE_PACKAGE_IMPLICIT_OBSOLETES;
  8844. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $provider, $reason, $package));
  8845. }
  8846. }
  8847. }
  8848. }
  8849. protected function addConflictRules()
  8850. {
  8851. foreach ($this->addedPackages as $package) {
  8852. foreach ($package->getConflicts() as $link) {
  8853. if (!isset($this->addedPackagesByNames[$link->getTarget()])) {
  8854. continue;
  8855. }
  8856. foreach ($this->addedPackagesByNames[$link->getTarget()] as $possibleConflict) {
  8857. $conflictMatch = $this->pool->match($possibleConflict, $link->getTarget(), $link->getConstraint(), true);
  8858. if ($conflictMatch === Pool::MATCH || $conflictMatch === Pool::MATCH_REPLACE) {
  8859. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $possibleConflict, Rule::RULE_PACKAGE_CONFLICT, $link));
  8860. }
  8861. }
  8862. }
  8863. $isInstalled = isset($this->installedMap[$package->id]);
  8864. foreach ($package->getReplaces() as $link) {
  8865. if (!isset($this->addedPackagesByNames[$link->getTarget()])) {
  8866. continue;
  8867. }
  8868. foreach ($this->addedPackagesByNames[$link->getTarget()] as $provider) {
  8869. if ($provider === $package) {
  8870. continue;
  8871. }
  8872. if (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  8873. $reason = $isInstalled ? Rule::RULE_INSTALLED_PACKAGE_OBSOLETES : Rule::RULE_PACKAGE_OBSOLETES;
  8874. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $provider, $reason, $link));
  8875. }
  8876. }
  8877. }
  8878. }
  8879. }
  8880. protected function obsoleteImpossibleForAlias($package, $provider)
  8881. {
  8882. $packageIsAlias = $package instanceof AliasPackage;
  8883. $providerIsAlias = $provider instanceof AliasPackage;
  8884. $impossible = (
  8885. ($packageIsAlias && $package->getAliasOf() === $provider) ||
  8886. ($providerIsAlias && $provider->getAliasOf() === $package) ||
  8887. ($packageIsAlias && $providerIsAlias && $provider->getAliasOf() === $package->getAliasOf())
  8888. );
  8889. return $impossible;
  8890. }
  8891. protected function whitelistFromJobs()
  8892. {
  8893. foreach ($this->jobs as $job) {
  8894. switch ($job['cmd']) {
  8895. case 'install':
  8896. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint'], true);
  8897. foreach ($packages as $package) {
  8898. $this->whitelistFromPackage($package);
  8899. }
  8900. break;
  8901. }
  8902. }
  8903. }
  8904. protected function addRulesForJobs($ignorePlatformReqs)
  8905. {
  8906. foreach ($this->jobs as $job) {
  8907. switch ($job['cmd']) {
  8908. case 'install':
  8909. if (!$job['fixed'] && $ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  8910. break;
  8911. }
  8912. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8913. if ($packages) {
  8914. foreach ($packages as $package) {
  8915. if (!isset($this->installedMap[$package->id])) {
  8916. $this->addRulesForPackage($package, $ignorePlatformReqs);
  8917. }
  8918. }
  8919. $rule = $this->createInstallOneOfRule($packages, Rule::RULE_JOB_INSTALL, $job);
  8920. $this->addRule(RuleSet::TYPE_JOB, $rule);
  8921. }
  8922. break;
  8923. case 'remove':
  8924. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8925. foreach ($packages as $package) {
  8926. $rule = $this->createRemoveRule($package, Rule::RULE_JOB_REMOVE, $job);
  8927. $this->addRule(RuleSet::TYPE_JOB, $rule);
  8928. }
  8929. break;
  8930. }
  8931. }
  8932. }
  8933. public function getRulesFor($jobs, $installedMap, $ignorePlatformReqs = false)
  8934. {
  8935. $this->jobs = $jobs;
  8936. $this->rules = new RuleSet;
  8937. $this->installedMap = $installedMap;
  8938. $this->whitelistedMap = array();
  8939. foreach ($this->installedMap as $package) {
  8940. $this->whitelistFromPackage($package);
  8941. }
  8942. $this->whitelistFromJobs();
  8943. $this->pool->setWhitelist($this->whitelistedMap);
  8944. $this->addedMap = array();
  8945. $this->conflictAddedMap = array();
  8946. $this->addedPackages = array();
  8947. $this->addedPackagesByNames = array();
  8948. foreach ($this->installedMap as $package) {
  8949. $this->addRulesForPackage($package, $ignorePlatformReqs);
  8950. }
  8951. $this->addRulesForJobs($ignorePlatformReqs);
  8952. $this->addConflictRules();
  8953. $this->addedPackages = $this->addedPackagesByNames = null;
  8954. return $this->rules;
  8955. }
  8956. }
  8957. <?php
  8958. namespace Composer\DependencyResolver;
  8959. class RuleSetIterator implements \Iterator
  8960. {
  8961. protected $rules;
  8962. protected $types;
  8963. protected $currentOffset;
  8964. protected $currentType;
  8965. protected $currentTypeOffset;
  8966. public function __construct(array $rules)
  8967. {
  8968. $this->rules = $rules;
  8969. $this->types = array_keys($rules);
  8970. sort($this->types);
  8971. $this->rewind();
  8972. }
  8973. public function current()
  8974. {
  8975. return $this->rules[$this->currentType][$this->currentOffset];
  8976. }
  8977. public function key()
  8978. {
  8979. return $this->currentType;
  8980. }
  8981. public function next()
  8982. {
  8983. $this->currentOffset++;
  8984. if (!isset($this->rules[$this->currentType])) {
  8985. return;
  8986. }
  8987. if ($this->currentOffset >= count($this->rules[$this->currentType])) {
  8988. $this->currentOffset = 0;
  8989. do {
  8990. $this->currentTypeOffset++;
  8991. if (!isset($this->types[$this->currentTypeOffset])) {
  8992. $this->currentType = -1;
  8993. break;
  8994. }
  8995. $this->currentType = $this->types[$this->currentTypeOffset];
  8996. } while (isset($this->types[$this->currentTypeOffset]) && !count($this->rules[$this->currentType]));
  8997. }
  8998. }
  8999. public function rewind()
  9000. {
  9001. $this->currentOffset = 0;
  9002. $this->currentTypeOffset = -1;
  9003. $this->currentType = -1;
  9004. do {
  9005. $this->currentTypeOffset++;
  9006. if (!isset($this->types[$this->currentTypeOffset])) {
  9007. $this->currentType = -1;
  9008. break;
  9009. }
  9010. $this->currentType = $this->types[$this->currentTypeOffset];
  9011. } while (isset($this->types[$this->currentTypeOffset]) && !count($this->rules[$this->currentType]));
  9012. }
  9013. public function valid()
  9014. {
  9015. return isset($this->rules[$this->currentType])
  9016. && isset($this->rules[$this->currentType][$this->currentOffset]);
  9017. }
  9018. }
  9019. <?php
  9020. namespace Composer\DependencyResolver;
  9021. class RuleWatchChain extends \SplDoublyLinkedList
  9022. {
  9023. protected $offset = 0;
  9024. public function seek($offset)
  9025. {
  9026. $this->rewind();
  9027. for ($i = 0; $i < $offset; $i++, $this->next());
  9028. }
  9029. public function remove()
  9030. {
  9031. $offset = $this->key();
  9032. $this->offsetUnset($offset);
  9033. $this->seek($offset);
  9034. }
  9035. }
  9036. <?php
  9037. namespace Composer\DependencyResolver;
  9038. class RuleWatchGraph
  9039. {
  9040. protected $watchChains = array();
  9041. public function insert(RuleWatchNode $node)
  9042. {
  9043. if ($node->getRule()->isAssertion()) {
  9044. return;
  9045. }
  9046. foreach (array($node->watch1, $node->watch2) as $literal) {
  9047. if (!isset($this->watchChains[$literal])) {
  9048. $this->watchChains[$literal] = new RuleWatchChain;
  9049. }
  9050. $this->watchChains[$literal]->unshift($node);
  9051. }
  9052. }
  9053. public function propagateLiteral($decidedLiteral, $level, $decisions)
  9054. {
  9055. $literal = -$decidedLiteral;
  9056. if (!isset($this->watchChains[$literal])) {
  9057. return null;
  9058. }
  9059. $chain = $this->watchChains[$literal];
  9060. $chain->rewind();
  9061. while ($chain->valid()) {
  9062. $node = $chain->current();
  9063. $otherWatch = $node->getOtherWatch($literal);
  9064. if (!$node->getRule()->isDisabled() && !$decisions->satisfy($otherWatch)) {
  9065. $ruleLiterals = $node->getRule()->getLiterals();
  9066. $alternativeLiterals = array_filter($ruleLiterals, function ($ruleLiteral) use ($literal, $otherWatch, $decisions) {
  9067. return $literal !== $ruleLiteral &&
  9068. $otherWatch !== $ruleLiteral &&
  9069. !$decisions->conflict($ruleLiteral);
  9070. });
  9071. if ($alternativeLiterals) {
  9072. reset($alternativeLiterals);
  9073. $this->moveWatch($literal, current($alternativeLiterals), $node);
  9074. continue;
  9075. }
  9076. if ($decisions->conflict($otherWatch)) {
  9077. return $node->getRule();
  9078. }
  9079. $decisions->decide($otherWatch, $level, $node->getRule());
  9080. }
  9081. $chain->next();
  9082. }
  9083. return null;
  9084. }
  9085. protected function moveWatch($fromLiteral, $toLiteral, $node)
  9086. {
  9087. if (!isset($this->watchChains[$toLiteral])) {
  9088. $this->watchChains[$toLiteral] = new RuleWatchChain;
  9089. }
  9090. $node->moveWatch($fromLiteral, $toLiteral);
  9091. $this->watchChains[$fromLiteral]->remove();
  9092. $this->watchChains[$toLiteral]->unshift($node);
  9093. }
  9094. }
  9095. <?php
  9096. namespace Composer\DependencyResolver;
  9097. class RuleWatchNode
  9098. {
  9099. public $watch1;
  9100. public $watch2;
  9101. protected $rule;
  9102. public function __construct($rule)
  9103. {
  9104. $this->rule = $rule;
  9105. $literals = $rule->getLiterals();
  9106. $literalCount = count($literals);
  9107. $this->watch1 = $literalCount > 0 ? $literals[0] : 0;
  9108. $this->watch2 = $literalCount > 1 ? $literals[1] : 0;
  9109. }
  9110. public function watch2OnHighest(Decisions $decisions)
  9111. {
  9112. $literals = $this->rule->getLiterals();
  9113. if (count($literals) < 3) {
  9114. return;
  9115. }
  9116. $watchLevel = 0;
  9117. foreach ($literals as $literal) {
  9118. $level = $decisions->decisionLevel($literal);
  9119. if ($level > $watchLevel) {
  9120. $this->watch2 = $literal;
  9121. $watchLevel = $level;
  9122. }
  9123. }
  9124. }
  9125. public function getRule()
  9126. {
  9127. return $this->rule;
  9128. }
  9129. public function getOtherWatch($literal)
  9130. {
  9131. if ($this->watch1 == $literal) {
  9132. return $this->watch2;
  9133. }
  9134. return $this->watch1;
  9135. }
  9136. public function moveWatch($from, $to)
  9137. {
  9138. if ($this->watch1 == $from) {
  9139. $this->watch1 = $to;
  9140. } else {
  9141. $this->watch2 = $to;
  9142. }
  9143. }
  9144. }
  9145. <?php
  9146. namespace Composer\DependencyResolver;
  9147. use Composer\IO\IOInterface;
  9148. use Composer\Repository\RepositoryInterface;
  9149. use Composer\Repository\PlatformRepository;
  9150. class Solver
  9151. {
  9152. const BRANCH_LITERALS = 0;
  9153. const BRANCH_LEVEL = 1;
  9154. protected $policy;
  9155. protected $pool;
  9156. protected $installed;
  9157. protected $rules;
  9158. protected $ruleSetGenerator;
  9159. protected $jobs;
  9160. protected $updateMap = array();
  9161. protected $watchGraph;
  9162. protected $decisions;
  9163. protected $installedMap;
  9164. protected $propagateIndex;
  9165. protected $branches = array();
  9166. protected $problems = array();
  9167. protected $learnedPool = array();
  9168. protected $learnedWhy = array();
  9169. protected $io;
  9170. public function __construct(PolicyInterface $policy, Pool $pool, RepositoryInterface $installed, IOInterface $io)
  9171. {
  9172. $this->io = $io;
  9173. $this->policy = $policy;
  9174. $this->pool = $pool;
  9175. $this->installed = $installed;
  9176. $this->ruleSetGenerator = new RuleSetGenerator($policy, $pool);
  9177. }
  9178. public function getRuleSetSize()
  9179. {
  9180. return count($this->rules);
  9181. }
  9182. private function makeAssertionRuleDecisions()
  9183. {
  9184. $decisionStart = count($this->decisions) - 1;
  9185. $rulesCount = count($this->rules);
  9186. for ($ruleIndex = 0; $ruleIndex < $rulesCount; $ruleIndex++) {
  9187. $rule = $this->rules->ruleById[$ruleIndex];
  9188. if (!$rule->isAssertion() || $rule->isDisabled()) {
  9189. continue;
  9190. }
  9191. $literals = $rule->getLiterals();
  9192. $literal = $literals[0];
  9193. if (!$this->decisions->decided($literal)) {
  9194. $this->decisions->decide($literal, 1, $rule);
  9195. continue;
  9196. }
  9197. if ($this->decisions->satisfy($literal)) {
  9198. continue;
  9199. }
  9200. if (RuleSet::TYPE_LEARNED === $rule->getType()) {
  9201. $rule->disable();
  9202. continue;
  9203. }
  9204. $conflict = $this->decisions->decisionRule($literal);
  9205. if ($conflict && RuleSet::TYPE_PACKAGE === $conflict->getType()) {
  9206. $problem = new Problem($this->pool);
  9207. $problem->addRule($rule);
  9208. $problem->addRule($conflict);
  9209. $this->disableProblem($rule);
  9210. $this->problems[] = $problem;
  9211. continue;
  9212. }
  9213. $problem = new Problem($this->pool);
  9214. $problem->addRule($rule);
  9215. $problem->addRule($conflict);
  9216. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_JOB) as $assertRule) {
  9217. if ($assertRule->isDisabled() || !$assertRule->isAssertion()) {
  9218. continue;
  9219. }
  9220. $assertRuleLiterals = $assertRule->getLiterals();
  9221. $assertRuleLiteral = $assertRuleLiterals[0];
  9222. if (abs($literal) !== abs($assertRuleLiteral)) {
  9223. continue;
  9224. }
  9225. $problem->addRule($assertRule);
  9226. $this->disableProblem($assertRule);
  9227. }
  9228. $this->problems[] = $problem;
  9229. $this->decisions->resetToOffset($decisionStart);
  9230. $ruleIndex = -1;
  9231. }
  9232. }
  9233. protected function setupInstalledMap()
  9234. {
  9235. $this->installedMap = array();
  9236. foreach ($this->installed->getPackages() as $package) {
  9237. $this->installedMap[$package->id] = $package;
  9238. }
  9239. }
  9240. protected function checkForRootRequireProblems($ignorePlatformReqs)
  9241. {
  9242. foreach ($this->jobs as $job) {
  9243. switch ($job['cmd']) {
  9244. case 'update':
  9245. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  9246. foreach ($packages as $package) {
  9247. if (isset($this->installedMap[$package->id])) {
  9248. $this->updateMap[$package->id] = true;
  9249. }
  9250. }
  9251. break;
  9252. case 'update-all':
  9253. foreach ($this->installedMap as $package) {
  9254. $this->updateMap[$package->id] = true;
  9255. }
  9256. break;
  9257. case 'install':
  9258. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  9259. break;
  9260. }
  9261. if (!$this->pool->whatProvides($job['packageName'], $job['constraint'])) {
  9262. $problem = new Problem($this->pool);
  9263. $problem->addRule(new GenericRule(array(), null, null, $job));
  9264. $this->problems[] = $problem;
  9265. }
  9266. break;
  9267. }
  9268. }
  9269. }
  9270. public function solve(Request $request, $ignorePlatformReqs = false)
  9271. {
  9272. $this->jobs = $request->getJobs();
  9273. $this->setupInstalledMap();
  9274. $this->rules = $this->ruleSetGenerator->getRulesFor($this->jobs, $this->installedMap, $ignorePlatformReqs);
  9275. $this->checkForRootRequireProblems($ignorePlatformReqs);
  9276. $this->decisions = new Decisions($this->pool);
  9277. $this->watchGraph = new RuleWatchGraph;
  9278. foreach ($this->rules as $rule) {
  9279. $this->watchGraph->insert(new RuleWatchNode($rule));
  9280. }
  9281. $this->makeAssertionRuleDecisions();
  9282. $this->io->writeError('Resolving dependencies through SAT', true, IOInterface::DEBUG);
  9283. $before = microtime(true);
  9284. $this->runSat(true);
  9285. $this->io->writeError('', true, IOInterface::DEBUG);
  9286. $this->io->writeError(sprintf('Dependency resolution completed in %.3f seconds', microtime(true) - $before), true, IOInterface::VERBOSE);
  9287. foreach ($this->installedMap as $packageId => $void) {
  9288. if ($this->decisions->undecided($packageId)) {
  9289. $this->decisions->decide(-$packageId, 1, null);
  9290. }
  9291. }
  9292. if ($this->problems) {
  9293. throw new SolverProblemsException($this->problems, $this->installedMap);
  9294. }
  9295. $transaction = new Transaction($this->policy, $this->pool, $this->installedMap, $this->decisions);
  9296. return $transaction->getOperations();
  9297. }
  9298. protected function propagate($level)
  9299. {
  9300. while ($this->decisions->validOffset($this->propagateIndex)) {
  9301. $decision = $this->decisions->atOffset($this->propagateIndex);
  9302. $conflict = $this->watchGraph->propagateLiteral(
  9303. $decision[Decisions::DECISION_LITERAL],
  9304. $level,
  9305. $this->decisions
  9306. );
  9307. $this->propagateIndex++;
  9308. if ($conflict) {
  9309. return $conflict;
  9310. }
  9311. }
  9312. return null;
  9313. }
  9314. private function revert($level)
  9315. {
  9316. while (!$this->decisions->isEmpty()) {
  9317. $literal = $this->decisions->lastLiteral();
  9318. if ($this->decisions->undecided($literal)) {
  9319. break;
  9320. }
  9321. $decisionLevel = $this->decisions->decisionLevel($literal);
  9322. if ($decisionLevel <= $level) {
  9323. break;
  9324. }
  9325. $this->decisions->revertLast();
  9326. $this->propagateIndex = count($this->decisions);
  9327. }
  9328. while (!empty($this->branches) && $this->branches[count($this->branches) - 1][self::BRANCH_LEVEL] >= $level) {
  9329. array_pop($this->branches);
  9330. }
  9331. }
  9332. private function setPropagateLearn($level, $literal, $disableRules, Rule $rule)
  9333. {
  9334. $level++;
  9335. $this->decisions->decide($literal, $level, $rule);
  9336. while (true) {
  9337. $rule = $this->propagate($level);
  9338. if (!$rule) {
  9339. break;
  9340. }
  9341. if ($level == 1) {
  9342. return $this->analyzeUnsolvable($rule, $disableRules);
  9343. }
  9344. list($learnLiteral, $newLevel, $newRule, $why) = $this->analyze($level, $rule);
  9345. if ($newLevel <= 0 || $newLevel >= $level) {
  9346. throw new SolverBugException(
  9347. "Trying to revert to invalid level ".(int) $newLevel." from level ".(int) $level."."
  9348. );
  9349. } elseif (!$newRule) {
  9350. throw new SolverBugException(
  9351. "No rule was learned from analyzing $rule at level $level."
  9352. );
  9353. }
  9354. $level = $newLevel;
  9355. $this->revert($level);
  9356. $this->rules->add($newRule, RuleSet::TYPE_LEARNED);
  9357. $this->learnedWhy[spl_object_hash($newRule)] = $why;
  9358. $ruleNode = new RuleWatchNode($newRule);
  9359. $ruleNode->watch2OnHighest($this->decisions);
  9360. $this->watchGraph->insert($ruleNode);
  9361. $this->decisions->decide($learnLiteral, $level, $newRule);
  9362. }
  9363. return $level;
  9364. }
  9365. private function selectAndInstall($level, array $decisionQueue, $disableRules, Rule $rule)
  9366. {
  9367. $literals = $this->policy->selectPreferredPackages($this->pool, $this->installedMap, $decisionQueue, $rule->getRequiredPackage());
  9368. $selectedLiteral = array_shift($literals);
  9369. if (count($literals)) {
  9370. $this->branches[] = array($literals, $level);
  9371. }
  9372. return $this->setPropagateLearn($level, $selectedLiteral, $disableRules, $rule);
  9373. }
  9374. protected function analyze($level, Rule $rule)
  9375. {
  9376. $analyzedRule = $rule;
  9377. $ruleLevel = 1;
  9378. $num = 0;
  9379. $l1num = 0;
  9380. $seen = array();
  9381. $learnedLiterals = array(null);
  9382. $decisionId = count($this->decisions);
  9383. $this->learnedPool[] = array();
  9384. while (true) {
  9385. $this->learnedPool[count($this->learnedPool) - 1][] = $rule;
  9386. foreach ($rule->getLiterals() as $literal) {
  9387. if ($this->decisions->satisfy($literal)) {
  9388. continue;
  9389. }
  9390. if (isset($seen[abs($literal)])) {
  9391. continue;
  9392. }
  9393. $seen[abs($literal)] = true;
  9394. $l = $this->decisions->decisionLevel($literal);
  9395. if (1 === $l) {
  9396. $l1num++;
  9397. } elseif ($level === $l) {
  9398. $num++;
  9399. } else {
  9400. $learnedLiterals[] = $literal;
  9401. if ($l > $ruleLevel) {
  9402. $ruleLevel = $l;
  9403. }
  9404. }
  9405. }
  9406. $l1retry = true;
  9407. while ($l1retry) {
  9408. $l1retry = false;
  9409. if (!$num && !--$l1num) {
  9410. break 2;
  9411. }
  9412. while (true) {
  9413. if ($decisionId <= 0) {
  9414. throw new SolverBugException(
  9415. "Reached invalid decision id $decisionId while looking through $rule for a literal present in the analyzed rule $analyzedRule."
  9416. );
  9417. }
  9418. $decisionId--;
  9419. $decision = $this->decisions->atOffset($decisionId);
  9420. $literal = $decision[Decisions::DECISION_LITERAL];
  9421. if (isset($seen[abs($literal)])) {
  9422. break;
  9423. }
  9424. }
  9425. unset($seen[abs($literal)]);
  9426. if ($num && 0 === --$num) {
  9427. $learnedLiterals[0] = -abs($literal);
  9428. if (!$l1num) {
  9429. break 2;
  9430. }
  9431. foreach ($learnedLiterals as $i => $learnedLiteral) {
  9432. if ($i !== 0) {
  9433. unset($seen[abs($learnedLiteral)]);
  9434. }
  9435. }
  9436. $l1num++;
  9437. $l1retry = true;
  9438. }
  9439. }
  9440. $decision = $this->decisions->atOffset($decisionId);
  9441. $rule = $decision[Decisions::DECISION_REASON];
  9442. }
  9443. $why = count($this->learnedPool) - 1;
  9444. if (!$learnedLiterals[0]) {
  9445. throw new SolverBugException(
  9446. "Did not find a learnable literal in analyzed rule $analyzedRule."
  9447. );
  9448. }
  9449. $newRule = new GenericRule($learnedLiterals, Rule::RULE_LEARNED, $why);
  9450. return array($learnedLiterals[0], $ruleLevel, $newRule, $why);
  9451. }
  9452. private function analyzeUnsolvableRule(Problem $problem, Rule $conflictRule)
  9453. {
  9454. if ($conflictRule->getType() == RuleSet::TYPE_LEARNED) {
  9455. $why = spl_object_hash($conflictRule);
  9456. $learnedWhy = $this->learnedWhy[$why];
  9457. $problemRules = $this->learnedPool[$learnedWhy];
  9458. foreach ($problemRules as $problemRule) {
  9459. $this->analyzeUnsolvableRule($problem, $problemRule);
  9460. }
  9461. return;
  9462. }
  9463. if ($conflictRule->getType() == RuleSet::TYPE_PACKAGE) {
  9464. return;
  9465. }
  9466. $problem->nextSection();
  9467. $problem->addRule($conflictRule);
  9468. }
  9469. private function analyzeUnsolvable(Rule $conflictRule, $disableRules)
  9470. {
  9471. $problem = new Problem($this->pool);
  9472. $problem->addRule($conflictRule);
  9473. $this->analyzeUnsolvableRule($problem, $conflictRule);
  9474. $this->problems[] = $problem;
  9475. $seen = array();
  9476. $literals = $conflictRule->getLiterals();
  9477. foreach ($literals as $literal) {
  9478. if ($this->decisions->satisfy($literal)) {
  9479. continue;
  9480. }
  9481. $seen[abs($literal)] = true;
  9482. }
  9483. foreach ($this->decisions as $decision) {
  9484. $literal = $decision[Decisions::DECISION_LITERAL];
  9485. if (!isset($seen[abs($literal)])) {
  9486. continue;
  9487. }
  9488. $why = $decision[Decisions::DECISION_REASON];
  9489. $problem->addRule($why);
  9490. $this->analyzeUnsolvableRule($problem, $why);
  9491. $literals = $why->getLiterals();
  9492. foreach ($literals as $literal) {
  9493. if ($this->decisions->satisfy($literal)) {
  9494. continue;
  9495. }
  9496. $seen[abs($literal)] = true;
  9497. }
  9498. }
  9499. if ($disableRules) {
  9500. foreach ($this->problems[count($this->problems) - 1] as $reason) {
  9501. $this->disableProblem($reason['rule']);
  9502. }
  9503. $this->resetSolver();
  9504. return 1;
  9505. }
  9506. return 0;
  9507. }
  9508. private function disableProblem(Rule $why)
  9509. {
  9510. $job = $why->getJob();
  9511. if (!$job) {
  9512. $why->disable();
  9513. return;
  9514. }
  9515. foreach ($this->rules as $rule) {
  9516. if ($job === $rule->getJob()) {
  9517. $rule->disable();
  9518. }
  9519. }
  9520. }
  9521. private function resetSolver()
  9522. {
  9523. $this->decisions->reset();
  9524. $this->propagateIndex = 0;
  9525. $this->branches = array();
  9526. $this->enableDisableLearnedRules();
  9527. $this->makeAssertionRuleDecisions();
  9528. }
  9529. private function enableDisableLearnedRules()
  9530. {
  9531. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_LEARNED) as $rule) {
  9532. $why = $this->learnedWhy[spl_object_hash($rule)];
  9533. $problemRules = $this->learnedPool[$why];
  9534. $foundDisabled = false;
  9535. foreach ($problemRules as $problemRule) {
  9536. if ($problemRule->isDisabled()) {
  9537. $foundDisabled = true;
  9538. break;
  9539. }
  9540. }
  9541. if ($foundDisabled && $rule->isEnabled()) {
  9542. $rule->disable();
  9543. } elseif (!$foundDisabled && $rule->isDisabled()) {
  9544. $rule->enable();
  9545. }
  9546. }
  9547. }
  9548. private function runSat($disableRules = true)
  9549. {
  9550. $this->propagateIndex = 0;
  9551. $decisionQueue = array();
  9552. $decisionSupplementQueue = array();
  9553. $disableRules = array();
  9554. $level = 1;
  9555. $systemLevel = $level + 1;
  9556. $installedPos = 0;
  9557. while (true) {
  9558. if (1 === $level) {
  9559. $conflictRule = $this->propagate($level);
  9560. if (null !== $conflictRule) {
  9561. if ($this->analyzeUnsolvable($conflictRule, $disableRules)) {
  9562. continue;
  9563. }
  9564. return;
  9565. }
  9566. }
  9567. if ($level < $systemLevel) {
  9568. $iterator = $this->rules->getIteratorFor(RuleSet::TYPE_JOB);
  9569. foreach ($iterator as $rule) {
  9570. if ($rule->isEnabled()) {
  9571. $decisionQueue = array();
  9572. $noneSatisfied = true;
  9573. foreach ($rule->getLiterals() as $literal) {
  9574. if ($this->decisions->satisfy($literal)) {
  9575. $noneSatisfied = false;
  9576. break;
  9577. }
  9578. if ($literal > 0 && $this->decisions->undecided($literal)) {
  9579. $decisionQueue[] = $literal;
  9580. }
  9581. }
  9582. if ($noneSatisfied && count($decisionQueue)) {
  9583. if (count($this->installed) != count($this->updateMap)) {
  9584. $prunedQueue = array();
  9585. foreach ($decisionQueue as $literal) {
  9586. if (isset($this->installedMap[abs($literal)])) {
  9587. $prunedQueue[] = $literal;
  9588. if (isset($this->updateMap[abs($literal)])) {
  9589. $prunedQueue = $decisionQueue;
  9590. break;
  9591. }
  9592. }
  9593. }
  9594. $decisionQueue = $prunedQueue;
  9595. }
  9596. }
  9597. if ($noneSatisfied && count($decisionQueue)) {
  9598. $oLevel = $level;
  9599. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  9600. if (0 === $level) {
  9601. return;
  9602. }
  9603. if ($level <= $oLevel) {
  9604. break;
  9605. }
  9606. }
  9607. }
  9608. }
  9609. $systemLevel = $level + 1;
  9610. $iterator->next();
  9611. if ($iterator->valid()) {
  9612. continue;
  9613. }
  9614. }
  9615. if ($level < $systemLevel) {
  9616. $systemLevel = $level;
  9617. }
  9618. $rulesCount = count($this->rules);
  9619. $pass = 1;
  9620. $this->io->writeError('Looking at all rules.', true, IOInterface::DEBUG);
  9621. for ($i = 0, $n = 0; $n < $rulesCount; $i++, $n++) {
  9622. if ($i == $rulesCount) {
  9623. if (1 === $pass) {
  9624. $this->io->writeError("Something's changed, looking at all rules again (pass #$pass)", false, IOInterface::DEBUG);
  9625. } else {
  9626. $this->io->overwriteError("Something's changed, looking at all rules again (pass #$pass)", false, null, IOInterface::DEBUG);
  9627. }
  9628. $i = 0;
  9629. $pass++;
  9630. }
  9631. $rule = $this->rules->ruleById[$i];
  9632. $literals = $rule->getLiterals();
  9633. if ($rule->isDisabled()) {
  9634. continue;
  9635. }
  9636. $decisionQueue = array();
  9637. foreach ($literals as $literal) {
  9638. if ($literal <= 0) {
  9639. if (!$this->decisions->decidedInstall($literal)) {
  9640. continue 2;
  9641. }
  9642. } else {
  9643. if ($this->decisions->decidedInstall($literal)) {
  9644. continue 2;
  9645. }
  9646. if ($this->decisions->undecided($literal)) {
  9647. $decisionQueue[] = $literal;
  9648. }
  9649. }
  9650. }
  9651. if (count($decisionQueue) < 2) {
  9652. continue;
  9653. }
  9654. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  9655. if (0 === $level) {
  9656. return;
  9657. }
  9658. $rulesCount = count($this->rules);
  9659. $n = -1;
  9660. }
  9661. if ($level < $systemLevel) {
  9662. continue;
  9663. }
  9664. if (count($this->branches)) {
  9665. $lastLiteral = null;
  9666. $lastLevel = null;
  9667. $lastBranchIndex = 0;
  9668. $lastBranchOffset = 0;
  9669. for ($i = count($this->branches) - 1; $i >= 0; $i--) {
  9670. list($literals, $l) = $this->branches[$i];
  9671. foreach ($literals as $offset => $literal) {
  9672. if ($literal && $literal > 0 && $this->decisions->decisionLevel($literal) > $l + 1) {
  9673. $lastLiteral = $literal;
  9674. $lastBranchIndex = $i;
  9675. $lastBranchOffset = $offset;
  9676. $lastLevel = $l;
  9677. }
  9678. }
  9679. }
  9680. if ($lastLiteral) {
  9681. unset($this->branches[$lastBranchIndex][self::BRANCH_LITERALS][$lastBranchOffset]);
  9682. $level = $lastLevel;
  9683. $this->revert($level);
  9684. $why = $this->decisions->lastReason();
  9685. $level = $this->setPropagateLearn($level, $lastLiteral, $disableRules, $why);
  9686. if ($level == 0) {
  9687. return;
  9688. }
  9689. continue;
  9690. }
  9691. }
  9692. break;
  9693. }
  9694. }
  9695. }
  9696. <?php
  9697. namespace Composer\DependencyResolver;
  9698. class SolverBugException extends \RuntimeException
  9699. {
  9700. public function __construct($message)
  9701. {
  9702. parent::__construct(
  9703. $message."\nThis exception was most likely caused by a bug in Composer.\n".
  9704. "Please report the command you ran, the exact error you received, and your composer.json on https://github.com/composer/composer/issues - thank you!\n"
  9705. );
  9706. }
  9707. }
  9708. <?php
  9709. namespace Composer\DependencyResolver;
  9710. use Composer\Util\IniHelper;
  9711. class SolverProblemsException extends \RuntimeException
  9712. {
  9713. protected $problems;
  9714. protected $installedMap;
  9715. public function __construct(array $problems, array $installedMap)
  9716. {
  9717. $this->problems = $problems;
  9718. $this->installedMap = $installedMap;
  9719. parent::__construct($this->createMessage(), 2);
  9720. }
  9721. protected function createMessage()
  9722. {
  9723. $text = "\n";
  9724. $hasExtensionProblems = false;
  9725. foreach ($this->problems as $i => $problem) {
  9726. $text .= " Problem ".($i + 1).$problem->getPrettyString($this->installedMap)."\n";
  9727. if (!$hasExtensionProblems && $this->hasExtensionProblems($problem->getReasons())) {
  9728. $hasExtensionProblems = true;
  9729. }
  9730. }
  9731. if (strpos($text, 'could not be found') || strpos($text, 'no matching package found')) {
  9732. $text .= "\nPotential causes:\n - A typo in the package name\n - The package is not available in a stable-enough version according to your minimum-stability setting\n see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.\n - It's a private package and you forgot to add a custom repository to find it\n\nRead <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.";
  9733. }
  9734. if ($hasExtensionProblems) {
  9735. $text .= $this->createExtensionHint();
  9736. }
  9737. return $text;
  9738. }
  9739. public function getProblems()
  9740. {
  9741. return $this->problems;
  9742. }
  9743. private function createExtensionHint()
  9744. {
  9745. $paths = IniHelper::getAll();
  9746. if (count($paths) === 1 && empty($paths[0])) {
  9747. return '';
  9748. }
  9749. $text = "\n To enable extensions, verify that they are enabled in your .ini files:\n - ";
  9750. $text .= implode("\n - ", $paths);
  9751. $text .= "\n You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.";
  9752. return $text;
  9753. }
  9754. private function hasExtensionProblems(array $reasonSets)
  9755. {
  9756. foreach ($reasonSets as $reasonSet) {
  9757. foreach ($reasonSet as $reason) {
  9758. if (isset($reason["rule"]) && 0 === strpos($reason["rule"]->getRequiredPackage(), 'ext-')) {
  9759. return true;
  9760. }
  9761. }
  9762. }
  9763. return false;
  9764. }
  9765. }
  9766. <?php
  9767. namespace Composer\DependencyResolver;
  9768. use Composer\Package\AliasPackage;
  9769. class Transaction
  9770. {
  9771. protected $policy;
  9772. protected $pool;
  9773. protected $installedMap;
  9774. protected $decisions;
  9775. protected $transaction;
  9776. public function __construct($policy, $pool, $installedMap, $decisions)
  9777. {
  9778. $this->policy = $policy;
  9779. $this->pool = $pool;
  9780. $this->installedMap = $installedMap;
  9781. $this->decisions = $decisions;
  9782. $this->transaction = array();
  9783. }
  9784. public function getOperations()
  9785. {
  9786. $installMeansUpdateMap = $this->findUpdates();
  9787. $updateMap = array();
  9788. $installMap = array();
  9789. $uninstallMap = array();
  9790. foreach ($this->decisions as $i => $decision) {
  9791. $literal = $decision[Decisions::DECISION_LITERAL];
  9792. $reason = $decision[Decisions::DECISION_REASON];
  9793. $package = $this->pool->literalToPackage($literal);
  9794. if (($literal > 0) == isset($this->installedMap[$package->id])) {
  9795. continue;
  9796. }
  9797. if ($literal > 0) {
  9798. if (isset($installMeansUpdateMap[abs($literal)]) && !$package instanceof AliasPackage) {
  9799. $source = $installMeansUpdateMap[abs($literal)];
  9800. $updateMap[$package->id] = array(
  9801. 'package' => $package,
  9802. 'source' => $source,
  9803. 'reason' => $reason,
  9804. );
  9805. unset($installMeansUpdateMap[abs($literal)]);
  9806. $ignoreRemove[$source->id] = true;
  9807. } else {
  9808. $installMap[$package->id] = array(
  9809. 'package' => $package,
  9810. 'reason' => $reason,
  9811. );
  9812. }
  9813. }
  9814. }
  9815. foreach ($this->decisions as $i => $decision) {
  9816. $literal = $decision[Decisions::DECISION_LITERAL];
  9817. $reason = $decision[Decisions::DECISION_REASON];
  9818. $package = $this->pool->literalToPackage($literal);
  9819. if ($literal <= 0 &&
  9820. isset($this->installedMap[$package->id]) &&
  9821. !isset($ignoreRemove[$package->id])) {
  9822. $uninstallMap[$package->id] = array(
  9823. 'package' => $package,
  9824. 'reason' => $reason,
  9825. );
  9826. }
  9827. }
  9828. $this->transactionFromMaps($installMap, $updateMap, $uninstallMap);
  9829. return $this->transaction;
  9830. }
  9831. protected function transactionFromMaps($installMap, $updateMap, $uninstallMap)
  9832. {
  9833. $queue = array_map(
  9834. function ($operation) {
  9835. return $operation['package'];
  9836. },
  9837. $this->findRootPackages($installMap, $updateMap)
  9838. );
  9839. $visited = array();
  9840. while (!empty($queue)) {
  9841. $package = array_pop($queue);
  9842. $packageId = $package->id;
  9843. if (!isset($visited[$packageId])) {
  9844. $queue[] = $package;
  9845. if ($package instanceof AliasPackage) {
  9846. $queue[] = $package->getAliasOf();
  9847. } else {
  9848. foreach ($package->getRequires() as $link) {
  9849. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  9850. foreach ($possibleRequires as $require) {
  9851. $queue[] = $require;
  9852. }
  9853. }
  9854. }
  9855. $visited[$package->id] = true;
  9856. } else {
  9857. if (isset($installMap[$packageId])) {
  9858. $this->install(
  9859. $installMap[$packageId]['package'],
  9860. $installMap[$packageId]['reason']
  9861. );
  9862. unset($installMap[$packageId]);
  9863. }
  9864. if (isset($updateMap[$packageId])) {
  9865. $this->update(
  9866. $updateMap[$packageId]['source'],
  9867. $updateMap[$packageId]['package'],
  9868. $updateMap[$packageId]['reason']
  9869. );
  9870. unset($updateMap[$packageId]);
  9871. }
  9872. }
  9873. }
  9874. foreach ($uninstallMap as $uninstall) {
  9875. $this->uninstall($uninstall['package'], $uninstall['reason']);
  9876. }
  9877. }
  9878. protected function findRootPackages($installMap, $updateMap)
  9879. {
  9880. $packages = $installMap + $updateMap;
  9881. $roots = $packages;
  9882. foreach ($packages as $packageId => $operation) {
  9883. $package = $operation['package'];
  9884. if (!isset($roots[$packageId])) {
  9885. continue;
  9886. }
  9887. foreach ($package->getRequires() as $link) {
  9888. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  9889. foreach ($possibleRequires as $require) {
  9890. if ($require !== $package) {
  9891. unset($roots[$require->id]);
  9892. }
  9893. }
  9894. }
  9895. }
  9896. return $roots;
  9897. }
  9898. protected function findUpdates()
  9899. {
  9900. $installMeansUpdateMap = array();
  9901. foreach ($this->decisions as $i => $decision) {
  9902. $literal = $decision[Decisions::DECISION_LITERAL];
  9903. $package = $this->pool->literalToPackage($literal);
  9904. if ($package instanceof AliasPackage) {
  9905. continue;
  9906. }
  9907. if ($literal <= 0 && isset($this->installedMap[$package->id])) {
  9908. $updates = $this->policy->findUpdatePackages($this->pool, $this->installedMap, $package);
  9909. $literals = array($package->id);
  9910. foreach ($updates as $update) {
  9911. $literals[] = $update->id;
  9912. }
  9913. foreach ($literals as $updateLiteral) {
  9914. if ($updateLiteral !== $literal) {
  9915. $installMeansUpdateMap[abs($updateLiteral)] = $package;
  9916. }
  9917. }
  9918. }
  9919. }
  9920. return $installMeansUpdateMap;
  9921. }
  9922. protected function install($package, $reason)
  9923. {
  9924. if ($package instanceof AliasPackage) {
  9925. return $this->markAliasInstalled($package, $reason);
  9926. }
  9927. $this->transaction[] = new Operation\InstallOperation($package, $reason);
  9928. }
  9929. protected function update($from, $to, $reason)
  9930. {
  9931. $this->transaction[] = new Operation\UpdateOperation($from, $to, $reason);
  9932. }
  9933. protected function uninstall($package, $reason)
  9934. {
  9935. if ($package instanceof AliasPackage) {
  9936. return $this->markAliasUninstalled($package, $reason);
  9937. }
  9938. $this->transaction[] = new Operation\UninstallOperation($package, $reason);
  9939. }
  9940. protected function markAliasInstalled($package, $reason)
  9941. {
  9942. $this->transaction[] = new Operation\MarkAliasInstalledOperation($package, $reason);
  9943. }
  9944. protected function markAliasUninstalled($package, $reason)
  9945. {
  9946. $this->transaction[] = new Operation\MarkAliasUninstalledOperation($package, $reason);
  9947. }
  9948. }
  9949. <?php
  9950. namespace Composer\Downloader;
  9951. use Composer\Package\PackageInterface;
  9952. use Symfony\Component\Finder\Finder;
  9953. use Composer\IO\IOInterface;
  9954. abstract class ArchiveDownloader extends FileDownloader
  9955. {
  9956. public function download(PackageInterface $package, $path, $output = true)
  9957. {
  9958. $temporaryDir = $this->config->get('vendor-dir').'/composer/'.substr(md5(uniqid('', true)), 0, 8);
  9959. $retries = 3;
  9960. while ($retries--) {
  9961. $fileName = parent::download($package, $path, $output);
  9962. if ($output) {
  9963. $this->io->writeError(' Extracting archive', false, IOInterface::VERBOSE);
  9964. }
  9965. try {
  9966. $this->filesystem->ensureDirectoryExists($temporaryDir);
  9967. try {
  9968. $this->extract($fileName, $temporaryDir);
  9969. } catch (\Exception $e) {
  9970. parent::clearLastCacheWrite($package);
  9971. throw $e;
  9972. }
  9973. $this->filesystem->unlink($fileName);
  9974. $contentDir = $this->getFolderContent($temporaryDir);
  9975. if (1 === count($contentDir) && is_dir(reset($contentDir))) {
  9976. $contentDir = $this->getFolderContent((string) reset($contentDir));
  9977. }
  9978. foreach ($contentDir as $file) {
  9979. $file = (string) $file;
  9980. $this->filesystem->rename($file, $path . '/' . basename($file));
  9981. }
  9982. $this->filesystem->removeDirectory($temporaryDir);
  9983. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir').'/composer/')) {
  9984. $this->filesystem->removeDirectory($this->config->get('vendor-dir').'/composer/');
  9985. }
  9986. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir'))) {
  9987. $this->filesystem->removeDirectory($this->config->get('vendor-dir'));
  9988. }
  9989. } catch (\Exception $e) {
  9990. $this->filesystem->removeDirectory($path);
  9991. $this->filesystem->removeDirectory($temporaryDir);
  9992. if ($retries && $e instanceof \UnexpectedValueException && class_exists('ZipArchive') && $e->getCode() === \ZipArchive::ER_NOZIP) {
  9993. $this->io->writeError('');
  9994. if ($this->io->isDebug()) {
  9995. $this->io->writeError(' Invalid zip file ('.$e->getMessage().'), retrying...');
  9996. } else {
  9997. $this->io->writeError(' Invalid zip file, retrying...');
  9998. }
  9999. usleep(500000);
  10000. continue;
  10001. }
  10002. throw $e;
  10003. }
  10004. break;
  10005. }
  10006. }
  10007. protected function getFileName(PackageInterface $package, $path)
  10008. {
  10009. return rtrim($path.'/'.md5($path.spl_object_hash($package)).'.'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_EXTENSION), '.');
  10010. }
  10011. abstract protected function extract($file, $path);
  10012. private function getFolderContent($dir)
  10013. {
  10014. $finder = Finder::create()
  10015. ->ignoreVCS(false)
  10016. ->ignoreDotFiles(false)
  10017. ->notName('.DS_Store')
  10018. ->depth(0)
  10019. ->in($dir);
  10020. return iterator_to_array($finder);
  10021. }
  10022. }
  10023. <?php
  10024. namespace Composer\Downloader;
  10025. use Composer\Package\PackageInterface;
  10026. interface ChangeReportInterface
  10027. {
  10028. public function getLocalChanges(PackageInterface $package, $path);
  10029. }
  10030. <?php
  10031. namespace Composer\Downloader;
  10032. use Composer\Package\PackageInterface;
  10033. use Composer\IO\IOInterface;
  10034. use Composer\Util\Filesystem;
  10035. class DownloadManager
  10036. {
  10037. private $io;
  10038. private $preferDist = false;
  10039. private $preferSource = false;
  10040. private $packagePreferences = array();
  10041. private $filesystem;
  10042. private $downloaders = array();
  10043. public function __construct(IOInterface $io, $preferSource = false, Filesystem $filesystem = null)
  10044. {
  10045. $this->io = $io;
  10046. $this->preferSource = $preferSource;
  10047. $this->filesystem = $filesystem ?: new Filesystem();
  10048. }
  10049. public function setPreferSource($preferSource)
  10050. {
  10051. $this->preferSource = $preferSource;
  10052. return $this;
  10053. }
  10054. public function setPreferDist($preferDist)
  10055. {
  10056. $this->preferDist = $preferDist;
  10057. return $this;
  10058. }
  10059. public function setPreferences(array $preferences)
  10060. {
  10061. $this->packagePreferences = $preferences;
  10062. return $this;
  10063. }
  10064. public function setOutputProgress($outputProgress)
  10065. {
  10066. foreach ($this->downloaders as $downloader) {
  10067. $downloader->setOutputProgress($outputProgress);
  10068. }
  10069. return $this;
  10070. }
  10071. public function setDownloader($type, DownloaderInterface $downloader)
  10072. {
  10073. $type = strtolower($type);
  10074. $this->downloaders[$type] = $downloader;
  10075. return $this;
  10076. }
  10077. public function getDownloader($type)
  10078. {
  10079. $type = strtolower($type);
  10080. if (!isset($this->downloaders[$type])) {
  10081. throw new \InvalidArgumentException(sprintf('Unknown downloader type: %s. Available types: %s.', $type, implode(', ', array_keys($this->downloaders))));
  10082. }
  10083. return $this->downloaders[$type];
  10084. }
  10085. public function getDownloaderForInstalledPackage(PackageInterface $package)
  10086. {
  10087. $installationSource = $package->getInstallationSource();
  10088. if ('metapackage' === $package->getType()) {
  10089. return;
  10090. }
  10091. if ('dist' === $installationSource) {
  10092. $downloader = $this->getDownloader($package->getDistType());
  10093. } elseif ('source' === $installationSource) {
  10094. $downloader = $this->getDownloader($package->getSourceType());
  10095. } else {
  10096. throw new \InvalidArgumentException(
  10097. 'Package '.$package.' seems not been installed properly'
  10098. );
  10099. }
  10100. if ($installationSource !== $downloader->getInstallationSource()) {
  10101. throw new \LogicException(sprintf(
  10102. 'Downloader "%s" is a %s type downloader and can not be used to download %s for package %s',
  10103. get_class($downloader),
  10104. $downloader->getInstallationSource(),
  10105. $installationSource,
  10106. $package
  10107. ));
  10108. }
  10109. return $downloader;
  10110. }
  10111. public function download(PackageInterface $package, $targetDir, $preferSource = null)
  10112. {
  10113. $preferSource = null !== $preferSource ? $preferSource : $this->preferSource;
  10114. $sourceType = $package->getSourceType();
  10115. $distType = $package->getDistType();
  10116. $sources = array();
  10117. if ($sourceType) {
  10118. $sources[] = 'source';
  10119. }
  10120. if ($distType) {
  10121. $sources[] = 'dist';
  10122. }
  10123. if (empty($sources)) {
  10124. throw new \InvalidArgumentException('Package '.$package.' must have a source or dist specified');
  10125. }
  10126. if (!$preferSource && ($this->preferDist || 'dist' === $this->resolvePackageInstallPreference($package))) {
  10127. $sources = array_reverse($sources);
  10128. }
  10129. $this->filesystem->ensureDirectoryExists($targetDir);
  10130. foreach ($sources as $i => $source) {
  10131. if (isset($e)) {
  10132. $this->io->writeError(' <warning>Now trying to download from ' . $source . '</warning>');
  10133. }
  10134. $package->setInstallationSource($source);
  10135. try {
  10136. $downloader = $this->getDownloaderForInstalledPackage($package);
  10137. if ($downloader) {
  10138. $downloader->download($package, $targetDir);
  10139. }
  10140. break;
  10141. } catch (\RuntimeException $e) {
  10142. if ($i === count($sources) - 1) {
  10143. throw $e;
  10144. }
  10145. $this->io->writeError(
  10146. ' <warning>Failed to download '.
  10147. $package->getPrettyName().
  10148. ' from ' . $source . ': '.
  10149. $e->getMessage().'</warning>'
  10150. );
  10151. }
  10152. }
  10153. }
  10154. public function update(PackageInterface $initial, PackageInterface $target, $targetDir)
  10155. {
  10156. $downloader = $this->getDownloaderForInstalledPackage($initial);
  10157. if (!$downloader) {
  10158. return;
  10159. }
  10160. $installationSource = $initial->getInstallationSource();
  10161. if ('dist' === $installationSource) {
  10162. $initialType = $initial->getDistType();
  10163. $targetType = $target->getDistType();
  10164. } else {
  10165. $initialType = $initial->getSourceType();
  10166. $targetType = $target->getSourceType();
  10167. }
  10168. if ($target->isDev() && 'dist' === $installationSource) {
  10169. $downloader->remove($initial, $targetDir);
  10170. $this->download($target, $targetDir);
  10171. return;
  10172. }
  10173. if ($initialType === $targetType) {
  10174. $target->setInstallationSource($installationSource);
  10175. try {
  10176. $downloader->update($initial, $target, $targetDir);
  10177. return;
  10178. } catch (\RuntimeException $e) {
  10179. if (!$this->io->isInteractive()) {
  10180. throw $e;
  10181. }
  10182. $this->io->writeError('<error> Update failed ('.$e->getMessage().')</error>');
  10183. if (!$this->io->askConfirmation(' Would you like to try reinstalling the package instead [<comment>yes</comment>]? ', true)) {
  10184. throw $e;
  10185. }
  10186. }
  10187. }
  10188. $downloader->remove($initial, $targetDir);
  10189. $this->download($target, $targetDir, 'source' === $installationSource);
  10190. }
  10191. public function remove(PackageInterface $package, $targetDir)
  10192. {
  10193. $downloader = $this->getDownloaderForInstalledPackage($package);
  10194. if ($downloader) {
  10195. $downloader->remove($package, $targetDir);
  10196. }
  10197. }
  10198. protected function resolvePackageInstallPreference(PackageInterface $package)
  10199. {
  10200. foreach ($this->packagePreferences as $pattern => $preference) {
  10201. $pattern = '{^'.str_replace('\\*', '.*', preg_quote($pattern)).'$}i';
  10202. if (preg_match($pattern, $package->getName())) {
  10203. if ('dist' === $preference || (!$package->isDev() && 'auto' === $preference)) {
  10204. return 'dist';
  10205. }
  10206. return 'source';
  10207. }
  10208. }
  10209. return $package->isDev() ? 'source' : 'dist';
  10210. }
  10211. }
  10212. <?php
  10213. namespace Composer\Downloader;
  10214. use Composer\Package\PackageInterface;
  10215. interface DownloaderInterface
  10216. {
  10217. public function getInstallationSource();
  10218. public function download(PackageInterface $package, $path);
  10219. public function update(PackageInterface $initial, PackageInterface $target, $path);
  10220. public function remove(PackageInterface $package, $path);
  10221. public function setOutputProgress($outputProgress);
  10222. }
  10223. <?php
  10224. namespace Composer\Downloader;
  10225. use Composer\Package\PackageInterface;
  10226. interface DvcsDownloaderInterface
  10227. {
  10228. public function getUnpushedChanges(PackageInterface $package, $path);
  10229. }
  10230. <?php
  10231. namespace Composer\Downloader;
  10232. use Composer\Config;
  10233. use Composer\Cache;
  10234. use Composer\Factory;
  10235. use Composer\IO\IOInterface;
  10236. use Composer\IO\NullIO;
  10237. use Composer\Package\Comparer\Comparer;
  10238. use Composer\Package\PackageInterface;
  10239. use Composer\Package\Version\VersionParser;
  10240. use Composer\Plugin\PluginEvents;
  10241. use Composer\Plugin\PreFileDownloadEvent;
  10242. use Composer\EventDispatcher\EventDispatcher;
  10243. use Composer\Util\Filesystem;
  10244. use Composer\Util\RemoteFilesystem;
  10245. use Composer\Util\Url as UrlUtil;
  10246. class FileDownloader implements DownloaderInterface, ChangeReportInterface
  10247. {
  10248. protected $io;
  10249. protected $config;
  10250. protected $rfs;
  10251. protected $filesystem;
  10252. protected $cache;
  10253. protected $outputProgress = true;
  10254. private $lastCacheWrites = array();
  10255. private $eventDispatcher;
  10256. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, RemoteFilesystem $rfs = null, Filesystem $filesystem = null)
  10257. {
  10258. $this->io = $io;
  10259. $this->config = $config;
  10260. $this->eventDispatcher = $eventDispatcher;
  10261. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  10262. $this->filesystem = $filesystem ?: new Filesystem();
  10263. $this->cache = $cache;
  10264. if ($this->cache && $this->cache->gcIsNecessary()) {
  10265. $this->cache->gc($config->get('cache-files-ttl'), $config->get('cache-files-maxsize'));
  10266. }
  10267. }
  10268. public function getInstallationSource()
  10269. {
  10270. return 'dist';
  10271. }
  10272. public function download(PackageInterface $package, $path, $output = true)
  10273. {
  10274. if (!$package->getDistUrl()) {
  10275. throw new \InvalidArgumentException('The given package is missing url information');
  10276. }
  10277. if ($output) {
  10278. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>): ", false);
  10279. }
  10280. $urls = $package->getDistUrls();
  10281. while ($url = array_shift($urls)) {
  10282. try {
  10283. $fileName = $this->doDownload($package, $path, $url);
  10284. break;
  10285. } catch (\Exception $e) {
  10286. if ($this->io->isDebug()) {
  10287. $this->io->writeError('');
  10288. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getCode().': '.$e->getMessage());
  10289. } elseif (count($urls)) {
  10290. $this->io->writeError('');
  10291. $this->io->writeError(' Failed, trying the next URL ('.$e->getCode().': '.$e->getMessage().')', false);
  10292. }
  10293. if (!count($urls)) {
  10294. throw $e;
  10295. }
  10296. }
  10297. }
  10298. if ($output) {
  10299. $this->io->writeError('');
  10300. }
  10301. return $fileName;
  10302. }
  10303. protected function doDownload(PackageInterface $package, $path, $url)
  10304. {
  10305. $this->filesystem->emptyDirectory($path);
  10306. $fileName = $this->getFileName($package, $path);
  10307. $processedUrl = $this->processUrl($package, $url);
  10308. $hostname = parse_url($processedUrl, PHP_URL_HOST);
  10309. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $processedUrl);
  10310. if ($this->eventDispatcher) {
  10311. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  10312. }
  10313. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  10314. try {
  10315. $checksum = $package->getDistSha1Checksum();
  10316. $cacheKey = $this->getCacheKey($package, $processedUrl);
  10317. if ($this->cache && (!$checksum || $checksum === $this->cache->sha1($cacheKey)) && $this->cache->copyTo($cacheKey, $fileName)) {
  10318. $this->io->writeError('Loading from cache', false);
  10319. } else {
  10320. if (!$this->outputProgress) {
  10321. $this->io->writeError('Downloading', false);
  10322. }
  10323. $retries = 3;
  10324. while ($retries--) {
  10325. try {
  10326. $rfs->copy($hostname, $processedUrl, $fileName, $this->outputProgress, $package->getTransportOptions());
  10327. break;
  10328. } catch (TransportException $e) {
  10329. if ((0 !== $e->getCode() && !in_array($e->getCode(), array(500, 502, 503, 504))) || !$retries) {
  10330. throw $e;
  10331. }
  10332. $this->io->writeError('');
  10333. $this->io->writeError(' Download failed, retrying...', true, IOInterface::VERBOSE);
  10334. usleep(500000);
  10335. }
  10336. }
  10337. if (!$this->outputProgress) {
  10338. $this->io->writeError(' (<comment>100%</comment>)', false);
  10339. }
  10340. if ($this->cache) {
  10341. $this->lastCacheWrites[$package->getName()] = $cacheKey;
  10342. $this->cache->copyFrom($cacheKey, $fileName);
  10343. }
  10344. }
  10345. if (!file_exists($fileName)) {
  10346. throw new \UnexpectedValueException($url.' could not be saved to '.$fileName.', make sure the'
  10347. .' directory is writable and you have internet connectivity');
  10348. }
  10349. if ($checksum && hash_file('sha1', $fileName) !== $checksum) {
  10350. throw new \UnexpectedValueException('The checksum verification of the file failed (downloaded from '.$url.')');
  10351. }
  10352. } catch (\Exception $e) {
  10353. $this->filesystem->removeDirectory($path);
  10354. $this->clearLastCacheWrite($package);
  10355. throw $e;
  10356. }
  10357. return $fileName;
  10358. }
  10359. public function setOutputProgress($outputProgress)
  10360. {
  10361. $this->outputProgress = $outputProgress;
  10362. return $this;
  10363. }
  10364. protected function clearLastCacheWrite(PackageInterface $package)
  10365. {
  10366. if ($this->cache && isset($this->lastCacheWrites[$package->getName()])) {
  10367. $this->cache->remove($this->lastCacheWrites[$package->getName()]);
  10368. unset($this->lastCacheWrites[$package->getName()]);
  10369. }
  10370. }
  10371. public function update(PackageInterface $initial, PackageInterface $target, $path)
  10372. {
  10373. $name = $target->getName();
  10374. $from = $initial->getPrettyVersion();
  10375. $to = $target->getPrettyVersion();
  10376. $actionName = VersionParser::isUpgrade($initial->getVersion(), $target->getVersion()) ? 'Updating' : 'Downgrading';
  10377. $this->io->writeError(" - " . $actionName . " <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>): ", false);
  10378. $this->remove($initial, $path, false);
  10379. $this->download($target, $path, false);
  10380. $this->io->writeError('');
  10381. }
  10382. public function remove(PackageInterface $package, $path, $output = true)
  10383. {
  10384. if ($output) {
  10385. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  10386. }
  10387. if (!$this->filesystem->removeDirectory($path)) {
  10388. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  10389. }
  10390. }
  10391. protected function getFileName(PackageInterface $package, $path)
  10392. {
  10393. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  10394. }
  10395. protected function processUrl(PackageInterface $package, $url)
  10396. {
  10397. if (!extension_loaded('openssl') && 0 === strpos($url, 'https:')) {
  10398. throw new \RuntimeException('You must enable the openssl extension to download files via https');
  10399. }
  10400. if ($package->getDistReference()) {
  10401. $url = UrlUtil::updateDistReference($this->config, $url, $package->getDistReference());
  10402. }
  10403. return $url;
  10404. }
  10405. private function getCacheKey(PackageInterface $package, $processedUrl)
  10406. {
  10407. $cacheKey = sha1($processedUrl);
  10408. return $package->getName().'/'.$cacheKey.'.'.$package->getDistType();
  10409. }
  10410. public function getLocalChanges(PackageInterface $package, $targetDir)
  10411. {
  10412. $prevIO = $this->io;
  10413. $prevProgress = $this->outputProgress;
  10414. $this->io = new NullIO;
  10415. $this->io->loadConfiguration($this->config);
  10416. $this->outputProgress = false;
  10417. $e = null;
  10418. try {
  10419. $this->download($package, $targetDir.'_compare', false);
  10420. $comparer = new Comparer();
  10421. $comparer->setSource($targetDir.'_compare');
  10422. $comparer->setUpdate($targetDir);
  10423. $comparer->doCompare();
  10424. $output = $comparer->getChanged(true, true);
  10425. $this->filesystem->removeDirectory($targetDir.'_compare');
  10426. } catch (\Exception $e) {
  10427. }
  10428. $this->io = $prevIO;
  10429. $this->outputProgress = $prevProgress;
  10430. if ($e) {
  10431. throw $e;
  10432. }
  10433. return trim($output);
  10434. }
  10435. }
  10436. <?php
  10437. namespace Composer\Downloader;
  10438. class FilesystemException extends \Exception
  10439. {
  10440. public function __construct($message = '', $code = 0, \Exception $previous = null)
  10441. {
  10442. parent::__construct("Filesystem exception: \n".$message, $code, $previous);
  10443. }
  10444. }
  10445. <?php
  10446. namespace Composer\Downloader;
  10447. use Composer\Package\PackageInterface;
  10448. use Composer\Util\ProcessExecutor;
  10449. class FossilDownloader extends VcsDownloader
  10450. {
  10451. public function doDownload(PackageInterface $package, $path, $url)
  10452. {
  10453. $this->config->prohibitUrlByConfig($url, $this->io);
  10454. $url = ProcessExecutor::escape($url);
  10455. $ref = ProcessExecutor::escape($package->getSourceReference());
  10456. $repoFile = $path . '.fossil';
  10457. $this->io->writeError("Cloning ".$package->getSourceReference());
  10458. $command = sprintf('fossil clone %s %s', $url, ProcessExecutor::escape($repoFile));
  10459. if (0 !== $this->process->execute($command, $ignoredOutput)) {
  10460. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10461. }
  10462. $command = sprintf('fossil open %s --nested', ProcessExecutor::escape($repoFile));
  10463. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10464. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10465. }
  10466. $command = sprintf('fossil update %s', $ref);
  10467. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10468. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10469. }
  10470. }
  10471. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  10472. {
  10473. $this->config->prohibitUrlByConfig($url, $this->io);
  10474. $url = ProcessExecutor::escape($url);
  10475. $ref = ProcessExecutor::escape($target->getSourceReference());
  10476. $this->io->writeError(" Updating to ".$target->getSourceReference());
  10477. if (!$this->hasMetadataRepository($path)) {
  10478. throw new \RuntimeException('The .fslckout file is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  10479. }
  10480. $command = sprintf('fossil pull && fossil up %s', $ref);
  10481. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10482. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10483. }
  10484. }
  10485. public function getLocalChanges(PackageInterface $package, $path)
  10486. {
  10487. if (!$this->hasMetadataRepository($path)) {
  10488. return null;
  10489. }
  10490. $this->process->execute('fossil changes', $output, realpath($path));
  10491. return trim($output) ?: null;
  10492. }
  10493. protected function getCommitLogs($fromReference, $toReference, $path)
  10494. {
  10495. $command = sprintf('fossil timeline -t ci -W 0 -n 0 before %s', ProcessExecutor::escape($toReference));
  10496. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  10497. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10498. }
  10499. $log = '';
  10500. $match = '/\d\d:\d\d:\d\d\s+\[' . $toReference . '\]/';
  10501. foreach ($this->process->splitLines($output) as $line) {
  10502. if (preg_match($match, $line)) {
  10503. break;
  10504. }
  10505. $log .= $line;
  10506. }
  10507. return $log;
  10508. }
  10509. protected function hasMetadataRepository($path)
  10510. {
  10511. return is_file($path . '/.fslckout') || is_file($path . '/_FOSSIL_');
  10512. }
  10513. }
  10514. <?php
  10515. namespace Composer\Downloader;
  10516. use Composer\Config;
  10517. use Composer\IO\IOInterface;
  10518. use Composer\Package\PackageInterface;
  10519. use Composer\Util\Filesystem;
  10520. use Composer\Util\Git as GitUtil;
  10521. use Composer\Util\Platform;
  10522. use Composer\Util\ProcessExecutor;
  10523. class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
  10524. {
  10525. private $hasStashedChanges = false;
  10526. private $hasDiscardedChanges = false;
  10527. private $gitUtil;
  10528. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  10529. {
  10530. parent::__construct($io, $config, $process, $fs);
  10531. $this->gitUtil = new GitUtil($this->io, $this->config, $this->process, $this->filesystem);
  10532. }
  10533. public function doDownload(PackageInterface $package, $path, $url)
  10534. {
  10535. GitUtil::cleanEnv();
  10536. $path = $this->normalizePath($path);
  10537. $cachePath = $this->config->get('cache-vcs-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $url).'/';
  10538. $ref = $package->getSourceReference();
  10539. $flag = Platform::isWindows() ? '/D ' : '';
  10540. $gitVersion = $this->gitUtil->getVersion();
  10541. $msg = "Cloning ".$this->getShortHash($ref);
  10542. $command = 'git clone --no-checkout %url% %path% && cd '.$flag.'%path% && git remote add composer %url% && git fetch composer';
  10543. if ($gitVersion && version_compare($gitVersion, '2.3.0-rc0', '>=')) {
  10544. $this->io->writeError('', true, IOInterface::DEBUG);
  10545. $this->io->writeError(sprintf(' Cloning to cache at %s', ProcessExecutor::escape($cachePath)), true, IOInterface::DEBUG);
  10546. try {
  10547. $this->gitUtil->fetchRefOrSyncMirror($url, $cachePath, $ref);
  10548. if (is_dir($cachePath)) {
  10549. $command =
  10550. 'git clone --no-checkout %cachePath% %path% --dissociate --reference %cachePath% '
  10551. . '&& cd '.$flag.'%path% '
  10552. . '&& git remote set-url origin %url% && git remote add composer %url%';
  10553. $msg = "Cloning ".$this->getShortHash($ref).' from cache';
  10554. }
  10555. } catch (\RuntimeException $e) {
  10556. }
  10557. }
  10558. $this->io->writeError($msg);
  10559. $commandCallable = function ($url) use ($path, $command, $cachePath) {
  10560. return str_replace(
  10561. array('%url%', '%path%', '%cachePath%'),
  10562. array(
  10563. ProcessExecutor::escape($url),
  10564. ProcessExecutor::escape($path),
  10565. ProcessExecutor::escape($cachePath),
  10566. ),
  10567. $command
  10568. );
  10569. };
  10570. $this->gitUtil->runCommand($commandCallable, $url, $path, true);
  10571. if ($url !== $package->getSourceUrl()) {
  10572. $this->updateOriginUrl($path, $package->getSourceUrl());
  10573. } else {
  10574. $this->setPushUrl($path, $url);
  10575. }
  10576. if ($newRef = $this->updateToCommit($path, $ref, $package->getPrettyVersion(), $package->getReleaseDate())) {
  10577. if ($package->getDistReference() === $package->getSourceReference()) {
  10578. $package->setDistReference($newRef);
  10579. }
  10580. $package->setSourceReference($newRef);
  10581. }
  10582. }
  10583. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  10584. {
  10585. GitUtil::cleanEnv();
  10586. if (!$this->hasMetadataRepository($path)) {
  10587. throw new \RuntimeException('The .git directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  10588. }
  10589. $updateOriginUrl = false;
  10590. if (
  10591. 0 === $this->process->execute('git remote -v', $output, $path)
  10592. && preg_match('{^origin\s+(?P<url>\S+)}m', $output, $originMatch)
  10593. && preg_match('{^composer\s+(?P<url>\S+)}m', $output, $composerMatch)
  10594. ) {
  10595. if ($originMatch['url'] === $composerMatch['url'] && $composerMatch['url'] !== $target->getSourceUrl()) {
  10596. $updateOriginUrl = true;
  10597. }
  10598. }
  10599. $ref = $target->getSourceReference();
  10600. $this->io->writeError(" Checking out ".$this->getShortHash($ref));
  10601. $command = 'git remote set-url composer %s && git rev-parse --quiet --verify %s || (git fetch composer && git fetch --tags composer)';
  10602. $commandCallable = function ($url) use ($command, $ref) {
  10603. return sprintf($command, ProcessExecutor::escape($url), ProcessExecutor::escape($ref.'^{commit}'));
  10604. };
  10605. $this->gitUtil->runCommand($commandCallable, $url, $path);
  10606. if ($newRef = $this->updateToCommit($path, $ref, $target->getPrettyVersion(), $target->getReleaseDate())) {
  10607. if ($target->getDistReference() === $target->getSourceReference()) {
  10608. $target->setDistReference($newRef);
  10609. }
  10610. $target->setSourceReference($newRef);
  10611. }
  10612. if ($updateOriginUrl) {
  10613. $this->updateOriginUrl($path, $target->getSourceUrl());
  10614. }
  10615. }
  10616. public function getLocalChanges(PackageInterface $package, $path)
  10617. {
  10618. GitUtil::cleanEnv();
  10619. if (!$this->hasMetadataRepository($path)) {
  10620. return;
  10621. }
  10622. $command = 'git status --porcelain --untracked-files=no';
  10623. if (0 !== $this->process->execute($command, $output, $path)) {
  10624. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10625. }
  10626. return trim($output) ?: null;
  10627. }
  10628. public function getUnpushedChanges(PackageInterface $package, $path)
  10629. {
  10630. GitUtil::cleanEnv();
  10631. $path = $this->normalizePath($path);
  10632. if (!$this->hasMetadataRepository($path)) {
  10633. return;
  10634. }
  10635. $command = 'git show-ref --head -d';
  10636. if (0 !== $this->process->execute($command, $output, $path)) {
  10637. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10638. }
  10639. $refs = trim($output);
  10640. if (!preg_match('{^([a-f0-9]+) HEAD$}mi', $refs, $match)) {
  10641. return;
  10642. }
  10643. $headRef = $match[1];
  10644. if (!preg_match_all('{^'.$headRef.' refs/heads/(.+)$}mi', $refs, $matches)) {
  10645. return;
  10646. }
  10647. $branch = $matches[1][0];
  10648. $unpushedChanges = null;
  10649. for ($i = 0; $i <= 1; $i++) {
  10650. foreach ($matches[1] as $candidate) {
  10651. if (preg_match('{^[a-f0-9]+ refs/remotes/((?:composer|origin)/'.preg_quote($candidate).')$}mi', $refs, $match)) {
  10652. $branch = $candidate;
  10653. $remoteBranch = $match[1];
  10654. break;
  10655. }
  10656. }
  10657. if (!isset($remoteBranch)) {
  10658. $unpushedChanges = 'Branch ' . $branch . ' could not be found on the origin remote and appears to be unpushed';
  10659. } else {
  10660. $command = sprintf('git diff --name-status %s...%s --', $remoteBranch, $branch);
  10661. if (0 !== $this->process->execute($command, $output, $path)) {
  10662. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10663. }
  10664. $unpushedChanges = trim($output) ?: null;
  10665. }
  10666. if ($unpushedChanges && $i === 0) {
  10667. $this->process->execute('git fetch composer && git fetch origin', $output, $path);
  10668. }
  10669. if (!$unpushedChanges) {
  10670. break;
  10671. }
  10672. }
  10673. return $unpushedChanges;
  10674. }
  10675. protected function cleanChanges(PackageInterface $package, $path, $update)
  10676. {
  10677. GitUtil::cleanEnv();
  10678. $path = $this->normalizePath($path);
  10679. $unpushed = $this->getUnpushedChanges($package, $path);
  10680. if ($unpushed && ($this->io->isInteractive() || $this->config->get('discard-changes') !== true)) {
  10681. throw new \RuntimeException('Source directory ' . $path . ' has unpushed changes on the current branch: '."\n".$unpushed);
  10682. }
  10683. if (!$changes = $this->getLocalChanges($package, $path)) {
  10684. return;
  10685. }
  10686. if (!$this->io->isInteractive()) {
  10687. $discardChanges = $this->config->get('discard-changes');
  10688. if (true === $discardChanges) {
  10689. return $this->discardChanges($path);
  10690. }
  10691. if ('stash' === $discardChanges) {
  10692. if (!$update) {
  10693. return parent::cleanChanges($package, $path, $update);
  10694. }
  10695. return $this->stashChanges($path);
  10696. }
  10697. return parent::cleanChanges($package, $path, $update);
  10698. }
  10699. $changes = array_map(function ($elem) {
  10700. return ' '.$elem;
  10701. }, preg_split('{\s*\r?\n\s*}', $changes));
  10702. $this->io->writeError(' <error>The package has modified files:</error>');
  10703. $this->io->writeError(array_slice($changes, 0, 10));
  10704. if (count($changes) > 10) {
  10705. $this->io->writeError(' <info>' . (count($changes) - 10) . ' more files modified, choose "v" to view the full list</info>');
  10706. }
  10707. while (true) {
  10708. switch ($this->io->ask(' <info>Discard changes [y,n,v,d,'.($update ? 's,' : '').'?]?</info> ', '?')) {
  10709. case 'y':
  10710. $this->discardChanges($path);
  10711. break 2;
  10712. case 's':
  10713. if (!$update) {
  10714. goto help;
  10715. }
  10716. $this->stashChanges($path);
  10717. break 2;
  10718. case 'n':
  10719. throw new \RuntimeException('Update aborted');
  10720. case 'v':
  10721. $this->io->writeError($changes);
  10722. break;
  10723. case 'd':
  10724. $this->viewDiff($path);
  10725. break;
  10726. case '?':
  10727. default:
  10728. help:
  10729. $this->io->writeError(array(
  10730. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  10731. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  10732. ' v - view modified files',
  10733. ' d - view local modifications (diff)',
  10734. ));
  10735. if ($update) {
  10736. $this->io->writeError(' s - stash changes and try to reapply them after the update');
  10737. }
  10738. $this->io->writeError(' ? - print help');
  10739. break;
  10740. }
  10741. }
  10742. }
  10743. protected function reapplyChanges($path)
  10744. {
  10745. $path = $this->normalizePath($path);
  10746. if ($this->hasStashedChanges) {
  10747. $this->hasStashedChanges = false;
  10748. $this->io->writeError(' <info>Re-applying stashed changes</info>');
  10749. if (0 !== $this->process->execute('git stash pop', $output, $path)) {
  10750. throw new \RuntimeException("Failed to apply stashed changes:\n\n".$this->process->getErrorOutput());
  10751. }
  10752. }
  10753. $this->hasDiscardedChanges = false;
  10754. }
  10755. protected function updateToCommit($path, $reference, $branch, $date)
  10756. {
  10757. $force = $this->hasDiscardedChanges || $this->hasStashedChanges ? '-f ' : '';
  10758. $template = 'git checkout '.$force.'%s -- && git reset --hard %1$s --';
  10759. $branch = preg_replace('{(?:^dev-|(?:\.x)?-dev$)}i', '', $branch);
  10760. $branches = null;
  10761. if (0 === $this->process->execute('git branch -r', $output, $path)) {
  10762. $branches = $output;
  10763. }
  10764. $gitRef = $reference;
  10765. if (!preg_match('{^[a-f0-9]{40}$}', $reference)
  10766. && $branches
  10767. && preg_match('{^\s+composer/'.preg_quote($reference).'$}m', $branches)
  10768. ) {
  10769. $command = sprintf('git checkout '.$force.'-B %s %s -- && git reset --hard %2$s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$reference));
  10770. if (0 === $this->process->execute($command, $output, $path)) {
  10771. return;
  10772. }
  10773. }
  10774. if (preg_match('{^[a-f0-9]{40}$}', $reference)) {
  10775. if (!preg_match('{^\s+composer/'.preg_quote($branch).'$}m', $branches) && preg_match('{^\s+composer/v'.preg_quote($branch).'$}m', $branches)) {
  10776. $branch = 'v' . $branch;
  10777. }
  10778. $command = sprintf('git checkout %s --', ProcessExecutor::escape($branch));
  10779. $fallbackCommand = sprintf('git checkout '.$force.'-B %s %s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$branch));
  10780. if (0 === $this->process->execute($command, $output, $path)
  10781. || 0 === $this->process->execute($fallbackCommand, $output, $path)
  10782. ) {
  10783. $command = sprintf('git reset --hard %s --', ProcessExecutor::escape($reference));
  10784. if (0 === $this->process->execute($command, $output, $path)) {
  10785. return;
  10786. }
  10787. }
  10788. }
  10789. $command = sprintf($template, ProcessExecutor::escape($gitRef));
  10790. if (0 === $this->process->execute($command, $output, $path)) {
  10791. return;
  10792. }
  10793. if (false !== strpos($this->process->getErrorOutput(), $reference)) {
  10794. $this->io->writeError(' <warning>'.$reference.' is gone (history was rewritten?)</warning>');
  10795. }
  10796. throw new \RuntimeException(GitUtil::sanitizeUrl('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()));
  10797. }
  10798. protected function updateOriginUrl($path, $url)
  10799. {
  10800. $this->process->execute(sprintf('git remote set-url origin %s', ProcessExecutor::escape($url)), $output, $path);
  10801. $this->setPushUrl($path, $url);
  10802. }
  10803. protected function setPushUrl($path, $url)
  10804. {
  10805. if (preg_match('{^(?:https?|git)://'.GitUtil::getGitHubDomainsRegex($this->config).'/([^/]+)/([^/]+?)(?:\.git)?$}', $url, $match)) {
  10806. $protocols = $this->config->get('github-protocols');
  10807. $pushUrl = 'git@'.$match[1].':'.$match[2].'/'.$match[3].'.git';
  10808. if (!in_array('ssh', $protocols, true)) {
  10809. $pushUrl = 'https://' . $match[1] . '/'.$match[2].'/'.$match[3].'.git';
  10810. }
  10811. $cmd = sprintf('git remote set-url --push origin %s', ProcessExecutor::escape($pushUrl));
  10812. $this->process->execute($cmd, $ignoredOutput, $path);
  10813. }
  10814. }
  10815. protected function getCommitLogs($fromReference, $toReference, $path)
  10816. {
  10817. $path = $this->normalizePath($path);
  10818. $command = sprintf('git log %s..%s --pretty=format:"%%h - %%an: %%s"', ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference));
  10819. if (0 !== $this->process->execute($command, $output, $path)) {
  10820. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10821. }
  10822. return $output;
  10823. }
  10824. protected function discardChanges($path)
  10825. {
  10826. $path = $this->normalizePath($path);
  10827. if (0 !== $this->process->execute('git reset --hard', $output, $path)) {
  10828. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  10829. }
  10830. $this->hasDiscardedChanges = true;
  10831. }
  10832. protected function stashChanges($path)
  10833. {
  10834. $path = $this->normalizePath($path);
  10835. if (0 !== $this->process->execute('git stash --include-untracked', $output, $path)) {
  10836. throw new \RuntimeException("Could not stash changes\n\n:".$this->process->getErrorOutput());
  10837. }
  10838. $this->hasStashedChanges = true;
  10839. }
  10840. protected function viewDiff($path)
  10841. {
  10842. $path = $this->normalizePath($path);
  10843. if (0 !== $this->process->execute('git diff HEAD', $output, $path)) {
  10844. throw new \RuntimeException("Could not view diff\n\n:".$this->process->getErrorOutput());
  10845. }
  10846. $this->io->writeError($output);
  10847. }
  10848. protected function normalizePath($path)
  10849. {
  10850. if (Platform::isWindows() && strlen($path) > 0) {
  10851. $basePath = $path;
  10852. $removed = array();
  10853. while (!is_dir($basePath) && $basePath !== '\\') {
  10854. array_unshift($removed, basename($basePath));
  10855. $basePath = dirname($basePath);
  10856. }
  10857. if ($basePath === '\\') {
  10858. return $path;
  10859. }
  10860. $path = rtrim(realpath($basePath) . '/' . implode('/', $removed), '/');
  10861. }
  10862. return $path;
  10863. }
  10864. protected function hasMetadataRepository($path)
  10865. {
  10866. $path = $this->normalizePath($path);
  10867. return is_dir($path.'/.git');
  10868. }
  10869. protected function getShortHash($reference)
  10870. {
  10871. if (!$this->io->isVerbose() && preg_match('{^[0-9a-f]{40}$}', $reference)) {
  10872. return substr($reference, 0, 10);
  10873. }
  10874. return $reference;
  10875. }
  10876. }
  10877. <?php
  10878. namespace Composer\Downloader;
  10879. use Composer\Config;
  10880. use Composer\Cache;
  10881. use Composer\EventDispatcher\EventDispatcher;
  10882. use Composer\Package\PackageInterface;
  10883. use Composer\Util\Platform;
  10884. use Composer\Util\ProcessExecutor;
  10885. use Composer\Util\RemoteFilesystem;
  10886. use Composer\IO\IOInterface;
  10887. class GzipDownloader extends ArchiveDownloader
  10888. {
  10889. protected $process;
  10890. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  10891. {
  10892. $this->process = $process ?: new ProcessExecutor($io);
  10893. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  10894. }
  10895. protected function extract($file, $path)
  10896. {
  10897. $targetFilepath = $path . DIRECTORY_SEPARATOR . basename(substr($file, 0, -3));
  10898. if (!Platform::isWindows()) {
  10899. $command = 'gzip -cd ' . ProcessExecutor::escape($file) . ' > ' . ProcessExecutor::escape($targetFilepath);
  10900. if (0 === $this->process->execute($command, $ignoredOutput)) {
  10901. return;
  10902. }
  10903. if (extension_loaded('zlib')) {
  10904. $this->extractUsingExt($file, $targetFilepath);
  10905. return;
  10906. }
  10907. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  10908. throw new \RuntimeException($processError);
  10909. }
  10910. $this->extractUsingExt($file, $targetFilepath);
  10911. }
  10912. protected function getFileName(PackageInterface $package, $path)
  10913. {
  10914. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  10915. }
  10916. private function extractUsingExt($file, $targetFilepath)
  10917. {
  10918. $archiveFile = gzopen($file, 'rb');
  10919. $targetFile = fopen($targetFilepath, 'wb');
  10920. while ($string = gzread($archiveFile, 4096)) {
  10921. fwrite($targetFile, $string, Platform::strlen($string));
  10922. }
  10923. gzclose($archiveFile);
  10924. fclose($targetFile);
  10925. }
  10926. }
  10927. <?php
  10928. namespace Composer\Downloader;
  10929. use Composer\Package\PackageInterface;
  10930. use Composer\Util\ProcessExecutor;
  10931. use Composer\Util\Hg as HgUtils;
  10932. class HgDownloader extends VcsDownloader
  10933. {
  10934. public function doDownload(PackageInterface $package, $path, $url)
  10935. {
  10936. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  10937. $cloneCommand = function ($url) use ($path) {
  10938. return sprintf('hg clone %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($path));
  10939. };
  10940. $hgUtils->runCommand($cloneCommand, $url, $path);
  10941. $ref = ProcessExecutor::escape($package->getSourceReference());
  10942. $command = sprintf('hg up %s', $ref);
  10943. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10944. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10945. }
  10946. }
  10947. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  10948. {
  10949. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  10950. $ref = $target->getSourceReference();
  10951. $this->io->writeError(" Updating to ".$target->getSourceReference());
  10952. if (!$this->hasMetadataRepository($path)) {
  10953. throw new \RuntimeException('The .hg directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  10954. }
  10955. $command = function ($url) use ($ref) {
  10956. return sprintf('hg pull %s && hg up %s', ProcessExecutor::escape($url), ProcessExecutor::escape($ref));
  10957. };
  10958. $hgUtils->runCommand($command, $url, $path);
  10959. }
  10960. public function getLocalChanges(PackageInterface $package, $path)
  10961. {
  10962. if (!is_dir($path.'/.hg')) {
  10963. return null;
  10964. }
  10965. $this->process->execute('hg st', $output, realpath($path));
  10966. return trim($output) ?: null;
  10967. }
  10968. protected function getCommitLogs($fromReference, $toReference, $path)
  10969. {
  10970. $command = sprintf('hg log -r %s:%s --style compact', ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference));
  10971. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  10972. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10973. }
  10974. return $output;
  10975. }
  10976. protected function hasMetadataRepository($path)
  10977. {
  10978. return is_dir($path . '/.hg');
  10979. }
  10980. }
  10981. <?php
  10982. namespace Composer\Downloader;
  10983. use Composer\Package\Archiver\ArchivableFilesFinder;
  10984. use Composer\Package\Dumper\ArrayDumper;
  10985. use Composer\Package\PackageInterface;
  10986. use Composer\Package\Version\VersionGuesser;
  10987. use Composer\Package\Version\VersionParser;
  10988. use Composer\Util\Platform;
  10989. use Composer\Util\ProcessExecutor;
  10990. use Composer\Util\Filesystem as ComposerFilesystem;
  10991. use Symfony\Component\Filesystem\Exception\IOException;
  10992. use Symfony\Component\Filesystem\Filesystem;
  10993. class PathDownloader extends FileDownloader implements VcsCapableDownloaderInterface
  10994. {
  10995. const STRATEGY_SYMLINK = 10;
  10996. const STRATEGY_MIRROR = 20;
  10997. public function download(PackageInterface $package, $path, $output = true)
  10998. {
  10999. $url = $package->getDistUrl();
  11000. $realUrl = realpath($url);
  11001. if (false === $realUrl || !file_exists($realUrl) || !is_dir($realUrl)) {
  11002. throw new \RuntimeException(sprintf(
  11003. 'Source path "%s" is not found for package %s',
  11004. $url,
  11005. $package->getName()
  11006. ));
  11007. }
  11008. if (strpos(realpath($path) . DIRECTORY_SEPARATOR, $realUrl . DIRECTORY_SEPARATOR) === 0) {
  11009. throw new \RuntimeException(sprintf(
  11010. 'Package %s cannot install to "%s" inside its source at "%s"',
  11011. $package->getName(),
  11012. realpath($path),
  11013. $realUrl
  11014. ));
  11015. }
  11016. $transportOptions = $package->getTransportOptions() + array('symlink' => null);
  11017. $currentStrategy = self::STRATEGY_SYMLINK;
  11018. $allowedStrategies = array(self::STRATEGY_SYMLINK, self::STRATEGY_MIRROR);
  11019. $mirrorPathRepos = getenv('COMPOSER_MIRROR_PATH_REPOS');
  11020. if ($mirrorPathRepos) {
  11021. $currentStrategy = self::STRATEGY_MIRROR;
  11022. }
  11023. if (true === $transportOptions['symlink']) {
  11024. $currentStrategy = self::STRATEGY_SYMLINK;
  11025. $allowedStrategies = array(self::STRATEGY_SYMLINK);
  11026. } elseif (false === $transportOptions['symlink']) {
  11027. $currentStrategy = self::STRATEGY_MIRROR;
  11028. $allowedStrategies = array(self::STRATEGY_MIRROR);
  11029. }
  11030. $fileSystem = new Filesystem();
  11031. $this->filesystem->removeDirectory($path);
  11032. if ($output) {
  11033. $this->io->writeError(sprintf(
  11034. ' - Installing <info>%s</info> (<comment>%s</comment>): ',
  11035. $package->getName(),
  11036. $package->getFullPrettyVersion()
  11037. ), false);
  11038. }
  11039. $isFallback = false;
  11040. if (self::STRATEGY_SYMLINK == $currentStrategy) {
  11041. try {
  11042. if (Platform::isWindows()) {
  11043. $this->io->writeError(sprintf('Junctioning from %s', $url), false);
  11044. $this->filesystem->junction($realUrl, $path);
  11045. } else {
  11046. $absolutePath = $path;
  11047. if (!$this->filesystem->isAbsolutePath($absolutePath)) {
  11048. $absolutePath = getcwd() . DIRECTORY_SEPARATOR . $path;
  11049. }
  11050. $shortestPath = $this->filesystem->findShortestPath($absolutePath, $realUrl);
  11051. $path = rtrim($path, "/");
  11052. $this->io->writeError(sprintf('Symlinking from %s', $url), false);
  11053. $fileSystem->symlink($shortestPath, $path);
  11054. }
  11055. } catch (IOException $e) {
  11056. if (in_array(self::STRATEGY_MIRROR, $allowedStrategies)) {
  11057. $this->io->writeError('');
  11058. $this->io->writeError(' <error>Symlink failed, fallback to use mirroring!</error>');
  11059. $currentStrategy = self::STRATEGY_MIRROR;
  11060. $isFallback = true;
  11061. } else {
  11062. throw new \RuntimeException(sprintf('Symlink from "%s" to "%s" failed!', $realUrl, $path));
  11063. }
  11064. }
  11065. }
  11066. if (self::STRATEGY_MIRROR == $currentStrategy) {
  11067. $fs = new ComposerFilesystem();
  11068. $realUrl = $fs->normalizePath($realUrl);
  11069. $this->io->writeError(sprintf('%sMirroring from %s', $isFallback ? ' ' : '', $url), false);
  11070. $iterator = new ArchivableFilesFinder($realUrl, array());
  11071. $fileSystem->mirror($realUrl, $path, $iterator);
  11072. }
  11073. $this->io->writeError('');
  11074. }
  11075. public function remove(PackageInterface $package, $path, $output = true)
  11076. {
  11077. if (Platform::isWindows() && $this->filesystem->isJunction($path)) {
  11078. if ($output) {
  11079. $this->io->writeError(" - Removing junction for <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  11080. }
  11081. if (!$this->filesystem->removeJunction($path)) {
  11082. $this->io->writeError(" <warning>Could not remove junction at " . $path . " - is another process locking it?</warning>");
  11083. throw new \RuntimeException('Could not reliably remove junction for package ' . $package->getName());
  11084. }
  11085. } else {
  11086. parent::remove($package, $path, $output);
  11087. }
  11088. }
  11089. public function getVcsReference(PackageInterface $package, $path)
  11090. {
  11091. $parser = new VersionParser;
  11092. $guesser = new VersionGuesser($this->config, new ProcessExecutor($this->io), $parser);
  11093. $dumper = new ArrayDumper;
  11094. $packageConfig = $dumper->dump($package);
  11095. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  11096. return $packageVersion['commit'];
  11097. }
  11098. }
  11099. }
  11100. <?php
  11101. namespace Composer\Downloader;
  11102. use Composer\Util\Filesystem;
  11103. class PearPackageExtractor
  11104. {
  11105. private static $rolesWithoutPackageNamePrefix = array('php', 'script', 'www');
  11106. private $filesystem;
  11107. private $file;
  11108. public function __construct($file)
  11109. {
  11110. if (!is_file($file)) {
  11111. throw new \UnexpectedValueException('PEAR package file is not found at '.$file);
  11112. }
  11113. $this->filesystem = new Filesystem();
  11114. $this->file = $file;
  11115. }
  11116. public function extractTo($target, array $roles = array('php' => '/', 'script' => '/bin'), $vars = array())
  11117. {
  11118. $extractionPath = $target.'/tarball';
  11119. try {
  11120. $archive = new \PharData($this->file);
  11121. $archive->extractTo($extractionPath, null, true);
  11122. if (!is_file($this->combine($extractionPath, '/package.xml'))) {
  11123. throw new \RuntimeException('Invalid PEAR package. It must contain package.xml file.');
  11124. }
  11125. $fileCopyActions = $this->buildCopyActions($extractionPath, $roles, $vars);
  11126. $this->copyFiles($fileCopyActions, $extractionPath, $target, $roles, $vars);
  11127. $this->filesystem->removeDirectory($extractionPath);
  11128. } catch (\Exception $exception) {
  11129. throw new \UnexpectedValueException(sprintf('Failed to extract PEAR package %s to %s. Reason: %s', $this->file, $target, $exception->getMessage()), 0, $exception);
  11130. }
  11131. }
  11132. private function copyFiles($files, $source, $target, $roles, $vars)
  11133. {
  11134. foreach ($files as $file) {
  11135. $from = $this->combine($source, $file['from']);
  11136. $to = $this->combine($target, $roles[$file['role']]);
  11137. $to = $this->combine($to, $file['to']);
  11138. $tasks = $file['tasks'];
  11139. $this->copyFile($from, $to, $tasks, $vars);
  11140. }
  11141. }
  11142. private function copyFile($from, $to, $tasks, $vars)
  11143. {
  11144. if (!is_file($from)) {
  11145. throw new \RuntimeException('Invalid PEAR package. package.xml defines file that is not located inside tarball.');
  11146. }
  11147. $this->filesystem->ensureDirectoryExists(dirname($to));
  11148. if (0 == count($tasks)) {
  11149. $copied = copy($from, $to);
  11150. } else {
  11151. $content = file_get_contents($from);
  11152. $replacements = array();
  11153. foreach ($tasks as $task) {
  11154. $pattern = $task['from'];
  11155. $varName = $task['to'];
  11156. if (isset($vars[$varName])) {
  11157. if ($varName === 'php_bin' && false === strpos($to, '.bat')) {
  11158. $replacements[$pattern] = preg_replace('{\.bat$}', '', $vars[$varName]);
  11159. } else {
  11160. $replacements[$pattern] = $vars[$varName];
  11161. }
  11162. }
  11163. }
  11164. $content = strtr($content, $replacements);
  11165. $copied = file_put_contents($to, $content);
  11166. }
  11167. if (false === $copied) {
  11168. throw new \RuntimeException(sprintf('Failed to copy %s to %s', $from, $to));
  11169. }
  11170. }
  11171. private function buildCopyActions($source, array $roles, $vars)
  11172. {
  11173. $package = simplexml_load_string(file_get_contents($this->combine($source, 'package.xml')));
  11174. if (false === $package) {
  11175. throw new \RuntimeException('Package definition file is not valid.');
  11176. }
  11177. $packageSchemaVersion = $package['version'];
  11178. if ('1.0' == $packageSchemaVersion) {
  11179. $children = $package->release->filelist->children();
  11180. $packageName = (string) $package->name;
  11181. $packageVersion = (string) $package->release->version;
  11182. $sourceDir = $packageName . '-' . $packageVersion;
  11183. $result = $this->buildSourceList10($children, $roles, $sourceDir, '', null, $packageName);
  11184. } elseif ('2.0' == $packageSchemaVersion || '2.1' == $packageSchemaVersion) {
  11185. $children = $package->contents->children();
  11186. $packageName = (string) $package->name;
  11187. $packageVersion = (string) $package->version->release;
  11188. $sourceDir = $packageName . '-' . $packageVersion;
  11189. $result = $this->buildSourceList20($children, $roles, $sourceDir, '', null, $packageName);
  11190. $namespaces = $package->getNamespaces();
  11191. $package->registerXPathNamespace('ns', $namespaces['']);
  11192. $releaseNodes = $package->xpath('ns:phprelease');
  11193. $this->applyRelease($result, $releaseNodes, $vars);
  11194. } else {
  11195. throw new \RuntimeException('Unsupported schema version of package definition file.');
  11196. }
  11197. return $result;
  11198. }
  11199. private function applyRelease(&$actions, $releaseNodes, $vars)
  11200. {
  11201. foreach ($releaseNodes as $releaseNode) {
  11202. $requiredOs = $releaseNode->installconditions && $releaseNode->installconditions->os && $releaseNode->installconditions->os->name ? (string) $releaseNode->installconditions->os->name : '';
  11203. if ($requiredOs && $vars['os'] != $requiredOs) {
  11204. continue;
  11205. }
  11206. if ($releaseNode->filelist) {
  11207. foreach ($releaseNode->filelist->children() as $action) {
  11208. if ('install' == $action->getName()) {
  11209. $name = (string) $action['name'];
  11210. $as = (string) $action['as'];
  11211. if (isset($actions[$name])) {
  11212. $actions[$name]['to'] = $as;
  11213. }
  11214. } elseif ('ignore' == $action->getName()) {
  11215. $name = (string) $action['name'];
  11216. unset($actions[$name]);
  11217. } else {
  11218. }
  11219. }
  11220. }
  11221. break;
  11222. }
  11223. }
  11224. private function buildSourceList10($children, $targetRoles, $source, $target, $role, $packageName)
  11225. {
  11226. $result = array();
  11227. foreach ($children as $child) {
  11228. if ($child->getName() == 'dir') {
  11229. $dirSource = $this->combine($source, (string) $child['name']);
  11230. $dirTarget = $child['baseinstalldir'] ?: $target;
  11231. $dirRole = $child['role'] ?: $role;
  11232. $dirFiles = $this->buildSourceList10($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  11233. $result = array_merge($result, $dirFiles);
  11234. } elseif ($child->getName() == 'file') {
  11235. $fileRole = (string) $child['role'] ?: $role;
  11236. if (isset($targetRoles[$fileRole])) {
  11237. $fileName = (string) ($child['name'] ?: $child[0]);
  11238. $fileSource = $this->combine($source, $fileName);
  11239. $fileTarget = $this->combine((string) $child['baseinstalldir'] ?: $target, $fileName);
  11240. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  11241. $fileTarget = $packageName . '/' . $fileTarget;
  11242. }
  11243. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => array());
  11244. }
  11245. }
  11246. }
  11247. return $result;
  11248. }
  11249. private function buildSourceList20($children, $targetRoles, $source, $target, $role, $packageName)
  11250. {
  11251. $result = array();
  11252. foreach ($children as $child) {
  11253. if ('dir' == $child->getName()) {
  11254. $dirSource = $this->combine($source, $child['name']);
  11255. $dirTarget = $child['baseinstalldir'] ?: $target;
  11256. $dirRole = $child['role'] ?: $role;
  11257. $dirFiles = $this->buildSourceList20($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  11258. $result = array_merge($result, $dirFiles);
  11259. } elseif ('file' == $child->getName()) {
  11260. $fileRole = (string) $child['role'] ?: $role;
  11261. if (isset($targetRoles[$fileRole])) {
  11262. $fileSource = $this->combine($source, (string) $child['name']);
  11263. $fileTarget = $this->combine((string) ($child['baseinstalldir'] ?: $target), (string) $child['name']);
  11264. $fileTasks = array();
  11265. foreach ($child->children('http://pear.php.net/dtd/tasks-1.0') as $taskNode) {
  11266. if ('replace' == $taskNode->getName()) {
  11267. $fileTasks[] = array('from' => (string) $taskNode->attributes()->from, 'to' => (string) $taskNode->attributes()->to);
  11268. }
  11269. }
  11270. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  11271. $fileTarget = $packageName . '/' . $fileTarget;
  11272. }
  11273. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => $fileTasks);
  11274. }
  11275. }
  11276. }
  11277. return $result;
  11278. }
  11279. private function combine($left, $right)
  11280. {
  11281. return rtrim($left, '/') . '/' . ltrim($right, '/');
  11282. }
  11283. }
  11284. <?php
  11285. namespace Composer\Downloader;
  11286. use Composer\Package\PackageInterface;
  11287. use Composer\Repository\VcsRepository;
  11288. use Composer\Util\Perforce;
  11289. class PerforceDownloader extends VcsDownloader
  11290. {
  11291. protected $perforce;
  11292. public function doDownload(PackageInterface $package, $path, $url)
  11293. {
  11294. $ref = $package->getSourceReference();
  11295. $label = $this->getLabelFromSourceReference($ref);
  11296. $this->io->writeError('Cloning ' . $ref);
  11297. $this->initPerforce($package, $path, $url);
  11298. $this->perforce->setStream($ref);
  11299. $this->perforce->p4Login();
  11300. $this->perforce->writeP4ClientSpec();
  11301. $this->perforce->connectClient();
  11302. $this->perforce->syncCodeBase($label);
  11303. $this->perforce->cleanupClientSpec();
  11304. }
  11305. private function getLabelFromSourceReference($ref)
  11306. {
  11307. $pos = strpos($ref, '@');
  11308. if (false !== $pos) {
  11309. return substr($ref, $pos + 1);
  11310. }
  11311. return null;
  11312. }
  11313. public function initPerforce(PackageInterface $package, $path, $url)
  11314. {
  11315. if (!empty($this->perforce)) {
  11316. $this->perforce->initializePath($path);
  11317. return;
  11318. }
  11319. $repository = $package->getRepository();
  11320. $repoConfig = null;
  11321. if ($repository instanceof VcsRepository) {
  11322. $repoConfig = $this->getRepoConfig($repository);
  11323. }
  11324. $this->perforce = Perforce::create($repoConfig, $url, $path, $this->process, $this->io);
  11325. }
  11326. private function getRepoConfig(VcsRepository $repository)
  11327. {
  11328. return $repository->getRepoConfig();
  11329. }
  11330. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11331. {
  11332. $this->doDownload($target, $path, $url);
  11333. }
  11334. public function getLocalChanges(PackageInterface $package, $path)
  11335. {
  11336. $this->io->writeError('Perforce driver does not check for local changes before overriding', true);
  11337. return;
  11338. }
  11339. protected function getCommitLogs($fromReference, $toReference, $path)
  11340. {
  11341. return $this->perforce->getCommitLogs($fromReference, $toReference);
  11342. }
  11343. public function setPerforce($perforce)
  11344. {
  11345. $this->perforce = $perforce;
  11346. }
  11347. protected function hasMetadataRepository($path)
  11348. {
  11349. return true;
  11350. }
  11351. }
  11352. <?php
  11353. namespace Composer\Downloader;
  11354. class PharDownloader extends ArchiveDownloader
  11355. {
  11356. protected function extract($file, $path)
  11357. {
  11358. $archive = new \Phar($file);
  11359. $archive->extractTo($path, null, true);
  11360. }
  11361. }
  11362. <?php
  11363. namespace Composer\Downloader;
  11364. use Composer\Config;
  11365. use Composer\Cache;
  11366. use Composer\EventDispatcher\EventDispatcher;
  11367. use Composer\Util\IniHelper;
  11368. use Composer\Util\Platform;
  11369. use Composer\Util\ProcessExecutor;
  11370. use Composer\Util\RemoteFilesystem;
  11371. use Composer\IO\IOInterface;
  11372. use RarArchive;
  11373. class RarDownloader extends ArchiveDownloader
  11374. {
  11375. protected $process;
  11376. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  11377. {
  11378. $this->process = $process ?: new ProcessExecutor($io);
  11379. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  11380. }
  11381. protected function extract($file, $path)
  11382. {
  11383. $processError = null;
  11384. if (!Platform::isWindows()) {
  11385. $command = 'unrar x ' . ProcessExecutor::escape($file) . ' ' . ProcessExecutor::escape($path) . ' >/dev/null && chmod -R u+w ' . ProcessExecutor::escape($path);
  11386. if (0 === $this->process->execute($command, $ignoredOutput)) {
  11387. return;
  11388. }
  11389. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  11390. }
  11391. if (!class_exists('RarArchive')) {
  11392. $iniMessage = IniHelper::getMessage();
  11393. $error = "Could not decompress the archive, enable the PHP rar extension or install unrar.\n"
  11394. . $iniMessage . "\n" . $processError;
  11395. if (!Platform::isWindows()) {
  11396. $error = "Could not decompress the archive, enable the PHP rar extension.\n" . $iniMessage;
  11397. }
  11398. throw new \RuntimeException($error);
  11399. }
  11400. $rarArchive = RarArchive::open($file);
  11401. if (false === $rarArchive) {
  11402. throw new \UnexpectedValueException('Could not open RAR archive: ' . $file);
  11403. }
  11404. $entries = $rarArchive->getEntries();
  11405. if (false === $entries) {
  11406. throw new \RuntimeException('Could not retrieve RAR archive entries');
  11407. }
  11408. foreach ($entries as $entry) {
  11409. if (false === $entry->extract($path)) {
  11410. throw new \RuntimeException('Could not extract entry');
  11411. }
  11412. }
  11413. $rarArchive->close();
  11414. }
  11415. }
  11416. <?php
  11417. namespace Composer\Downloader;
  11418. use Composer\Package\PackageInterface;
  11419. use Composer\Util\Svn as SvnUtil;
  11420. use Composer\Repository\VcsRepository;
  11421. use Composer\Util\ProcessExecutor;
  11422. class SvnDownloader extends VcsDownloader
  11423. {
  11424. protected $cacheCredentials = true;
  11425. public function doDownload(PackageInterface $package, $path, $url)
  11426. {
  11427. SvnUtil::cleanEnv();
  11428. $ref = $package->getSourceReference();
  11429. $repo = $package->getRepository();
  11430. if ($repo instanceof VcsRepository) {
  11431. $repoConfig = $repo->getRepoConfig();
  11432. if (array_key_exists('svn-cache-credentials', $repoConfig)) {
  11433. $this->cacheCredentials = (bool) $repoConfig['svn-cache-credentials'];
  11434. }
  11435. }
  11436. $this->io->writeError(" Checking out ".$package->getSourceReference());
  11437. $this->execute($url, "svn co", sprintf("%s/%s", $url, $ref), null, $path);
  11438. }
  11439. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11440. {
  11441. SvnUtil::cleanEnv();
  11442. $ref = $target->getSourceReference();
  11443. if (!$this->hasMetadataRepository($path)) {
  11444. throw new \RuntimeException('The .svn directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  11445. }
  11446. $util = new SvnUtil($url, $this->io, $this->config);
  11447. $flags = "";
  11448. if (version_compare($util->binaryVersion(), '1.7.0', '>=')) {
  11449. $flags .= ' --ignore-ancestry';
  11450. }
  11451. $this->io->writeError(" Checking out " . $ref);
  11452. $this->execute($url, "svn switch" . $flags, sprintf("%s/%s", $url, $ref), $path);
  11453. }
  11454. public function getLocalChanges(PackageInterface $package, $path)
  11455. {
  11456. if (!$this->hasMetadataRepository($path)) {
  11457. return null;
  11458. }
  11459. $this->process->execute('svn status --ignore-externals', $output, $path);
  11460. return preg_match('{^ *[^X ] +}m', $output) ? $output : null;
  11461. }
  11462. protected function execute($baseUrl, $command, $url, $cwd = null, $path = null)
  11463. {
  11464. $util = new SvnUtil($baseUrl, $this->io, $this->config);
  11465. $util->setCacheCredentials($this->cacheCredentials);
  11466. try {
  11467. return $util->execute($command, $url, $cwd, $path, $this->io->isVerbose());
  11468. } catch (\RuntimeException $e) {
  11469. throw new \RuntimeException(
  11470. 'Package could not be downloaded, '.$e->getMessage()
  11471. );
  11472. }
  11473. }
  11474. protected function cleanChanges(PackageInterface $package, $path, $update)
  11475. {
  11476. if (!$changes = $this->getLocalChanges($package, $path)) {
  11477. return;
  11478. }
  11479. if (!$this->io->isInteractive()) {
  11480. if (true === $this->config->get('discard-changes')) {
  11481. return $this->discardChanges($path);
  11482. }
  11483. return parent::cleanChanges($package, $path, $update);
  11484. }
  11485. $changes = array_map(function ($elem) {
  11486. return ' '.$elem;
  11487. }, preg_split('{\s*\r?\n\s*}', $changes));
  11488. $countChanges = count($changes);
  11489. $this->io->writeError(sprintf(' <error>The package has modified file%s:</error>', $countChanges === 1 ? '' : 's'));
  11490. $this->io->writeError(array_slice($changes, 0, 10));
  11491. if ($countChanges > 10) {
  11492. $remaingChanges = $countChanges - 10;
  11493. $this->io->writeError(
  11494. sprintf(
  11495. ' <info>'.$remaingChanges.' more file%s modified, choose "v" to view the full list</info>',
  11496. $remaingChanges === 1 ? '' : 's'
  11497. )
  11498. );
  11499. }
  11500. while (true) {
  11501. switch ($this->io->ask(' <info>Discard changes [y,n,v,?]?</info> ', '?')) {
  11502. case 'y':
  11503. $this->discardChanges($path);
  11504. break 2;
  11505. case 'n':
  11506. throw new \RuntimeException('Update aborted');
  11507. case 'v':
  11508. $this->io->writeError($changes);
  11509. break;
  11510. case '?':
  11511. default:
  11512. $this->io->writeError(array(
  11513. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  11514. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  11515. ' v - view modified files',
  11516. ' ? - print help',
  11517. ));
  11518. break;
  11519. }
  11520. }
  11521. }
  11522. protected function getCommitLogs($fromReference, $toReference, $path)
  11523. {
  11524. if (preg_match('{.*@(\d+)$}', $fromReference) && preg_match('{.*@(\d+)$}', $toReference)) {
  11525. $command = sprintf('svn info --non-interactive --xml %s', ProcessExecutor::escape($path));
  11526. if (0 !== $this->process->execute($command, $output, $path)) {
  11527. throw new \RuntimeException(
  11528. 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()
  11529. );
  11530. }
  11531. $urlPattern = '#<url>(.*)</url>#';
  11532. if (preg_match($urlPattern, $output, $matches)) {
  11533. $baseUrl = $matches[1];
  11534. } else {
  11535. throw new \RuntimeException(
  11536. 'Unable to determine svn url for path '. $path
  11537. );
  11538. }
  11539. $fromRevision = preg_replace('{.*@(\d+)$}', '$1', $fromReference);
  11540. $toRevision = preg_replace('{.*@(\d+)$}', '$1', $toReference);
  11541. $command = sprintf('svn log -r%s:%s --incremental', ProcessExecutor::escape($fromRevision), ProcessExecutor::escape($toRevision));
  11542. $util = new SvnUtil($baseUrl, $this->io, $this->config);
  11543. $util->setCacheCredentials($this->cacheCredentials);
  11544. try {
  11545. return $util->executeLocal($command, $path, null, $this->io->isVerbose());
  11546. } catch (\RuntimeException $e) {
  11547. throw new \RuntimeException(
  11548. 'Failed to execute ' . $command . "\n\n".$e->getMessage()
  11549. );
  11550. }
  11551. }
  11552. return "Could not retrieve changes between $fromReference and $toReference due to missing revision information";
  11553. }
  11554. protected function discardChanges($path)
  11555. {
  11556. if (0 !== $this->process->execute('svn revert -R .', $output, $path)) {
  11557. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  11558. }
  11559. }
  11560. protected function hasMetadataRepository($path)
  11561. {
  11562. return is_dir($path.'/.svn');
  11563. }
  11564. }
  11565. <?php
  11566. namespace Composer\Downloader;
  11567. class TarDownloader extends ArchiveDownloader
  11568. {
  11569. protected function extract($file, $path)
  11570. {
  11571. $archive = new \PharData($file);
  11572. $archive->extractTo($path, null, true);
  11573. }
  11574. }
  11575. <?php
  11576. namespace Composer\Downloader;
  11577. class TransportException extends \RuntimeException
  11578. {
  11579. protected $headers;
  11580. protected $response;
  11581. protected $statusCode;
  11582. public function setHeaders($headers)
  11583. {
  11584. $this->headers = $headers;
  11585. }
  11586. public function getHeaders()
  11587. {
  11588. return $this->headers;
  11589. }
  11590. public function setResponse($response)
  11591. {
  11592. $this->response = $response;
  11593. }
  11594. public function getResponse()
  11595. {
  11596. return $this->response;
  11597. }
  11598. public function setStatusCode($statusCode)
  11599. {
  11600. $this->statusCode = $statusCode;
  11601. }
  11602. public function getStatusCode()
  11603. {
  11604. return $this->statusCode;
  11605. }
  11606. }
  11607. <?php
  11608. namespace Composer\Downloader;
  11609. use Composer\Package\PackageInterface;
  11610. interface VcsCapableDownloaderInterface
  11611. {
  11612. public function getVcsReference(PackageInterface $package, $path);
  11613. }
  11614. <?php
  11615. namespace Composer\Downloader;
  11616. use Composer\Config;
  11617. use Composer\Package\Dumper\ArrayDumper;
  11618. use Composer\Package\PackageInterface;
  11619. use Composer\Package\Version\VersionGuesser;
  11620. use Composer\Package\Version\VersionParser;
  11621. use Composer\Util\ProcessExecutor;
  11622. use Composer\IO\IOInterface;
  11623. use Composer\Util\Filesystem;
  11624. abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterface, VcsCapableDownloaderInterface
  11625. {
  11626. protected $io;
  11627. protected $config;
  11628. protected $process;
  11629. protected $filesystem;
  11630. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  11631. {
  11632. $this->io = $io;
  11633. $this->config = $config;
  11634. $this->process = $process ?: new ProcessExecutor($io);
  11635. $this->filesystem = $fs ?: new Filesystem($this->process);
  11636. }
  11637. public function getInstallationSource()
  11638. {
  11639. return 'source';
  11640. }
  11641. public function download(PackageInterface $package, $path)
  11642. {
  11643. if (!$package->getSourceReference()) {
  11644. throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
  11645. }
  11646. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>): ", false);
  11647. $this->filesystem->emptyDirectory($path);
  11648. $urls = $package->getSourceUrls();
  11649. while ($url = array_shift($urls)) {
  11650. try {
  11651. if (Filesystem::isLocalPath($url)) {
  11652. $needle = 'file://';
  11653. $isFileProtocol = false;
  11654. if (0 === strpos($url, $needle)) {
  11655. $url = substr($url, strlen($needle));
  11656. $isFileProtocol = true;
  11657. }
  11658. if (false !== strpos($url, '%')) {
  11659. $url = rawurldecode($url);
  11660. }
  11661. $url = realpath($url);
  11662. if ($isFileProtocol) {
  11663. $url = $needle . $url;
  11664. }
  11665. }
  11666. $this->doDownload($package, $path, $url);
  11667. break;
  11668. } catch (\Exception $e) {
  11669. if ($e instanceof \PHPUnit_Framework_Exception) {
  11670. throw $e;
  11671. }
  11672. if ($this->io->isDebug()) {
  11673. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getMessage());
  11674. } elseif (count($urls)) {
  11675. $this->io->writeError(' Failed, trying the next URL');
  11676. }
  11677. if (!count($urls)) {
  11678. throw $e;
  11679. }
  11680. }
  11681. }
  11682. }
  11683. public function update(PackageInterface $initial, PackageInterface $target, $path)
  11684. {
  11685. if (!$target->getSourceReference()) {
  11686. throw new \InvalidArgumentException('Package '.$target->getPrettyName().' is missing reference information');
  11687. }
  11688. $name = $target->getName();
  11689. if ($initial->getPrettyVersion() == $target->getPrettyVersion()) {
  11690. if ($target->getSourceType() === 'svn') {
  11691. $from = $initial->getSourceReference();
  11692. $to = $target->getSourceReference();
  11693. } else {
  11694. $from = substr($initial->getSourceReference(), 0, 7);
  11695. $to = substr($target->getSourceReference(), 0, 7);
  11696. }
  11697. $name .= ' '.$initial->getPrettyVersion();
  11698. } else {
  11699. $from = $initial->getFullPrettyVersion();
  11700. $to = $target->getFullPrettyVersion();
  11701. }
  11702. $actionName = VersionParser::isUpgrade($initial->getVersion(), $target->getVersion()) ? 'Updating' : 'Downgrading';
  11703. $this->io->writeError(" - " . $actionName . " <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>): ", false);
  11704. $this->cleanChanges($initial, $path, true);
  11705. $urls = $target->getSourceUrls();
  11706. $exception = null;
  11707. while ($url = array_shift($urls)) {
  11708. try {
  11709. if (Filesystem::isLocalPath($url)) {
  11710. $url = realpath($url);
  11711. }
  11712. $this->doUpdate($initial, $target, $path, $url);
  11713. $exception = null;
  11714. break;
  11715. } catch (\Exception $exception) {
  11716. if ($exception instanceof \PHPUnit_Framework_Exception) {
  11717. throw $exception;
  11718. }
  11719. if ($this->io->isDebug()) {
  11720. $this->io->writeError('Failed: ['.get_class($exception).'] '.$exception->getMessage());
  11721. } elseif (count($urls)) {
  11722. $this->io->writeError(' Failed, trying the next URL');
  11723. }
  11724. }
  11725. }
  11726. $this->reapplyChanges($path);
  11727. if (!$exception && $this->io->isVerbose() && $this->hasMetadataRepository($path)) {
  11728. $message = 'Pulling in changes:';
  11729. $logs = $this->getCommitLogs($initial->getSourceReference(), $target->getSourceReference(), $path);
  11730. if (!trim($logs)) {
  11731. $message = 'Rolling back changes:';
  11732. $logs = $this->getCommitLogs($target->getSourceReference(), $initial->getSourceReference(), $path);
  11733. }
  11734. if (trim($logs)) {
  11735. $logs = implode("\n", array_map(function ($line) {
  11736. return ' ' . $line;
  11737. }, explode("\n", $logs)));
  11738. $logs = str_replace('<', '\<', $logs);
  11739. $this->io->writeError(' '.$message);
  11740. $this->io->writeError($logs);
  11741. }
  11742. }
  11743. if (!$urls && $exception) {
  11744. throw $exception;
  11745. }
  11746. }
  11747. public function remove(PackageInterface $package, $path)
  11748. {
  11749. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getPrettyVersion() . "</comment>)");
  11750. $this->cleanChanges($package, $path, false);
  11751. if (!$this->filesystem->removeDirectory($path)) {
  11752. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  11753. }
  11754. }
  11755. public function setOutputProgress($outputProgress)
  11756. {
  11757. return $this;
  11758. }
  11759. public function getVcsReference(PackageInterface $package, $path)
  11760. {
  11761. $parser = new VersionParser;
  11762. $guesser = new VersionGuesser($this->config, $this->process, $parser);
  11763. $dumper = new ArrayDumper;
  11764. $packageConfig = $dumper->dump($package);
  11765. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  11766. return $packageVersion['commit'];
  11767. }
  11768. }
  11769. protected function cleanChanges(PackageInterface $package, $path, $update)
  11770. {
  11771. if (null !== $this->getLocalChanges($package, $path)) {
  11772. throw new \RuntimeException('Source directory ' . $path . ' has uncommitted changes.');
  11773. }
  11774. }
  11775. protected function reapplyChanges($path)
  11776. {
  11777. }
  11778. abstract protected function doDownload(PackageInterface $package, $path, $url);
  11779. abstract protected function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url);
  11780. abstract protected function getCommitLogs($fromReference, $toReference, $path);
  11781. abstract protected function hasMetadataRepository($path);
  11782. }
  11783. <?php
  11784. namespace Composer\Downloader;
  11785. use Composer\Config;
  11786. use Composer\Cache;
  11787. use Composer\EventDispatcher\EventDispatcher;
  11788. use Composer\Package\PackageInterface;
  11789. use Composer\Util\ProcessExecutor;
  11790. use Composer\Util\RemoteFilesystem;
  11791. use Composer\IO\IOInterface;
  11792. class XzDownloader extends ArchiveDownloader
  11793. {
  11794. protected $process;
  11795. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  11796. {
  11797. $this->process = $process ?: new ProcessExecutor($io);
  11798. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  11799. }
  11800. protected function extract($file, $path)
  11801. {
  11802. $command = 'tar -xJf ' . ProcessExecutor::escape($file) . ' -C ' . ProcessExecutor::escape($path);
  11803. if (0 === $this->process->execute($command, $ignoredOutput)) {
  11804. return;
  11805. }
  11806. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  11807. throw new \RuntimeException($processError);
  11808. }
  11809. protected function getFileName(PackageInterface $package, $path)
  11810. {
  11811. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  11812. }
  11813. }
  11814. <?php
  11815. namespace Composer\Downloader;
  11816. use Composer\Config;
  11817. use Composer\Cache;
  11818. use Composer\EventDispatcher\EventDispatcher;
  11819. use Composer\Package\PackageInterface;
  11820. use Composer\Util\IniHelper;
  11821. use Composer\Util\Platform;
  11822. use Composer\Util\ProcessExecutor;
  11823. use Composer\Util\RemoteFilesystem;
  11824. use Composer\IO\IOInterface;
  11825. use Symfony\Component\Process\ExecutableFinder;
  11826. use ZipArchive;
  11827. class ZipDownloader extends ArchiveDownloader
  11828. {
  11829. protected static $hasSystemUnzip;
  11830. private static $hasZipArchive;
  11831. private static $isWindows;
  11832. protected $process;
  11833. private $zipArchiveObject;
  11834. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  11835. {
  11836. $this->process = $process ?: new ProcessExecutor($io);
  11837. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  11838. }
  11839. public function download(PackageInterface $package, $path, $output = true)
  11840. {
  11841. if (null === self::$hasSystemUnzip) {
  11842. $finder = new ExecutableFinder;
  11843. self::$hasSystemUnzip = (bool) $finder->find('unzip');
  11844. }
  11845. if (null === self::$hasZipArchive) {
  11846. self::$hasZipArchive = class_exists('ZipArchive');
  11847. }
  11848. if (!self::$hasZipArchive && !self::$hasSystemUnzip) {
  11849. $iniMessage = IniHelper::getMessage();
  11850. $error = "The zip extension and unzip command are both missing, skipping.\n" . $iniMessage;
  11851. throw new \RuntimeException($error);
  11852. }
  11853. if (null === self::$isWindows) {
  11854. self::$isWindows = Platform::isWindows();
  11855. if (!self::$isWindows && !self::$hasSystemUnzip) {
  11856. $this->io->writeError("<warning>As there is no 'unzip' command installed zip files are being unpacked using the PHP zip extension.</warning>");
  11857. $this->io->writeError("<warning>This may cause invalid reports of corrupted archives. Besides, any UNIX permissions (e.g. executable) defined in the archives will be lost.</warning>");
  11858. $this->io->writeError("<warning>Installing 'unzip' may remediate them.</warning>");
  11859. }
  11860. }
  11861. return parent::download($package, $path, $output);
  11862. }
  11863. protected function extractWithSystemUnzip($file, $path, $isLastChance)
  11864. {
  11865. if (!self::$hasZipArchive) {
  11866. $isLastChance = true;
  11867. }
  11868. if (!self::$hasSystemUnzip && !$isLastChance) {
  11869. return $this->extractWithZipArchive($file, $path, true);
  11870. }
  11871. $processError = null;
  11872. $overwrite = $isLastChance ? '-o' : '';
  11873. $command = 'unzip -qq '.$overwrite.' '.ProcessExecutor::escape($file).' -d '.ProcessExecutor::escape($path);
  11874. try {
  11875. if (0 === $this->process->execute($command, $ignoredOutput)) {
  11876. return true;
  11877. }
  11878. $processError = new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11879. } catch (\Exception $e) {
  11880. $processError = $e;
  11881. }
  11882. if ($isLastChance) {
  11883. throw $processError;
  11884. }
  11885. $this->io->writeError(' '.$processError->getMessage());
  11886. $this->io->writeError(' The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems)');
  11887. $this->io->writeError(' Unzip with unzip command failed, falling back to ZipArchive class');
  11888. return $this->extractWithZipArchive($file, $path, true);
  11889. }
  11890. protected function extractWithZipArchive($file, $path, $isLastChance)
  11891. {
  11892. if (!self::$hasSystemUnzip) {
  11893. $isLastChance = true;
  11894. }
  11895. if (!self::$hasZipArchive && !$isLastChance) {
  11896. return $this->extractWithSystemUnzip($file, $path, true);
  11897. }
  11898. $processError = null;
  11899. $zipArchive = $this->zipArchiveObject ?: new ZipArchive();
  11900. try {
  11901. if (true === ($retval = $zipArchive->open($file))) {
  11902. $extractResult = $zipArchive->extractTo($path);
  11903. if (true === $extractResult) {
  11904. $zipArchive->close();
  11905. return true;
  11906. }
  11907. $processError = new \RuntimeException(rtrim("There was an error extracting the ZIP file, it is either corrupted or using an invalid format.\n"));
  11908. } else {
  11909. $processError = new \UnexpectedValueException(rtrim($this->getErrorMessage($retval, $file)."\n"), $retval);
  11910. }
  11911. } catch (\ErrorException $e) {
  11912. $processError = new \RuntimeException('The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems): '.$e->getMessage(), 0, $e);
  11913. } catch (\Exception $e) {
  11914. $processError = $e;
  11915. }
  11916. if ($isLastChance) {
  11917. throw $processError;
  11918. }
  11919. $this->io->writeError(' '.$processError->getMessage());
  11920. $this->io->writeError(' Unzip with ZipArchive class failed, falling back to unzip command');
  11921. return $this->extractWithSystemUnzip($file, $path, true);
  11922. }
  11923. public function extract($file, $path)
  11924. {
  11925. if (self::$isWindows) {
  11926. $this->extractWithZipArchive($file, $path, false);
  11927. } else {
  11928. $this->extractWithSystemUnzip($file, $path, false);
  11929. }
  11930. }
  11931. protected function getErrorMessage($retval, $file)
  11932. {
  11933. switch ($retval) {
  11934. case ZipArchive::ER_EXISTS:
  11935. return sprintf("File '%s' already exists.", $file);
  11936. case ZipArchive::ER_INCONS:
  11937. return sprintf("Zip archive '%s' is inconsistent.", $file);
  11938. case ZipArchive::ER_INVAL:
  11939. return sprintf("Invalid argument (%s)", $file);
  11940. case ZipArchive::ER_MEMORY:
  11941. return sprintf("Malloc failure (%s)", $file);
  11942. case ZipArchive::ER_NOENT:
  11943. return sprintf("No such zip file: '%s'", $file);
  11944. case ZipArchive::ER_NOZIP:
  11945. return sprintf("'%s' is not a zip archive.", $file);
  11946. case ZipArchive::ER_OPEN:
  11947. return sprintf("Can't open zip file: %s", $file);
  11948. case ZipArchive::ER_READ:
  11949. return sprintf("Zip read error (%s)", $file);
  11950. case ZipArchive::ER_SEEK:
  11951. return sprintf("Zip seek error (%s)", $file);
  11952. default:
  11953. return sprintf("'%s' is not a valid zip archive, got error code: %s", $file, $retval);
  11954. }
  11955. }
  11956. }
  11957. <?php
  11958. namespace Composer\EventDispatcher;
  11959. class Event
  11960. {
  11961. protected $name;
  11962. protected $args;
  11963. protected $flags;
  11964. private $propagationStopped = false;
  11965. public function __construct($name, array $args = array(), array $flags = array())
  11966. {
  11967. $this->name = $name;
  11968. $this->args = $args;
  11969. $this->flags = $flags;
  11970. }
  11971. public function getName()
  11972. {
  11973. return $this->name;
  11974. }
  11975. public function getArguments()
  11976. {
  11977. return $this->args;
  11978. }
  11979. public function getFlags()
  11980. {
  11981. return $this->flags;
  11982. }
  11983. public function isPropagationStopped()
  11984. {
  11985. return $this->propagationStopped;
  11986. }
  11987. public function stopPropagation()
  11988. {
  11989. $this->propagationStopped = true;
  11990. }
  11991. }
  11992. <?php
  11993. namespace Composer\EventDispatcher;
  11994. use Composer\DependencyResolver\PolicyInterface;
  11995. use Composer\DependencyResolver\Pool;
  11996. use Composer\DependencyResolver\Request;
  11997. use Composer\Installer\InstallerEvent;
  11998. use Composer\IO\IOInterface;
  11999. use Composer\Composer;
  12000. use Composer\DependencyResolver\Operation\OperationInterface;
  12001. use Composer\Repository\CompositeRepository;
  12002. use Composer\Script;
  12003. use Composer\Installer\PackageEvent;
  12004. use Composer\Installer\BinaryInstaller;
  12005. use Composer\Util\ProcessExecutor;
  12006. use Composer\Script\Event as ScriptEvent;
  12007. use Symfony\Component\Process\PhpExecutableFinder;
  12008. class EventDispatcher
  12009. {
  12010. protected $composer;
  12011. protected $io;
  12012. protected $loader;
  12013. protected $process;
  12014. protected $listeners;
  12015. private $eventStack;
  12016. public function __construct(Composer $composer, IOInterface $io, ProcessExecutor $process = null)
  12017. {
  12018. $this->composer = $composer;
  12019. $this->io = $io;
  12020. $this->process = $process ?: new ProcessExecutor($io);
  12021. $this->eventStack = array();
  12022. }
  12023. public function dispatch($eventName, Event $event = null)
  12024. {
  12025. if (null === $event) {
  12026. $event = new Event($eventName);
  12027. }
  12028. return $this->doDispatch($event);
  12029. }
  12030. public function dispatchScript($eventName, $devMode = false, $additionalArgs = array(), $flags = array())
  12031. {
  12032. return $this->doDispatch(new Script\Event($eventName, $this->composer, $this->io, $devMode, $additionalArgs, $flags));
  12033. }
  12034. public function dispatchPackageEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  12035. {
  12036. return $this->doDispatch(new PackageEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations, $operation));
  12037. }
  12038. public function dispatchInstallerEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  12039. {
  12040. return $this->doDispatch(new InstallerEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations));
  12041. }
  12042. protected function doDispatch(Event $event)
  12043. {
  12044. $pathStr = 'PATH';
  12045. if (!isset($_SERVER[$pathStr]) && isset($_SERVER['Path'])) {
  12046. $pathStr = 'Path';
  12047. }
  12048. $binDir = $this->composer->getConfig()->get('bin-dir');
  12049. if (is_dir($binDir)) {
  12050. $binDir = realpath($binDir);
  12051. if (isset($_SERVER[$pathStr]) && !preg_match('{(^|'.PATH_SEPARATOR.')'.preg_quote($binDir).'($|'.PATH_SEPARATOR.')}', $_SERVER[$pathStr])) {
  12052. $_SERVER[$pathStr] = $binDir.PATH_SEPARATOR.getenv($pathStr);
  12053. putenv($pathStr.'='.$_SERVER[$pathStr]);
  12054. }
  12055. }
  12056. $listeners = $this->getListeners($event);
  12057. $this->pushEvent($event);
  12058. $return = 0;
  12059. foreach ($listeners as $callable) {
  12060. if (!is_string($callable)) {
  12061. if (!is_callable($callable)) {
  12062. $className = is_object($callable[0]) ? get_class($callable[0]) : $callable[0];
  12063. throw new \RuntimeException('Subscriber '.$className.'::'.$callable[1].' for event '.$event->getName().' is not callable, make sure the function is defined and public');
  12064. }
  12065. $event = $this->checkListenerExpectedEvent($callable, $event);
  12066. $return = false === call_user_func($callable, $event) ? 1 : 0;
  12067. } elseif ($this->isComposerScript($callable)) {
  12068. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $callable), true, IOInterface::VERBOSE);
  12069. $scriptName = substr($callable, 1);
  12070. $args = $event->getArguments();
  12071. $flags = $event->getFlags();
  12072. if (substr($callable, 0, 10) === '@composer ') {
  12073. $exec = $this->getPhpExecCommand() . ' ' . ProcessExecutor::escape(getenv('COMPOSER_BINARY')) . substr($callable, 9);
  12074. if (0 !== ($exitCode = $this->process->execute($exec))) {
  12075. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  12076. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  12077. }
  12078. } else {
  12079. if (!$this->getListeners(new Event($scriptName))) {
  12080. $this->io->writeError(sprintf('<warning>You made a reference to a non-existent script %s</warning>', $callable), true, IOInterface::QUIET);
  12081. }
  12082. try {
  12083. $return = $this->dispatch($scriptName, new Script\Event($scriptName, $event->getComposer(), $event->getIO(), $event->isDevMode(), $args, $flags));
  12084. } catch (ScriptExecutionException $e) {
  12085. $this->io->writeError(sprintf('<error>Script %s was called via %s</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  12086. throw $e;
  12087. }
  12088. }
  12089. } elseif ($this->isPhpScript($callable)) {
  12090. $className = substr($callable, 0, strpos($callable, '::'));
  12091. $methodName = substr($callable, strpos($callable, '::') + 2);
  12092. if (!class_exists($className)) {
  12093. $this->io->writeError('<warning>Class '.$className.' is not autoloadable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  12094. continue;
  12095. }
  12096. if (!is_callable($callable)) {
  12097. $this->io->writeError('<warning>Method '.$callable.' is not callable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  12098. continue;
  12099. }
  12100. try {
  12101. $return = false === $this->executeEventPhpScript($className, $methodName, $event) ? 1 : 0;
  12102. } catch (\Exception $e) {
  12103. $message = "Script %s handling the %s event terminated with an exception";
  12104. $this->io->writeError('<error>'.sprintf($message, $callable, $event->getName()).'</error>', true, IOInterface::QUIET);
  12105. throw $e;
  12106. }
  12107. } else {
  12108. $args = implode(' ', array_map(array('Composer\Util\ProcessExecutor', 'escape'), $event->getArguments()));
  12109. $exec = $callable . ($args === '' ? '' : ' '.$args);
  12110. if ($this->io->isVerbose()) {
  12111. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $exec));
  12112. } else {
  12113. $this->io->writeError(sprintf('> %s', $exec));
  12114. }
  12115. $possibleLocalBinaries = $this->composer->getPackage()->getBinaries();
  12116. if ($possibleLocalBinaries) {
  12117. foreach ($possibleLocalBinaries as $localExec) {
  12118. if (preg_match('{\b'.preg_quote($callable).'$}', $localExec)) {
  12119. $caller = BinaryInstaller::determineBinaryCaller($localExec);
  12120. $exec = preg_replace('{^'.preg_quote($callable).'}', $caller . ' ' . $localExec, $exec);
  12121. break;
  12122. }
  12123. }
  12124. }
  12125. if (substr($exec, 0, 5) === '@php ') {
  12126. $exec = $this->getPhpExecCommand() . ' ' . substr($exec, 5);
  12127. }
  12128. if (0 !== ($exitCode = $this->process->execute($exec))) {
  12129. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  12130. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  12131. }
  12132. }
  12133. if ($event->isPropagationStopped()) {
  12134. break;
  12135. }
  12136. }
  12137. $this->popEvent();
  12138. return $return;
  12139. }
  12140. protected function getPhpExecCommand()
  12141. {
  12142. $finder = new PhpExecutableFinder();
  12143. $phpPath = $finder->find();
  12144. if (!$phpPath) {
  12145. throw new \RuntimeException('Failed to locate PHP binary to execute '.$scriptName);
  12146. }
  12147. $allowUrlFOpenFlag = ' -d allow_url_fopen=' . ProcessExecutor::escape(ini_get('allow_url_fopen'));
  12148. $disableFunctionsFlag = ' -d disable_functions=' . ProcessExecutor::escape(ini_get('disable_functions'));
  12149. $memoryLimitFlag = ' -d memory_limit=' . ProcessExecutor::escape(ini_get('memory_limit'));
  12150. return ProcessExecutor::escape($phpPath) . $allowUrlFOpenFlag . $disableFunctionsFlag . $memoryLimitFlag;
  12151. }
  12152. protected function executeEventPhpScript($className, $methodName, Event $event)
  12153. {
  12154. $event = $this->checkListenerExpectedEvent(array($className, $methodName), $event);
  12155. if ($this->io->isVerbose()) {
  12156. $this->io->writeError(sprintf('> %s: %s::%s', $event->getName(), $className, $methodName));
  12157. } else {
  12158. $this->io->writeError(sprintf('> %s::%s', $className, $methodName));
  12159. }
  12160. return $className::$methodName($event);
  12161. }
  12162. protected function checkListenerExpectedEvent($target, Event $event)
  12163. {
  12164. if (in_array($event->getName(), array(
  12165. 'init',
  12166. 'command',
  12167. 'pre-file-download',
  12168. ), true)) {
  12169. return $event;
  12170. }
  12171. try {
  12172. $reflected = new \ReflectionParameter($target, 0);
  12173. } catch (\Exception $e) {
  12174. return $event;
  12175. }
  12176. $typehint = $reflected->getClass();
  12177. if (!$typehint instanceof \ReflectionClass) {
  12178. return $event;
  12179. }
  12180. $expected = $typehint->getName();
  12181. if (!$event instanceof $expected && $expected === 'Composer\Script\CommandEvent') {
  12182. trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
  12183. $event = new \Composer\Script\CommandEvent(
  12184. $event->getName(),
  12185. $event->getComposer(),
  12186. $event->getIO(),
  12187. $event->isDevMode(),
  12188. $event->getArguments()
  12189. );
  12190. }
  12191. if (!$event instanceof $expected && $expected === 'Composer\Script\PackageEvent') {
  12192. trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
  12193. $event = new \Composer\Script\PackageEvent(
  12194. $event->getName(),
  12195. $event->getComposer(),
  12196. $event->getIO(),
  12197. $event->isDevMode(),
  12198. $event->getPolicy(),
  12199. $event->getPool(),
  12200. $event->getInstalledRepo(),
  12201. $event->getRequest(),
  12202. $event->getOperations(),
  12203. $event->getOperation()
  12204. );
  12205. }
  12206. if (!$event instanceof $expected && $expected === 'Composer\Script\Event') {
  12207. trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
  12208. $event = new \Composer\Script\Event(
  12209. $event->getName(),
  12210. $event->getComposer(),
  12211. $event->getIO(),
  12212. $event->isDevMode(),
  12213. $event->getArguments(),
  12214. $event->getFlags()
  12215. );
  12216. }
  12217. return $event;
  12218. }
  12219. private function serializeCallback($cb)
  12220. {
  12221. if (is_array($cb) && count($cb) === 2) {
  12222. if (is_object($cb[0])) {
  12223. $cb[0] = get_class($cb[0]);
  12224. }
  12225. if (is_string($cb[0]) && is_string($cb[1])) {
  12226. $cb = implode('::', $cb);
  12227. }
  12228. }
  12229. if (is_string($cb)) {
  12230. return $cb;
  12231. }
  12232. return var_export($cb, true);
  12233. }
  12234. public function addListener($eventName, $listener, $priority = 0)
  12235. {
  12236. $this->listeners[$eventName][$priority][] = $listener;
  12237. }
  12238. public function addSubscriber(EventSubscriberInterface $subscriber)
  12239. {
  12240. foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
  12241. if (is_string($params)) {
  12242. $this->addListener($eventName, array($subscriber, $params));
  12243. } elseif (is_string($params[0])) {
  12244. $this->addListener($eventName, array($subscriber, $params[0]), isset($params[1]) ? $params[1] : 0);
  12245. } else {
  12246. foreach ($params as $listener) {
  12247. $this->addListener($eventName, array($subscriber, $listener[0]), isset($listener[1]) ? $listener[1] : 0);
  12248. }
  12249. }
  12250. }
  12251. }
  12252. protected function getListeners(Event $event)
  12253. {
  12254. $scriptListeners = $this->getScriptListeners($event);
  12255. if (!isset($this->listeners[$event->getName()][0])) {
  12256. $this->listeners[$event->getName()][0] = array();
  12257. }
  12258. krsort($this->listeners[$event->getName()]);
  12259. $listeners = $this->listeners;
  12260. $listeners[$event->getName()][0] = array_merge($listeners[$event->getName()][0], $scriptListeners);
  12261. return call_user_func_array('array_merge', $listeners[$event->getName()]);
  12262. }
  12263. public function hasEventListeners(Event $event)
  12264. {
  12265. $listeners = $this->getListeners($event);
  12266. return count($listeners) > 0;
  12267. }
  12268. protected function getScriptListeners(Event $event)
  12269. {
  12270. $package = $this->composer->getPackage();
  12271. $scripts = $package->getScripts();
  12272. if (empty($scripts[$event->getName()])) {
  12273. return array();
  12274. }
  12275. if ($this->loader) {
  12276. $this->loader->unregister();
  12277. }
  12278. $generator = $this->composer->getAutoloadGenerator();
  12279. if ($event instanceof ScriptEvent) {
  12280. $generator->setDevMode($event->isDevMode());
  12281. }
  12282. $packages = $this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages();
  12283. $packageMap = $generator->buildPackageMap($this->composer->getInstallationManager(), $package, $packages);
  12284. $map = $generator->parseAutoloads($packageMap, $package);
  12285. $this->loader = $generator->createLoader($map);
  12286. $this->loader->register();
  12287. return $scripts[$event->getName()];
  12288. }
  12289. protected function isPhpScript($callable)
  12290. {
  12291. return false === strpos($callable, ' ') && false !== strpos($callable, '::');
  12292. }
  12293. protected function isComposerScript($callable)
  12294. {
  12295. return '@' === substr($callable, 0, 1) && '@php ' !== substr($callable, 0, 5);
  12296. }
  12297. protected function pushEvent(Event $event)
  12298. {
  12299. $eventName = $event->getName();
  12300. if (in_array($eventName, $this->eventStack)) {
  12301. throw new \RuntimeException(sprintf("Circular call to script handler '%s' detected", $eventName));
  12302. }
  12303. return array_push($this->eventStack, $eventName);
  12304. }
  12305. protected function popEvent()
  12306. {
  12307. return array_pop($this->eventStack);
  12308. }
  12309. }
  12310. <?php
  12311. namespace Composer\EventDispatcher;
  12312. interface EventSubscriberInterface
  12313. {
  12314. public static function getSubscribedEvents();
  12315. }
  12316. <?php
  12317. namespace Composer\EventDispatcher;
  12318. class ScriptExecutionException extends \RuntimeException
  12319. {
  12320. }
  12321. <?php
  12322. namespace Composer\Exception;
  12323. class NoSslException extends \RuntimeException
  12324. {
  12325. }
  12326. <?php
  12327. namespace Composer;
  12328. use Composer\Config\JsonConfigSource;
  12329. use Composer\Json\JsonFile;
  12330. use Composer\IO\IOInterface;
  12331. use Composer\Package\Archiver;
  12332. use Composer\Package\Version\VersionGuesser;
  12333. use Composer\Repository\RepositoryManager;
  12334. use Composer\Repository\RepositoryFactory;
  12335. use Composer\Repository\WritableRepositoryInterface;
  12336. use Composer\Util\Filesystem;
  12337. use Composer\Util\Platform;
  12338. use Composer\Util\ProcessExecutor;
  12339. use Composer\Util\RemoteFilesystem;
  12340. use Composer\Util\Silencer;
  12341. use Composer\Plugin\PluginEvents;
  12342. use Composer\EventDispatcher\Event;
  12343. use Seld\JsonLint\DuplicateKeyException;
  12344. use Symfony\Component\Console\Formatter\OutputFormatter;
  12345. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  12346. use Symfony\Component\Console\Output\ConsoleOutput;
  12347. use Composer\EventDispatcher\EventDispatcher;
  12348. use Composer\Autoload\AutoloadGenerator;
  12349. use Composer\Package\Version\VersionParser;
  12350. use Composer\Downloader\TransportException;
  12351. use Seld\JsonLint\JsonParser;
  12352. class Factory
  12353. {
  12354. protected static function getHomeDir()
  12355. {
  12356. $home = getenv('COMPOSER_HOME');
  12357. if ($home) {
  12358. return $home;
  12359. }
  12360. if (Platform::isWindows()) {
  12361. if (!getenv('APPDATA')) {
  12362. throw new \RuntimeException('The APPDATA or COMPOSER_HOME environment variable must be set for composer to run correctly');
  12363. }
  12364. return rtrim(strtr(getenv('APPDATA'), '\\', '/'), '/') . '/Composer';
  12365. }
  12366. $userDir = self::getUserDir();
  12367. if (is_dir($userDir . '/.composer')) {
  12368. return $userDir . '/.composer';
  12369. }
  12370. if (self::useXdg()) {
  12371. $xdgConfig = getenv('XDG_CONFIG_HOME') ?: $userDir . '/.config';
  12372. return $xdgConfig . '/composer';
  12373. }
  12374. return $userDir . '/.composer';
  12375. }
  12376. protected static function getCacheDir($home)
  12377. {
  12378. $cacheDir = getenv('COMPOSER_CACHE_DIR');
  12379. if ($cacheDir) {
  12380. return $cacheDir;
  12381. }
  12382. $homeEnv = getenv('COMPOSER_HOME');
  12383. if ($homeEnv) {
  12384. return $homeEnv . '/cache';
  12385. }
  12386. if (Platform::isWindows()) {
  12387. if ($cacheDir = getenv('LOCALAPPDATA')) {
  12388. $cacheDir .= '/Composer';
  12389. } else {
  12390. $cacheDir = $home . '/cache';
  12391. }
  12392. return rtrim(strtr($cacheDir, '\\', '/'), '/');
  12393. }
  12394. $userDir = self::getUserDir();
  12395. if ($home === $userDir . '/.composer' && is_dir($home . '/cache')) {
  12396. return $home . '/cache';
  12397. }
  12398. if (self::useXdg()) {
  12399. $xdgCache = getenv('XDG_CACHE_HOME') ?: $userDir . '/.cache';
  12400. return $xdgCache . '/composer';
  12401. }
  12402. return $home . '/cache';
  12403. }
  12404. protected static function getDataDir($home)
  12405. {
  12406. $homeEnv = getenv('COMPOSER_HOME');
  12407. if ($homeEnv) {
  12408. return $homeEnv;
  12409. }
  12410. if (Platform::isWindows()) {
  12411. return strtr($home, '\\', '/');
  12412. }
  12413. $userDir = self::getUserDir();
  12414. if ($home !== $userDir . '/.composer' && self::useXdg()) {
  12415. $xdgData = getenv('XDG_DATA_HOME') ?: $userDir . '/.local/share';
  12416. return $xdgData . '/composer';
  12417. }
  12418. return $home;
  12419. }
  12420. public static function createConfig(IOInterface $io = null, $cwd = null)
  12421. {
  12422. $cwd = $cwd ?: getcwd();
  12423. $config = new Config(true, $cwd);
  12424. $home = self::getHomeDir();
  12425. $config->merge(array('config' => array(
  12426. 'home' => $home,
  12427. 'cache-dir' => self::getCacheDir($home),
  12428. 'data-dir' => self::getDataDir($home),
  12429. )));
  12430. $htaccessProtect = (bool) $config->get('htaccess-protect');
  12431. if ($htaccessProtect) {
  12432. $dirs = array($config->get('home'), $config->get('cache-dir'), $config->get('data-dir'));
  12433. foreach ($dirs as $dir) {
  12434. if (!file_exists($dir . '/.htaccess')) {
  12435. if (!is_dir($dir)) {
  12436. Silencer::call('mkdir', $dir, 0777, true);
  12437. }
  12438. Silencer::call('file_put_contents', $dir . '/.htaccess', 'Deny from all');
  12439. }
  12440. }
  12441. }
  12442. $file = new JsonFile($config->get('home').'/config.json');
  12443. if ($file->exists()) {
  12444. if ($io && $io->isDebug()) {
  12445. $io->writeError('Loading config file ' . $file->getPath());
  12446. }
  12447. $config->merge($file->read());
  12448. }
  12449. $config->setConfigSource(new JsonConfigSource($file));
  12450. $file = new JsonFile($config->get('home').'/auth.json');
  12451. if ($file->exists()) {
  12452. if ($io && $io->isDebug()) {
  12453. $io->writeError('Loading config file ' . $file->getPath());
  12454. }
  12455. $config->merge(array('config' => $file->read()));
  12456. }
  12457. $config->setAuthConfigSource(new JsonConfigSource($file, true));
  12458. if ($composerAuthEnv = getenv('COMPOSER_AUTH')) {
  12459. $authData = json_decode($composerAuthEnv, true);
  12460. if (null === $authData) {
  12461. throw new \UnexpectedValueException('COMPOSER_AUTH environment variable is malformed, should be a valid JSON object');
  12462. }
  12463. if ($io && $io->isDebug()) {
  12464. $io->writeError('Loading auth config from COMPOSER_AUTH');
  12465. }
  12466. $config->merge(array('config' => $authData));
  12467. }
  12468. return $config;
  12469. }
  12470. public static function getComposerFile()
  12471. {
  12472. return trim(getenv('COMPOSER')) ?: './composer.json';
  12473. }
  12474. public static function createAdditionalStyles()
  12475. {
  12476. return array(
  12477. 'highlight' => new OutputFormatterStyle('red'),
  12478. 'warning' => new OutputFormatterStyle('black', 'yellow'),
  12479. );
  12480. }
  12481. public static function createOutput()
  12482. {
  12483. $styles = self::createAdditionalStyles();
  12484. $formatter = new OutputFormatter(false, $styles);
  12485. return new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, null, $formatter);
  12486. }
  12487. public static function createDefaultRepositories(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  12488. {
  12489. return RepositoryFactory::defaultRepos($io, $config, $rm);
  12490. }
  12491. public function createComposer(IOInterface $io, $localConfig = null, $disablePlugins = false, $cwd = null, $fullLoad = true)
  12492. {
  12493. $cwd = $cwd ?: getcwd();
  12494. if (null === $localConfig) {
  12495. $localConfig = static::getComposerFile();
  12496. }
  12497. if (is_string($localConfig)) {
  12498. $composerFile = $localConfig;
  12499. $file = new JsonFile($localConfig, null, $io);
  12500. if (!$file->exists()) {
  12501. if ($localConfig === './composer.json' || $localConfig === 'composer.json') {
  12502. $message = 'Composer could not find a composer.json file in '.$cwd;
  12503. } else {
  12504. $message = 'Composer could not find the config file: '.$localConfig;
  12505. }
  12506. $instructions = 'To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section';
  12507. throw new \InvalidArgumentException($message.PHP_EOL.$instructions);
  12508. }
  12509. $file->validateSchema(JsonFile::LAX_SCHEMA);
  12510. $jsonParser = new JsonParser;
  12511. try {
  12512. $jsonParser->parse(file_get_contents($localConfig), JsonParser::DETECT_KEY_CONFLICTS);
  12513. } catch (DuplicateKeyException $e) {
  12514. $details = $e->getDetails();
  12515. $io->writeError('<warning>Key '.$details['key'].' is a duplicate in '.$localConfig.' at line '.$details['line'].'</warning>');
  12516. }
  12517. $localConfig = $file->read();
  12518. }
  12519. $config = static::createConfig($io, $cwd);
  12520. $config->merge($localConfig);
  12521. if (isset($composerFile)) {
  12522. $io->writeError('Loading config file ' . $composerFile, true, IOInterface::DEBUG);
  12523. $config->setConfigSource(new JsonConfigSource(new JsonFile(realpath($composerFile), null, $io)));
  12524. $localAuthFile = new JsonFile(dirname(realpath($composerFile)) . '/auth.json', null, $io);
  12525. if ($localAuthFile->exists()) {
  12526. $io->writeError('Loading config file ' . $localAuthFile->getPath(), true, IOInterface::DEBUG);
  12527. $config->merge(array('config' => $localAuthFile->read()));
  12528. $config->setAuthConfigSource(new JsonConfigSource($localAuthFile, true));
  12529. }
  12530. }
  12531. $vendorDir = $config->get('vendor-dir');
  12532. $composer = new Composer();
  12533. $composer->setConfig($config);
  12534. if ($fullLoad) {
  12535. $io->loadConfiguration($config);
  12536. }
  12537. $rfs = self::createRemoteFilesystem($io, $config);
  12538. $dispatcher = new EventDispatcher($composer, $io);
  12539. $composer->setEventDispatcher($dispatcher);
  12540. $rm = RepositoryFactory::manager($io, $config, $dispatcher, $rfs);
  12541. $composer->setRepositoryManager($rm);
  12542. $this->addLocalRepository($io, $rm, $vendorDir);
  12543. if (!$fullLoad && !isset($localConfig['version'])) {
  12544. $localConfig['version'] = '1.0.0';
  12545. }
  12546. $parser = new VersionParser;
  12547. $guesser = new VersionGuesser($config, new ProcessExecutor($io), $parser);
  12548. $loader = new Package\Loader\RootPackageLoader($rm, $config, $parser, $guesser);
  12549. $package = $loader->load($localConfig, 'Composer\Package\RootPackage', $cwd);
  12550. $composer->setPackage($package);
  12551. $im = $this->createInstallationManager();
  12552. $composer->setInstallationManager($im);
  12553. if ($fullLoad) {
  12554. $dm = $this->createDownloadManager($io, $config, $dispatcher, $rfs);
  12555. $composer->setDownloadManager($dm);
  12556. $generator = new AutoloadGenerator($dispatcher, $io);
  12557. $composer->setAutoloadGenerator($generator);
  12558. $am = $this->createArchiveManager($config, $dm);
  12559. $composer->setArchiveManager($am);
  12560. }
  12561. $this->createDefaultInstallers($im, $composer, $io);
  12562. if ($fullLoad) {
  12563. $globalComposer = null;
  12564. if (realpath($config->get('home')) !== $cwd) {
  12565. $globalComposer = $this->createGlobalComposer($io, $config, $disablePlugins);
  12566. }
  12567. $pm = $this->createPluginManager($io, $composer, $globalComposer, $disablePlugins);
  12568. $composer->setPluginManager($pm);
  12569. $pm->loadInstalledPlugins();
  12570. }
  12571. if ($fullLoad && isset($composerFile)) {
  12572. $lockFile = "json" === pathinfo($composerFile, PATHINFO_EXTENSION)
  12573. ? substr($composerFile, 0, -4).'lock'
  12574. : $composerFile . '.lock';
  12575. $locker = new Package\Locker($io, new JsonFile($lockFile, null, $io), $rm, $im, file_get_contents($composerFile));
  12576. $composer->setLocker($locker);
  12577. }
  12578. if ($fullLoad) {
  12579. $initEvent = new Event(PluginEvents::INIT);
  12580. $composer->getEventDispatcher()->dispatch($initEvent->getName(), $initEvent);
  12581. if ($rm->getLocalRepository()) {
  12582. $this->purgePackages($rm->getLocalRepository(), $im);
  12583. }
  12584. }
  12585. return $composer;
  12586. }
  12587. public static function createGlobal(IOInterface $io, $disablePlugins = false)
  12588. {
  12589. $factory = new static();
  12590. return $factory->createGlobalComposer($io, static::createConfig($io), $disablePlugins, true);
  12591. }
  12592. protected function addLocalRepository(IOInterface $io, RepositoryManager $rm, $vendorDir)
  12593. {
  12594. $rm->setLocalRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/composer/installed.json', null, $io)));
  12595. }
  12596. protected function createGlobalComposer(IOInterface $io, Config $config, $disablePlugins, $fullLoad = false)
  12597. {
  12598. $composer = null;
  12599. try {
  12600. $composer = $this->createComposer($io, $config->get('home') . '/composer.json', $disablePlugins, $config->get('home'), $fullLoad);
  12601. } catch (\Exception $e) {
  12602. $io->writeError('Failed to initialize global composer: '.$e->getMessage(), true, IOInterface::DEBUG);
  12603. }
  12604. return $composer;
  12605. }
  12606. public function createDownloadManager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  12607. {
  12608. $cache = null;
  12609. if ($config->get('cache-files-ttl') > 0) {
  12610. $cache = new Cache($io, $config->get('cache-files-dir'), 'a-z0-9_./');
  12611. }
  12612. $dm = new Downloader\DownloadManager($io);
  12613. switch ($preferred = $config->get('preferred-install')) {
  12614. case 'dist':
  12615. $dm->setPreferDist(true);
  12616. break;
  12617. case 'source':
  12618. $dm->setPreferSource(true);
  12619. break;
  12620. case 'auto':
  12621. default:
  12622. break;
  12623. }
  12624. if (is_array($preferred)) {
  12625. $dm->setPreferences($preferred);
  12626. }
  12627. $executor = new ProcessExecutor($io);
  12628. $fs = new Filesystem($executor);
  12629. $dm->setDownloader('git', new Downloader\GitDownloader($io, $config, $executor, $fs));
  12630. $dm->setDownloader('svn', new Downloader\SvnDownloader($io, $config, $executor, $fs));
  12631. $dm->setDownloader('fossil', new Downloader\FossilDownloader($io, $config, $executor, $fs));
  12632. $dm->setDownloader('hg', new Downloader\HgDownloader($io, $config, $executor, $fs));
  12633. $dm->setDownloader('perforce', new Downloader\PerforceDownloader($io, $config));
  12634. $dm->setDownloader('zip', new Downloader\ZipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12635. $dm->setDownloader('rar', new Downloader\RarDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12636. $dm->setDownloader('tar', new Downloader\TarDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12637. $dm->setDownloader('gzip', new Downloader\GzipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12638. $dm->setDownloader('xz', new Downloader\XzDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12639. $dm->setDownloader('phar', new Downloader\PharDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12640. $dm->setDownloader('file', new Downloader\FileDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12641. $dm->setDownloader('path', new Downloader\PathDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12642. return $dm;
  12643. }
  12644. public function createArchiveManager(Config $config, Downloader\DownloadManager $dm = null)
  12645. {
  12646. if (null === $dm) {
  12647. $io = new IO\NullIO();
  12648. $io->loadConfiguration($config);
  12649. $dm = $this->createDownloadManager($io, $config);
  12650. }
  12651. $am = new Archiver\ArchiveManager($dm);
  12652. $am->addArchiver(new Archiver\ZipArchiver);
  12653. $am->addArchiver(new Archiver\PharArchiver);
  12654. return $am;
  12655. }
  12656. protected function createPluginManager(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  12657. {
  12658. return new Plugin\PluginManager($io, $composer, $globalComposer, $disablePlugins);
  12659. }
  12660. protected function createInstallationManager()
  12661. {
  12662. return new Installer\InstallationManager();
  12663. }
  12664. protected function createDefaultInstallers(Installer\InstallationManager $im, Composer $composer, IOInterface $io)
  12665. {
  12666. $im->addInstaller(new Installer\LibraryInstaller($io, $composer, null));
  12667. $im->addInstaller(new Installer\PearInstaller($io, $composer, 'pear-library'));
  12668. $im->addInstaller(new Installer\PluginInstaller($io, $composer));
  12669. $im->addInstaller(new Installer\MetapackageInstaller());
  12670. }
  12671. protected function purgePackages(WritableRepositoryInterface $repo, Installer\InstallationManager $im)
  12672. {
  12673. foreach ($repo->getPackages() as $package) {
  12674. if (!$im->isPackageInstalled($repo, $package)) {
  12675. $repo->removePackage($package);
  12676. }
  12677. }
  12678. }
  12679. public static function create(IOInterface $io, $config = null, $disablePlugins = false)
  12680. {
  12681. $factory = new static();
  12682. return $factory->createComposer($io, $config, $disablePlugins);
  12683. }
  12684. public static function createRemoteFilesystem(IOInterface $io, Config $config = null, $options = array())
  12685. {
  12686. static $warned = false;
  12687. $disableTls = false;
  12688. if ($config && $config->get('disable-tls') === true) {
  12689. if (!$warned) {
  12690. $io->write('<warning>You are running Composer with SSL/TLS protection disabled.</warning>');
  12691. }
  12692. $warned = true;
  12693. $disableTls = true;
  12694. } elseif (!extension_loaded('openssl')) {
  12695. throw new Exception\NoSslException('The openssl extension is required for SSL/TLS protection but is not available. '
  12696. . 'If you can not enable the openssl extension, you can disable this error, at your own risk, by setting the \'disable-tls\' option to true.');
  12697. }
  12698. $remoteFilesystemOptions = array();
  12699. if ($disableTls === false) {
  12700. if ($config && $config->get('cafile')) {
  12701. $remoteFilesystemOptions['ssl']['cafile'] = $config->get('cafile');
  12702. }
  12703. if ($config && $config->get('capath')) {
  12704. $remoteFilesystemOptions['ssl']['capath'] = $config->get('capath');
  12705. }
  12706. $remoteFilesystemOptions = array_replace_recursive($remoteFilesystemOptions, $options);
  12707. }
  12708. try {
  12709. $remoteFilesystem = new RemoteFilesystem($io, $config, $remoteFilesystemOptions, $disableTls);
  12710. } catch (TransportException $e) {
  12711. if (false !== strpos($e->getMessage(), 'cafile')) {
  12712. $io->write('<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>');
  12713. $io->write('<error>A valid CA certificate file is required for SSL/TLS protection.</error>');
  12714. if (PHP_VERSION_ID < 50600) {
  12715. $io->write('<error>It is recommended you upgrade to PHP 5.6+ which can detect your system CA file automatically.</error>');
  12716. }
  12717. $io->write('<error>You can disable this error, at your own risk, by setting the \'disable-tls\' option to true.</error>');
  12718. }
  12719. throw $e;
  12720. }
  12721. return $remoteFilesystem;
  12722. }
  12723. private static function useXdg()
  12724. {
  12725. foreach (array_keys($_SERVER) as $key) {
  12726. if (substr($key, 0, 4) === 'XDG_') {
  12727. return true;
  12728. }
  12729. }
  12730. return false;
  12731. }
  12732. private static function getUserDir()
  12733. {
  12734. $home = getenv('HOME');
  12735. if (!$home) {
  12736. throw new \RuntimeException('The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly');
  12737. }
  12738. return rtrim(strtr($home, '\\', '/'), '/');
  12739. }
  12740. }
  12741. <?php
  12742. namespace Composer\IO;
  12743. use Composer\Config;
  12744. use Composer\Util\ProcessExecutor;
  12745. use Psr\Log\LoggerInterface;
  12746. use Psr\Log\LogLevel;
  12747. abstract class BaseIO implements IOInterface, LoggerInterface
  12748. {
  12749. protected $authentications = array();
  12750. public function getAuthentications()
  12751. {
  12752. return $this->authentications;
  12753. }
  12754. public function hasAuthentication($repositoryName)
  12755. {
  12756. return isset($this->authentications[$repositoryName]);
  12757. }
  12758. public function getAuthentication($repositoryName)
  12759. {
  12760. if (isset($this->authentications[$repositoryName])) {
  12761. return $this->authentications[$repositoryName];
  12762. }
  12763. return array('username' => null, 'password' => null);
  12764. }
  12765. public function setAuthentication($repositoryName, $username, $password = null)
  12766. {
  12767. $this->authentications[$repositoryName] = array('username' => $username, 'password' => $password);
  12768. }
  12769. protected function checkAndSetAuthentication($repositoryName, $username, $password = null)
  12770. {
  12771. if ($this->hasAuthentication($repositoryName)) {
  12772. $auth = $this->getAuthentication($repositoryName);
  12773. if ($auth['username'] === $username && $auth['password'] === $password) {
  12774. return;
  12775. }
  12776. $this->writeError(
  12777. sprintf(
  12778. "<warning>Warning: You should avoid overwriting already defined auth settings for %s.</warning>",
  12779. $repositoryName
  12780. )
  12781. );
  12782. }
  12783. $this->setAuthentication($repositoryName, $username, $password);
  12784. }
  12785. public function loadConfiguration(Config $config)
  12786. {
  12787. $bitbucketOauth = $config->get('bitbucket-oauth') ?: array();
  12788. $githubOauth = $config->get('github-oauth') ?: array();
  12789. $gitlabOauth = $config->get('gitlab-oauth') ?: array();
  12790. $gitlabToken = $config->get('gitlab-token') ?: array();
  12791. $httpBasic = $config->get('http-basic') ?: array();
  12792. foreach ($bitbucketOauth as $domain => $cred) {
  12793. $this->checkAndSetAuthentication($domain, $cred['consumer-key'], $cred['consumer-secret']);
  12794. }
  12795. foreach ($githubOauth as $domain => $token) {
  12796. if (!preg_match('{^[.a-z0-9]+$}', $token)) {
  12797. throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"');
  12798. }
  12799. $this->checkAndSetAuthentication($domain, $token, 'x-oauth-basic');
  12800. }
  12801. foreach ($gitlabOauth as $domain => $token) {
  12802. $this->checkAndSetAuthentication($domain, $token, 'oauth2');
  12803. }
  12804. foreach ($gitlabToken as $domain => $token) {
  12805. $this->checkAndSetAuthentication($domain, $token, 'private-token');
  12806. }
  12807. foreach ($httpBasic as $domain => $cred) {
  12808. $this->checkAndSetAuthentication($domain, $cred['username'], $cred['password']);
  12809. }
  12810. ProcessExecutor::setTimeout((int) $config->get('process-timeout'));
  12811. }
  12812. public function emergency($message, array $context = array())
  12813. {
  12814. return $this->log(LogLevel::EMERGENCY, $message, $context);
  12815. }
  12816. public function alert($message, array $context = array())
  12817. {
  12818. return $this->log(LogLevel::ALERT, $message, $context);
  12819. }
  12820. public function critical($message, array $context = array())
  12821. {
  12822. return $this->log(LogLevel::CRITICAL, $message, $context);
  12823. }
  12824. public function error($message, array $context = array())
  12825. {
  12826. return $this->log(LogLevel::ERROR, $message, $context);
  12827. }
  12828. public function warning($message, array $context = array())
  12829. {
  12830. return $this->log(LogLevel::WARNING, $message, $context);
  12831. }
  12832. public function notice($message, array $context = array())
  12833. {
  12834. return $this->log(LogLevel::NOTICE, $message, $context);
  12835. }
  12836. public function info($message, array $context = array())
  12837. {
  12838. return $this->log(LogLevel::INFO, $message, $context);
  12839. }
  12840. public function debug($message, array $context = array())
  12841. {
  12842. return $this->log(LogLevel::DEBUG, $message, $context);
  12843. }
  12844. public function log($level, $message, array $context = array())
  12845. {
  12846. if (in_array($level, array(LogLevel::EMERGENCY, LogLevel::ALERT, LogLevel::CRITICAL, LogLevel::ERROR))) {
  12847. $this->writeError('<error>'.$message.'</error>', true, self::NORMAL);
  12848. } elseif ($level === LogLevel::WARNING) {
  12849. $this->writeError('<warning>'.$message.'</warning>', true, self::NORMAL);
  12850. } elseif ($level === LogLevel::NOTICE) {
  12851. $this->writeError('<info>'.$message.'</info>', true, self::VERBOSE);
  12852. } elseif ($level === LogLevel::INFO) {
  12853. $this->writeError('<info>'.$message.'</info>', true, self::VERY_VERBOSE);
  12854. } else {
  12855. $this->writeError($message, true, self::DEBUG);
  12856. }
  12857. }
  12858. }
  12859. <?php
  12860. namespace Composer\IO;
  12861. use Symfony\Component\Console\Output\StreamOutput;
  12862. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  12863. use Symfony\Component\Console\Input\StringInput;
  12864. use Symfony\Component\Console\Helper\HelperSet;
  12865. class BufferIO extends ConsoleIO
  12866. {
  12867. public function __construct($input = '', $verbosity = StreamOutput::VERBOSITY_NORMAL, OutputFormatterInterface $formatter = null)
  12868. {
  12869. $input = new StringInput($input);
  12870. $input->setInteractive(false);
  12871. $output = new StreamOutput(fopen('php://memory', 'rw'), $verbosity, $formatter ? $formatter->isDecorated() : false, $formatter);
  12872. parent::__construct($input, $output, new HelperSet(array()));
  12873. }
  12874. public function getOutput()
  12875. {
  12876. fseek($this->output->getStream(), 0);
  12877. $output = stream_get_contents($this->output->getStream());
  12878. $output = preg_replace_callback("{(?<=^|\n|\x08)(.+?)(\x08+)}", function ($matches) {
  12879. $pre = strip_tags($matches[1]);
  12880. if (strlen($pre) === strlen($matches[2])) {
  12881. return '';
  12882. }
  12883. return rtrim($matches[1])."\n";
  12884. }, $output);
  12885. return $output;
  12886. }
  12887. }
  12888. <?php
  12889. namespace Composer\IO;
  12890. use Composer\Question\StrictConfirmationQuestion;
  12891. use Symfony\Component\Console\Helper\HelperSet;
  12892. use Symfony\Component\Console\Input\InputInterface;
  12893. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  12894. use Symfony\Component\Console\Output\OutputInterface;
  12895. use Symfony\Component\Console\Question\ChoiceQuestion;
  12896. use Symfony\Component\Console\Question\Question;
  12897. class ConsoleIO extends BaseIO
  12898. {
  12899. protected $input;
  12900. protected $output;
  12901. protected $helperSet;
  12902. protected $lastMessage;
  12903. protected $lastMessageErr;
  12904. private $startTime;
  12905. private $verbosityMap;
  12906. public function __construct(InputInterface $input, OutputInterface $output, HelperSet $helperSet)
  12907. {
  12908. $this->input = $input;
  12909. $this->output = $output;
  12910. $this->helperSet = $helperSet;
  12911. $this->verbosityMap = array(
  12912. self::QUIET => OutputInterface::VERBOSITY_QUIET,
  12913. self::NORMAL => OutputInterface::VERBOSITY_NORMAL,
  12914. self::VERBOSE => OutputInterface::VERBOSITY_VERBOSE,
  12915. self::VERY_VERBOSE => OutputInterface::VERBOSITY_VERY_VERBOSE,
  12916. self::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  12917. );
  12918. }
  12919. public function enableDebugging($startTime)
  12920. {
  12921. $this->startTime = $startTime;
  12922. }
  12923. public function isInteractive()
  12924. {
  12925. return $this->input->isInteractive();
  12926. }
  12927. public function isDecorated()
  12928. {
  12929. return $this->output->isDecorated();
  12930. }
  12931. public function isVerbose()
  12932. {
  12933. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE;
  12934. }
  12935. public function isVeryVerbose()
  12936. {
  12937. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE;
  12938. }
  12939. public function isDebug()
  12940. {
  12941. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG;
  12942. }
  12943. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  12944. {
  12945. $this->doWrite($messages, $newline, false, $verbosity);
  12946. }
  12947. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  12948. {
  12949. $this->doWrite($messages, $newline, true, $verbosity);
  12950. }
  12951. private function doWrite($messages, $newline, $stderr, $verbosity)
  12952. {
  12953. $sfVerbosity = $this->verbosityMap[$verbosity];
  12954. if ($sfVerbosity > $this->output->getVerbosity()) {
  12955. return;
  12956. }
  12957. if (OutputInterface::VERBOSITY_QUIET === 0) {
  12958. $sfVerbosity = OutputInterface::OUTPUT_NORMAL;
  12959. }
  12960. if (null !== $this->startTime) {
  12961. $memoryUsage = memory_get_usage() / 1024 / 1024;
  12962. $timeSpent = microtime(true) - $this->startTime;
  12963. $messages = array_map(function ($message) use ($memoryUsage, $timeSpent) {
  12964. return sprintf('[%.1fMB/%.2fs] %s', $memoryUsage, $timeSpent, $message);
  12965. }, (array) $messages);
  12966. }
  12967. if (true === $stderr && $this->output instanceof ConsoleOutputInterface) {
  12968. $this->output->getErrorOutput()->write($messages, $newline, $sfVerbosity);
  12969. $this->lastMessageErr = implode($newline ? "\n" : '', (array) $messages);
  12970. return;
  12971. }
  12972. $this->output->write($messages, $newline, $sfVerbosity);
  12973. $this->lastMessage = implode($newline ? "\n" : '', (array) $messages);
  12974. }
  12975. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  12976. {
  12977. $this->doOverwrite($messages, $newline, $size, false, $verbosity);
  12978. }
  12979. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  12980. {
  12981. $this->doOverwrite($messages, $newline, $size, true, $verbosity);
  12982. }
  12983. private function doOverwrite($messages, $newline, $size, $stderr, $verbosity)
  12984. {
  12985. $messages = implode($newline ? "\n" : '', (array) $messages);
  12986. if (!isset($size)) {
  12987. $size = strlen(strip_tags($stderr ? $this->lastMessageErr : $this->lastMessage));
  12988. }
  12989. $this->doWrite(str_repeat("\x08", $size), false, $stderr, $verbosity);
  12990. $this->doWrite($messages, false, $stderr, $verbosity);
  12991. $fill = $size - strlen(strip_tags($messages));
  12992. if ($fill > 0) {
  12993. $this->doWrite(str_repeat(' ', $fill), false, $stderr, $verbosity);
  12994. $this->doWrite(str_repeat("\x08", $fill), false, $stderr, $verbosity);
  12995. }
  12996. if ($newline) {
  12997. $this->doWrite('', true, $stderr, $verbosity);
  12998. }
  12999. if ($stderr) {
  13000. $this->lastMessageErr = $messages;
  13001. } else {
  13002. $this->lastMessage = $messages;
  13003. }
  13004. }
  13005. public function ask($question, $default = null)
  13006. {
  13007. $helper = $this->helperSet->get('question');
  13008. $question = new Question($question, $default);
  13009. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  13010. }
  13011. public function askConfirmation($question, $default = true)
  13012. {
  13013. $helper = $this->helperSet->get('question');
  13014. $question = new StrictConfirmationQuestion($question, $default);
  13015. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  13016. }
  13017. public function askAndValidate($question, $validator, $attempts = null, $default = null)
  13018. {
  13019. $helper = $this->helperSet->get('question');
  13020. $question = new Question($question, $default);
  13021. $question->setValidator($validator);
  13022. $question->setMaxAttempts($attempts);
  13023. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  13024. }
  13025. public function askAndHideAnswer($question)
  13026. {
  13027. $helper = $this->helperSet->get('question');
  13028. $question = new Question($question);
  13029. $question->setHidden(true);
  13030. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  13031. }
  13032. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  13033. {
  13034. $helper = $this->helperSet->get('question');
  13035. $question = new ChoiceQuestion($question, $choices, $default);
  13036. $question->setMaxAttempts($attempts ?: null);
  13037. $question->setErrorMessage($errorMessage);
  13038. $question->setMultiselect($multiselect);
  13039. $result = $helper->ask($this->input, $this->getErrorOutput(), $question);
  13040. if (!is_array($result)) {
  13041. return (string) array_search($result, $choices, true);
  13042. }
  13043. $results = array();
  13044. foreach ($choices as $index => $choice) {
  13045. if (in_array($choice, $result, true)) {
  13046. $results[] = (string) $index;
  13047. }
  13048. }
  13049. return $results;
  13050. }
  13051. private function getErrorOutput()
  13052. {
  13053. if ($this->output instanceof ConsoleOutputInterface) {
  13054. return $this->output->getErrorOutput();
  13055. }
  13056. return $this->output;
  13057. }
  13058. }
  13059. <?php
  13060. namespace Composer\IO;
  13061. use Composer\Config;
  13062. interface IOInterface
  13063. {
  13064. const QUIET = 1;
  13065. const NORMAL = 2;
  13066. const VERBOSE = 4;
  13067. const VERY_VERBOSE = 8;
  13068. const DEBUG = 16;
  13069. public function isInteractive();
  13070. public function isVerbose();
  13071. public function isVeryVerbose();
  13072. public function isDebug();
  13073. public function isDecorated();
  13074. public function write($messages, $newline = true, $verbosity = self::NORMAL);
  13075. public function writeError($messages, $newline = true, $verbosity = self::NORMAL);
  13076. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  13077. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  13078. public function ask($question, $default = null);
  13079. public function askConfirmation($question, $default = true);
  13080. public function askAndValidate($question, $validator, $attempts = null, $default = null);
  13081. public function askAndHideAnswer($question);
  13082. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false);
  13083. public function getAuthentications();
  13084. public function hasAuthentication($repositoryName);
  13085. public function getAuthentication($repositoryName);
  13086. public function setAuthentication($repositoryName, $username, $password = null);
  13087. public function loadConfiguration(Config $config);
  13088. }
  13089. <?php
  13090. namespace Composer\IO;
  13091. class NullIO extends BaseIO
  13092. {
  13093. public function isInteractive()
  13094. {
  13095. return false;
  13096. }
  13097. public function isVerbose()
  13098. {
  13099. return false;
  13100. }
  13101. public function isVeryVerbose()
  13102. {
  13103. return false;
  13104. }
  13105. public function isDebug()
  13106. {
  13107. return false;
  13108. }
  13109. public function isDecorated()
  13110. {
  13111. return false;
  13112. }
  13113. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  13114. {
  13115. }
  13116. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  13117. {
  13118. }
  13119. public function overwrite($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  13120. {
  13121. }
  13122. public function overwriteError($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  13123. {
  13124. }
  13125. public function ask($question, $default = null)
  13126. {
  13127. return $default;
  13128. }
  13129. public function askConfirmation($question, $default = true)
  13130. {
  13131. return $default;
  13132. }
  13133. public function askAndValidate($question, $validator, $attempts = false, $default = null)
  13134. {
  13135. return $default;
  13136. }
  13137. public function askAndHideAnswer($question)
  13138. {
  13139. return null;
  13140. }
  13141. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  13142. {
  13143. return $default;
  13144. }
  13145. }
  13146. <?php
  13147. namespace Composer;
  13148. use Composer\Autoload\AutoloadGenerator;
  13149. use Composer\DependencyResolver\DefaultPolicy;
  13150. use Composer\DependencyResolver\Operation\UpdateOperation;
  13151. use Composer\DependencyResolver\Operation\InstallOperation;
  13152. use Composer\DependencyResolver\Operation\UninstallOperation;
  13153. use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
  13154. use Composer\DependencyResolver\Operation\OperationInterface;
  13155. use Composer\DependencyResolver\PolicyInterface;
  13156. use Composer\DependencyResolver\Pool;
  13157. use Composer\DependencyResolver\Request;
  13158. use Composer\DependencyResolver\Rule;
  13159. use Composer\DependencyResolver\Solver;
  13160. use Composer\DependencyResolver\SolverProblemsException;
  13161. use Composer\Downloader\DownloadManager;
  13162. use Composer\EventDispatcher\EventDispatcher;
  13163. use Composer\Installer\InstallationManager;
  13164. use Composer\Installer\InstallerEvents;
  13165. use Composer\Installer\NoopInstaller;
  13166. use Composer\Installer\SuggestedPackagesReporter;
  13167. use Composer\IO\IOInterface;
  13168. use Composer\Package\AliasPackage;
  13169. use Composer\Package\CompletePackage;
  13170. use Composer\Package\Link;
  13171. use Composer\Package\Loader\ArrayLoader;
  13172. use Composer\Package\Dumper\ArrayDumper;
  13173. use Composer\Semver\Constraint\Constraint;
  13174. use Composer\Package\Locker;
  13175. use Composer\Package\PackageInterface;
  13176. use Composer\Package\RootPackageInterface;
  13177. use Composer\Repository\CompositeRepository;
  13178. use Composer\Repository\InstalledArrayRepository;
  13179. use Composer\Repository\PlatformRepository;
  13180. use Composer\Repository\RepositoryInterface;
  13181. use Composer\Repository\RepositoryManager;
  13182. use Composer\Repository\WritableRepositoryInterface;
  13183. use Composer\Script\ScriptEvents;
  13184. class Installer
  13185. {
  13186. protected $io;
  13187. protected $config;
  13188. protected $package;
  13189. protected $downloadManager;
  13190. protected $repositoryManager;
  13191. protected $locker;
  13192. protected $installationManager;
  13193. protected $eventDispatcher;
  13194. protected $autoloadGenerator;
  13195. protected $preferSource = false;
  13196. protected $preferDist = false;
  13197. protected $optimizeAutoloader = false;
  13198. protected $classMapAuthoritative = false;
  13199. protected $apcuAutoloader = false;
  13200. protected $devMode = false;
  13201. protected $dryRun = false;
  13202. protected $verbose = false;
  13203. protected $update = false;
  13204. protected $dumpAutoloader = true;
  13205. protected $runScripts = true;
  13206. protected $ignorePlatformReqs = false;
  13207. protected $preferStable = false;
  13208. protected $preferLowest = false;
  13209. protected $skipSuggest = false;
  13210. protected $writeLock = true;
  13211. protected $executeOperations = true;
  13212. protected $updateWhitelist = null;
  13213. protected $whitelistDependencies = false;
  13214. protected $whitelistAllDependencies = false;
  13215. protected $suggestedPackagesReporter;
  13216. protected $additionalInstalledRepository;
  13217. public function __construct(IOInterface $io, Config $config, RootPackageInterface $package, DownloadManager $downloadManager, RepositoryManager $repositoryManager, Locker $locker, InstallationManager $installationManager, EventDispatcher $eventDispatcher, AutoloadGenerator $autoloadGenerator)
  13218. {
  13219. $this->io = $io;
  13220. $this->config = $config;
  13221. $this->package = $package;
  13222. $this->downloadManager = $downloadManager;
  13223. $this->repositoryManager = $repositoryManager;
  13224. $this->locker = $locker;
  13225. $this->installationManager = $installationManager;
  13226. $this->eventDispatcher = $eventDispatcher;
  13227. $this->autoloadGenerator = $autoloadGenerator;
  13228. }
  13229. public function run()
  13230. {
  13231. gc_collect_cycles();
  13232. gc_disable();
  13233. if (!$this->update && !$this->locker->isLocked()) {
  13234. $this->update = true;
  13235. }
  13236. if ($this->dryRun) {
  13237. $this->verbose = true;
  13238. $this->runScripts = false;
  13239. $this->executeOperations = false;
  13240. $this->writeLock = false;
  13241. $this->dumpAutoloader = false;
  13242. $this->installationManager->addInstaller(new NoopInstaller);
  13243. $this->mockLocalRepositories($this->repositoryManager);
  13244. }
  13245. if ($this->runScripts) {
  13246. $devMode = (int) $this->devMode;
  13247. putenv("COMPOSER_DEV_MODE=$devMode");
  13248. $eventName = $this->update ? ScriptEvents::PRE_UPDATE_CMD : ScriptEvents::PRE_INSTALL_CMD;
  13249. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  13250. }
  13251. $this->downloadManager->setPreferSource($this->preferSource);
  13252. $this->downloadManager->setPreferDist($this->preferDist);
  13253. $localRepo = $this->repositoryManager->getLocalRepository();
  13254. if ($this->update) {
  13255. $platformOverrides = $this->config->get('platform') ?: array();
  13256. } else {
  13257. $platformOverrides = $this->locker->getPlatformOverrides();
  13258. }
  13259. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  13260. $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
  13261. $aliases = $this->getRootAliases();
  13262. $this->aliasPlatformPackages($platformRepo, $aliases);
  13263. if (!$this->suggestedPackagesReporter) {
  13264. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($this->io);
  13265. }
  13266. try {
  13267. list($res, $devPackages) = $this->doInstall($localRepo, $installedRepo, $platformRepo, $aliases);
  13268. if ($res !== 0) {
  13269. return $res;
  13270. }
  13271. } catch (\Exception $e) {
  13272. if ($this->executeOperations) {
  13273. $this->installationManager->notifyInstalls($this->io);
  13274. }
  13275. throw $e;
  13276. }
  13277. if ($this->executeOperations) {
  13278. $this->installationManager->notifyInstalls($this->io);
  13279. }
  13280. if ($this->devMode && !$this->skipSuggest) {
  13281. $this->suggestedPackagesReporter->output($installedRepo);
  13282. }
  13283. foreach ($localRepo->getPackages() as $package) {
  13284. if (!$package instanceof CompletePackage || !$package->isAbandoned()) {
  13285. continue;
  13286. }
  13287. $replacement = is_string($package->getReplacementPackage())
  13288. ? 'Use ' . $package->getReplacementPackage() . ' instead'
  13289. : 'No replacement was suggested';
  13290. $this->io->writeError(
  13291. sprintf(
  13292. "<warning>Package %s is abandoned, you should avoid using it. %s.</warning>",
  13293. $package->getPrettyName(),
  13294. $replacement
  13295. )
  13296. );
  13297. }
  13298. if ($this->update && $this->writeLock) {
  13299. $localRepo->reload();
  13300. $platformReqs = $this->extractPlatformRequirements($this->package->getRequires());
  13301. $platformDevReqs = $this->extractPlatformRequirements($this->package->getDevRequires());
  13302. $updatedLock = $this->locker->setLockData(
  13303. array_diff($localRepo->getCanonicalPackages(), $devPackages),
  13304. $devPackages,
  13305. $platformReqs,
  13306. $platformDevReqs,
  13307. $aliases,
  13308. $this->package->getMinimumStability(),
  13309. $this->package->getStabilityFlags(),
  13310. $this->preferStable || $this->package->getPreferStable(),
  13311. $this->preferLowest,
  13312. $this->config->get('platform') ?: array()
  13313. );
  13314. if ($updatedLock) {
  13315. $this->io->writeError('<info>Writing lock file</info>');
  13316. }
  13317. }
  13318. if ($this->dumpAutoloader) {
  13319. if ($this->optimizeAutoloader) {
  13320. $this->io->writeError('<info>Generating optimized autoload files</info>');
  13321. } else {
  13322. $this->io->writeError('<info>Generating autoload files</info>');
  13323. }
  13324. $this->autoloadGenerator->setDevMode($this->devMode);
  13325. $this->autoloadGenerator->setClassMapAuthoritative($this->classMapAuthoritative);
  13326. $this->autoloadGenerator->setApcu($this->apcuAutoloader);
  13327. $this->autoloadGenerator->setRunScripts($this->runScripts);
  13328. $this->autoloadGenerator->dump($this->config, $localRepo, $this->package, $this->installationManager, 'composer', $this->optimizeAutoloader);
  13329. }
  13330. if ($this->executeOperations) {
  13331. foreach ($localRepo->getPackages() as $package) {
  13332. $this->installationManager->ensureBinariesPresence($package);
  13333. }
  13334. $vendorDir = $this->config->get('vendor-dir');
  13335. if (is_dir($vendorDir)) {
  13336. @touch($vendorDir);
  13337. }
  13338. }
  13339. if ($this->runScripts) {
  13340. $eventName = $this->update ? ScriptEvents::POST_UPDATE_CMD : ScriptEvents::POST_INSTALL_CMD;
  13341. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  13342. }
  13343. if (!defined('HHVM_VERSION')) {
  13344. gc_enable();
  13345. }
  13346. return 0;
  13347. }
  13348. protected function doInstall($localRepo, $installedRepo, $platformRepo, $aliases)
  13349. {
  13350. $lockedRepository = null;
  13351. $repositories = null;
  13352. if (!$this->update || (!empty($this->updateWhitelist) && $this->locker->isLocked())) {
  13353. try {
  13354. $lockedRepository = $this->locker->getLockedRepository($this->devMode);
  13355. } catch (\RuntimeException $e) {
  13356. if ($this->package->getDevRequires()) {
  13357. throw $e;
  13358. }
  13359. $lockedRepository = $this->locker->getLockedRepository();
  13360. }
  13361. }
  13362. $this->whitelistUpdateDependencies(
  13363. $lockedRepository ?: $localRepo,
  13364. $this->package->getRequires(),
  13365. $this->package->getDevRequires()
  13366. );
  13367. $this->io->writeError('<info>Loading composer repositories with package information</info>');
  13368. $policy = $this->createPolicy();
  13369. $pool = $this->createPool($this->update ? null : $lockedRepository);
  13370. $pool->addRepository($installedRepo, $aliases);
  13371. if ($this->update) {
  13372. $repositories = $this->repositoryManager->getRepositories();
  13373. foreach ($repositories as $repository) {
  13374. $pool->addRepository($repository, $aliases);
  13375. }
  13376. }
  13377. if ($lockedRepository) {
  13378. $pool->addRepository($lockedRepository, $aliases);
  13379. }
  13380. $request = $this->createRequest($this->package, $platformRepo);
  13381. if ($this->update) {
  13382. $removedUnstablePackages = array();
  13383. foreach ($localRepo->getPackages() as $package) {
  13384. if (
  13385. !$pool->isPackageAcceptable($package->getNames(), $package->getStability())
  13386. && $this->installationManager->isPackageInstalled($localRepo, $package)
  13387. ) {
  13388. $removedUnstablePackages[$package->getName()] = true;
  13389. $request->remove($package->getName(), new Constraint('=', $package->getVersion()));
  13390. }
  13391. }
  13392. $this->io->writeError('<info>Updating dependencies'.($this->devMode ? ' (including require-dev)' : '').'</info>');
  13393. $request->updateAll();
  13394. $links = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  13395. foreach ($links as $link) {
  13396. $request->install($link->getTarget(), $link->getConstraint());
  13397. }
  13398. if ($this->updateWhitelist) {
  13399. $currentPackages = $this->getCurrentPackages($installedRepo);
  13400. $candidates = array();
  13401. foreach ($links as $link) {
  13402. $candidates[$link->getTarget()] = true;
  13403. $rootRequires[$link->getTarget()] = $link;
  13404. }
  13405. foreach ($currentPackages as $package) {
  13406. $candidates[$package->getName()] = true;
  13407. }
  13408. foreach ($candidates as $candidate => $dummy) {
  13409. foreach ($currentPackages as $curPackage) {
  13410. if ($curPackage->getName() === $candidate) {
  13411. if (!$this->isUpdateable($curPackage) && !isset($removedUnstablePackages[$curPackage->getName()])) {
  13412. $constraint = new Constraint('=', $curPackage->getVersion());
  13413. $description = $this->locker->isLocked() ? '(locked at' : '(installed at';
  13414. $requiredAt = isset($rootRequires[$candidate]) ? ', required as ' . $rootRequires[$candidate]->getPrettyConstraint() : '';
  13415. $constraint->setPrettyString($description . ' ' . $curPackage->getPrettyVersion() . $requiredAt . ')');
  13416. $request->install($curPackage->getName(), $constraint);
  13417. }
  13418. break;
  13419. }
  13420. }
  13421. }
  13422. }
  13423. } else {
  13424. $this->io->writeError('<info>Installing dependencies'.($this->devMode ? ' (including require-dev)' : '').' from lock file</info>');
  13425. if (!$this->locker->isFresh()) {
  13426. $this->io->writeError('<warning>Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.</warning>', true, IOInterface::QUIET);
  13427. }
  13428. foreach ($lockedRepository->getPackages() as $package) {
  13429. $version = $package->getVersion();
  13430. if (isset($aliases[$package->getName()][$version])) {
  13431. $version = $aliases[$package->getName()][$version]['alias_normalized'];
  13432. }
  13433. $constraint = new Constraint('=', $version);
  13434. $constraint->setPrettyString($package->getPrettyVersion());
  13435. $request->install($package->getName(), $constraint);
  13436. }
  13437. foreach ($this->locker->getPlatformRequirements($this->devMode) as $link) {
  13438. $request->install($link->getTarget(), $link->getConstraint());
  13439. }
  13440. }
  13441. $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, 'force-links');
  13442. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request);
  13443. $solver = new Solver($policy, $pool, $installedRepo, $this->io);
  13444. try {
  13445. $operations = $solver->solve($request, $this->ignorePlatformReqs);
  13446. } catch (SolverProblemsException $e) {
  13447. $this->io->writeError('<error>Your requirements could not be resolved to an installable set of packages.</error>', true, IOInterface::QUIET);
  13448. $this->io->writeError($e->getMessage());
  13449. if ($this->update && !$this->devMode) {
  13450. $this->io->writeError('<warning>Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.</warning>', true, IOInterface::QUIET);
  13451. }
  13452. return array(max(1, $e->getCode()), array());
  13453. }
  13454. $operations = $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, 'force-updates', $operations);
  13455. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request, $operations);
  13456. $this->io->writeError("Analyzed ".count($pool)." packages to resolve dependencies", true, IOInterface::VERBOSE);
  13457. $this->io->writeError("Analyzed ".$solver->getRuleSetSize()." rules to resolve dependencies", true, IOInterface::VERBOSE);
  13458. if (!$operations) {
  13459. $this->io->writeError('Nothing to install or update');
  13460. }
  13461. $operations = $this->movePluginsToFront($operations);
  13462. $operations = $this->moveUninstallsToFront($operations);
  13463. if ($this->update) {
  13464. $devPackages = $this->extractDevPackages($operations, $localRepo, $platformRepo, $aliases);
  13465. if (!$this->devMode) {
  13466. $operations = $this->filterDevPackageOperations($devPackages, $operations, $localRepo);
  13467. }
  13468. } else {
  13469. $devPackages = null;
  13470. }
  13471. if ($operations) {
  13472. $installs = $updates = $uninstalls = array();
  13473. foreach ($operations as $operation) {
  13474. if ($operation instanceof InstallOperation) {
  13475. $installs[] = $operation->getPackage()->getPrettyName().':'.$operation->getPackage()->getFullPrettyVersion();
  13476. } elseif ($operation instanceof UpdateOperation) {
  13477. $updates[] = $operation->getTargetPackage()->getPrettyName().':'.$operation->getTargetPackage()->getFullPrettyVersion();
  13478. } elseif ($operation instanceof UninstallOperation) {
  13479. $uninstalls[] = $operation->getPackage()->getPrettyName();
  13480. }
  13481. }
  13482. $this->io->writeError(sprintf(
  13483. "<info>Package operations: %d install%s, %d update%s, %d removal%s</info>",
  13484. count($installs),
  13485. 1 === count($installs) ? '' : 's',
  13486. count($updates),
  13487. 1 === count($updates) ? '' : 's',
  13488. count($uninstalls),
  13489. 1 === count($uninstalls) ? '' : 's'
  13490. ));
  13491. if ($installs) {
  13492. $this->io->writeError("Installs: ".implode(', ', $installs), true, IOInterface::VERBOSE);
  13493. }
  13494. if ($updates) {
  13495. $this->io->writeError("Updates: ".implode(', ', $updates), true, IOInterface::VERBOSE);
  13496. }
  13497. if ($uninstalls) {
  13498. $this->io->writeError("Removals: ".implode(', ', $uninstalls), true, IOInterface::VERBOSE);
  13499. }
  13500. }
  13501. foreach ($operations as $operation) {
  13502. $jobType = $operation->getJobType();
  13503. if ('install' === $jobType) {
  13504. $this->suggestedPackagesReporter->addSuggestionsFromPackage($operation->getPackage());
  13505. }
  13506. if ($this->update) {
  13507. $package = null;
  13508. if ('update' === $jobType) {
  13509. $package = $operation->getTargetPackage();
  13510. } elseif ('install' === $jobType) {
  13511. $package = $operation->getPackage();
  13512. }
  13513. if ($package && $package->isDev()) {
  13514. $references = $this->package->getReferences();
  13515. if (isset($references[$package->getName()])) {
  13516. $this->updateInstallReferences($package, $references[$package->getName()]);
  13517. }
  13518. }
  13519. if ('update' === $jobType) {
  13520. $targetPackage = $operation->getTargetPackage();
  13521. if ($targetPackage->isDev()) {
  13522. $initialPackage = $operation->getInitialPackage();
  13523. if ($targetPackage->getVersion() === $initialPackage->getVersion()
  13524. && (!$targetPackage->getSourceReference() || $targetPackage->getSourceReference() === $initialPackage->getSourceReference())
  13525. && (!$targetPackage->getDistReference() || $targetPackage->getDistReference() === $initialPackage->getDistReference())
  13526. ) {
  13527. $this->io->writeError(' - Skipping update of ' . $targetPackage->getPrettyName() . ' to the same reference-locked version', true, IOInterface::DEBUG);
  13528. $this->io->writeError('', true, IOInterface::DEBUG);
  13529. continue;
  13530. }
  13531. }
  13532. }
  13533. }
  13534. $event = 'Composer\Installer\PackageEvents::PRE_PACKAGE_'.strtoupper($jobType);
  13535. if (defined($event) && $this->runScripts) {
  13536. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  13537. }
  13538. if (!$this->executeOperations && false === strpos($operation->getJobType(), 'Alias')) {
  13539. $this->io->writeError(' - ' . $operation);
  13540. } elseif ($this->io->isDebug() && false !== strpos($operation->getJobType(), 'Alias')) {
  13541. $this->io->writeError(' - ' . $operation);
  13542. }
  13543. $this->installationManager->execute($localRepo, $operation);
  13544. if ($this->verbose && $this->io->isVeryVerbose() && in_array($jobType, array('install', 'update'))) {
  13545. $reason = $operation->getReason();
  13546. if ($reason instanceof Rule) {
  13547. switch ($reason->getReason()) {
  13548. case Rule::RULE_JOB_INSTALL:
  13549. $this->io->writeError(' REASON: Required by the root package: '.$reason->getPrettyString($pool));
  13550. $this->io->writeError('');
  13551. break;
  13552. case Rule::RULE_PACKAGE_REQUIRES:
  13553. $this->io->writeError(' REASON: '.$reason->getPrettyString($pool));
  13554. $this->io->writeError('');
  13555. break;
  13556. }
  13557. }
  13558. }
  13559. $event = 'Composer\Installer\PackageEvents::POST_PACKAGE_'.strtoupper($jobType);
  13560. if (defined($event) && $this->runScripts) {
  13561. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  13562. }
  13563. if ($this->executeOperations || $this->writeLock) {
  13564. $localRepo->write();
  13565. }
  13566. }
  13567. if ($this->executeOperations) {
  13568. $this->processPackageUrls($pool, $policy, $localRepo, $repositories);
  13569. $localRepo->write();
  13570. }
  13571. return array(0, $devPackages);
  13572. }
  13573. private function extractDevPackages(array $operations, RepositoryInterface $localRepo, PlatformRepository $platformRepo, array $aliases)
  13574. {
  13575. if (!$this->package->getDevRequires()) {
  13576. return array();
  13577. }
  13578. $tempLocalRepo = clone $localRepo;
  13579. foreach ($operations as $operation) {
  13580. switch ($operation->getJobType()) {
  13581. case 'install':
  13582. case 'markAliasInstalled':
  13583. if (!$tempLocalRepo->hasPackage($operation->getPackage())) {
  13584. $tempLocalRepo->addPackage(clone $operation->getPackage());
  13585. }
  13586. break;
  13587. case 'uninstall':
  13588. case 'markAliasUninstalled':
  13589. $tempLocalRepo->removePackage($operation->getPackage());
  13590. break;
  13591. case 'update':
  13592. $tempLocalRepo->removePackage($operation->getInitialPackage());
  13593. if (!$tempLocalRepo->hasPackage($operation->getTargetPackage())) {
  13594. $tempLocalRepo->addPackage(clone $operation->getTargetPackage());
  13595. }
  13596. break;
  13597. default:
  13598. throw new \LogicException('Unknown type: '.$operation->getJobType());
  13599. }
  13600. }
  13601. $localRepo = new InstalledArrayRepository(array());
  13602. $loader = new ArrayLoader(null, true);
  13603. $dumper = new ArrayDumper();
  13604. foreach ($tempLocalRepo->getCanonicalPackages() as $pkg) {
  13605. $localRepo->addPackage($loader->load($dumper->dump($pkg)));
  13606. }
  13607. unset($tempLocalRepo, $loader, $dumper);
  13608. $policy = $this->createPolicy();
  13609. $pool = $this->createPool();
  13610. $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
  13611. $pool->addRepository($installedRepo, $aliases);
  13612. $request = $this->createRequest($this->package, $platformRepo);
  13613. $request->updateAll();
  13614. foreach ($this->package->getRequires() as $link) {
  13615. $request->install($link->getTarget(), $link->getConstraint());
  13616. }
  13617. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request);
  13618. $solver = new Solver($policy, $pool, $installedRepo, $this->io);
  13619. $ops = $solver->solve($request, $this->ignorePlatformReqs);
  13620. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request, $ops);
  13621. $devPackages = array();
  13622. foreach ($ops as $op) {
  13623. if ($op->getJobType() === 'uninstall') {
  13624. $devPackages[] = $op->getPackage();
  13625. }
  13626. }
  13627. return $devPackages;
  13628. }
  13629. private function filterDevPackageOperations(array $devPackages, array $operations, RepositoryInterface $localRepo)
  13630. {
  13631. $finalOps = array();
  13632. $packagesToSkip = array();
  13633. foreach ($devPackages as $pkg) {
  13634. $packagesToSkip[$pkg->getName()] = true;
  13635. if ($installedDevPkg = $localRepo->findPackage($pkg->getName(), '*')) {
  13636. if ($installedDevPkg instanceof AliasPackage) {
  13637. $finalOps[] = new MarkAliasUninstalledOperation($installedDevPkg, 'non-dev install removing it');
  13638. $installedDevPkg = $installedDevPkg->getAliasOf();
  13639. }
  13640. $finalOps[] = new UninstallOperation($installedDevPkg, 'non-dev install removing it');
  13641. }
  13642. }
  13643. foreach ($operations as $op) {
  13644. $package = $op->getJobType() === 'update' ? $op->getTargetPackage() : $op->getPackage();
  13645. if (isset($packagesToSkip[$package->getName()])) {
  13646. continue;
  13647. }
  13648. $finalOps[] = $op;
  13649. }
  13650. return $finalOps;
  13651. }
  13652. private function movePluginsToFront(array $operations)
  13653. {
  13654. $pluginsNoDeps = array();
  13655. $pluginsWithDeps = array();
  13656. $pluginRequires = array();
  13657. foreach (array_reverse($operations, true) as $idx => $op) {
  13658. if ($op instanceof InstallOperation) {
  13659. $package = $op->getPackage();
  13660. } elseif ($op instanceof UpdateOperation) {
  13661. $package = $op->getTargetPackage();
  13662. } else {
  13663. continue;
  13664. }
  13665. $isPlugin = $package->getType() === 'composer-plugin' || $package->getType() === 'composer-installer';
  13666. if ($isPlugin || count(array_intersect($package->getNames(), $pluginRequires))) {
  13667. $requires = array_filter(array_keys($package->getRequires()), function ($req) {
  13668. return $req !== 'composer-plugin-api' && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req);
  13669. });
  13670. if ($isPlugin && !count($requires)) {
  13671. array_unshift($pluginsNoDeps, $op);
  13672. } else {
  13673. $pluginRequires = array_merge($pluginRequires, $requires);
  13674. array_unshift($pluginsWithDeps, $op);
  13675. }
  13676. unset($operations[$idx]);
  13677. }
  13678. }
  13679. return array_merge($pluginsNoDeps, $pluginsWithDeps, $operations);
  13680. }
  13681. private function moveUninstallsToFront(array $operations)
  13682. {
  13683. $uninstOps = array();
  13684. foreach ($operations as $idx => $op) {
  13685. if ($op instanceof UninstallOperation) {
  13686. $uninstOps[] = $op;
  13687. unset($operations[$idx]);
  13688. }
  13689. }
  13690. return array_merge($uninstOps, $operations);
  13691. }
  13692. private function createInstalledRepo(RepositoryInterface $localRepo, PlatformRepository $platformRepo)
  13693. {
  13694. $installedRootPackage = clone $this->package;
  13695. $installedRootPackage->setRequires(array());
  13696. $installedRootPackage->setDevRequires(array());
  13697. $repos = array(
  13698. $localRepo,
  13699. new InstalledArrayRepository(array($installedRootPackage)),
  13700. $platformRepo,
  13701. );
  13702. $installedRepo = new CompositeRepository($repos);
  13703. if ($this->additionalInstalledRepository) {
  13704. $installedRepo->addRepository($this->additionalInstalledRepository);
  13705. }
  13706. return $installedRepo;
  13707. }
  13708. private function createPool(RepositoryInterface $lockedRepository = null)
  13709. {
  13710. if ($this->update) {
  13711. $minimumStability = $this->package->getMinimumStability();
  13712. $stabilityFlags = $this->package->getStabilityFlags();
  13713. $requires = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  13714. } else {
  13715. $minimumStability = $this->locker->getMinimumStability();
  13716. $stabilityFlags = $this->locker->getStabilityFlags();
  13717. $requires = array();
  13718. foreach ($lockedRepository->getPackages() as $package) {
  13719. $constraint = new Constraint('=', $package->getVersion());
  13720. $constraint->setPrettyString($package->getPrettyVersion());
  13721. $requires[$package->getName()] = $constraint;
  13722. }
  13723. }
  13724. $rootConstraints = array();
  13725. foreach ($requires as $req => $constraint) {
  13726. if ($this->ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req)) {
  13727. continue;
  13728. }
  13729. if ($constraint instanceof Link) {
  13730. $rootConstraints[$req] = $constraint->getConstraint();
  13731. } else {
  13732. $rootConstraints[$req] = $constraint;
  13733. }
  13734. }
  13735. return new Pool($minimumStability, $stabilityFlags, $rootConstraints);
  13736. }
  13737. private function createPolicy()
  13738. {
  13739. $preferStable = null;
  13740. $preferLowest = null;
  13741. if (!$this->update) {
  13742. $preferStable = $this->locker->getPreferStable();
  13743. $preferLowest = $this->locker->getPreferLowest();
  13744. }
  13745. if (null === $preferStable) {
  13746. $preferStable = $this->preferStable || $this->package->getPreferStable();
  13747. }
  13748. if (null === $preferLowest) {
  13749. $preferLowest = $this->preferLowest;
  13750. }
  13751. return new DefaultPolicy($preferStable, $preferLowest);
  13752. }
  13753. private function createRequest(RootPackageInterface $rootPackage, PlatformRepository $platformRepo)
  13754. {
  13755. $request = new Request();
  13756. $constraint = new Constraint('=', $rootPackage->getVersion());
  13757. $constraint->setPrettyString($rootPackage->getPrettyVersion());
  13758. $request->install($rootPackage->getName(), $constraint);
  13759. $fixedPackages = $platformRepo->getPackages();
  13760. if ($this->additionalInstalledRepository) {
  13761. $additionalFixedPackages = $this->additionalInstalledRepository->getPackages();
  13762. $fixedPackages = array_merge($fixedPackages, $additionalFixedPackages);
  13763. }
  13764. $provided = $rootPackage->getProvides();
  13765. foreach ($fixedPackages as $package) {
  13766. $constraint = new Constraint('=', $package->getVersion());
  13767. $constraint->setPrettyString($package->getPrettyVersion());
  13768. if ($package->getRepository() !== $platformRepo
  13769. || !isset($provided[$package->getName()])
  13770. || !$provided[$package->getName()]->getConstraint()->matches($constraint)
  13771. ) {
  13772. $request->fix($package->getName(), $constraint);
  13773. }
  13774. }
  13775. return $request;
  13776. }
  13777. private function processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, $task, array $operations = null)
  13778. {
  13779. if ($task === 'force-updates' && null === $operations) {
  13780. throw new \InvalidArgumentException('Missing operations argument');
  13781. }
  13782. if ($task === 'force-links') {
  13783. $operations = array();
  13784. }
  13785. if ($this->update && $this->updateWhitelist) {
  13786. $currentPackages = $this->getCurrentPackages($installedRepo);
  13787. }
  13788. foreach ($localRepo->getCanonicalPackages() as $package) {
  13789. if (!$package->isDev()) {
  13790. continue;
  13791. }
  13792. foreach ($operations as $operation) {
  13793. if (('update' === $operation->getJobType() && $operation->getInitialPackage()->equals($package))
  13794. || ('uninstall' === $operation->getJobType() && $operation->getPackage()->equals($package))
  13795. ) {
  13796. continue 2;
  13797. }
  13798. }
  13799. if ($this->update) {
  13800. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  13801. foreach ($currentPackages as $curPackage) {
  13802. if ($curPackage->isDev() && $curPackage->getName() === $package->getName() && $curPackage->getVersion() === $package->getVersion()) {
  13803. if ($task === 'force-links') {
  13804. $package->setRequires($curPackage->getRequires());
  13805. $package->setConflicts($curPackage->getConflicts());
  13806. $package->setProvides($curPackage->getProvides());
  13807. $package->setReplaces($curPackage->getReplaces());
  13808. } elseif ($task === 'force-updates') {
  13809. if (($curPackage->getSourceReference() && $curPackage->getSourceReference() !== $package->getSourceReference())
  13810. || ($curPackage->getDistReference() && $curPackage->getDistReference() !== $package->getDistReference())
  13811. ) {
  13812. $operations[] = new UpdateOperation($package, $curPackage);
  13813. }
  13814. }
  13815. break;
  13816. }
  13817. }
  13818. continue;
  13819. }
  13820. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  13821. foreach ($matches as $index => $match) {
  13822. if (!in_array($match->getRepository(), $repositories, true)) {
  13823. unset($matches[$index]);
  13824. continue;
  13825. }
  13826. if ($match->getName() !== $package->getName()) {
  13827. unset($matches[$index]);
  13828. continue;
  13829. }
  13830. $matches[$index] = $match->getId();
  13831. }
  13832. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  13833. $newPackage = $pool->literalToPackage($matches[0]);
  13834. if ($task === 'force-links' && $newPackage) {
  13835. $package->setRequires($newPackage->getRequires());
  13836. $package->setConflicts($newPackage->getConflicts());
  13837. $package->setProvides($newPackage->getProvides());
  13838. $package->setReplaces($newPackage->getReplaces());
  13839. }
  13840. if (
  13841. $task === 'force-updates'
  13842. && $newPackage
  13843. && (
  13844. ($newPackage->getSourceReference() && $newPackage->getSourceReference() !== $package->getSourceReference())
  13845. || ($newPackage->getDistReference() && $newPackage->getDistReference() !== $package->getDistReference())
  13846. )
  13847. ) {
  13848. $operations[] = new UpdateOperation($package, $newPackage);
  13849. continue;
  13850. }
  13851. }
  13852. if ($task === 'force-updates') {
  13853. $references = $this->package->getReferences();
  13854. if (isset($references[$package->getName()]) && $references[$package->getName()] !== $package->getSourceReference()) {
  13855. $operations[] = new UpdateOperation($package, clone $package);
  13856. }
  13857. }
  13858. } else {
  13859. foreach ($lockedRepository->findPackages($package->getName()) as $lockedPackage) {
  13860. if ($lockedPackage->isDev() && $lockedPackage->getVersion() === $package->getVersion()) {
  13861. if ($task === 'force-links') {
  13862. $package->setRequires($lockedPackage->getRequires());
  13863. $package->setConflicts($lockedPackage->getConflicts());
  13864. $package->setProvides($lockedPackage->getProvides());
  13865. $package->setReplaces($lockedPackage->getReplaces());
  13866. } elseif ($task === 'force-updates') {
  13867. if (($lockedPackage->getSourceReference() && $lockedPackage->getSourceReference() !== $package->getSourceReference())
  13868. || ($lockedPackage->getDistReference() && $lockedPackage->getDistReference() !== $package->getDistReference())
  13869. ) {
  13870. $operations[] = new UpdateOperation($package, $lockedPackage);
  13871. }
  13872. }
  13873. break;
  13874. }
  13875. }
  13876. }
  13877. }
  13878. return $operations;
  13879. }
  13880. private function getCurrentPackages($installedRepo)
  13881. {
  13882. if ($this->locker->isLocked()) {
  13883. try {
  13884. return $this->locker->getLockedRepository(true)->getPackages();
  13885. } catch (\RuntimeException $e) {
  13886. return $this->locker->getLockedRepository()->getPackages();
  13887. }
  13888. }
  13889. return $installedRepo->getPackages();
  13890. }
  13891. private function getRootAliases()
  13892. {
  13893. if ($this->update) {
  13894. $aliases = $this->package->getAliases();
  13895. } else {
  13896. $aliases = $this->locker->getAliases();
  13897. }
  13898. $normalizedAliases = array();
  13899. foreach ($aliases as $alias) {
  13900. $normalizedAliases[$alias['package']][$alias['version']] = array(
  13901. 'alias' => $alias['alias'],
  13902. 'alias_normalized' => $alias['alias_normalized'],
  13903. );
  13904. }
  13905. return $normalizedAliases;
  13906. }
  13907. private function processPackageUrls($pool, $policy, $localRepo, $repositories)
  13908. {
  13909. if (!$this->update) {
  13910. return;
  13911. }
  13912. $rootRefs = $this->package->getReferences();
  13913. foreach ($localRepo->getCanonicalPackages() as $package) {
  13914. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  13915. foreach ($matches as $index => $match) {
  13916. if (!in_array($match->getRepository(), $repositories, true)) {
  13917. unset($matches[$index]);
  13918. continue;
  13919. }
  13920. if ($match->getName() !== $package->getName()) {
  13921. unset($matches[$index]);
  13922. continue;
  13923. }
  13924. $matches[$index] = $match->getId();
  13925. }
  13926. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  13927. $newPackage = $pool->literalToPackage($matches[0]);
  13928. $sourceUrl = $package->getSourceUrl();
  13929. $newSourceUrl = $newPackage->getSourceUrl();
  13930. $newReference = $newPackage->getSourceReference();
  13931. if ($package->isDev() && isset($rootRefs[$package->getName()]) && $package->getSourceReference() === $rootRefs[$package->getName()]) {
  13932. $newReference = $rootRefs[$package->getName()];
  13933. }
  13934. $this->updatePackageUrl($package, $newSourceUrl, $newPackage->getSourceType(), $newReference, $newPackage->getDistUrl());
  13935. if ($package instanceof CompletePackage && $newPackage instanceof CompletePackage) {
  13936. $package->setAbandoned($newPackage->getReplacementPackage() ?: $newPackage->isAbandoned());
  13937. }
  13938. $package->setDistMirrors($newPackage->getDistMirrors());
  13939. $package->setSourceMirrors($newPackage->getSourceMirrors());
  13940. }
  13941. }
  13942. }
  13943. private function updatePackageUrl(PackageInterface $package, $sourceUrl, $sourceType, $sourceReference, $distUrl)
  13944. {
  13945. $oldSourceRef = $package->getSourceReference();
  13946. if ($package->getSourceUrl() !== $sourceUrl) {
  13947. $package->setSourceType($sourceType);
  13948. $package->setSourceUrl($sourceUrl);
  13949. $package->setSourceReference($sourceReference);
  13950. }
  13951. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com|(?:www\.)?gitlab\.com)/}i', $distUrl)) {
  13952. $package->setDistUrl($distUrl);
  13953. $this->updateInstallReferences($package, $sourceReference);
  13954. }
  13955. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  13956. $this->updateInstallReferences($package, $oldSourceRef);
  13957. }
  13958. }
  13959. private function updateInstallReferences(PackageInterface $package, $reference)
  13960. {
  13961. if (!$reference) {
  13962. return;
  13963. }
  13964. $package->setSourceReference($reference);
  13965. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com|(?:www\.)?gitlab\.com)/}i', $package->getDistUrl())) {
  13966. $package->setDistReference($reference);
  13967. $package->setDistUrl(preg_replace('{(?<=/|sha=)[a-f0-9]{40}(?=/|$)}i', $reference, $package->getDistUrl()));
  13968. } elseif ($package->getDistReference()) {
  13969. $package->setDistReference($reference);
  13970. }
  13971. }
  13972. private function aliasPlatformPackages(PlatformRepository $platformRepo, $aliases)
  13973. {
  13974. foreach ($aliases as $package => $versions) {
  13975. foreach ($versions as $version => $alias) {
  13976. $packages = $platformRepo->findPackages($package, $version);
  13977. foreach ($packages as $package) {
  13978. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  13979. $aliasPackage->setRootPackageAlias(true);
  13980. $platformRepo->addPackage($aliasPackage);
  13981. }
  13982. }
  13983. }
  13984. }
  13985. private function isUpdateable(PackageInterface $package)
  13986. {
  13987. if (!$this->updateWhitelist) {
  13988. throw new \LogicException('isUpdateable should only be called when a whitelist is present');
  13989. }
  13990. foreach ($this->updateWhitelist as $whiteListedPattern => $void) {
  13991. $patternRegexp = $this->packageNameToRegexp($whiteListedPattern);
  13992. if (preg_match($patternRegexp, $package->getName())) {
  13993. return true;
  13994. }
  13995. }
  13996. return false;
  13997. }
  13998. private function packageNameToRegexp($whiteListedPattern)
  13999. {
  14000. $cleanedWhiteListedPattern = str_replace('\\*', '.*', preg_quote($whiteListedPattern));
  14001. return "{^" . $cleanedWhiteListedPattern . "$}i";
  14002. }
  14003. private function extractPlatformRequirements($links)
  14004. {
  14005. $platformReqs = array();
  14006. foreach ($links as $link) {
  14007. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  14008. $platformReqs[$link->getTarget()] = $link->getPrettyConstraint();
  14009. }
  14010. }
  14011. return $platformReqs;
  14012. }
  14013. private function whitelistUpdateDependencies($localOrLockRepo, array $rootRequires, array $rootDevRequires)
  14014. {
  14015. if (!$this->updateWhitelist) {
  14016. return;
  14017. }
  14018. $rootRequires = array_merge($rootRequires, $rootDevRequires);
  14019. $requiredPackageNames = array();
  14020. foreach ($rootRequires as $require) {
  14021. $requiredPackageNames[] = $require->getTarget();
  14022. }
  14023. $skipPackages = array();
  14024. if (!$this->whitelistAllDependencies) {
  14025. foreach ($rootRequires as $require) {
  14026. $skipPackages[$require->getTarget()] = true;
  14027. }
  14028. }
  14029. $pool = new Pool('dev');
  14030. $pool->addRepository($localOrLockRepo);
  14031. $seen = array();
  14032. $rootRequiredPackageNames = array_keys($rootRequires);
  14033. foreach ($this->updateWhitelist as $packageName => $void) {
  14034. $packageQueue = new \SplQueue;
  14035. $depPackages = $pool->whatProvides($packageName);
  14036. $nameMatchesRequiredPackage = in_array($packageName, $requiredPackageNames, true);
  14037. if (!$nameMatchesRequiredPackage) {
  14038. $whitelistPatternRegexp = $this->packageNameToRegexp($packageName);
  14039. foreach ($rootRequiredPackageNames as $rootRequiredPackageName) {
  14040. if (preg_match($whitelistPatternRegexp, $rootRequiredPackageName)) {
  14041. $nameMatchesRequiredPackage = true;
  14042. break;
  14043. }
  14044. }
  14045. }
  14046. if (count($depPackages) == 0 && !$nameMatchesRequiredPackage && !in_array($packageName, array('nothing', 'lock', 'mirrors'))) {
  14047. $this->io->writeError('<warning>Package "' . $packageName . '" listed for update is not installed. Ignoring.</warning>');
  14048. }
  14049. foreach ($depPackages as $depPackage) {
  14050. $packageQueue->enqueue($depPackage);
  14051. }
  14052. while (!$packageQueue->isEmpty()) {
  14053. $package = $packageQueue->dequeue();
  14054. if (isset($seen[$package->getId()])) {
  14055. continue;
  14056. }
  14057. $seen[$package->getId()] = true;
  14058. $this->updateWhitelist[$package->getName()] = true;
  14059. if (!$this->whitelistDependencies && !$this->whitelistAllDependencies) {
  14060. continue;
  14061. }
  14062. $requires = $package->getRequires();
  14063. foreach ($requires as $require) {
  14064. $requirePackages = $pool->whatProvides($require->getTarget());
  14065. foreach ($requirePackages as $requirePackage) {
  14066. if (isset($this->updateWhitelist[$requirePackage->getName()])) {
  14067. continue;
  14068. }
  14069. if (isset($skipPackages[$requirePackage->getName()])) {
  14070. $this->io->writeError('<warning>Dependency "' . $requirePackage->getName() . '" is also a root requirement, but is not explicitly whitelisted. Ignoring.</warning>');
  14071. continue;
  14072. }
  14073. $packageQueue->enqueue($requirePackage);
  14074. }
  14075. }
  14076. }
  14077. }
  14078. }
  14079. private function mockLocalRepositories(RepositoryManager $rm)
  14080. {
  14081. $packages = array();
  14082. foreach ($rm->getLocalRepository()->getPackages() as $package) {
  14083. $packages[(string) $package] = clone $package;
  14084. }
  14085. foreach ($packages as $key => $package) {
  14086. if ($package instanceof AliasPackage) {
  14087. $alias = (string) $package->getAliasOf();
  14088. $packages[$key] = new AliasPackage($packages[$alias], $package->getVersion(), $package->getPrettyVersion());
  14089. }
  14090. }
  14091. $rm->setLocalRepository(
  14092. new InstalledArrayRepository($packages)
  14093. );
  14094. }
  14095. public static function create(IOInterface $io, Composer $composer)
  14096. {
  14097. return new static(
  14098. $io,
  14099. $composer->getConfig(),
  14100. $composer->getPackage(),
  14101. $composer->getDownloadManager(),
  14102. $composer->getRepositoryManager(),
  14103. $composer->getLocker(),
  14104. $composer->getInstallationManager(),
  14105. $composer->getEventDispatcher(),
  14106. $composer->getAutoloadGenerator()
  14107. );
  14108. }
  14109. public function setAdditionalInstalledRepository(RepositoryInterface $additionalInstalledRepository)
  14110. {
  14111. $this->additionalInstalledRepository = $additionalInstalledRepository;
  14112. return $this;
  14113. }
  14114. public function setDryRun($dryRun = true)
  14115. {
  14116. $this->dryRun = (bool) $dryRun;
  14117. return $this;
  14118. }
  14119. public function isDryRun()
  14120. {
  14121. return $this->dryRun;
  14122. }
  14123. public function setPreferSource($preferSource = true)
  14124. {
  14125. $this->preferSource = (bool) $preferSource;
  14126. return $this;
  14127. }
  14128. public function setPreferDist($preferDist = true)
  14129. {
  14130. $this->preferDist = (bool) $preferDist;
  14131. return $this;
  14132. }
  14133. public function setOptimizeAutoloader($optimizeAutoloader = false)
  14134. {
  14135. $this->optimizeAutoloader = (bool) $optimizeAutoloader;
  14136. if (!$this->optimizeAutoloader) {
  14137. $this->setClassMapAuthoritative(false);
  14138. }
  14139. return $this;
  14140. }
  14141. public function setClassMapAuthoritative($classMapAuthoritative = false)
  14142. {
  14143. $this->classMapAuthoritative = (bool) $classMapAuthoritative;
  14144. if ($this->classMapAuthoritative) {
  14145. $this->setOptimizeAutoloader(true);
  14146. }
  14147. return $this;
  14148. }
  14149. public function setApcuAutoloader($apcuAutoloader = false)
  14150. {
  14151. $this->apcuAutoloader = (bool) $apcuAutoloader;
  14152. return $this;
  14153. }
  14154. public function setUpdate($update = true)
  14155. {
  14156. $this->update = (bool) $update;
  14157. return $this;
  14158. }
  14159. public function setDevMode($devMode = true)
  14160. {
  14161. $this->devMode = (bool) $devMode;
  14162. return $this;
  14163. }
  14164. public function setDumpAutoloader($dumpAutoloader = true)
  14165. {
  14166. $this->dumpAutoloader = (bool) $dumpAutoloader;
  14167. return $this;
  14168. }
  14169. public function setRunScripts($runScripts = true)
  14170. {
  14171. $this->runScripts = (bool) $runScripts;
  14172. return $this;
  14173. }
  14174. public function setConfig(Config $config)
  14175. {
  14176. $this->config = $config;
  14177. return $this;
  14178. }
  14179. public function setVerbose($verbose = true)
  14180. {
  14181. $this->verbose = (bool) $verbose;
  14182. return $this;
  14183. }
  14184. public function isVerbose()
  14185. {
  14186. return $this->verbose;
  14187. }
  14188. public function setIgnorePlatformRequirements($ignorePlatformReqs = false)
  14189. {
  14190. $this->ignorePlatformReqs = (bool) $ignorePlatformReqs;
  14191. return $this;
  14192. }
  14193. public function setUpdateWhitelist(array $packages)
  14194. {
  14195. $this->updateWhitelist = array_flip(array_map('strtolower', $packages));
  14196. return $this;
  14197. }
  14198. public function setWhitelistDependencies($updateDependencies = true)
  14199. {
  14200. return $this->setWhitelistTransitiveDependencies($updateDependencies);
  14201. }
  14202. public function setWhitelistTransitiveDependencies($updateTransitiveDependencies = true)
  14203. {
  14204. $this->whitelistDependencies = (bool) $updateTransitiveDependencies;
  14205. return $this;
  14206. }
  14207. public function setWhitelistAllDependencies($updateAllDependencies = true)
  14208. {
  14209. $this->whitelistAllDependencies = (bool) $updateAllDependencies;
  14210. return $this;
  14211. }
  14212. public function setPreferStable($preferStable = true)
  14213. {
  14214. $this->preferStable = (bool) $preferStable;
  14215. return $this;
  14216. }
  14217. public function setPreferLowest($preferLowest = true)
  14218. {
  14219. $this->preferLowest = (bool) $preferLowest;
  14220. return $this;
  14221. }
  14222. public function setWriteLock($writeLock = true)
  14223. {
  14224. $this->writeLock = (bool) $writeLock;
  14225. return $this;
  14226. }
  14227. public function setExecuteOperations($executeOperations = true)
  14228. {
  14229. $this->executeOperations = (bool) $executeOperations;
  14230. return $this;
  14231. }
  14232. public function setSkipSuggest($skipSuggest = true)
  14233. {
  14234. $this->skipSuggest = (bool) $skipSuggest;
  14235. return $this;
  14236. }
  14237. public function disablePlugins()
  14238. {
  14239. $this->installationManager->disablePlugins();
  14240. return $this;
  14241. }
  14242. public function setSuggestedPackagesReporter(SuggestedPackagesReporter $suggestedPackagesReporter)
  14243. {
  14244. $this->suggestedPackagesReporter = $suggestedPackagesReporter;
  14245. return $this;
  14246. }
  14247. }
  14248. <?php
  14249. namespace Composer\Installer;
  14250. use Composer\IO\IOInterface;
  14251. use Composer\Package\PackageInterface;
  14252. use Composer\Util\Filesystem;
  14253. use Composer\Util\Platform;
  14254. use Composer\Util\ProcessExecutor;
  14255. use Composer\Util\Silencer;
  14256. class BinaryInstaller
  14257. {
  14258. protected $binDir;
  14259. protected $binCompat;
  14260. protected $io;
  14261. protected $filesystem;
  14262. public function __construct(IOInterface $io, $binDir, $binCompat, Filesystem $filesystem = null)
  14263. {
  14264. $this->binDir = $binDir;
  14265. $this->binCompat = $binCompat;
  14266. $this->io = $io;
  14267. $this->filesystem = $filesystem ?: new Filesystem();
  14268. }
  14269. public function installBinaries(PackageInterface $package, $installPath, $warnOnOverwrite = true)
  14270. {
  14271. $binaries = $this->getBinaries($package);
  14272. if (!$binaries) {
  14273. return;
  14274. }
  14275. foreach ($binaries as $bin) {
  14276. $binPath = $installPath.'/'.$bin;
  14277. if (!file_exists($binPath)) {
  14278. $this->io->writeError(' <warning>Skipped installation of bin '.$bin.' for package '.$package->getName().': file not found in package</warning>');
  14279. continue;
  14280. }
  14281. $binPath = realpath($binPath);
  14282. $this->initializeBinDir();
  14283. $link = $this->binDir.'/'.basename($bin);
  14284. if (file_exists($link)) {
  14285. if (is_link($link)) {
  14286. Silencer::call('chmod', $link, 0777 & ~umask());
  14287. }
  14288. if ($warnOnOverwrite) {
  14289. $this->io->writeError(' Skipped installation of bin '.$bin.' for package '.$package->getName().': name conflicts with an existing file');
  14290. }
  14291. continue;
  14292. }
  14293. if ($this->binCompat === "auto") {
  14294. if (Platform::isWindows()) {
  14295. $this->installFullBinaries($binPath, $link, $bin, $package);
  14296. } else {
  14297. $this->installSymlinkBinaries($binPath, $link);
  14298. }
  14299. } elseif ($this->binCompat === "full") {
  14300. $this->installFullBinaries($binPath, $link, $bin, $package);
  14301. }
  14302. Silencer::call('chmod', $link, 0777 & ~umask());
  14303. }
  14304. }
  14305. public function removeBinaries(PackageInterface $package)
  14306. {
  14307. $this->initializeBinDir();
  14308. $binaries = $this->getBinaries($package);
  14309. if (!$binaries) {
  14310. return;
  14311. }
  14312. foreach ($binaries as $bin) {
  14313. $link = $this->binDir.'/'.basename($bin);
  14314. if (is_link($link) || file_exists($link)) {
  14315. $this->filesystem->unlink($link);
  14316. }
  14317. if (file_exists($link.'.bat')) {
  14318. $this->filesystem->unlink($link.'.bat');
  14319. }
  14320. }
  14321. if (is_dir($this->binDir) && $this->filesystem->isDirEmpty($this->binDir)) {
  14322. Silencer::call('rmdir', $this->binDir);
  14323. }
  14324. }
  14325. public static function determineBinaryCaller($bin)
  14326. {
  14327. if ('.bat' === substr($bin, -4) || '.exe' === substr($bin, -4)) {
  14328. return 'call';
  14329. }
  14330. $handle = fopen($bin, 'r');
  14331. $line = fgets($handle);
  14332. fclose($handle);
  14333. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  14334. return trim($match[1]);
  14335. }
  14336. return 'php';
  14337. }
  14338. protected function getBinaries(PackageInterface $package)
  14339. {
  14340. return $package->getBinaries();
  14341. }
  14342. protected function installFullBinaries($binPath, $link, $bin, PackageInterface $package)
  14343. {
  14344. if ('.bat' !== substr($binPath, -4)) {
  14345. $this->installUnixyProxyBinaries($binPath, $link);
  14346. @chmod($link, 0777 & ~umask());
  14347. $link .= '.bat';
  14348. if (file_exists($link)) {
  14349. $this->io->writeError(' Skipped installation of bin '.$bin.'.bat proxy for package '.$package->getName().': a .bat proxy was already installed');
  14350. }
  14351. }
  14352. if (!file_exists($link)) {
  14353. file_put_contents($link, $this->generateWindowsProxyCode($binPath, $link));
  14354. }
  14355. }
  14356. protected function installSymlinkBinaries($binPath, $link)
  14357. {
  14358. if (!$this->filesystem->relativeSymlink($binPath, $link)) {
  14359. $this->installUnixyProxyBinaries($binPath, $link);
  14360. }
  14361. }
  14362. protected function installUnixyProxyBinaries($binPath, $link)
  14363. {
  14364. file_put_contents($link, $this->generateUnixyProxyCode($binPath, $link));
  14365. }
  14366. protected function initializeBinDir()
  14367. {
  14368. $this->filesystem->ensureDirectoryExists($this->binDir);
  14369. $this->binDir = realpath($this->binDir);
  14370. }
  14371. protected function generateWindowsProxyCode($bin, $link)
  14372. {
  14373. $binPath = $this->filesystem->findShortestPath($link, $bin);
  14374. $caller = self::determineBinaryCaller($bin);
  14375. return "@ECHO OFF\r\n".
  14376. "setlocal DISABLEDELAYEDEXPANSION\r\n".
  14377. "SET BIN_TARGET=%~dp0/".trim(ProcessExecutor::escape($binPath), '"\'')."\r\n".
  14378. "{$caller} \"%BIN_TARGET%\" %*\r\n";
  14379. }
  14380. protected function generateUnixyProxyCode($bin, $link)
  14381. {
  14382. $binPath = $this->filesystem->findShortestPath($link, $bin);
  14383. $binDir = ProcessExecutor::escape(dirname($binPath));
  14384. $binFile = basename($binPath);
  14385. $proxyCode = <<<PROXY
  14386. #!/usr/bin/env sh
  14387. dir=\$(cd "\${0%[/\\\\]*}" > /dev/null; cd $binDir && pwd)
  14388. if [ -d /proc/cygdrive ] && [[ \$(which php) == \$(readlink -n /proc/cygdrive)/* ]]; then
  14389. # We are in Cgywin using Windows php, so the path must be translated
  14390. dir=\$(cygpath -m "\$dir");
  14391. fi
  14392. "\${dir}/$binFile" "\$@"
  14393. PROXY;
  14394. return $proxyCode;
  14395. }
  14396. }
  14397. <?php
  14398. namespace Composer\Installer;
  14399. use Composer\Package\PackageInterface;
  14400. interface BinaryPresenceInterface
  14401. {
  14402. public function ensureBinariesPresence(PackageInterface $package);
  14403. }
  14404. <?php
  14405. namespace Composer\Installer;
  14406. use Composer\IO\IOInterface;
  14407. use Composer\Package\PackageInterface;
  14408. use Composer\Package\AliasPackage;
  14409. use Composer\Repository\RepositoryInterface;
  14410. use Composer\Repository\InstalledRepositoryInterface;
  14411. use Composer\DependencyResolver\Operation\OperationInterface;
  14412. use Composer\DependencyResolver\Operation\InstallOperation;
  14413. use Composer\DependencyResolver\Operation\UpdateOperation;
  14414. use Composer\DependencyResolver\Operation\UninstallOperation;
  14415. use Composer\DependencyResolver\Operation\MarkAliasInstalledOperation;
  14416. use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
  14417. use Composer\Util\StreamContextFactory;
  14418. class InstallationManager
  14419. {
  14420. private $installers = array();
  14421. private $cache = array();
  14422. private $notifiablePackages = array();
  14423. public function reset()
  14424. {
  14425. $this->notifiablePackages = array();
  14426. }
  14427. public function addInstaller(InstallerInterface $installer)
  14428. {
  14429. array_unshift($this->installers, $installer);
  14430. $this->cache = array();
  14431. }
  14432. public function removeInstaller(InstallerInterface $installer)
  14433. {
  14434. if (false !== ($key = array_search($installer, $this->installers, true))) {
  14435. array_splice($this->installers, $key, 1);
  14436. $this->cache = array();
  14437. }
  14438. }
  14439. public function disablePlugins()
  14440. {
  14441. foreach ($this->installers as $i => $installer) {
  14442. if (!$installer instanceof PluginInstaller) {
  14443. continue;
  14444. }
  14445. unset($this->installers[$i]);
  14446. }
  14447. }
  14448. public function getInstaller($type)
  14449. {
  14450. $type = strtolower($type);
  14451. if (isset($this->cache[$type])) {
  14452. return $this->cache[$type];
  14453. }
  14454. foreach ($this->installers as $installer) {
  14455. if ($installer->supports($type)) {
  14456. return $this->cache[$type] = $installer;
  14457. }
  14458. }
  14459. throw new \InvalidArgumentException('Unknown installer type: '.$type);
  14460. }
  14461. public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14462. {
  14463. if ($package instanceof AliasPackage) {
  14464. return $repo->hasPackage($package) && $this->isPackageInstalled($repo, $package->getAliasOf());
  14465. }
  14466. return $this->getInstaller($package->getType())->isInstalled($repo, $package);
  14467. }
  14468. public function ensureBinariesPresence(PackageInterface $package)
  14469. {
  14470. try {
  14471. $installer = $this->getInstaller($package->getType());
  14472. } catch (\InvalidArgumentException $e) {
  14473. return;
  14474. }
  14475. if ($installer instanceof BinaryPresenceInterface) {
  14476. $installer->ensureBinariesPresence($package);
  14477. }
  14478. }
  14479. public function execute(RepositoryInterface $repo, OperationInterface $operation)
  14480. {
  14481. $method = $operation->getJobType();
  14482. $this->$method($repo, $operation);
  14483. }
  14484. public function install(RepositoryInterface $repo, InstallOperation $operation)
  14485. {
  14486. $package = $operation->getPackage();
  14487. $installer = $this->getInstaller($package->getType());
  14488. $installer->install($repo, $package);
  14489. $this->markForNotification($package);
  14490. }
  14491. public function update(RepositoryInterface $repo, UpdateOperation $operation)
  14492. {
  14493. $initial = $operation->getInitialPackage();
  14494. $target = $operation->getTargetPackage();
  14495. $initialType = $initial->getType();
  14496. $targetType = $target->getType();
  14497. if ($initialType === $targetType) {
  14498. $installer = $this->getInstaller($initialType);
  14499. $installer->update($repo, $initial, $target);
  14500. $this->markForNotification($target);
  14501. } else {
  14502. $this->getInstaller($initialType)->uninstall($repo, $initial);
  14503. $this->getInstaller($targetType)->install($repo, $target);
  14504. }
  14505. }
  14506. public function uninstall(RepositoryInterface $repo, UninstallOperation $operation)
  14507. {
  14508. $package = $operation->getPackage();
  14509. $installer = $this->getInstaller($package->getType());
  14510. $installer->uninstall($repo, $package);
  14511. }
  14512. public function markAliasInstalled(RepositoryInterface $repo, MarkAliasInstalledOperation $operation)
  14513. {
  14514. $package = $operation->getPackage();
  14515. if (!$repo->hasPackage($package)) {
  14516. $repo->addPackage(clone $package);
  14517. }
  14518. }
  14519. public function markAliasUninstalled(RepositoryInterface $repo, MarkAliasUninstalledOperation $operation)
  14520. {
  14521. $package = $operation->getPackage();
  14522. $repo->removePackage($package);
  14523. }
  14524. public function getInstallPath(PackageInterface $package)
  14525. {
  14526. $installer = $this->getInstaller($package->getType());
  14527. return $installer->getInstallPath($package);
  14528. }
  14529. public function notifyInstalls(IOInterface $io)
  14530. {
  14531. foreach ($this->notifiablePackages as $repoUrl => $packages) {
  14532. $repositoryName = parse_url($repoUrl, PHP_URL_HOST);
  14533. if ($io->hasAuthentication($repositoryName)) {
  14534. $auth = $io->getAuthentication($repositoryName);
  14535. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  14536. $authHeader = 'Authorization: Basic '.$authStr;
  14537. }
  14538. if (strpos($repoUrl, '%package%')) {
  14539. foreach ($packages as $package) {
  14540. $url = str_replace('%package%', $package->getPrettyName(), $repoUrl);
  14541. $params = array(
  14542. 'version' => $package->getPrettyVersion(),
  14543. 'version_normalized' => $package->getVersion(),
  14544. );
  14545. $opts = array('http' =>
  14546. array(
  14547. 'method' => 'POST',
  14548. 'header' => array('Content-type: application/x-www-form-urlencoded'),
  14549. 'content' => http_build_query($params, '', '&'),
  14550. 'timeout' => 3,
  14551. ),
  14552. );
  14553. if (isset($authHeader)) {
  14554. $opts['http']['header'][] = $authHeader;
  14555. }
  14556. $context = StreamContextFactory::getContext($url, $opts);
  14557. @file_get_contents($url, false, $context);
  14558. }
  14559. continue;
  14560. }
  14561. $postData = array('downloads' => array());
  14562. foreach ($packages as $package) {
  14563. $postData['downloads'][] = array(
  14564. 'name' => $package->getPrettyName(),
  14565. 'version' => $package->getVersion(),
  14566. );
  14567. }
  14568. $opts = array('http' =>
  14569. array(
  14570. 'method' => 'POST',
  14571. 'header' => array('Content-Type: application/json'),
  14572. 'content' => json_encode($postData),
  14573. 'timeout' => 6,
  14574. ),
  14575. );
  14576. if (isset($authHeader)) {
  14577. $opts['http']['header'][] = $authHeader;
  14578. }
  14579. $context = StreamContextFactory::getContext($repoUrl, $opts);
  14580. @file_get_contents($repoUrl, false, $context);
  14581. }
  14582. $this->reset();
  14583. }
  14584. private function markForNotification(PackageInterface $package)
  14585. {
  14586. if ($package->getNotificationUrl()) {
  14587. $this->notifiablePackages[$package->getNotificationUrl()][$package->getName()] = $package;
  14588. }
  14589. }
  14590. }
  14591. <?php
  14592. namespace Composer\Installer;
  14593. use Composer\Composer;
  14594. use Composer\DependencyResolver\PolicyInterface;
  14595. use Composer\DependencyResolver\Operation\OperationInterface;
  14596. use Composer\DependencyResolver\Pool;
  14597. use Composer\DependencyResolver\Request;
  14598. use Composer\EventDispatcher\Event;
  14599. use Composer\IO\IOInterface;
  14600. use Composer\Repository\CompositeRepository;
  14601. class InstallerEvent extends Event
  14602. {
  14603. private $composer;
  14604. private $io;
  14605. private $devMode;
  14606. private $policy;
  14607. private $pool;
  14608. private $installedRepo;
  14609. private $request;
  14610. private $operations;
  14611. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  14612. {
  14613. parent::__construct($eventName);
  14614. $this->composer = $composer;
  14615. $this->io = $io;
  14616. $this->devMode = $devMode;
  14617. $this->policy = $policy;
  14618. $this->pool = $pool;
  14619. $this->installedRepo = $installedRepo;
  14620. $this->request = $request;
  14621. $this->operations = $operations;
  14622. }
  14623. public function getComposer()
  14624. {
  14625. return $this->composer;
  14626. }
  14627. public function getIO()
  14628. {
  14629. return $this->io;
  14630. }
  14631. public function isDevMode()
  14632. {
  14633. return $this->devMode;
  14634. }
  14635. public function getPolicy()
  14636. {
  14637. return $this->policy;
  14638. }
  14639. public function getPool()
  14640. {
  14641. return $this->pool;
  14642. }
  14643. public function getInstalledRepo()
  14644. {
  14645. return $this->installedRepo;
  14646. }
  14647. public function getRequest()
  14648. {
  14649. return $this->request;
  14650. }
  14651. public function getOperations()
  14652. {
  14653. return $this->operations;
  14654. }
  14655. }
  14656. <?php
  14657. namespace Composer\Installer;
  14658. class InstallerEvents
  14659. {
  14660. const PRE_DEPENDENCIES_SOLVING = 'pre-dependencies-solving';
  14661. const POST_DEPENDENCIES_SOLVING = 'post-dependencies-solving';
  14662. }
  14663. <?php
  14664. namespace Composer\Installer;
  14665. use Composer\Package\PackageInterface;
  14666. use Composer\Repository\InstalledRepositoryInterface;
  14667. use InvalidArgumentException;
  14668. interface InstallerInterface
  14669. {
  14670. public function supports($packageType);
  14671. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package);
  14672. public function install(InstalledRepositoryInterface $repo, PackageInterface $package);
  14673. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target);
  14674. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package);
  14675. public function getInstallPath(PackageInterface $package);
  14676. }
  14677. <?php
  14678. namespace Composer\Installer;
  14679. use Composer\Composer;
  14680. use Composer\IO\IOInterface;
  14681. use Composer\Repository\InstalledRepositoryInterface;
  14682. use Composer\Package\PackageInterface;
  14683. use Composer\Util\Filesystem;
  14684. use Composer\Util\Silencer;
  14685. use Composer\Util\Platform;
  14686. class LibraryInstaller implements InstallerInterface, BinaryPresenceInterface
  14687. {
  14688. protected $composer;
  14689. protected $vendorDir;
  14690. protected $binDir;
  14691. protected $downloadManager;
  14692. protected $io;
  14693. protected $type;
  14694. protected $filesystem;
  14695. protected $binCompat;
  14696. protected $binaryInstaller;
  14697. public function __construct(IOInterface $io, Composer $composer, $type = 'library', Filesystem $filesystem = null, BinaryInstaller $binaryInstaller = null)
  14698. {
  14699. $this->composer = $composer;
  14700. $this->downloadManager = $composer->getDownloadManager();
  14701. $this->io = $io;
  14702. $this->type = $type;
  14703. $this->filesystem = $filesystem ?: new Filesystem();
  14704. $this->vendorDir = rtrim($composer->getConfig()->get('vendor-dir'), '/');
  14705. $this->binaryInstaller = $binaryInstaller ?: new BinaryInstaller($this->io, rtrim($composer->getConfig()->get('bin-dir'), '/'), $composer->getConfig()->get('bin-compat'), $this->filesystem);
  14706. }
  14707. public function supports($packageType)
  14708. {
  14709. return $packageType === $this->type || null === $this->type;
  14710. }
  14711. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14712. {
  14713. if (!$repo->hasPackage($package)) {
  14714. return false;
  14715. }
  14716. $installPath = $this->getInstallPath($package);
  14717. if (is_readable($installPath)) {
  14718. return true;
  14719. }
  14720. return (Platform::isWindows() && $this->filesystem->isJunction($installPath)) || is_link($installPath);
  14721. }
  14722. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  14723. {
  14724. $this->initializeVendorDir();
  14725. $downloadPath = $this->getInstallPath($package);
  14726. if (!is_readable($downloadPath) && $repo->hasPackage($package)) {
  14727. $this->binaryInstaller->removeBinaries($package);
  14728. }
  14729. $this->installCode($package);
  14730. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package));
  14731. if (!$repo->hasPackage($package)) {
  14732. $repo->addPackage(clone $package);
  14733. }
  14734. }
  14735. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  14736. {
  14737. if (!$repo->hasPackage($initial)) {
  14738. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  14739. }
  14740. $this->initializeVendorDir();
  14741. $this->binaryInstaller->removeBinaries($initial);
  14742. $this->updateCode($initial, $target);
  14743. $this->binaryInstaller->installBinaries($target, $this->getInstallPath($target));
  14744. $repo->removePackage($initial);
  14745. if (!$repo->hasPackage($target)) {
  14746. $repo->addPackage(clone $target);
  14747. }
  14748. }
  14749. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  14750. {
  14751. if (!$repo->hasPackage($package)) {
  14752. throw new \InvalidArgumentException('Package is not installed: '.$package);
  14753. }
  14754. $this->removeCode($package);
  14755. $this->binaryInstaller->removeBinaries($package);
  14756. $repo->removePackage($package);
  14757. $downloadPath = $this->getPackageBasePath($package);
  14758. if (strpos($package->getName(), '/')) {
  14759. $packageVendorDir = dirname($downloadPath);
  14760. if (is_dir($packageVendorDir) && $this->filesystem->isDirEmpty($packageVendorDir)) {
  14761. Silencer::call('rmdir', $packageVendorDir);
  14762. }
  14763. }
  14764. }
  14765. public function getInstallPath(PackageInterface $package)
  14766. {
  14767. $this->initializeVendorDir();
  14768. $basePath = ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName();
  14769. $targetDir = $package->getTargetDir();
  14770. return $basePath . ($targetDir ? '/'.$targetDir : '');
  14771. }
  14772. public function ensureBinariesPresence(PackageInterface $package)
  14773. {
  14774. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package), false);
  14775. }
  14776. protected function getPackageBasePath(PackageInterface $package)
  14777. {
  14778. $installPath = $this->getInstallPath($package);
  14779. $targetDir = $package->getTargetDir();
  14780. if ($targetDir) {
  14781. return preg_replace('{/*'.str_replace('/', '/+', preg_quote($targetDir)).'/?$}', '', $installPath);
  14782. }
  14783. return $installPath;
  14784. }
  14785. protected function installCode(PackageInterface $package)
  14786. {
  14787. $downloadPath = $this->getInstallPath($package);
  14788. $this->downloadManager->download($package, $downloadPath);
  14789. }
  14790. protected function updateCode(PackageInterface $initial, PackageInterface $target)
  14791. {
  14792. $initialDownloadPath = $this->getInstallPath($initial);
  14793. $targetDownloadPath = $this->getInstallPath($target);
  14794. if ($targetDownloadPath !== $initialDownloadPath) {
  14795. if (substr($initialDownloadPath, 0, strlen($targetDownloadPath)) === $targetDownloadPath
  14796. || substr($targetDownloadPath, 0, strlen($initialDownloadPath)) === $initialDownloadPath
  14797. ) {
  14798. $this->removeCode($initial);
  14799. $this->installCode($target);
  14800. return;
  14801. }
  14802. $this->filesystem->rename($initialDownloadPath, $targetDownloadPath);
  14803. }
  14804. $this->downloadManager->update($initial, $target, $targetDownloadPath);
  14805. }
  14806. protected function removeCode(PackageInterface $package)
  14807. {
  14808. $downloadPath = $this->getPackageBasePath($package);
  14809. $this->downloadManager->remove($package, $downloadPath);
  14810. }
  14811. protected function initializeVendorDir()
  14812. {
  14813. $this->filesystem->ensureDirectoryExists($this->vendorDir);
  14814. $this->vendorDir = realpath($this->vendorDir);
  14815. }
  14816. }
  14817. <?php
  14818. namespace Composer\Installer;
  14819. use Composer\Repository\InstalledRepositoryInterface;
  14820. use Composer\Package\PackageInterface;
  14821. class MetapackageInstaller implements InstallerInterface
  14822. {
  14823. public function supports($packageType)
  14824. {
  14825. return $packageType === 'metapackage';
  14826. }
  14827. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14828. {
  14829. return $repo->hasPackage($package);
  14830. }
  14831. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  14832. {
  14833. $repo->addPackage(clone $package);
  14834. }
  14835. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  14836. {
  14837. if (!$repo->hasPackage($initial)) {
  14838. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  14839. }
  14840. $repo->removePackage($initial);
  14841. $repo->addPackage(clone $target);
  14842. }
  14843. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  14844. {
  14845. if (!$repo->hasPackage($package)) {
  14846. throw new \InvalidArgumentException('Package is not installed: '.$package);
  14847. }
  14848. $repo->removePackage($package);
  14849. }
  14850. public function getInstallPath(PackageInterface $package)
  14851. {
  14852. return '';
  14853. }
  14854. }
  14855. <?php
  14856. namespace Composer\Installer;
  14857. use Composer\Repository\InstalledRepositoryInterface;
  14858. use Composer\Package\PackageInterface;
  14859. class NoopInstaller implements InstallerInterface
  14860. {
  14861. public function supports($packageType)
  14862. {
  14863. return true;
  14864. }
  14865. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14866. {
  14867. return $repo->hasPackage($package);
  14868. }
  14869. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  14870. {
  14871. if (!$repo->hasPackage($package)) {
  14872. $repo->addPackage(clone $package);
  14873. }
  14874. }
  14875. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  14876. {
  14877. if (!$repo->hasPackage($initial)) {
  14878. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  14879. }
  14880. $repo->removePackage($initial);
  14881. if (!$repo->hasPackage($target)) {
  14882. $repo->addPackage(clone $target);
  14883. }
  14884. }
  14885. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  14886. {
  14887. if (!$repo->hasPackage($package)) {
  14888. throw new \InvalidArgumentException('Package is not installed: '.$package);
  14889. }
  14890. $repo->removePackage($package);
  14891. }
  14892. public function getInstallPath(PackageInterface $package)
  14893. {
  14894. $targetDir = $package->getTargetDir();
  14895. return $package->getPrettyName() . ($targetDir ? '/'.$targetDir : '');
  14896. }
  14897. }
  14898. <?php
  14899. namespace Composer\Installer;
  14900. use Composer\Composer;
  14901. use Composer\IO\IOInterface;
  14902. use Composer\DependencyResolver\Operation\OperationInterface;
  14903. use Composer\DependencyResolver\PolicyInterface;
  14904. use Composer\DependencyResolver\Pool;
  14905. use Composer\DependencyResolver\Request;
  14906. use Composer\Repository\CompositeRepository;
  14907. class PackageEvent extends InstallerEvent
  14908. {
  14909. private $operation;
  14910. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  14911. {
  14912. parent::__construct($eventName, $composer, $io, $devMode, $policy, $pool, $installedRepo, $request, $operations);
  14913. $this->operation = $operation;
  14914. }
  14915. public function getOperation()
  14916. {
  14917. return $this->operation;
  14918. }
  14919. }
  14920. <?php
  14921. namespace Composer\Installer;
  14922. class PackageEvents
  14923. {
  14924. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  14925. const POST_PACKAGE_INSTALL = 'post-package-install';
  14926. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  14927. const POST_PACKAGE_UPDATE = 'post-package-update';
  14928. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  14929. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  14930. }
  14931. <?php
  14932. namespace Composer\Installer;
  14933. use Composer\IO\IOInterface;
  14934. use Composer\Package\PackageInterface;
  14935. use Composer\Util\Filesystem;
  14936. use Composer\Util\ProcessExecutor;
  14937. class PearBinaryInstaller extends BinaryInstaller
  14938. {
  14939. private $installer;
  14940. private $vendorDir;
  14941. public function __construct(IOInterface $io, $binDir, $vendorDir, $binCompat, Filesystem $filesystem, PearInstaller $installer)
  14942. {
  14943. parent::__construct($io, $binDir, $binCompat, $filesystem);
  14944. $this->installer = $installer;
  14945. $this->vendorDir = $vendorDir;
  14946. }
  14947. protected function getBinaries(PackageInterface $package)
  14948. {
  14949. $binariesPath = $this->installer->getInstallPath($package) . '/bin/';
  14950. $binaries = array();
  14951. if (file_exists($binariesPath)) {
  14952. foreach (new \FilesystemIterator($binariesPath, \FilesystemIterator::KEY_AS_FILENAME | \FilesystemIterator::CURRENT_AS_FILEINFO) as $fileName => $value) {
  14953. if (!$value->isDir()) {
  14954. $binaries[] = 'bin/'.$fileName;
  14955. }
  14956. }
  14957. }
  14958. return $binaries;
  14959. }
  14960. protected function initializeBinDir()
  14961. {
  14962. parent::initializeBinDir();
  14963. file_put_contents($this->binDir.'/composer-php', $this->generateUnixyPhpProxyCode());
  14964. @chmod($this->binDir.'/composer-php', 0777 & ~umask());
  14965. file_put_contents($this->binDir.'/composer-php.bat', $this->generateWindowsPhpProxyCode());
  14966. @chmod($this->binDir.'/composer-php.bat', 0777 & ~umask());
  14967. }
  14968. protected function generateWindowsProxyCode($bin, $link)
  14969. {
  14970. $binPath = $this->filesystem->findShortestPath($link, $bin);
  14971. if ('.bat' === substr($bin, -4)) {
  14972. $caller = 'call';
  14973. } else {
  14974. $handle = fopen($bin, 'r');
  14975. $line = fgets($handle);
  14976. fclose($handle);
  14977. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  14978. $caller = trim($match[1]);
  14979. } else {
  14980. $caller = 'php';
  14981. }
  14982. if ($caller === 'php') {
  14983. return "@echo off\r\n".
  14984. "pushd .\r\n".
  14985. "cd %~dp0\r\n".
  14986. "set PHP_PROXY=%CD%\\composer-php.bat\r\n".
  14987. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  14988. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  14989. "popd\r\n".
  14990. "%PHP_PROXY% \"%BIN_TARGET%\" %*\r\n";
  14991. }
  14992. }
  14993. return "@echo off\r\n".
  14994. "pushd .\r\n".
  14995. "cd %~dp0\r\n".
  14996. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  14997. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  14998. "popd\r\n".
  14999. $caller." \"%BIN_TARGET%\" %*\r\n";
  15000. }
  15001. private function generateWindowsPhpProxyCode()
  15002. {
  15003. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  15004. return
  15005. "@echo off\r\n" .
  15006. "setlocal enabledelayedexpansion\r\n" .
  15007. "set BIN_DIR=%~dp0\r\n" .
  15008. "set VENDOR_DIR=%BIN_DIR%\\".$binToVendor."\r\n" .
  15009. "set DIRS=.\r\n" .
  15010. "FOR /D %%V IN (%VENDOR_DIR%\\*) DO (\r\n" .
  15011. " FOR /D %%P IN (%%V\\*) DO (\r\n" .
  15012. " set DIRS=!DIRS!;%%~fP\r\n" .
  15013. " )\r\n" .
  15014. ")\r\n" .
  15015. "php.exe -d include_path=!DIRS! %*\r\n";
  15016. }
  15017. private function generateUnixyPhpProxyCode()
  15018. {
  15019. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  15020. return
  15021. "#!/usr/bin/env sh\n".
  15022. "SRC_DIR=`pwd`\n".
  15023. "BIN_DIR=`dirname $0`\n".
  15024. "VENDOR_DIR=\$BIN_DIR/".escapeshellarg($binToVendor)."\n".
  15025. "DIRS=\"\"\n".
  15026. "for vendor in \$VENDOR_DIR/*; do\n".
  15027. " if [ -d \"\$vendor\" ]; then\n".
  15028. " for package in \$vendor/*; do\n".
  15029. " if [ -d \"\$package\" ]; then\n".
  15030. " DIRS=\"\${DIRS}:\${package}\"\n".
  15031. " fi\n".
  15032. " done\n".
  15033. " fi\n".
  15034. "done\n".
  15035. "php -d include_path=\".\$DIRS\" $@\n";
  15036. }
  15037. }
  15038. <?php
  15039. namespace Composer\Installer;
  15040. use Composer\IO\IOInterface;
  15041. use Composer\Composer;
  15042. use Composer\Downloader\PearPackageExtractor;
  15043. use Composer\Repository\InstalledRepositoryInterface;
  15044. use Composer\Package\PackageInterface;
  15045. use Composer\Util\Platform;
  15046. use Composer\Util\Filesystem;
  15047. class PearInstaller extends LibraryInstaller
  15048. {
  15049. public function __construct(IOInterface $io, Composer $composer, $type = 'pear-library')
  15050. {
  15051. $filesystem = new Filesystem();
  15052. $binaryInstaller = new PearBinaryInstaller($io, rtrim($composer->getConfig()->get('bin-dir'), '/'), rtrim($composer->getConfig()->get('vendor-dir'), '/'), $composer->getConfig()->get('bin-compat'), $filesystem, $this);
  15053. parent::__construct($io, $composer, $type, $filesystem, $binaryInstaller);
  15054. }
  15055. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15056. {
  15057. $this->uninstall($repo, $initial);
  15058. $this->install($repo, $target);
  15059. }
  15060. protected function installCode(PackageInterface $package)
  15061. {
  15062. parent::installCode($package);
  15063. $isWindows = Platform::isWindows();
  15064. $php_bin = $this->binDir . ($isWindows ? '/composer-php.bat' : '/composer-php');
  15065. if (!$isWindows) {
  15066. $php_bin = '/usr/bin/env ' . $php_bin;
  15067. }
  15068. $installPath = $this->getInstallPath($package);
  15069. $vars = array(
  15070. 'os' => $isWindows ? 'windows' : 'linux',
  15071. 'php_bin' => $php_bin,
  15072. 'pear_php' => $installPath,
  15073. 'php_dir' => $installPath,
  15074. 'bin_dir' => $installPath . '/bin',
  15075. 'data_dir' => $installPath . '/data',
  15076. 'version' => $package->getPrettyVersion(),
  15077. );
  15078. $packageArchive = $this->getInstallPath($package).'/'.pathinfo($package->getDistUrl(), PATHINFO_BASENAME);
  15079. $pearExtractor = new PearPackageExtractor($packageArchive);
  15080. $pearExtractor->extractTo($this->getInstallPath($package), array('php' => '/', 'script' => '/bin', 'data' => '/data'), $vars);
  15081. $this->io->writeError(' Cleaning up', true, IOInterface::VERBOSE);
  15082. $this->filesystem->unlink($packageArchive);
  15083. }
  15084. }
  15085. <?php
  15086. namespace Composer\Installer;
  15087. use Composer\Composer;
  15088. use Composer\IO\IOInterface;
  15089. use Composer\Repository\InstalledRepositoryInterface;
  15090. use Composer\Package\PackageInterface;
  15091. class PluginInstaller extends LibraryInstaller
  15092. {
  15093. private $installationManager;
  15094. public function __construct(IOInterface $io, Composer $composer)
  15095. {
  15096. parent::__construct($io, $composer, 'composer-plugin');
  15097. $this->installationManager = $composer->getInstallationManager();
  15098. }
  15099. public function supports($packageType)
  15100. {
  15101. return $packageType === 'composer-plugin' || $packageType === 'composer-installer';
  15102. }
  15103. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15104. {
  15105. $extra = $package->getExtra();
  15106. if (empty($extra['class'])) {
  15107. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  15108. }
  15109. parent::install($repo, $package);
  15110. try {
  15111. $this->composer->getPluginManager()->registerPackage($package, true);
  15112. } catch (\Exception $e) {
  15113. $this->io->writeError('Plugin installation failed, rolling back');
  15114. parent::uninstall($repo, $package);
  15115. throw $e;
  15116. }
  15117. }
  15118. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15119. {
  15120. $extra = $target->getExtra();
  15121. if (empty($extra['class'])) {
  15122. throw new \UnexpectedValueException('Error while installing '.$target->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  15123. }
  15124. parent::update($repo, $initial, $target);
  15125. $this->composer->getPluginManager()->registerPackage($target, true);
  15126. }
  15127. }
  15128. <?php
  15129. namespace Composer\Installer;
  15130. use Composer\Package\PackageInterface;
  15131. use Composer\Downloader\DownloadManager;
  15132. use Composer\Repository\InstalledRepositoryInterface;
  15133. use Composer\Util\Filesystem;
  15134. class ProjectInstaller implements InstallerInterface
  15135. {
  15136. private $installPath;
  15137. private $downloadManager;
  15138. private $filesystem;
  15139. public function __construct($installPath, DownloadManager $dm)
  15140. {
  15141. $this->installPath = rtrim(strtr($installPath, '\\', '/'), '/').'/';
  15142. $this->downloadManager = $dm;
  15143. $this->filesystem = new Filesystem;
  15144. }
  15145. public function supports($packageType)
  15146. {
  15147. return true;
  15148. }
  15149. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15150. {
  15151. return false;
  15152. }
  15153. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15154. {
  15155. $installPath = $this->installPath;
  15156. if (file_exists($installPath) && !$this->filesystem->isDirEmpty($installPath)) {
  15157. throw new \InvalidArgumentException("Project directory $installPath is not empty.");
  15158. }
  15159. if (!is_dir($installPath)) {
  15160. mkdir($installPath, 0777, true);
  15161. }
  15162. $this->downloadManager->download($package, $installPath);
  15163. }
  15164. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15165. {
  15166. throw new \InvalidArgumentException("not supported");
  15167. }
  15168. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  15169. {
  15170. throw new \InvalidArgumentException("not supported");
  15171. }
  15172. public function getInstallPath(PackageInterface $package)
  15173. {
  15174. return $this->installPath;
  15175. }
  15176. }
  15177. <?php
  15178. namespace Composer\Installer;
  15179. use Composer\IO\IOInterface;
  15180. use Composer\Package\PackageInterface;
  15181. use Composer\Repository\RepositoryInterface;
  15182. use Symfony\Component\Console\Formatter\OutputFormatter;
  15183. class SuggestedPackagesReporter
  15184. {
  15185. protected $suggestedPackages = array();
  15186. private $io;
  15187. public function __construct(IOInterface $io)
  15188. {
  15189. $this->io = $io;
  15190. }
  15191. public function getPackages()
  15192. {
  15193. return $this->suggestedPackages;
  15194. }
  15195. public function addPackage($source, $target, $reason)
  15196. {
  15197. $this->suggestedPackages[] = array(
  15198. 'source' => $source,
  15199. 'target' => $target,
  15200. 'reason' => $reason,
  15201. );
  15202. return $this;
  15203. }
  15204. public function addSuggestionsFromPackage(PackageInterface $package)
  15205. {
  15206. $source = $package->getPrettyName();
  15207. foreach ($package->getSuggests() as $target => $reason) {
  15208. $this->addPackage(
  15209. $source,
  15210. $target,
  15211. $reason
  15212. );
  15213. }
  15214. return $this;
  15215. }
  15216. public function output(RepositoryInterface $installedRepo = null)
  15217. {
  15218. $suggestedPackages = $this->getPackages();
  15219. $installedPackages = array();
  15220. if (null !== $installedRepo && ! empty($suggestedPackages)) {
  15221. foreach ($installedRepo->getPackages() as $package) {
  15222. $installedPackages = array_merge(
  15223. $installedPackages,
  15224. $package->getNames()
  15225. );
  15226. }
  15227. }
  15228. foreach ($suggestedPackages as $suggestion) {
  15229. if (in_array($suggestion['target'], $installedPackages)) {
  15230. continue;
  15231. }
  15232. $this->io->writeError(sprintf(
  15233. '%s suggests installing %s%s',
  15234. $suggestion['source'],
  15235. $this->escapeOutput($suggestion['target']),
  15236. $this->escapeOutput('' !== $suggestion['reason'] ? ' ('.$suggestion['reason'].')' : '')
  15237. ));
  15238. }
  15239. return $this;
  15240. }
  15241. private function escapeOutput($string)
  15242. {
  15243. return OutputFormatter::escape(
  15244. $this->removeControlCharacters($string)
  15245. );
  15246. }
  15247. private function removeControlCharacters($string)
  15248. {
  15249. return preg_replace(
  15250. '/[[:cntrl:]]/',
  15251. '',
  15252. str_replace("\n", ' ', $string)
  15253. );
  15254. }
  15255. }
  15256. <?php
  15257. namespace Composer\Json;
  15258. use JsonSchema\Validator;
  15259. use Seld\JsonLint\JsonParser;
  15260. use Seld\JsonLint\ParsingException;
  15261. use Composer\Util\RemoteFilesystem;
  15262. use Composer\IO\IOInterface;
  15263. use Composer\Downloader\TransportException;
  15264. class JsonFile
  15265. {
  15266. const LAX_SCHEMA = 1;
  15267. const STRICT_SCHEMA = 2;
  15268. const JSON_UNESCAPED_SLASHES = 64;
  15269. const JSON_PRETTY_PRINT = 128;
  15270. const JSON_UNESCAPED_UNICODE = 256;
  15271. private $path;
  15272. private $rfs;
  15273. private $io;
  15274. public function __construct($path, RemoteFilesystem $rfs = null, IOInterface $io = null)
  15275. {
  15276. $this->path = $path;
  15277. if (null === $rfs && preg_match('{^https?://}i', $path)) {
  15278. throw new \InvalidArgumentException('http urls require a RemoteFilesystem instance to be passed');
  15279. }
  15280. $this->rfs = $rfs;
  15281. $this->io = $io;
  15282. }
  15283. public function getPath()
  15284. {
  15285. return $this->path;
  15286. }
  15287. public function exists()
  15288. {
  15289. return is_file($this->path);
  15290. }
  15291. public function read()
  15292. {
  15293. try {
  15294. if ($this->rfs) {
  15295. $json = $this->rfs->getContents($this->path, $this->path, false);
  15296. } else {
  15297. if ($this->io && $this->io->isDebug()) {
  15298. $this->io->writeError('Reading ' . $this->path);
  15299. }
  15300. $json = file_get_contents($this->path);
  15301. }
  15302. } catch (TransportException $e) {
  15303. throw new \RuntimeException($e->getMessage(), 0, $e);
  15304. } catch (\Exception $e) {
  15305. throw new \RuntimeException('Could not read '.$this->path."\n\n".$e->getMessage());
  15306. }
  15307. return static::parseJson($json, $this->path);
  15308. }
  15309. public function write(array $hash, $options = 448)
  15310. {
  15311. $dir = dirname($this->path);
  15312. if (!is_dir($dir)) {
  15313. if (file_exists($dir)) {
  15314. throw new \UnexpectedValueException(
  15315. $dir.' exists and is not a directory.'
  15316. );
  15317. }
  15318. if (!@mkdir($dir, 0777, true)) {
  15319. throw new \UnexpectedValueException(
  15320. $dir.' does not exist and could not be created.'
  15321. );
  15322. }
  15323. }
  15324. $retries = 3;
  15325. while ($retries--) {
  15326. try {
  15327. file_put_contents($this->path, static::encode($hash, $options). ($options & self::JSON_PRETTY_PRINT ? "\n" : ''));
  15328. break;
  15329. } catch (\Exception $e) {
  15330. if ($retries) {
  15331. usleep(500000);
  15332. continue;
  15333. }
  15334. throw $e;
  15335. }
  15336. }
  15337. }
  15338. public function validateSchema($schema = self::STRICT_SCHEMA)
  15339. {
  15340. $content = file_get_contents($this->path);
  15341. $data = json_decode($content);
  15342. if (null === $data && 'null' !== $content) {
  15343. self::validateSyntax($content, $this->path);
  15344. }
  15345. $schemaFile = __DIR__ . '/../../../res/composer-schema.json';
  15346. if (false === strpos($schemaFile, '://')) {
  15347. $schemaFile = 'file://' . $schemaFile;
  15348. }
  15349. $schemaData = (object) array('$ref' => $schemaFile);
  15350. if ($schema === self::LAX_SCHEMA) {
  15351. $schemaData->additionalProperties = true;
  15352. $schemaData->required = array();
  15353. }
  15354. $validator = new Validator();
  15355. $validator->check($data, $schemaData);
  15356. if (!$validator->isValid()) {
  15357. $errors = array();
  15358. foreach ((array) $validator->getErrors() as $error) {
  15359. $errors[] = ($error['property'] ? $error['property'].' : ' : '').$error['message'];
  15360. }
  15361. throw new JsonValidationException('"'.$this->path.'" does not match the expected JSON schema', $errors);
  15362. }
  15363. return true;
  15364. }
  15365. public static function encode($data, $options = 448)
  15366. {
  15367. if (PHP_VERSION_ID >= 50400) {
  15368. $json = json_encode($data, $options);
  15369. if (false === $json) {
  15370. self::throwEncodeError(json_last_error());
  15371. }
  15372. if (PHP_VERSION_ID < 50428 || (PHP_VERSION_ID >= 50500 && PHP_VERSION_ID < 50512) || (defined('JSON_C_VERSION') && version_compare(phpversion('json'), '1.3.6', '<'))) {
  15373. $json = preg_replace('/\[\s+\]/', '[]', $json);
  15374. $json = preg_replace('/\{\s+\}/', '{}', $json);
  15375. }
  15376. return $json;
  15377. }
  15378. $json = json_encode($data);
  15379. if (false === $json) {
  15380. self::throwEncodeError(json_last_error());
  15381. }
  15382. $prettyPrint = (bool) ($options & self::JSON_PRETTY_PRINT);
  15383. $unescapeUnicode = (bool) ($options & self::JSON_UNESCAPED_UNICODE);
  15384. $unescapeSlashes = (bool) ($options & self::JSON_UNESCAPED_SLASHES);
  15385. if (!$prettyPrint && !$unescapeUnicode && !$unescapeSlashes) {
  15386. return $json;
  15387. }
  15388. return JsonFormatter::format($json, $unescapeUnicode, $unescapeSlashes);
  15389. }
  15390. private static function throwEncodeError($code)
  15391. {
  15392. switch ($code) {
  15393. case JSON_ERROR_DEPTH:
  15394. $msg = 'Maximum stack depth exceeded';
  15395. break;
  15396. case JSON_ERROR_STATE_MISMATCH:
  15397. $msg = 'Underflow or the modes mismatch';
  15398. break;
  15399. case JSON_ERROR_CTRL_CHAR:
  15400. $msg = 'Unexpected control character found';
  15401. break;
  15402. case JSON_ERROR_UTF8:
  15403. $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  15404. break;
  15405. default:
  15406. $msg = 'Unknown error';
  15407. }
  15408. throw new \RuntimeException('JSON encoding failed: '.$msg);
  15409. }
  15410. public static function parseJson($json, $file = null)
  15411. {
  15412. if (null === $json) {
  15413. return;
  15414. }
  15415. $data = json_decode($json, true);
  15416. if (null === $data && JSON_ERROR_NONE !== json_last_error()) {
  15417. self::validateSyntax($json, $file);
  15418. }
  15419. return $data;
  15420. }
  15421. protected static function validateSyntax($json, $file = null)
  15422. {
  15423. $parser = new JsonParser();
  15424. $result = $parser->lint($json);
  15425. if (null === $result) {
  15426. if (defined('JSON_ERROR_UTF8') && JSON_ERROR_UTF8 === json_last_error()) {
  15427. throw new \UnexpectedValueException('"'.$file.'" is not UTF-8, could not parse as JSON');
  15428. }
  15429. return true;
  15430. }
  15431. throw new ParsingException('"'.$file.'" does not contain valid JSON'."\n".$result->getMessage(), $result->getDetails());
  15432. }
  15433. }
  15434. <?php
  15435. namespace Composer\Json;
  15436. class JsonFormatter
  15437. {
  15438. public static function format($json, $unescapeUnicode, $unescapeSlashes)
  15439. {
  15440. $result = '';
  15441. $pos = 0;
  15442. $strLen = strlen($json);
  15443. $indentStr = ' ';
  15444. $newLine = "\n";
  15445. $outOfQuotes = true;
  15446. $buffer = '';
  15447. $noescape = true;
  15448. for ($i = 0; $i < $strLen; $i++) {
  15449. $char = substr($json, $i, 1);
  15450. if ('"' === $char && $noescape) {
  15451. $outOfQuotes = !$outOfQuotes;
  15452. }
  15453. if (!$outOfQuotes) {
  15454. $buffer .= $char;
  15455. $noescape = '\\' === $char ? !$noescape : true;
  15456. continue;
  15457. } elseif ('' !== $buffer) {
  15458. if ($unescapeSlashes) {
  15459. $buffer = str_replace('\\/', '/', $buffer);
  15460. }
  15461. if ($unescapeUnicode && function_exists('mb_convert_encoding')) {
  15462. $buffer = preg_replace_callback('/(\\\\+)u([0-9a-f]{4})/i', function ($match) {
  15463. $l = strlen($match[1]);
  15464. if ($l % 2) {
  15465. $code = hexdec($match[2]);
  15466. if (0xD800 <= $code && 0xDFFF >= $code) {
  15467. return $match[0];
  15468. }
  15469. return str_repeat('\\', $l - 1) . mb_convert_encoding(
  15470. pack('H*', $match[2]),
  15471. 'UTF-8',
  15472. 'UCS-2BE'
  15473. );
  15474. }
  15475. return $match[0];
  15476. }, $buffer);
  15477. }
  15478. $result .= $buffer.$char;
  15479. $buffer = '';
  15480. continue;
  15481. }
  15482. if (':' === $char) {
  15483. $char .= ' ';
  15484. } elseif ('}' === $char || ']' === $char) {
  15485. $pos--;
  15486. $prevChar = substr($json, $i - 1, 1);
  15487. if ('{' !== $prevChar && '[' !== $prevChar) {
  15488. $result .= $newLine;
  15489. for ($j = 0; $j < $pos; $j++) {
  15490. $result .= $indentStr;
  15491. }
  15492. } else {
  15493. $result = rtrim($result);
  15494. }
  15495. }
  15496. $result .= $char;
  15497. if (',' === $char || '{' === $char || '[' === $char) {
  15498. $result .= $newLine;
  15499. if ('{' === $char || '[' === $char) {
  15500. $pos++;
  15501. }
  15502. for ($j = 0; $j < $pos; $j++) {
  15503. $result .= $indentStr;
  15504. }
  15505. }
  15506. }
  15507. return $result;
  15508. }
  15509. }
  15510. <?php
  15511. namespace Composer\Json;
  15512. use Composer\Repository\PlatformRepository;
  15513. class JsonManipulator
  15514. {
  15515. private static $DEFINES = '(?(DEFINE)
  15516. (?<number> -? (?= [1-9]|0(?!\d) ) \d+ (\.\d+)? ([eE] [+-]? \d+)? )
  15517. (?<boolean> true | false | null )
  15518. (?<string> " ([^"\\\\]* | \\\\ ["\\\\bfnrt\/] | \\\\ u [0-9a-f]{4} )* " )
  15519. (?<array> \[ (?: (?&json) \s* (?: , (?&json) \s* )* )? \s* \] )
  15520. (?<pair> \s* (?&string) \s* : (?&json) \s* )
  15521. (?<object> \{ (?: (?&pair) (?: , (?&pair) )* )? \s* \} )
  15522. (?<json> \s* (?: (?&number) | (?&boolean) | (?&string) | (?&array) | (?&object) ) )
  15523. )';
  15524. private $contents;
  15525. private $newline;
  15526. private $indent;
  15527. public function __construct($contents)
  15528. {
  15529. $contents = trim($contents);
  15530. if ($contents === '') {
  15531. $contents = '{}';
  15532. }
  15533. if (!$this->pregMatch('#^\{(.*)\}$#s', $contents)) {
  15534. throw new \InvalidArgumentException('The json file must be an object ({})');
  15535. }
  15536. $this->newline = false !== strpos($contents, "\r\n") ? "\r\n" : "\n";
  15537. $this->contents = $contents === '{}' ? '{' . $this->newline . '}' : $contents;
  15538. $this->detectIndenting();
  15539. }
  15540. public function getContents()
  15541. {
  15542. return $this->contents . $this->newline;
  15543. }
  15544. public function addLink($type, $package, $constraint, $sortPackages = false)
  15545. {
  15546. $decoded = JsonFile::parseJson($this->contents);
  15547. if (!isset($decoded[$type])) {
  15548. return $this->addMainKey($type, array($package => $constraint));
  15549. }
  15550. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  15551. '(?P<property>'.preg_quote(JsonFile::encode($type)).'\s*:\s*)(?P<value>(?&json))(?P<end>.*)}sx';
  15552. if (!$this->pregMatch($regex, $this->contents, $matches)) {
  15553. return false;
  15554. }
  15555. $links = $matches['value'];
  15556. $packageRegex = str_replace('/', '\\\\?/', preg_quote($package));
  15557. $regex = '{'.self::$DEFINES.'"(?P<package>'.$packageRegex.')"(\s*:\s*)(?&string)}ix';
  15558. if ($this->pregMatch($regex, $links, $packageMatches)) {
  15559. $existingPackage = $packageMatches['package'];
  15560. $packageRegex = str_replace('/', '\\\\?/', preg_quote($existingPackage));
  15561. $links = preg_replace_callback('{'.self::$DEFINES.'"'.$packageRegex.'"(?P<separator>\s*:\s*)(?&string)}ix', function ($m) use ($existingPackage, $constraint) {
  15562. return JsonFile::encode(str_replace('\\/', '/', $existingPackage)) . $m['separator'] . '"' . $constraint . '"';
  15563. }, $links);
  15564. } else {
  15565. if ($this->pregMatch('#^\s*\{\s*\S+.*?(\s*\}\s*)$#s', $links, $match)) {
  15566. $links = preg_replace(
  15567. '{'.preg_quote($match[1]).'$}',
  15568. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $match[1], '\\$'),
  15569. $links
  15570. );
  15571. } else {
  15572. $links = '{' . $this->newline .
  15573. $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $this->newline .
  15574. $this->indent . '}';
  15575. }
  15576. }
  15577. if (true === $sortPackages) {
  15578. $requirements = json_decode($links, true);
  15579. $this->sortPackages($requirements);
  15580. $links = $this->format($requirements);
  15581. }
  15582. $this->contents = $matches['start'] . $matches['property'] . $links . $matches['end'];
  15583. return true;
  15584. }
  15585. private function sortPackages(array &$packages = array())
  15586. {
  15587. $prefix = function ($requirement) {
  15588. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $requirement)) {
  15589. return preg_replace(
  15590. array(
  15591. '/^php/',
  15592. '/^hhvm/',
  15593. '/^ext/',
  15594. '/^lib/',
  15595. '/^\D/',
  15596. ),
  15597. array(
  15598. '0-$0',
  15599. '1-$0',
  15600. '2-$0',
  15601. '3-$0',
  15602. '4-$0',
  15603. ),
  15604. $requirement
  15605. );
  15606. }
  15607. return '5-'.$requirement;
  15608. };
  15609. uksort($packages, function ($a, $b) use ($prefix) {
  15610. return strnatcmp($prefix($a), $prefix($b));
  15611. });
  15612. }
  15613. public function addRepository($name, $config)
  15614. {
  15615. return $this->addSubNode('repositories', $name, $config);
  15616. }
  15617. public function removeRepository($name)
  15618. {
  15619. return $this->removeSubNode('repositories', $name);
  15620. }
  15621. public function addConfigSetting($name, $value)
  15622. {
  15623. return $this->addSubNode('config', $name, $value);
  15624. }
  15625. public function removeConfigSetting($name)
  15626. {
  15627. return $this->removeSubNode('config', $name);
  15628. }
  15629. public function addProperty($name, $value)
  15630. {
  15631. if (substr($name, 0, 6) === 'extra.') {
  15632. return $this->addSubNode('extra', substr($name, 6), $value);
  15633. }
  15634. if (substr($name, 0, 8) === 'scripts.') {
  15635. return $this->addSubNode('scripts', substr($name, 8), $value);
  15636. }
  15637. return $this->addMainKey($name, $value);
  15638. }
  15639. public function removeProperty($name)
  15640. {
  15641. if (substr($name, 0, 6) === 'extra.') {
  15642. return $this->removeSubNode('extra', substr($name, 6));
  15643. }
  15644. if (substr($name, 0, 8) === 'scripts.') {
  15645. return $this->removeSubNode('scripts', substr($name, 8));
  15646. }
  15647. return $this->removeMainKey($name);
  15648. }
  15649. public function addSubNode($mainNode, $name, $value)
  15650. {
  15651. $decoded = JsonFile::parseJson($this->contents);
  15652. $subName = null;
  15653. if (in_array($mainNode, array('config', 'extra', 'scripts')) && false !== strpos($name, '.')) {
  15654. list($name, $subName) = explode('.', $name, 2);
  15655. }
  15656. if (!isset($decoded[$mainNode])) {
  15657. if ($subName !== null) {
  15658. $this->addMainKey($mainNode, array($name => array($subName => $value)));
  15659. } else {
  15660. $this->addMainKey($mainNode, array($name => $value));
  15661. }
  15662. return true;
  15663. }
  15664. $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  15665. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  15666. try {
  15667. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  15668. return false;
  15669. }
  15670. } catch (\RuntimeException $e) {
  15671. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  15672. return false;
  15673. }
  15674. throw $e;
  15675. }
  15676. $children = $match['content'];
  15677. if (!@json_decode($children)) {
  15678. return false;
  15679. }
  15680. $that = $this;
  15681. $childRegex = '{'.self::$DEFINES.'(?P<start>"'.preg_quote($name).'"\s*:\s*)(?P<content>(?&json))(?P<end>,?)}x';
  15682. if ($this->pregMatch($childRegex, $children, $matches)) {
  15683. $children = preg_replace_callback($childRegex, function ($matches) use ($subName, $value, $that) {
  15684. if ($subName !== null) {
  15685. $curVal = json_decode($matches['content'], true);
  15686. if (!is_array($curVal)) {
  15687. $curVal = array();
  15688. }
  15689. $curVal[$subName] = $value;
  15690. $value = $curVal;
  15691. }
  15692. return $matches['start'] . $that->format($value, 1) . $matches['end'];
  15693. }, $children);
  15694. } else {
  15695. $this->pregMatch('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $children, $match);
  15696. $whitespace = '';
  15697. if (!empty($match['trailingspace'])) {
  15698. $whitespace = $match['trailingspace'];
  15699. }
  15700. if (!empty($match['content'])) {
  15701. if ($subName !== null) {
  15702. $value = array($subName => $value);
  15703. }
  15704. $children = preg_replace(
  15705. '#'.$whitespace.'}$#',
  15706. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}', '\\$'),
  15707. $children
  15708. );
  15709. } else {
  15710. if ($subName !== null) {
  15711. $value = array($subName => $value);
  15712. }
  15713. $children = '{' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}';
  15714. }
  15715. }
  15716. $this->contents = preg_replace_callback($nodeRegex, function ($m) use ($children) {
  15717. return $m['start'] . $children . $m['end'];
  15718. }, $this->contents);
  15719. return true;
  15720. }
  15721. public function removeSubNode($mainNode, $name)
  15722. {
  15723. $decoded = JsonFile::parseJson($this->contents);
  15724. if (empty($decoded[$mainNode])) {
  15725. return true;
  15726. }
  15727. $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  15728. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  15729. try {
  15730. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  15731. return false;
  15732. }
  15733. } catch (\RuntimeException $e) {
  15734. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  15735. return false;
  15736. }
  15737. throw $e;
  15738. }
  15739. $children = $match['content'];
  15740. if (!@json_decode($children, true)) {
  15741. return false;
  15742. }
  15743. $subName = null;
  15744. if (in_array($mainNode, array('config', 'extra', 'scripts')) && false !== strpos($name, '.')) {
  15745. list($name, $subName) = explode('.', $name, 2);
  15746. }
  15747. if (!isset($decoded[$mainNode][$name]) || ($subName && !isset($decoded[$mainNode][$name][$subName]))) {
  15748. return true;
  15749. }
  15750. if ($this->pregMatch('{"'.preg_quote($name).'"\s*:}i', $children)) {
  15751. if (preg_match_all('{'.self::$DEFINES.'"'.preg_quote($name).'"\s*:\s*(?:(?&json))}x', $children, $matches)) {
  15752. $bestMatch = '';
  15753. foreach ($matches[0] as $match) {
  15754. if (strlen($bestMatch) < strlen($match)) {
  15755. $bestMatch = $match;
  15756. }
  15757. }
  15758. $childrenClean = preg_replace('{,\s*'.preg_quote($bestMatch).'}i', '', $children, -1, $count);
  15759. if (1 !== $count) {
  15760. $childrenClean = preg_replace('{'.preg_quote($bestMatch).'\s*,?\s*}i', '', $childrenClean, -1, $count);
  15761. if (1 !== $count) {
  15762. return false;
  15763. }
  15764. }
  15765. }
  15766. } else {
  15767. $childrenClean = $children;
  15768. }
  15769. $this->pregMatch('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $childrenClean, $match);
  15770. if (empty($match['content'])) {
  15771. $newline = $this->newline;
  15772. $indent = $this->indent;
  15773. $this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($indent, $newline) {
  15774. return $matches['start'] . '{' . $newline . $indent . '}' . $matches['end'];
  15775. }, $this->contents);
  15776. if ($subName !== null) {
  15777. $curVal = json_decode($children, true);
  15778. unset($curVal[$name][$subName]);
  15779. $this->addSubNode($mainNode, $name, $curVal[$name]);
  15780. }
  15781. return true;
  15782. }
  15783. $that = $this;
  15784. $this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($that, $name, $subName, $childrenClean) {
  15785. if ($subName !== null) {
  15786. $curVal = json_decode($matches['content'], true);
  15787. unset($curVal[$name][$subName]);
  15788. $childrenClean = $that->format($curVal, 0);
  15789. }
  15790. return $matches['start'] . $childrenClean . $matches['end'];
  15791. }, $this->contents);
  15792. return true;
  15793. }
  15794. public function addMainKey($key, $content)
  15795. {
  15796. $decoded = JsonFile::parseJson($this->contents);
  15797. $content = $this->format($content);
  15798. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  15799. '(?P<key>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))(?P<end>.*)}sx';
  15800. if (isset($decoded[$key]) && $this->pregMatch($regex, $this->contents, $matches)) {
  15801. if (!@json_decode('{'.$matches['key'].'}')) {
  15802. return false;
  15803. }
  15804. $this->contents = $matches['start'] . JsonFile::encode($key).': '.$content . $matches['end'];
  15805. return true;
  15806. }
  15807. if ($this->pregMatch('#[^{\s](\s*)\}$#', $this->contents, $match)) {
  15808. $this->contents = preg_replace(
  15809. '#'.$match[1].'\}$#',
  15810. addcslashes(',' . $this->newline . $this->indent . JsonFile::encode($key). ': '. $content . $this->newline . '}', '\\$'),
  15811. $this->contents
  15812. );
  15813. return true;
  15814. }
  15815. $this->contents = preg_replace(
  15816. '#\}$#',
  15817. addcslashes($this->indent . JsonFile::encode($key). ': '.$content . $this->newline . '}', '\\$'),
  15818. $this->contents
  15819. );
  15820. return true;
  15821. }
  15822. public function removeMainKey($key)
  15823. {
  15824. $decoded = JsonFile::parseJson($this->contents);
  15825. if (!array_key_exists($key, $decoded)) {
  15826. return true;
  15827. }
  15828. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  15829. '(?P<removal>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))\s*,?\s*(?P<end>.*)}sx';
  15830. if ($this->pregMatch($regex, $this->contents, $matches)) {
  15831. if (!@json_decode('{'.$matches['removal'].'}')) {
  15832. return false;
  15833. }
  15834. if (preg_match('#,\s*$#', $matches['start']) && preg_match('#^\}$#', $matches['end'])) {
  15835. $matches['start'] = rtrim(preg_replace('#,(\s*)$#', '$1', $matches['start']), $this->indent);
  15836. }
  15837. $this->contents = $matches['start'] . $matches['end'];
  15838. if (preg_match('#^\{\s*\}\s*$#', $this->contents)) {
  15839. $this->contents = "{\n}";
  15840. }
  15841. return true;
  15842. }
  15843. return false;
  15844. }
  15845. public function format($data, $depth = 0)
  15846. {
  15847. if (is_array($data)) {
  15848. reset($data);
  15849. if (is_numeric(key($data))) {
  15850. foreach ($data as $key => $val) {
  15851. $data[$key] = $this->format($val, $depth + 1);
  15852. }
  15853. return '['.implode(', ', $data).']';
  15854. }
  15855. $out = '{' . $this->newline;
  15856. $elems = array();
  15857. foreach ($data as $key => $val) {
  15858. $elems[] = str_repeat($this->indent, $depth + 2) . JsonFile::encode($key). ': '.$this->format($val, $depth + 1);
  15859. }
  15860. return $out . implode(','.$this->newline, $elems) . $this->newline . str_repeat($this->indent, $depth + 1) . '}';
  15861. }
  15862. return JsonFile::encode($data);
  15863. }
  15864. protected function detectIndenting()
  15865. {
  15866. if ($this->pregMatch('{^([ \t]+)"}m', $this->contents, $match)) {
  15867. $this->indent = $match[1];
  15868. } else {
  15869. $this->indent = ' ';
  15870. }
  15871. }
  15872. protected function pregMatch($re, $str, &$matches = array())
  15873. {
  15874. $count = preg_match($re, $str, $matches);
  15875. if ($count === false) {
  15876. switch (preg_last_error()) {
  15877. case PREG_NO_ERROR:
  15878. throw new \RuntimeException('Failed to execute regex: PREG_NO_ERROR', PREG_NO_ERROR);
  15879. case PREG_INTERNAL_ERROR:
  15880. throw new \RuntimeException('Failed to execute regex: PREG_INTERNAL_ERROR', PREG_INTERNAL_ERROR);
  15881. case PREG_BACKTRACK_LIMIT_ERROR:
  15882. throw new \RuntimeException('Failed to execute regex: PREG_BACKTRACK_LIMIT_ERROR', PREG_BACKTRACK_LIMIT_ERROR);
  15883. case PREG_RECURSION_LIMIT_ERROR:
  15884. throw new \RuntimeException('Failed to execute regex: PREG_RECURSION_LIMIT_ERROR', PREG_RECURSION_LIMIT_ERROR);
  15885. case PREG_BAD_UTF8_ERROR:
  15886. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_ERROR', PREG_BAD_UTF8_ERROR);
  15887. case PREG_BAD_UTF8_OFFSET_ERROR:
  15888. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_OFFSET_ERROR', PREG_BAD_UTF8_OFFSET_ERROR);
  15889. case 6:
  15890. if (PHP_VERSION_ID > 70000) {
  15891. throw new \RuntimeException('Failed to execute regex: PREG_JIT_STACKLIMIT_ERROR', 6);
  15892. }
  15893. default:
  15894. throw new \RuntimeException('Failed to execute regex: Unknown error');
  15895. }
  15896. }
  15897. return $count;
  15898. }
  15899. }
  15900. <?php
  15901. namespace Composer\Json;
  15902. use Exception;
  15903. class JsonValidationException extends Exception
  15904. {
  15905. protected $errors;
  15906. public function __construct($message, $errors = array(), Exception $previous = null)
  15907. {
  15908. $this->errors = $errors;
  15909. parent::__construct($message, 0, $previous);
  15910. }
  15911. public function getErrors()
  15912. {
  15913. return $this->errors;
  15914. }
  15915. }
  15916. <?php
  15917. namespace Composer\Package;
  15918. use Composer\Semver\Constraint\Constraint;
  15919. use Composer\Package\Version\VersionParser;
  15920. class AliasPackage extends BasePackage implements CompletePackageInterface
  15921. {
  15922. protected $version;
  15923. protected $prettyVersion;
  15924. protected $dev;
  15925. protected $rootPackageAlias = false;
  15926. protected $stability;
  15927. protected $aliasOf;
  15928. protected $requires;
  15929. protected $devRequires;
  15930. protected $conflicts;
  15931. protected $provides;
  15932. protected $replaces;
  15933. public function __construct(PackageInterface $aliasOf, $version, $prettyVersion)
  15934. {
  15935. parent::__construct($aliasOf->getName());
  15936. $this->version = $version;
  15937. $this->prettyVersion = $prettyVersion;
  15938. $this->aliasOf = $aliasOf;
  15939. $this->stability = VersionParser::parseStability($version);
  15940. $this->dev = $this->stability === 'dev';
  15941. foreach (array('requires', 'devRequires', 'conflicts', 'provides', 'replaces') as $type) {
  15942. $links = $aliasOf->{'get' . ucfirst($type)}();
  15943. $this->$type = $this->replaceSelfVersionDependencies($links, $type);
  15944. }
  15945. }
  15946. public function getAliasOf()
  15947. {
  15948. return $this->aliasOf;
  15949. }
  15950. public function getVersion()
  15951. {
  15952. return $this->version;
  15953. }
  15954. public function getStability()
  15955. {
  15956. return $this->stability;
  15957. }
  15958. public function getPrettyVersion()
  15959. {
  15960. return $this->prettyVersion;
  15961. }
  15962. public function isDev()
  15963. {
  15964. return $this->dev;
  15965. }
  15966. public function getRequires()
  15967. {
  15968. return $this->requires;
  15969. }
  15970. public function getConflicts()
  15971. {
  15972. return $this->conflicts;
  15973. }
  15974. public function getProvides()
  15975. {
  15976. return $this->provides;
  15977. }
  15978. public function getReplaces()
  15979. {
  15980. return $this->replaces;
  15981. }
  15982. public function getDevRequires()
  15983. {
  15984. return $this->devRequires;
  15985. }
  15986. public function setRootPackageAlias($value)
  15987. {
  15988. return $this->rootPackageAlias = $value;
  15989. }
  15990. public function isRootPackageAlias()
  15991. {
  15992. return $this->rootPackageAlias;
  15993. }
  15994. protected function replaceSelfVersionDependencies(array $links, $linkType)
  15995. {
  15996. if (in_array($linkType, array('conflicts', 'provides', 'replaces'), true)) {
  15997. $newLinks = array();
  15998. foreach ($links as $link) {
  15999. if ('self.version' === $link->getPrettyConstraint()) {
  16000. $newLinks[] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  16001. }
  16002. }
  16003. $links = array_merge($links, $newLinks);
  16004. } else {
  16005. foreach ($links as $index => $link) {
  16006. if ('self.version' === $link->getPrettyConstraint()) {
  16007. $links[$index] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  16008. }
  16009. }
  16010. }
  16011. return $links;
  16012. }
  16013. public function getType()
  16014. {
  16015. return $this->aliasOf->getType();
  16016. }
  16017. public function getTargetDir()
  16018. {
  16019. return $this->aliasOf->getTargetDir();
  16020. }
  16021. public function getExtra()
  16022. {
  16023. return $this->aliasOf->getExtra();
  16024. }
  16025. public function setInstallationSource($type)
  16026. {
  16027. $this->aliasOf->setInstallationSource($type);
  16028. }
  16029. public function getInstallationSource()
  16030. {
  16031. return $this->aliasOf->getInstallationSource();
  16032. }
  16033. public function getSourceType()
  16034. {
  16035. return $this->aliasOf->getSourceType();
  16036. }
  16037. public function getSourceUrl()
  16038. {
  16039. return $this->aliasOf->getSourceUrl();
  16040. }
  16041. public function getSourceUrls()
  16042. {
  16043. return $this->aliasOf->getSourceUrls();
  16044. }
  16045. public function getSourceReference()
  16046. {
  16047. return $this->aliasOf->getSourceReference();
  16048. }
  16049. public function setSourceReference($reference)
  16050. {
  16051. return $this->aliasOf->setSourceReference($reference);
  16052. }
  16053. public function setSourceMirrors($mirrors)
  16054. {
  16055. return $this->aliasOf->setSourceMirrors($mirrors);
  16056. }
  16057. public function getSourceMirrors()
  16058. {
  16059. return $this->aliasOf->getSourceMirrors();
  16060. }
  16061. public function getDistType()
  16062. {
  16063. return $this->aliasOf->getDistType();
  16064. }
  16065. public function getDistUrl()
  16066. {
  16067. return $this->aliasOf->getDistUrl();
  16068. }
  16069. public function getDistUrls()
  16070. {
  16071. return $this->aliasOf->getDistUrls();
  16072. }
  16073. public function getDistReference()
  16074. {
  16075. return $this->aliasOf->getDistReference();
  16076. }
  16077. public function setDistReference($reference)
  16078. {
  16079. return $this->aliasOf->setDistReference($reference);
  16080. }
  16081. public function getDistSha1Checksum()
  16082. {
  16083. return $this->aliasOf->getDistSha1Checksum();
  16084. }
  16085. public function setTransportOptions(array $options)
  16086. {
  16087. return $this->aliasOf->setTransportOptions($options);
  16088. }
  16089. public function getTransportOptions()
  16090. {
  16091. return $this->aliasOf->getTransportOptions();
  16092. }
  16093. public function setDistMirrors($mirrors)
  16094. {
  16095. return $this->aliasOf->setDistMirrors($mirrors);
  16096. }
  16097. public function getDistMirrors()
  16098. {
  16099. return $this->aliasOf->getDistMirrors();
  16100. }
  16101. public function getScripts()
  16102. {
  16103. return $this->aliasOf->getScripts();
  16104. }
  16105. public function getLicense()
  16106. {
  16107. return $this->aliasOf->getLicense();
  16108. }
  16109. public function getAutoload()
  16110. {
  16111. return $this->aliasOf->getAutoload();
  16112. }
  16113. public function getDevAutoload()
  16114. {
  16115. return $this->aliasOf->getDevAutoload();
  16116. }
  16117. public function getIncludePaths()
  16118. {
  16119. return $this->aliasOf->getIncludePaths();
  16120. }
  16121. public function getRepositories()
  16122. {
  16123. return $this->aliasOf->getRepositories();
  16124. }
  16125. public function getReleaseDate()
  16126. {
  16127. return $this->aliasOf->getReleaseDate();
  16128. }
  16129. public function getBinaries()
  16130. {
  16131. return $this->aliasOf->getBinaries();
  16132. }
  16133. public function getKeywords()
  16134. {
  16135. return $this->aliasOf->getKeywords();
  16136. }
  16137. public function getDescription()
  16138. {
  16139. return $this->aliasOf->getDescription();
  16140. }
  16141. public function getHomepage()
  16142. {
  16143. return $this->aliasOf->getHomepage();
  16144. }
  16145. public function getSuggests()
  16146. {
  16147. return $this->aliasOf->getSuggests();
  16148. }
  16149. public function getAuthors()
  16150. {
  16151. return $this->aliasOf->getAuthors();
  16152. }
  16153. public function getSupport()
  16154. {
  16155. return $this->aliasOf->getSupport();
  16156. }
  16157. public function getNotificationUrl()
  16158. {
  16159. return $this->aliasOf->getNotificationUrl();
  16160. }
  16161. public function getArchiveExcludes()
  16162. {
  16163. return $this->aliasOf->getArchiveExcludes();
  16164. }
  16165. public function isAbandoned()
  16166. {
  16167. return $this->aliasOf->isAbandoned();
  16168. }
  16169. public function getReplacementPackage()
  16170. {
  16171. return $this->aliasOf->getReplacementPackage();
  16172. }
  16173. public function __toString()
  16174. {
  16175. return parent::__toString().' (alias of '.$this->aliasOf->getVersion().')';
  16176. }
  16177. }
  16178. <?php
  16179. namespace Composer\Package\Archiver;
  16180. use FilterIterator;
  16181. use PharData;
  16182. class ArchivableFilesFilter extends FilterIterator
  16183. {
  16184. private $dirs = array();
  16185. public function accept()
  16186. {
  16187. $file = $this->getInnerIterator()->current();
  16188. if ($file->isDir()) {
  16189. $this->dirs[] = (string) $file;
  16190. return false;
  16191. }
  16192. return true;
  16193. }
  16194. public function addEmptyDir(PharData $phar, $sources)
  16195. {
  16196. foreach ($this->dirs as $filepath) {
  16197. $localname = str_replace($sources . "/", '', $filepath);
  16198. $phar->addEmptyDir($localname);
  16199. }
  16200. }
  16201. }
  16202. <?php
  16203. namespace Composer\Package\Archiver;
  16204. use Composer\Util\Filesystem;
  16205. use FilesystemIterator;
  16206. use Symfony\Component\Finder\Finder;
  16207. use Symfony\Component\Finder\SplFileInfo;
  16208. class ArchivableFilesFinder extends \FilterIterator
  16209. {
  16210. protected $finder;
  16211. public function __construct($sources, array $excludes, $ignoreFilters = false)
  16212. {
  16213. $fs = new Filesystem();
  16214. $sources = $fs->normalizePath($sources);
  16215. if ($ignoreFilters) {
  16216. $filters = array();
  16217. } else {
  16218. $filters = array(
  16219. new HgExcludeFilter($sources),
  16220. new GitExcludeFilter($sources),
  16221. new ComposerExcludeFilter($sources, $excludes),
  16222. );
  16223. }
  16224. $this->finder = new Finder();
  16225. $filter = function (\SplFileInfo $file) use ($sources, $filters, $fs) {
  16226. if ($file->isLink() && strpos($file->getLinkTarget(), $sources) !== 0) {
  16227. return false;
  16228. }
  16229. $relativePath = preg_replace(
  16230. '#^'.preg_quote($sources, '#').'#',
  16231. '',
  16232. $fs->normalizePath($file->getRealPath())
  16233. );
  16234. $exclude = false;
  16235. foreach ($filters as $filter) {
  16236. $exclude = $filter->filter($relativePath, $exclude);
  16237. }
  16238. return !$exclude;
  16239. };
  16240. if (method_exists($filter, 'bindTo')) {
  16241. $filter = $filter->bindTo(null);
  16242. }
  16243. $this->finder
  16244. ->in($sources)
  16245. ->filter($filter)
  16246. ->ignoreVCS(true)
  16247. ->ignoreDotFiles(false);
  16248. parent::__construct($this->finder->getIterator());
  16249. }
  16250. public function accept()
  16251. {
  16252. $current = $this->getInnerIterator()->current();
  16253. if (!$current->isDir()) {
  16254. return true;
  16255. }
  16256. $iterator = new FilesystemIterator($current, FilesystemIterator::SKIP_DOTS);
  16257. return !$iterator->valid();
  16258. }
  16259. }
  16260. <?php
  16261. namespace Composer\Package\Archiver;
  16262. use Composer\Downloader\DownloadManager;
  16263. use Composer\Package\PackageInterface;
  16264. use Composer\Package\RootPackageInterface;
  16265. use Composer\Util\Filesystem;
  16266. use Composer\Json\JsonFile;
  16267. class ArchiveManager
  16268. {
  16269. protected $downloadManager;
  16270. protected $archivers = array();
  16271. protected $overwriteFiles = true;
  16272. public function __construct(DownloadManager $downloadManager)
  16273. {
  16274. $this->downloadManager = $downloadManager;
  16275. }
  16276. public function addArchiver(ArchiverInterface $archiver)
  16277. {
  16278. $this->archivers[] = $archiver;
  16279. }
  16280. public function setOverwriteFiles($overwriteFiles)
  16281. {
  16282. $this->overwriteFiles = $overwriteFiles;
  16283. return $this;
  16284. }
  16285. public function getPackageFilename(PackageInterface $package)
  16286. {
  16287. $nameParts = array(preg_replace('#[^a-z0-9-_]#i', '-', $package->getName()));
  16288. if (preg_match('{^[a-f0-9]{40}$}', $package->getDistReference())) {
  16289. array_push($nameParts, $package->getDistReference(), $package->getDistType());
  16290. } else {
  16291. array_push($nameParts, $package->getPrettyVersion(), $package->getDistReference());
  16292. }
  16293. if ($package->getSourceReference()) {
  16294. $nameParts[] = substr(sha1($package->getSourceReference()), 0, 6);
  16295. }
  16296. $name = implode('-', array_filter($nameParts, function ($p) {
  16297. return !empty($p);
  16298. }));
  16299. return str_replace('/', '-', $name);
  16300. }
  16301. public function archive(PackageInterface $package, $format, $targetDir, $fileName = null, $ignoreFilters = false)
  16302. {
  16303. if (empty($format)) {
  16304. throw new \InvalidArgumentException('Format must be specified');
  16305. }
  16306. $usableArchiver = null;
  16307. foreach ($this->archivers as $archiver) {
  16308. if ($archiver->supports($format, $package->getSourceType())) {
  16309. $usableArchiver = $archiver;
  16310. break;
  16311. }
  16312. }
  16313. if (null === $usableArchiver) {
  16314. throw new \RuntimeException(sprintf('No archiver found to support %s format', $format));
  16315. }
  16316. $filesystem = new Filesystem();
  16317. if (null === $fileName) {
  16318. $packageName = $this->getPackageFilename($package);
  16319. } else {
  16320. $packageName = $fileName;
  16321. }
  16322. $filesystem->ensureDirectoryExists($targetDir);
  16323. $target = realpath($targetDir).'/'.$packageName.'.'.$format;
  16324. $filesystem->ensureDirectoryExists(dirname($target));
  16325. if (!$this->overwriteFiles && file_exists($target)) {
  16326. return $target;
  16327. }
  16328. if ($package instanceof RootPackageInterface) {
  16329. $sourcePath = realpath('.');
  16330. } else {
  16331. $sourcePath = sys_get_temp_dir().'/composer_archive'.uniqid();
  16332. $filesystem->ensureDirectoryExists($sourcePath);
  16333. $this->downloadManager->download($package, $sourcePath);
  16334. if (file_exists($composerJsonPath = $sourcePath.'/composer.json')) {
  16335. $jsonFile = new JsonFile($composerJsonPath);
  16336. $jsonData = $jsonFile->read();
  16337. if (!empty($jsonData['archive']['exclude'])) {
  16338. $package->setArchiveExcludes($jsonData['archive']['exclude']);
  16339. }
  16340. }
  16341. }
  16342. $tempTarget = sys_get_temp_dir().'/composer_archive'.uniqid().'.'.$format;
  16343. $filesystem->ensureDirectoryExists(dirname($tempTarget));
  16344. $archivePath = $usableArchiver->archive($sourcePath, $tempTarget, $format, $package->getArchiveExcludes(), $ignoreFilters);
  16345. $filesystem->rename($archivePath, $target);
  16346. if (!$package instanceof RootPackageInterface) {
  16347. $filesystem->removeDirectory($sourcePath);
  16348. }
  16349. $filesystem->remove($tempTarget);
  16350. return $target;
  16351. }
  16352. }
  16353. <?php
  16354. namespace Composer\Package\Archiver;
  16355. interface ArchiverInterface
  16356. {
  16357. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false);
  16358. public function supports($format, $sourceType);
  16359. }
  16360. <?php
  16361. namespace Composer\Package\Archiver;
  16362. use Symfony\Component\Finder;
  16363. abstract class BaseExcludeFilter
  16364. {
  16365. protected $sourcePath;
  16366. protected $excludePatterns;
  16367. public function __construct($sourcePath)
  16368. {
  16369. $this->sourcePath = $sourcePath;
  16370. $this->excludePatterns = array();
  16371. }
  16372. public function filter($relativePath, $exclude)
  16373. {
  16374. foreach ($this->excludePatterns as $patternData) {
  16375. list($pattern, $negate, $stripLeadingSlash) = $patternData;
  16376. if ($stripLeadingSlash) {
  16377. $path = substr($relativePath, 1);
  16378. } else {
  16379. $path = $relativePath;
  16380. }
  16381. if (preg_match($pattern, $path)) {
  16382. $exclude = !$negate;
  16383. }
  16384. }
  16385. return $exclude;
  16386. }
  16387. protected function parseLines(array $lines, $lineParser)
  16388. {
  16389. return array_filter(
  16390. array_map(
  16391. function ($line) use ($lineParser) {
  16392. $line = trim($line);
  16393. if (!$line || 0 === strpos($line, '#')) {
  16394. return null;
  16395. }
  16396. return call_user_func($lineParser, $line);
  16397. },
  16398. $lines
  16399. ),
  16400. function ($pattern) {
  16401. return $pattern !== null;
  16402. }
  16403. );
  16404. }
  16405. protected function generatePatterns($rules)
  16406. {
  16407. $patterns = array();
  16408. foreach ($rules as $rule) {
  16409. $patterns[] = $this->generatePattern($rule);
  16410. }
  16411. return $patterns;
  16412. }
  16413. protected function generatePattern($rule)
  16414. {
  16415. $negate = false;
  16416. $pattern = '{';
  16417. if (strlen($rule) && $rule[0] === '!') {
  16418. $negate = true;
  16419. $rule = substr($rule, 1);
  16420. }
  16421. if (strlen($rule) && $rule[0] === '/') {
  16422. $pattern .= '^/';
  16423. $rule = substr($rule, 1);
  16424. } elseif (strlen($rule) - 1 === strpos($rule, '/')) {
  16425. $pattern .= '/';
  16426. $rule = substr($rule, 0, -1);
  16427. } elseif (false === strpos($rule, '/')) {
  16428. $pattern .= '/';
  16429. }
  16430. $pattern .= substr(Finder\Glob::toRegex($rule), 2, -2) . '(?=$|/)';
  16431. return array($pattern . '}', $negate, false);
  16432. }
  16433. }
  16434. <?php
  16435. namespace Composer\Package\Archiver;
  16436. class ComposerExcludeFilter extends BaseExcludeFilter
  16437. {
  16438. public function __construct($sourcePath, array $excludeRules)
  16439. {
  16440. parent::__construct($sourcePath);
  16441. $this->excludePatterns = $this->generatePatterns($excludeRules);
  16442. }
  16443. }
  16444. <?php
  16445. namespace Composer\Package\Archiver;
  16446. class GitExcludeFilter extends BaseExcludeFilter
  16447. {
  16448. public function __construct($sourcePath)
  16449. {
  16450. parent::__construct($sourcePath);
  16451. if (file_exists($sourcePath.'/.gitignore')) {
  16452. $this->excludePatterns = $this->parseLines(
  16453. file($sourcePath.'/.gitignore'),
  16454. array($this, 'parseGitIgnoreLine')
  16455. );
  16456. }
  16457. if (file_exists($sourcePath.'/.gitattributes')) {
  16458. $this->excludePatterns = array_merge(
  16459. $this->excludePatterns,
  16460. $this->parseLines(
  16461. file($sourcePath.'/.gitattributes'),
  16462. array($this, 'parseGitAttributesLine')
  16463. )
  16464. );
  16465. }
  16466. }
  16467. public function parseGitIgnoreLine($line)
  16468. {
  16469. return $this->generatePattern($line);
  16470. }
  16471. public function parseGitAttributesLine($line)
  16472. {
  16473. $parts = preg_split('#\s+#', $line);
  16474. if (count($parts) == 2 && $parts[1] === 'export-ignore') {
  16475. return $this->generatePattern($parts[0]);
  16476. }
  16477. return null;
  16478. }
  16479. }
  16480. <?php
  16481. namespace Composer\Package\Archiver;
  16482. use Symfony\Component\Finder;
  16483. class HgExcludeFilter extends BaseExcludeFilter
  16484. {
  16485. const HG_IGNORE_REGEX = 1;
  16486. const HG_IGNORE_GLOB = 2;
  16487. protected $patternMode;
  16488. public function __construct($sourcePath)
  16489. {
  16490. parent::__construct($sourcePath);
  16491. $this->patternMode = self::HG_IGNORE_REGEX;
  16492. if (file_exists($sourcePath.'/.hgignore')) {
  16493. $this->excludePatterns = $this->parseLines(
  16494. file($sourcePath.'/.hgignore'),
  16495. array($this, 'parseHgIgnoreLine')
  16496. );
  16497. }
  16498. }
  16499. public function parseHgIgnoreLine($line)
  16500. {
  16501. if (preg_match('#^syntax\s*:\s*(glob|regexp)$#', $line, $matches)) {
  16502. if ($matches[1] === 'glob') {
  16503. $this->patternMode = self::HG_IGNORE_GLOB;
  16504. } else {
  16505. $this->patternMode = self::HG_IGNORE_REGEX;
  16506. }
  16507. return null;
  16508. }
  16509. if ($this->patternMode == self::HG_IGNORE_GLOB) {
  16510. return $this->patternFromGlob($line);
  16511. }
  16512. return $this->patternFromRegex($line);
  16513. }
  16514. protected function patternFromGlob($line)
  16515. {
  16516. $pattern = '#'.substr(Finder\Glob::toRegex($line), 2, -1).'#';
  16517. $pattern = str_replace('[^/]*', '.*', $pattern);
  16518. return array($pattern, false, true);
  16519. }
  16520. public function patternFromRegex($line)
  16521. {
  16522. $pattern = '#'.preg_replace('/((?:\\\\\\\\)*)(\\\\?)#/', '\1\2\2\\#', $line).'#';
  16523. return array($pattern, false, true);
  16524. }
  16525. }
  16526. <?php
  16527. namespace Composer\Package\Archiver;
  16528. class PharArchiver implements ArchiverInterface
  16529. {
  16530. protected static $formats = array(
  16531. 'zip' => \Phar::ZIP,
  16532. 'tar' => \Phar::TAR,
  16533. 'tar.gz' => \Phar::TAR,
  16534. 'tar.bz2' => \Phar::TAR,
  16535. );
  16536. protected static $compressFormats = array(
  16537. 'tar.gz' => \Phar::GZ,
  16538. 'tar.bz2' => \Phar::BZ2,
  16539. );
  16540. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false)
  16541. {
  16542. $sources = realpath($sources);
  16543. if (file_exists($target)) {
  16544. unlink($target);
  16545. }
  16546. try {
  16547. $filename = substr($target, 0, strrpos($target, $format) - 1);
  16548. if (isset(static::$compressFormats[$format])) {
  16549. $target = $filename . '.tar';
  16550. }
  16551. $phar = new \PharData($target, null, null, static::$formats[$format]);
  16552. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  16553. $filesOnly = new ArchivableFilesFilter($files);
  16554. $phar->buildFromIterator($filesOnly, $sources);
  16555. $filesOnly->addEmptyDir($phar, $sources);
  16556. if (isset(static::$compressFormats[$format])) {
  16557. if (!$phar->canCompress(static::$compressFormats[$format])) {
  16558. throw new \RuntimeException(sprintf('Can not compress to %s format', $format));
  16559. }
  16560. unlink($target);
  16561. $phar->compress(static::$compressFormats[$format]);
  16562. $target = $filename . '.' . $format;
  16563. }
  16564. return $target;
  16565. } catch (\UnexpectedValueException $e) {
  16566. $message = sprintf(
  16567. "Could not create archive '%s' from '%s': %s",
  16568. $target,
  16569. $sources,
  16570. $e->getMessage()
  16571. );
  16572. throw new \RuntimeException($message, $e->getCode(), $e);
  16573. }
  16574. }
  16575. public function supports($format, $sourceType)
  16576. {
  16577. return isset(static::$formats[$format]);
  16578. }
  16579. }
  16580. <?php
  16581. namespace Composer\Package\Archiver;
  16582. use ZipArchive;
  16583. use Composer\Util\Filesystem;
  16584. class ZipArchiver implements ArchiverInterface
  16585. {
  16586. protected static $formats = array(
  16587. 'zip' => 1,
  16588. );
  16589. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false)
  16590. {
  16591. $fs = new Filesystem();
  16592. $sources = $fs->normalizePath($sources);
  16593. $zip = new ZipArchive();
  16594. $res = $zip->open($target, ZipArchive::CREATE);
  16595. if ($res === true) {
  16596. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  16597. foreach ($files as $file) {
  16598. $filepath = strtr($file->getPath()."/".$file->getFilename(), '\\', '/');
  16599. $localname = str_replace($sources.'/', '', $filepath);
  16600. if ($file->isDir()) {
  16601. $zip->addEmptyDir($localname);
  16602. } else {
  16603. $zip->addFile($filepath, $localname);
  16604. }
  16605. }
  16606. if ($zip->close()) {
  16607. return $target;
  16608. }
  16609. }
  16610. $message = sprintf(
  16611. "Could not create archive '%s' from '%s': %s",
  16612. $target,
  16613. $sources,
  16614. $zip->getStatusString()
  16615. );
  16616. throw new \RuntimeException($message);
  16617. }
  16618. public function supports($format, $sourceType)
  16619. {
  16620. return isset(static::$formats[$format]) && $this->compressionAvailable();
  16621. }
  16622. private function compressionAvailable()
  16623. {
  16624. return class_exists('ZipArchive');
  16625. }
  16626. }
  16627. <?php
  16628. namespace Composer\Package;
  16629. use Composer\Repository\RepositoryInterface;
  16630. use Composer\Repository\PlatformRepository;
  16631. abstract class BasePackage implements PackageInterface
  16632. {
  16633. public static $supportedLinkTypes = array(
  16634. 'require' => array('description' => 'requires', 'method' => 'requires'),
  16635. 'conflict' => array('description' => 'conflicts', 'method' => 'conflicts'),
  16636. 'provide' => array('description' => 'provides', 'method' => 'provides'),
  16637. 'replace' => array('description' => 'replaces', 'method' => 'replaces'),
  16638. 'require-dev' => array('description' => 'requires (for development)', 'method' => 'devRequires'),
  16639. );
  16640. const STABILITY_STABLE = 0;
  16641. const STABILITY_RC = 5;
  16642. const STABILITY_BETA = 10;
  16643. const STABILITY_ALPHA = 15;
  16644. const STABILITY_DEV = 20;
  16645. public static $stabilities = array(
  16646. 'stable' => self::STABILITY_STABLE,
  16647. 'RC' => self::STABILITY_RC,
  16648. 'beta' => self::STABILITY_BETA,
  16649. 'alpha' => self::STABILITY_ALPHA,
  16650. 'dev' => self::STABILITY_DEV,
  16651. );
  16652. public $id;
  16653. protected $name;
  16654. protected $prettyName;
  16655. protected $repository;
  16656. protected $transportOptions = array();
  16657. public function __construct($name)
  16658. {
  16659. $this->prettyName = $name;
  16660. $this->name = strtolower($name);
  16661. $this->id = -1;
  16662. }
  16663. public function getName()
  16664. {
  16665. return $this->name;
  16666. }
  16667. public function getPrettyName()
  16668. {
  16669. return $this->prettyName;
  16670. }
  16671. public function getNames()
  16672. {
  16673. $names = array(
  16674. $this->getName() => true,
  16675. );
  16676. foreach ($this->getProvides() as $link) {
  16677. $names[$link->getTarget()] = true;
  16678. }
  16679. foreach ($this->getReplaces() as $link) {
  16680. $names[$link->getTarget()] = true;
  16681. }
  16682. return array_keys($names);
  16683. }
  16684. public function setId($id)
  16685. {
  16686. $this->id = $id;
  16687. }
  16688. public function getId()
  16689. {
  16690. return $this->id;
  16691. }
  16692. public function setRepository(RepositoryInterface $repository)
  16693. {
  16694. if ($this->repository && $repository !== $this->repository) {
  16695. throw new \LogicException('A package can only be added to one repository');
  16696. }
  16697. $this->repository = $repository;
  16698. }
  16699. public function getRepository()
  16700. {
  16701. return $this->repository;
  16702. }
  16703. public function getTransportOptions()
  16704. {
  16705. return $this->transportOptions;
  16706. }
  16707. public function setTransportOptions(array $options)
  16708. {
  16709. $this->transportOptions = $options;
  16710. }
  16711. public function isPlatform()
  16712. {
  16713. return $this->getRepository() instanceof PlatformRepository;
  16714. }
  16715. public function getUniqueName()
  16716. {
  16717. return $this->getName().'-'.$this->getVersion();
  16718. }
  16719. public function equals(PackageInterface $package)
  16720. {
  16721. $self = $this;
  16722. if ($this instanceof AliasPackage) {
  16723. $self = $this->getAliasOf();
  16724. }
  16725. if ($package instanceof AliasPackage) {
  16726. $package = $package->getAliasOf();
  16727. }
  16728. return $package === $self;
  16729. }
  16730. public function __toString()
  16731. {
  16732. return $this->getUniqueName();
  16733. }
  16734. public function getPrettyString()
  16735. {
  16736. return $this->getPrettyName().' '.$this->getPrettyVersion();
  16737. }
  16738. public function getFullPrettyVersion($truncate = true)
  16739. {
  16740. if (!$this->isDev() || !in_array($this->getSourceType(), array('hg', 'git'))) {
  16741. return $this->getPrettyVersion();
  16742. }
  16743. if ($truncate && strlen($this->getSourceReference()) === 40) {
  16744. return $this->getPrettyVersion() . ' ' . substr($this->getSourceReference(), 0, 7);
  16745. }
  16746. return $this->getPrettyVersion() . ' ' . $this->getSourceReference();
  16747. }
  16748. public function getStabilityPriority()
  16749. {
  16750. return self::$stabilities[$this->getStability()];
  16751. }
  16752. public function __clone()
  16753. {
  16754. $this->repository = null;
  16755. $this->id = -1;
  16756. }
  16757. }
  16758. <?php
  16759. namespace Composer\Package\Comparer;
  16760. class Comparer
  16761. {
  16762. private $source;
  16763. private $update;
  16764. private $changed;
  16765. public function setSource($source)
  16766. {
  16767. $this->source = $source;
  16768. }
  16769. public function setUpdate($update)
  16770. {
  16771. $this->update = $update;
  16772. }
  16773. public function getChanged($toString = false, $explicated = false)
  16774. {
  16775. $changed = $this->changed;
  16776. if (!count($changed)) {
  16777. return false;
  16778. }
  16779. if ($explicated) {
  16780. foreach ($changed as $sectionKey => $itemSection) {
  16781. foreach ($itemSection as $itemKey => $item) {
  16782. $changed[$sectionKey][$itemKey] = $item.' ('.$sectionKey.')';
  16783. }
  16784. }
  16785. }
  16786. if ($toString) {
  16787. foreach ($changed as $sectionKey => $itemSection) {
  16788. foreach ($itemSection as $itemKey => $item) {
  16789. $changed['string'][] = $item."\r\n";
  16790. }
  16791. }
  16792. $changed = implode("\r\n", $changed['string']);
  16793. }
  16794. return $changed;
  16795. }
  16796. public function doCompare()
  16797. {
  16798. $source = array();
  16799. $destination = array();
  16800. $this->changed = array();
  16801. $currentDirectory = getcwd();
  16802. chdir($this->source);
  16803. $source = $this->doTree('.', $source);
  16804. if (!is_array($source)) {
  16805. return;
  16806. }
  16807. chdir($currentDirectory);
  16808. chdir($this->update);
  16809. $destination = $this->doTree('.', $destination);
  16810. if (!is_array($destination)) {
  16811. exit;
  16812. }
  16813. chdir($currentDirectory);
  16814. foreach ($source as $dir => $value) {
  16815. foreach ($value as $file => $hash) {
  16816. if (isset($destination[$dir][$file])) {
  16817. if ($hash !== $destination[$dir][$file]) {
  16818. $this->changed['changed'][] = $dir.'/'.$file;
  16819. }
  16820. } else {
  16821. $this->changed['removed'][] = $dir.'/'.$file;
  16822. }
  16823. }
  16824. }
  16825. foreach ($destination as $dir => $value) {
  16826. foreach ($value as $file => $hash) {
  16827. if (!isset($source[$dir][$file])) {
  16828. $this->changed['added'][] = $dir.'/'.$file;
  16829. }
  16830. }
  16831. }
  16832. }
  16833. private function doTree($dir, &$array)
  16834. {
  16835. if ($dh = opendir($dir)) {
  16836. while ($file = readdir($dh)) {
  16837. if ($file !== '.' && $file !== '..') {
  16838. if (is_dir($dir.'/'.$file)) {
  16839. if (!count($array)) {
  16840. $array[0] = 'Temp';
  16841. }
  16842. if (!$this->doTree($dir.'/'.$file, $array)) {
  16843. return false;
  16844. }
  16845. } else {
  16846. if (filesize($dir.'/'.$file)) {
  16847. set_time_limit(30);
  16848. $array[$dir][$file] = md5_file($dir.'/'.$file);
  16849. }
  16850. }
  16851. }
  16852. }
  16853. if (count($array) > 1 && isset($array['0'])) {
  16854. unset($array['0']);
  16855. }
  16856. return $array;
  16857. }
  16858. return false;
  16859. }
  16860. }
  16861. <?php
  16862. namespace Composer\Package;
  16863. class CompletePackage extends Package implements CompletePackageInterface
  16864. {
  16865. protected $repositories;
  16866. protected $license = array();
  16867. protected $keywords;
  16868. protected $authors;
  16869. protected $description;
  16870. protected $homepage;
  16871. protected $scripts = array();
  16872. protected $support = array();
  16873. protected $abandoned = false;
  16874. public function setScripts(array $scripts)
  16875. {
  16876. $this->scripts = $scripts;
  16877. }
  16878. public function getScripts()
  16879. {
  16880. return $this->scripts;
  16881. }
  16882. public function setRepositories($repositories)
  16883. {
  16884. $this->repositories = $repositories;
  16885. }
  16886. public function getRepositories()
  16887. {
  16888. return $this->repositories;
  16889. }
  16890. public function setLicense(array $license)
  16891. {
  16892. $this->license = $license;
  16893. }
  16894. public function getLicense()
  16895. {
  16896. return $this->license;
  16897. }
  16898. public function setKeywords(array $keywords)
  16899. {
  16900. $this->keywords = $keywords;
  16901. }
  16902. public function getKeywords()
  16903. {
  16904. return $this->keywords;
  16905. }
  16906. public function setAuthors(array $authors)
  16907. {
  16908. $this->authors = $authors;
  16909. }
  16910. public function getAuthors()
  16911. {
  16912. return $this->authors;
  16913. }
  16914. public function setDescription($description)
  16915. {
  16916. $this->description = $description;
  16917. }
  16918. public function getDescription()
  16919. {
  16920. return $this->description;
  16921. }
  16922. public function setHomepage($homepage)
  16923. {
  16924. $this->homepage = $homepage;
  16925. }
  16926. public function getHomepage()
  16927. {
  16928. return $this->homepage;
  16929. }
  16930. public function setSupport(array $support)
  16931. {
  16932. $this->support = $support;
  16933. }
  16934. public function getSupport()
  16935. {
  16936. return $this->support;
  16937. }
  16938. public function isAbandoned()
  16939. {
  16940. return (bool) $this->abandoned;
  16941. }
  16942. public function setAbandoned($abandoned)
  16943. {
  16944. $this->abandoned = $abandoned;
  16945. }
  16946. public function getReplacementPackage()
  16947. {
  16948. return is_string($this->abandoned) ? $this->abandoned : null;
  16949. }
  16950. }
  16951. <?php
  16952. namespace Composer\Package;
  16953. interface CompletePackageInterface extends PackageInterface
  16954. {
  16955. public function getScripts();
  16956. public function getRepositories();
  16957. public function getLicense();
  16958. public function getKeywords();
  16959. public function getDescription();
  16960. public function getHomepage();
  16961. public function getAuthors();
  16962. public function getSupport();
  16963. public function isAbandoned();
  16964. public function getReplacementPackage();
  16965. }
  16966. <?php
  16967. namespace Composer\Package\Dumper;
  16968. use Composer\Package\BasePackage;
  16969. use Composer\Package\PackageInterface;
  16970. use Composer\Package\CompletePackageInterface;
  16971. use Composer\Package\RootPackageInterface;
  16972. class ArrayDumper
  16973. {
  16974. public function dump(PackageInterface $package)
  16975. {
  16976. $keys = array(
  16977. 'binaries' => 'bin',
  16978. 'type',
  16979. 'extra',
  16980. 'installationSource' => 'installation-source',
  16981. 'autoload',
  16982. 'devAutoload' => 'autoload-dev',
  16983. 'notificationUrl' => 'notification-url',
  16984. 'includePaths' => 'include-path',
  16985. );
  16986. $data = array();
  16987. $data['name'] = $package->getPrettyName();
  16988. $data['version'] = $package->getPrettyVersion();
  16989. $data['version_normalized'] = $package->getVersion();
  16990. if ($package->getTargetDir()) {
  16991. $data['target-dir'] = $package->getTargetDir();
  16992. }
  16993. if ($package->getSourceType()) {
  16994. $data['source']['type'] = $package->getSourceType();
  16995. $data['source']['url'] = $package->getSourceUrl();
  16996. $data['source']['reference'] = $package->getSourceReference();
  16997. if ($mirrors = $package->getSourceMirrors()) {
  16998. $data['source']['mirrors'] = $mirrors;
  16999. }
  17000. }
  17001. if ($package->getDistType()) {
  17002. $data['dist']['type'] = $package->getDistType();
  17003. $data['dist']['url'] = $package->getDistUrl();
  17004. $data['dist']['reference'] = $package->getDistReference();
  17005. $data['dist']['shasum'] = $package->getDistSha1Checksum();
  17006. if ($mirrors = $package->getDistMirrors()) {
  17007. $data['dist']['mirrors'] = $mirrors;
  17008. }
  17009. }
  17010. if ($package->getArchiveExcludes()) {
  17011. $data['archive']['exclude'] = $package->getArchiveExcludes();
  17012. }
  17013. foreach (BasePackage::$supportedLinkTypes as $type => $opts) {
  17014. if ($links = $package->{'get'.ucfirst($opts['method'])}()) {
  17015. foreach ($links as $link) {
  17016. $data[$type][$link->getTarget()] = $link->getPrettyConstraint();
  17017. }
  17018. ksort($data[$type]);
  17019. }
  17020. }
  17021. if ($packages = $package->getSuggests()) {
  17022. ksort($packages);
  17023. $data['suggest'] = $packages;
  17024. }
  17025. if ($package->getReleaseDate()) {
  17026. $data['time'] = $package->getReleaseDate()->format(DATE_RFC3339);
  17027. }
  17028. $data = $this->dumpValues($package, $keys, $data);
  17029. if ($package instanceof CompletePackageInterface) {
  17030. $keys = array(
  17031. 'scripts',
  17032. 'license',
  17033. 'authors',
  17034. 'description',
  17035. 'homepage',
  17036. 'keywords',
  17037. 'repositories',
  17038. 'support',
  17039. );
  17040. $data = $this->dumpValues($package, $keys, $data);
  17041. if (isset($data['keywords']) && is_array($data['keywords'])) {
  17042. sort($data['keywords']);
  17043. }
  17044. if ($package->isAbandoned()) {
  17045. $data['abandoned'] = $package->getReplacementPackage() ?: true;
  17046. }
  17047. }
  17048. if ($package instanceof RootPackageInterface) {
  17049. $minimumStability = $package->getMinimumStability();
  17050. if ($minimumStability) {
  17051. $data['minimum-stability'] = $minimumStability;
  17052. }
  17053. }
  17054. if (count($package->getTransportOptions()) > 0) {
  17055. $data['transport-options'] = $package->getTransportOptions();
  17056. }
  17057. return $data;
  17058. }
  17059. private function dumpValues(PackageInterface $package, array $keys, array $data)
  17060. {
  17061. foreach ($keys as $method => $key) {
  17062. if (is_numeric($method)) {
  17063. $method = $key;
  17064. }
  17065. $getter = 'get'.ucfirst($method);
  17066. $value = $package->$getter();
  17067. if (null !== $value && !(is_array($value) && 0 === count($value))) {
  17068. $data[$key] = $value;
  17069. }
  17070. }
  17071. return $data;
  17072. }
  17073. }
  17074. <?php
  17075. namespace Composer\Package;
  17076. use Composer\Semver\Constraint\ConstraintInterface;
  17077. class Link
  17078. {
  17079. protected $source;
  17080. protected $target;
  17081. protected $constraint;
  17082. protected $description;
  17083. protected $prettyConstraint;
  17084. public function __construct($source, $target, ConstraintInterface $constraint = null, $description = 'relates to', $prettyConstraint = null)
  17085. {
  17086. $this->source = strtolower($source);
  17087. $this->target = strtolower($target);
  17088. $this->constraint = $constraint;
  17089. $this->description = $description;
  17090. $this->prettyConstraint = $prettyConstraint;
  17091. }
  17092. public function getDescription()
  17093. {
  17094. return $this->description;
  17095. }
  17096. public function getSource()
  17097. {
  17098. return $this->source;
  17099. }
  17100. public function getTarget()
  17101. {
  17102. return $this->target;
  17103. }
  17104. public function getConstraint()
  17105. {
  17106. return $this->constraint;
  17107. }
  17108. public function getPrettyConstraint()
  17109. {
  17110. if (null === $this->prettyConstraint) {
  17111. throw new \UnexpectedValueException(sprintf('Link %s has been misconfigured and had no prettyConstraint given.', $this));
  17112. }
  17113. return $this->prettyConstraint;
  17114. }
  17115. public function __toString()
  17116. {
  17117. return $this->source.' '.$this->description.' '.$this->target.' ('.$this->constraint.')';
  17118. }
  17119. public function getPrettyString(PackageInterface $sourcePackage)
  17120. {
  17121. return $sourcePackage->getPrettyString().' '.$this->description.' '.$this->target.' '.$this->constraint->getPrettyString().'';
  17122. }
  17123. }
  17124. <?php
  17125. namespace Composer\Package\LinkConstraint;
  17126. use Composer\Semver\Constraint\EmptyConstraint as SemverEmptyConstraint;
  17127. trigger_error('The ' . __NAMESPACE__ . '\EmptyConstraint class is deprecated, use Composer\Semver\Constraint\EmptyConstraint instead.', E_USER_DEPRECATED);
  17128. class EmptyConstraint extends SemverEmptyConstraint implements LinkConstraintInterface
  17129. {
  17130. }
  17131. <?php
  17132. namespace Composer\Package\LinkConstraint;
  17133. use Composer\Semver\Constraint\ConstraintInterface;
  17134. trigger_error('The ' . __NAMESPACE__ . '\LinkConstraintInterface interface is deprecated, use Composer\Semver\Constraint\ConstraintInterface instead.', E_USER_DEPRECATED);
  17135. interface LinkConstraintInterface extends ConstraintInterface
  17136. {
  17137. }
  17138. <?php
  17139. namespace Composer\Package\LinkConstraint;
  17140. use Composer\Semver\Constraint\MultiConstraint as SemverMultiConstraint;
  17141. trigger_error('The ' . __NAMESPACE__ . '\MultiConstraint class is deprecated, use Composer\Semver\Constraint\MultiConstraint instead.', E_USER_DEPRECATED);
  17142. class MultiConstraint extends SemverMultiConstraint implements LinkConstraintInterface
  17143. {
  17144. }
  17145. <?php
  17146. namespace Composer\Package\LinkConstraint;
  17147. use Composer\Semver\Constraint\AbstractConstraint;
  17148. trigger_error('The ' . __NAMESPACE__ . '\SpecificConstraint abstract class is deprecated, there is no replacement for it.', E_USER_DEPRECATED);
  17149. abstract class SpecificConstraint extends AbstractConstraint implements LinkConstraintInterface
  17150. {
  17151. }
  17152. <?php
  17153. namespace Composer\Package\LinkConstraint;
  17154. use Composer\Semver\Constraint\Constraint;
  17155. trigger_error('The ' . __NAMESPACE__ . '\VersionConstraint class is deprecated, use Composer\Semver\Constraint\Constraint instead.', E_USER_DEPRECATED);
  17156. class VersionConstraint extends Constraint implements LinkConstraintInterface
  17157. {
  17158. }
  17159. <?php
  17160. namespace Composer\Package\Loader;
  17161. use Composer\Package;
  17162. use Composer\Package\AliasPackage;
  17163. use Composer\Package\Link;
  17164. use Composer\Package\RootAliasPackage;
  17165. use Composer\Package\RootPackageInterface;
  17166. use Composer\Package\Version\VersionParser;
  17167. use Composer\Semver\VersionParser as SemverVersionParser;
  17168. class ArrayLoader implements LoaderInterface
  17169. {
  17170. protected $versionParser;
  17171. protected $loadOptions;
  17172. public function __construct(SemverVersionParser $parser = null, $loadOptions = false)
  17173. {
  17174. if (!$parser) {
  17175. $parser = new VersionParser;
  17176. }
  17177. $this->versionParser = $parser;
  17178. $this->loadOptions = $loadOptions;
  17179. }
  17180. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  17181. {
  17182. if (!isset($config['name'])) {
  17183. throw new \UnexpectedValueException('Unknown package has no name defined ('.json_encode($config).').');
  17184. }
  17185. if (!isset($config['version'])) {
  17186. throw new \UnexpectedValueException('Package '.$config['name'].' has no version defined.');
  17187. }
  17188. if (isset($config['version_normalized'])) {
  17189. $version = $config['version_normalized'];
  17190. } else {
  17191. $version = $this->versionParser->normalize($config['version']);
  17192. }
  17193. $package = new $class($config['name'], $version, $config['version']);
  17194. $package->setType(isset($config['type']) ? strtolower($config['type']) : 'library');
  17195. if (isset($config['target-dir'])) {
  17196. $package->setTargetDir($config['target-dir']);
  17197. }
  17198. if (isset($config['extra']) && is_array($config['extra'])) {
  17199. $package->setExtra($config['extra']);
  17200. }
  17201. if (isset($config['bin'])) {
  17202. foreach ((array) $config['bin'] as $key => $bin) {
  17203. $config['bin'][$key] = ltrim($bin, '/');
  17204. }
  17205. $package->setBinaries((array) $config['bin']);
  17206. }
  17207. if (isset($config['installation-source'])) {
  17208. $package->setInstallationSource($config['installation-source']);
  17209. }
  17210. if (isset($config['source'])) {
  17211. if (!isset($config['source']['type']) || !isset($config['source']['url']) || !isset($config['source']['reference'])) {
  17212. throw new \UnexpectedValueException(sprintf(
  17213. "Package %s's source key should be specified as {\"type\": ..., \"url\": ..., \"reference\": ...},\n%s given.",
  17214. $config['name'],
  17215. json_encode($config['source'])
  17216. ));
  17217. }
  17218. $package->setSourceType($config['source']['type']);
  17219. $package->setSourceUrl($config['source']['url']);
  17220. $package->setSourceReference($config['source']['reference']);
  17221. if (isset($config['source']['mirrors'])) {
  17222. $package->setSourceMirrors($config['source']['mirrors']);
  17223. }
  17224. }
  17225. if (isset($config['dist'])) {
  17226. if (!isset($config['dist']['type'])
  17227. || !isset($config['dist']['url'])) {
  17228. throw new \UnexpectedValueException(sprintf(
  17229. "Package %s's dist key should be specified as ".
  17230. "{\"type\": ..., \"url\": ..., \"reference\": ..., \"shasum\": ...},\n%s given.",
  17231. $config['name'],
  17232. json_encode($config['dist'])
  17233. ));
  17234. }
  17235. $package->setDistType($config['dist']['type']);
  17236. $package->setDistUrl($config['dist']['url']);
  17237. $package->setDistReference(isset($config['dist']['reference']) ? $config['dist']['reference'] : null);
  17238. $package->setDistSha1Checksum(isset($config['dist']['shasum']) ? $config['dist']['shasum'] : null);
  17239. if (isset($config['dist']['mirrors'])) {
  17240. $package->setDistMirrors($config['dist']['mirrors']);
  17241. }
  17242. }
  17243. foreach (Package\BasePackage::$supportedLinkTypes as $type => $opts) {
  17244. if (isset($config[$type])) {
  17245. $method = 'set'.ucfirst($opts['method']);
  17246. $package->{$method}(
  17247. $this->parseLinks(
  17248. $package->getName(),
  17249. $package->getPrettyVersion(),
  17250. $opts['description'],
  17251. $config[$type]
  17252. )
  17253. );
  17254. }
  17255. }
  17256. if (isset($config['suggest']) && is_array($config['suggest'])) {
  17257. foreach ($config['suggest'] as $target => $reason) {
  17258. if ('self.version' === trim($reason)) {
  17259. $config['suggest'][$target] = $package->getPrettyVersion();
  17260. }
  17261. }
  17262. $package->setSuggests($config['suggest']);
  17263. }
  17264. if (isset($config['autoload'])) {
  17265. $package->setAutoload($config['autoload']);
  17266. }
  17267. if (isset($config['autoload-dev'])) {
  17268. $package->setDevAutoload($config['autoload-dev']);
  17269. }
  17270. if (isset($config['include-path'])) {
  17271. $package->setIncludePaths($config['include-path']);
  17272. }
  17273. if (!empty($config['time'])) {
  17274. $time = preg_match('/^\d++$/D', $config['time']) ? '@'.$config['time'] : $config['time'];
  17275. try {
  17276. $date = new \DateTime($time, new \DateTimeZone('UTC'));
  17277. $package->setReleaseDate($date);
  17278. } catch (\Exception $e) {
  17279. }
  17280. }
  17281. if (!empty($config['notification-url'])) {
  17282. $package->setNotificationUrl($config['notification-url']);
  17283. }
  17284. if (!empty($config['archive']['exclude'])) {
  17285. $package->setArchiveExcludes($config['archive']['exclude']);
  17286. }
  17287. if ($package instanceof Package\CompletePackageInterface) {
  17288. if (isset($config['scripts']) && is_array($config['scripts'])) {
  17289. foreach ($config['scripts'] as $event => $listeners) {
  17290. $config['scripts'][$event] = (array) $listeners;
  17291. }
  17292. if (isset($config['scripts']['composer'])) {
  17293. trigger_error('The `composer` script name is reserved for internal use, please avoid defining it', E_USER_DEPRECATED);
  17294. }
  17295. $package->setScripts($config['scripts']);
  17296. }
  17297. if (!empty($config['description']) && is_string($config['description'])) {
  17298. $package->setDescription($config['description']);
  17299. }
  17300. if (!empty($config['homepage']) && is_string($config['homepage'])) {
  17301. $package->setHomepage($config['homepage']);
  17302. }
  17303. if (!empty($config['keywords']) && is_array($config['keywords'])) {
  17304. $package->setKeywords($config['keywords']);
  17305. }
  17306. if (!empty($config['license'])) {
  17307. $package->setLicense(is_array($config['license']) ? $config['license'] : array($config['license']));
  17308. }
  17309. if (!empty($config['authors']) && is_array($config['authors'])) {
  17310. $package->setAuthors($config['authors']);
  17311. }
  17312. if (isset($config['support'])) {
  17313. $package->setSupport($config['support']);
  17314. }
  17315. if (isset($config['abandoned'])) {
  17316. $package->setAbandoned($config['abandoned']);
  17317. }
  17318. }
  17319. if ($aliasNormalized = $this->getBranchAlias($config)) {
  17320. if ($package instanceof RootPackageInterface) {
  17321. $package = new RootAliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  17322. } else {
  17323. $package = new AliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  17324. }
  17325. }
  17326. if ($this->loadOptions && isset($config['transport-options'])) {
  17327. $package->setTransportOptions($config['transport-options']);
  17328. }
  17329. return $package;
  17330. }
  17331. public function parseLinks($source, $sourceVersion, $description, $links)
  17332. {
  17333. $res = array();
  17334. foreach ($links as $target => $constraint) {
  17335. if (!is_string($constraint)) {
  17336. throw new \UnexpectedValueException('Link constraint in '.$source.' '.$description.' > '.$target.' should be a string, got '.gettype($constraint) . ' (' . var_export($constraint, true) . ')');
  17337. }
  17338. if ('self.version' === $constraint) {
  17339. $parsedConstraint = $this->versionParser->parseConstraints($sourceVersion);
  17340. } else {
  17341. $parsedConstraint = $this->versionParser->parseConstraints($constraint);
  17342. }
  17343. $res[strtolower($target)] = new Link($source, $target, $parsedConstraint, $description, $constraint);
  17344. }
  17345. return $res;
  17346. }
  17347. public function getBranchAlias(array $config)
  17348. {
  17349. if (('dev-' !== substr($config['version'], 0, 4) && '-dev' !== substr($config['version'], -4))
  17350. || !isset($config['extra']['branch-alias'])
  17351. || !is_array($config['extra']['branch-alias'])
  17352. ) {
  17353. return;
  17354. }
  17355. foreach ($config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  17356. if ('-dev' !== substr($targetBranch, -4)) {
  17357. continue;
  17358. }
  17359. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  17360. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  17361. continue;
  17362. }
  17363. if (strtolower($config['version']) !== strtolower($sourceBranch)) {
  17364. continue;
  17365. }
  17366. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  17367. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  17368. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  17369. ) {
  17370. continue;
  17371. }
  17372. return $validatedTargetBranch;
  17373. }
  17374. }
  17375. }
  17376. <?php
  17377. namespace Composer\Package\Loader;
  17378. class InvalidPackageException extends \Exception
  17379. {
  17380. private $errors;
  17381. private $warnings;
  17382. private $data;
  17383. public function __construct(array $errors, array $warnings, array $data)
  17384. {
  17385. $this->errors = $errors;
  17386. $this->warnings = $warnings;
  17387. $this->data = $data;
  17388. parent::__construct("Invalid package information: \n".implode("\n", array_merge($errors, $warnings)));
  17389. }
  17390. public function getData()
  17391. {
  17392. return $this->data;
  17393. }
  17394. public function getErrors()
  17395. {
  17396. return $this->errors;
  17397. }
  17398. public function getWarnings()
  17399. {
  17400. return $this->warnings;
  17401. }
  17402. }
  17403. <?php
  17404. namespace Composer\Package\Loader;
  17405. use Composer\Json\JsonFile;
  17406. class JsonLoader
  17407. {
  17408. private $loader;
  17409. public function __construct(LoaderInterface $loader)
  17410. {
  17411. $this->loader = $loader;
  17412. }
  17413. public function load($json)
  17414. {
  17415. if ($json instanceof JsonFile) {
  17416. $config = $json->read();
  17417. } elseif (file_exists($json)) {
  17418. $config = JsonFile::parseJson(file_get_contents($json), $json);
  17419. } elseif (is_string($json)) {
  17420. $config = JsonFile::parseJson($json);
  17421. }
  17422. return $this->loader->load($config);
  17423. }
  17424. }
  17425. <?php
  17426. namespace Composer\Package\Loader;
  17427. interface LoaderInterface
  17428. {
  17429. public function load(array $package, $class = 'Composer\Package\CompletePackage');
  17430. }
  17431. <?php
  17432. namespace Composer\Package\Loader;
  17433. use Composer\Package\BasePackage;
  17434. use Composer\Package\AliasPackage;
  17435. use Composer\Config;
  17436. use Composer\Package\RootPackageInterface;
  17437. use Composer\Repository\RepositoryFactory;
  17438. use Composer\Package\Version\VersionGuesser;
  17439. use Composer\Package\Version\VersionParser;
  17440. use Composer\Repository\RepositoryManager;
  17441. use Composer\Util\ProcessExecutor;
  17442. class RootPackageLoader extends ArrayLoader
  17443. {
  17444. private $manager;
  17445. private $config;
  17446. private $versionGuesser;
  17447. public function __construct(RepositoryManager $manager, Config $config, VersionParser $parser = null, VersionGuesser $versionGuesser = null)
  17448. {
  17449. parent::__construct($parser);
  17450. $this->manager = $manager;
  17451. $this->config = $config;
  17452. $this->versionGuesser = $versionGuesser ?: new VersionGuesser($config, new ProcessExecutor(), $this->versionParser);
  17453. }
  17454. public function load(array $config, $class = 'Composer\Package\RootPackage', $cwd = null)
  17455. {
  17456. if (!isset($config['name'])) {
  17457. $config['name'] = '__root__';
  17458. }
  17459. $autoVersioned = false;
  17460. if (!isset($config['version'])) {
  17461. $commit = null;
  17462. if (getenv('COMPOSER_ROOT_VERSION')) {
  17463. $config['version'] = getenv('COMPOSER_ROOT_VERSION');
  17464. } else {
  17465. $versionData = $this->versionGuesser->guessVersion($config, $cwd ?: getcwd());
  17466. if ($versionData) {
  17467. $config['version'] = $versionData['pretty_version'];
  17468. $config['version_normalized'] = $versionData['version'];
  17469. $commit = $versionData['commit'];
  17470. }
  17471. }
  17472. if (!isset($config['version'])) {
  17473. $config['version'] = '1.0.0';
  17474. $autoVersioned = true;
  17475. }
  17476. if ($commit) {
  17477. $config['source'] = array(
  17478. 'type' => '',
  17479. 'url' => '',
  17480. 'reference' => $commit,
  17481. );
  17482. $config['dist'] = array(
  17483. 'type' => '',
  17484. 'url' => '',
  17485. 'reference' => $commit,
  17486. );
  17487. }
  17488. }
  17489. $realPackage = $package = parent::load($config, $class);
  17490. if ($realPackage instanceof AliasPackage) {
  17491. $realPackage = $package->getAliasOf();
  17492. }
  17493. if ($autoVersioned) {
  17494. $realPackage->replaceVersion($realPackage->getVersion(), 'No version set (parsed as 1.0.0)');
  17495. }
  17496. if (isset($config['minimum-stability'])) {
  17497. $realPackage->setMinimumStability(VersionParser::normalizeStability($config['minimum-stability']));
  17498. }
  17499. $aliases = array();
  17500. $stabilityFlags = array();
  17501. $references = array();
  17502. foreach (array('require', 'require-dev') as $linkType) {
  17503. if (isset($config[$linkType])) {
  17504. $linkInfo = BasePackage::$supportedLinkTypes[$linkType];
  17505. $method = 'get'.ucfirst($linkInfo['method']);
  17506. $links = array();
  17507. foreach ($realPackage->$method() as $link) {
  17508. $links[$link->getTarget()] = $link->getConstraint()->getPrettyString();
  17509. }
  17510. $aliases = $this->extractAliases($links, $aliases);
  17511. $stabilityFlags = $this->extractStabilityFlags($links, $stabilityFlags, $realPackage->getMinimumStability());
  17512. $references = $this->extractReferences($links, $references);
  17513. }
  17514. }
  17515. if (isset($links[$config['name']])) {
  17516. throw new \InvalidArgumentException(sprintf('Root package \'%s\' cannot require itself in its composer.json' . PHP_EOL .
  17517. 'Did you accidentally name your root package after an external package?', $config['name']));
  17518. }
  17519. $realPackage->setAliases($aliases);
  17520. $realPackage->setStabilityFlags($stabilityFlags);
  17521. $realPackage->setReferences($references);
  17522. if (isset($config['prefer-stable'])) {
  17523. $realPackage->setPreferStable((bool) $config['prefer-stable']);
  17524. }
  17525. if (isset($config['config'])) {
  17526. $realPackage->setConfig($config['config']);
  17527. }
  17528. $repos = RepositoryFactory::defaultRepos(null, $this->config, $this->manager);
  17529. foreach ($repos as $repo) {
  17530. $this->manager->addRepository($repo);
  17531. }
  17532. $realPackage->setRepositories($this->config->getRepositories());
  17533. return $package;
  17534. }
  17535. private function extractAliases(array $requires, array $aliases)
  17536. {
  17537. foreach ($requires as $reqName => $reqVersion) {
  17538. if (preg_match('{^([^,\s#]+)(?:#[^ ]+)? +as +([^,\s]+)$}', $reqVersion, $match)) {
  17539. $aliases[] = array(
  17540. 'package' => strtolower($reqName),
  17541. 'version' => $this->versionParser->normalize($match[1], $reqVersion),
  17542. 'alias' => $match[2],
  17543. 'alias_normalized' => $this->versionParser->normalize($match[2], $reqVersion),
  17544. );
  17545. }
  17546. }
  17547. return $aliases;
  17548. }
  17549. private function extractStabilityFlags(array $requires, array $stabilityFlags, $minimumStability)
  17550. {
  17551. $stabilities = BasePackage::$stabilities;
  17552. $minimumStability = $stabilities[$minimumStability];
  17553. foreach ($requires as $reqName => $reqVersion) {
  17554. $constraints = array();
  17555. $orSplit = preg_split('{\s*\|\|?\s*}', trim($reqVersion));
  17556. foreach ($orSplit as $orConstraint) {
  17557. $andSplit = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $orConstraint);
  17558. foreach ($andSplit as $andConstraint) {
  17559. $constraints[] = $andConstraint;
  17560. }
  17561. }
  17562. $match = false;
  17563. foreach ($constraints as $constraint) {
  17564. if (preg_match('{^[^@]*?@('.implode('|', array_keys($stabilities)).')$}i', $constraint, $match)) {
  17565. $name = strtolower($reqName);
  17566. $stability = $stabilities[VersionParser::normalizeStability($match[1])];
  17567. if (isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) {
  17568. continue;
  17569. }
  17570. $stabilityFlags[$name] = $stability;
  17571. $match = true;
  17572. }
  17573. }
  17574. if ($match) {
  17575. continue;
  17576. }
  17577. foreach ($constraints as $constraint) {
  17578. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $constraint);
  17579. if (preg_match('{^[^,\s@]+$}', $reqVersion) && 'stable' !== ($stabilityName = VersionParser::parseStability($reqVersion))) {
  17580. $name = strtolower($reqName);
  17581. $stability = $stabilities[$stabilityName];
  17582. if ((isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) || ($minimumStability > $stability)) {
  17583. continue;
  17584. }
  17585. $stabilityFlags[$name] = $stability;
  17586. }
  17587. }
  17588. }
  17589. return $stabilityFlags;
  17590. }
  17591. private function extractReferences(array $requires, array $references)
  17592. {
  17593. foreach ($requires as $reqName => $reqVersion) {
  17594. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $reqVersion);
  17595. if (preg_match('{^[^,\s@]+?#([a-f0-9]+)$}', $reqVersion, $match) && 'dev' === VersionParser::parseStability($reqVersion)) {
  17596. $name = strtolower($reqName);
  17597. $references[$name] = $match[1];
  17598. }
  17599. }
  17600. return $references;
  17601. }
  17602. }
  17603. <?php
  17604. namespace Composer\Package\Loader;
  17605. use Composer\Package\BasePackage;
  17606. use Composer\Semver\Constraint\Constraint;
  17607. use Composer\Package\Version\VersionParser;
  17608. use Composer\Repository\PlatformRepository;
  17609. use Composer\Spdx\SpdxLicenses;
  17610. class ValidatingArrayLoader implements LoaderInterface
  17611. {
  17612. const CHECK_ALL = 3;
  17613. const CHECK_UNBOUND_CONSTRAINTS = 1;
  17614. const CHECK_STRICT_CONSTRAINTS = 2;
  17615. private $loader;
  17616. private $versionParser;
  17617. private $errors;
  17618. private $warnings;
  17619. private $config;
  17620. private $strictName;
  17621. private $flags;
  17622. public function __construct(LoaderInterface $loader, $strictName = true, VersionParser $parser = null, $flags = 0)
  17623. {
  17624. $this->loader = $loader;
  17625. $this->versionParser = $parser ?: new VersionParser();
  17626. $this->strictName = $strictName;
  17627. $this->flags = $flags;
  17628. }
  17629. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  17630. {
  17631. $this->errors = array();
  17632. $this->warnings = array();
  17633. $this->config = $config;
  17634. if ($this->strictName) {
  17635. $this->validateRegex('name', '[A-Za-z0-9][A-Za-z0-9_.-]*/[A-Za-z0-9][A-Za-z0-9_.-]*', true);
  17636. } else {
  17637. $this->validateString('name', true);
  17638. }
  17639. if (!empty($this->config['version'])) {
  17640. try {
  17641. $this->versionParser->normalize($this->config['version']);
  17642. } catch (\Exception $e) {
  17643. $this->errors[] = 'version : invalid value ('.$this->config['version'].'): '.$e->getMessage();
  17644. unset($this->config['version']);
  17645. }
  17646. }
  17647. if (!empty($this->config['config']['platform'])) {
  17648. foreach ((array) $this->config['config']['platform'] as $key => $platform) {
  17649. try {
  17650. $this->versionParser->normalize($platform);
  17651. } catch (\Exception $e) {
  17652. $this->errors[] = 'config.platform.' . $key . ' : invalid value ('.$platform.'): '.$e->getMessage();
  17653. }
  17654. }
  17655. }
  17656. $this->validateRegex('type', '[A-Za-z0-9-]+');
  17657. $this->validateString('target-dir');
  17658. $this->validateArray('extra');
  17659. if (isset($this->config['bin'])) {
  17660. if (is_string($this->config['bin'])) {
  17661. $this->validateString('bin');
  17662. } else {
  17663. $this->validateFlatArray('bin');
  17664. }
  17665. }
  17666. $this->validateArray('scripts');
  17667. $this->validateString('description');
  17668. $this->validateUrl('homepage');
  17669. $this->validateFlatArray('keywords', '[\p{N}\p{L} ._-]+');
  17670. $releaseDate = null;
  17671. $this->validateString('time');
  17672. if (!empty($this->config['time'])) {
  17673. try {
  17674. $releaseDate = new \DateTime($this->config['time'], new \DateTimeZone('UTC'));
  17675. } catch (\Exception $e) {
  17676. $this->errors[] = 'time : invalid value ('.$this->config['time'].'): '.$e->getMessage();
  17677. unset($this->config['time']);
  17678. }
  17679. }
  17680. if (isset($this->config['license']) && (!$releaseDate || $releaseDate->getTimestamp() >= strtotime('-8days'))) {
  17681. if (is_array($this->config['license']) || is_string($this->config['license'])) {
  17682. $licenses = (array) $this->config['license'];
  17683. foreach ($licenses as $key => $license) {
  17684. if ('proprietary' === $license) {
  17685. unset($licenses[$key]);
  17686. }
  17687. }
  17688. $licenseValidator = new SpdxLicenses();
  17689. if (count($licenses) === 1 && !$licenseValidator->validate($licenses) && $licenseValidator->validate(trim($licenses[0]))) {
  17690. $this->warnings[] = sprintf(
  17691. 'License %s must not contain extra spaces, make sure to trim it.',
  17692. json_encode($this->config['license'])
  17693. );
  17694. } elseif (array() !== $licenses && !$licenseValidator->validate($licenses)) {
  17695. $this->warnings[] = sprintf(
  17696. 'License %s is not a valid SPDX license identifier, see https://spdx.org/licenses/ if you use an open license.' . PHP_EOL .
  17697. 'If the software is closed-source, you may use "proprietary" as license.',
  17698. json_encode($this->config['license'])
  17699. );
  17700. }
  17701. }
  17702. }
  17703. if ($this->validateArray('authors') && !empty($this->config['authors'])) {
  17704. foreach ($this->config['authors'] as $key => $author) {
  17705. if (!is_array($author)) {
  17706. $this->errors[] = 'authors.'.$key.' : should be an array, '.gettype($author).' given';
  17707. unset($this->config['authors'][$key]);
  17708. continue;
  17709. }
  17710. foreach (array('homepage', 'email', 'name', 'role') as $authorData) {
  17711. if (isset($author[$authorData]) && !is_string($author[$authorData])) {
  17712. $this->errors[] = 'authors.'.$key.'.'.$authorData.' : invalid value, must be a string';
  17713. unset($this->config['authors'][$key][$authorData]);
  17714. }
  17715. }
  17716. if (isset($author['homepage']) && !$this->filterUrl($author['homepage'])) {
  17717. $this->warnings[] = 'authors.'.$key.'.homepage : invalid value ('.$author['homepage'].'), must be an http/https URL';
  17718. unset($this->config['authors'][$key]['homepage']);
  17719. }
  17720. if (isset($author['email']) && !filter_var($author['email'], FILTER_VALIDATE_EMAIL)) {
  17721. $this->warnings[] = 'authors.'.$key.'.email : invalid value ('.$author['email'].'), must be a valid email address';
  17722. unset($this->config['authors'][$key]['email']);
  17723. }
  17724. if (empty($this->config['authors'][$key])) {
  17725. unset($this->config['authors'][$key]);
  17726. }
  17727. }
  17728. if (empty($this->config['authors'])) {
  17729. unset($this->config['authors']);
  17730. }
  17731. }
  17732. if ($this->validateArray('support') && !empty($this->config['support'])) {
  17733. foreach (array('issues', 'forum', 'wiki', 'source', 'email', 'irc', 'docs', 'rss') as $key) {
  17734. if (isset($this->config['support'][$key]) && !is_string($this->config['support'][$key])) {
  17735. $this->errors[] = 'support.'.$key.' : invalid value, must be a string';
  17736. unset($this->config['support'][$key]);
  17737. }
  17738. }
  17739. if (isset($this->config['support']['email']) && !filter_var($this->config['support']['email'], FILTER_VALIDATE_EMAIL)) {
  17740. $this->warnings[] = 'support.email : invalid value ('.$this->config['support']['email'].'), must be a valid email address';
  17741. unset($this->config['support']['email']);
  17742. }
  17743. if (isset($this->config['support']['irc']) && !$this->filterUrl($this->config['support']['irc'], array('irc'))) {
  17744. $this->warnings[] = 'support.irc : invalid value ('.$this->config['support']['irc'].'), must be a irc://<server>/<channel> URL';
  17745. unset($this->config['support']['irc']);
  17746. }
  17747. foreach (array('issues', 'forum', 'wiki', 'source', 'docs') as $key) {
  17748. if (isset($this->config['support'][$key]) && !$this->filterUrl($this->config['support'][$key])) {
  17749. $this->warnings[] = 'support.'.$key.' : invalid value ('.$this->config['support'][$key].'), must be an http/https URL';
  17750. unset($this->config['support'][$key]);
  17751. }
  17752. }
  17753. if (empty($this->config['support'])) {
  17754. unset($this->config['support']);
  17755. }
  17756. }
  17757. $unboundConstraint = new Constraint('=', $this->versionParser->normalize('dev-master'));
  17758. $stableConstraint = new Constraint('=', '1.0.0');
  17759. foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
  17760. if ($this->validateArray($linkType) && isset($this->config[$linkType])) {
  17761. foreach ($this->config[$linkType] as $package => $constraint) {
  17762. if (!preg_match('{^[A-Za-z0-9_./-]+$}', $package)) {
  17763. $this->warnings[] = $linkType.'.'.$package.' : invalid key, package names must be strings containing only [A-Za-z0-9_./-]';
  17764. }
  17765. if (!is_string($constraint)) {
  17766. $this->errors[] = $linkType.'.'.$package.' : invalid value, must be a string containing a version constraint';
  17767. unset($this->config[$linkType][$package]);
  17768. } elseif ('self.version' !== $constraint) {
  17769. try {
  17770. $linkConstraint = $this->versionParser->parseConstraints($constraint);
  17771. } catch (\Exception $e) {
  17772. $this->errors[] = $linkType.'.'.$package.' : invalid version constraint ('.$e->getMessage().')';
  17773. unset($this->config[$linkType][$package]);
  17774. continue;
  17775. }
  17776. if (
  17777. ($this->flags & self::CHECK_UNBOUND_CONSTRAINTS)
  17778. && 'require' === $linkType
  17779. && $linkConstraint->matches($unboundConstraint)
  17780. && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $package)
  17781. ) {
  17782. $this->warnings[] = $linkType.'.'.$package.' : unbound version constraints ('.$constraint.') should be avoided';
  17783. } elseif (
  17784. ($this->flags & self::CHECK_STRICT_CONSTRAINTS)
  17785. && 'require' === $linkType
  17786. && substr($linkConstraint, 0, 1) === '='
  17787. && $stableConstraint->versionCompare($stableConstraint, $linkConstraint, '<=')
  17788. ) {
  17789. $this->warnings[] = $linkType.'.'.$package.' : exact version constraints ('.$constraint.') should be avoided if the package follows semantic versioning';
  17790. }
  17791. }
  17792. }
  17793. }
  17794. }
  17795. if ($this->validateArray('suggest') && !empty($this->config['suggest'])) {
  17796. foreach ($this->config['suggest'] as $package => $description) {
  17797. if (!is_string($description)) {
  17798. $this->errors[] = 'suggest.'.$package.' : invalid value, must be a string describing why the package is suggested';
  17799. unset($this->config['suggest'][$package]);
  17800. }
  17801. }
  17802. }
  17803. if ($this->validateString('minimum-stability') && !empty($this->config['minimum-stability'])) {
  17804. if (!isset(BasePackage::$stabilities[$this->config['minimum-stability']])) {
  17805. $this->errors[] = 'minimum-stability : invalid value ('.$this->config['minimum-stability'].'), must be one of '.implode(', ', array_keys(BasePackage::$stabilities));
  17806. unset($this->config['minimum-stability']);
  17807. }
  17808. }
  17809. if ($this->validateArray('autoload') && !empty($this->config['autoload'])) {
  17810. $types = array('psr-0', 'psr-4', 'classmap', 'files', 'exclude-from-classmap');
  17811. foreach ($this->config['autoload'] as $type => $typeConfig) {
  17812. if (!in_array($type, $types)) {
  17813. $this->errors[] = 'autoload : invalid value ('.$type.'), must be one of '.implode(', ', $types);
  17814. unset($this->config['autoload'][$type]);
  17815. }
  17816. if ($type === 'psr-4') {
  17817. foreach ($typeConfig as $namespace => $dirs) {
  17818. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  17819. $this->errors[] = 'autoload.psr-4 : invalid value ('.$namespace.'), namespaces must end with a namespace separator, should be '.$namespace.'\\\\';
  17820. }
  17821. }
  17822. }
  17823. }
  17824. }
  17825. if (!empty($this->config['autoload']['psr-4']) && !empty($this->config['target-dir'])) {
  17826. $this->errors[] = 'target-dir : this can not be used together with the autoload.psr-4 setting, remove target-dir to upgrade to psr-4';
  17827. unset($this->config['autoload']['psr-4']);
  17828. }
  17829. $this->validateFlatArray('include-path');
  17830. $this->validateArray('transport-options');
  17831. if (isset($this->config['extra']['branch-alias'])) {
  17832. if (!is_array($this->config['extra']['branch-alias'])) {
  17833. $this->errors[] = 'extra.branch-alias : must be an array of versions => aliases';
  17834. } else {
  17835. foreach ($this->config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  17836. if ('-dev' !== substr($targetBranch, -4)) {
  17837. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must end in -dev';
  17838. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  17839. continue;
  17840. }
  17841. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  17842. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  17843. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must be a parseable number like 2.0-dev';
  17844. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  17845. continue;
  17846. }
  17847. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  17848. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  17849. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  17850. ) {
  17851. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') is not a valid numeric alias for this version';
  17852. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  17853. }
  17854. }
  17855. }
  17856. }
  17857. if ($this->errors) {
  17858. throw new InvalidPackageException($this->errors, $this->warnings, $config);
  17859. }
  17860. $package = $this->loader->load($this->config, $class);
  17861. $this->config = null;
  17862. return $package;
  17863. }
  17864. public function getWarnings()
  17865. {
  17866. return $this->warnings;
  17867. }
  17868. public function getErrors()
  17869. {
  17870. return $this->errors;
  17871. }
  17872. private function validateRegex($property, $regex, $mandatory = false)
  17873. {
  17874. if (!$this->validateString($property, $mandatory)) {
  17875. return false;
  17876. }
  17877. if (!preg_match('{^'.$regex.'$}u', $this->config[$property])) {
  17878. $message = $property.' : invalid value ('.$this->config[$property].'), must match '.$regex;
  17879. if ($mandatory) {
  17880. $this->errors[] = $message;
  17881. } else {
  17882. $this->warnings[] = $message;
  17883. }
  17884. unset($this->config[$property]);
  17885. return false;
  17886. }
  17887. return true;
  17888. }
  17889. private function validateString($property, $mandatory = false)
  17890. {
  17891. if (isset($this->config[$property]) && !is_string($this->config[$property])) {
  17892. $this->errors[] = $property.' : should be a string, '.gettype($this->config[$property]).' given';
  17893. unset($this->config[$property]);
  17894. return false;
  17895. }
  17896. if (!isset($this->config[$property]) || trim($this->config[$property]) === '') {
  17897. if ($mandatory) {
  17898. $this->errors[] = $property.' : must be present';
  17899. }
  17900. unset($this->config[$property]);
  17901. return false;
  17902. }
  17903. return true;
  17904. }
  17905. private function validateArray($property, $mandatory = false)
  17906. {
  17907. if (isset($this->config[$property]) && !is_array($this->config[$property])) {
  17908. $this->errors[] = $property.' : should be an array, '.gettype($this->config[$property]).' given';
  17909. unset($this->config[$property]);
  17910. return false;
  17911. }
  17912. if (!isset($this->config[$property]) || !count($this->config[$property])) {
  17913. if ($mandatory) {
  17914. $this->errors[] = $property.' : must be present and contain at least one element';
  17915. }
  17916. unset($this->config[$property]);
  17917. return false;
  17918. }
  17919. return true;
  17920. }
  17921. private function validateFlatArray($property, $regex = null, $mandatory = false)
  17922. {
  17923. if (!$this->validateArray($property, $mandatory)) {
  17924. return false;
  17925. }
  17926. $pass = true;
  17927. foreach ($this->config[$property] as $key => $value) {
  17928. if (!is_string($value) && !is_numeric($value)) {
  17929. $this->errors[] = $property.'.'.$key.' : must be a string or int, '.gettype($value).' given';
  17930. unset($this->config[$property][$key]);
  17931. $pass = false;
  17932. continue;
  17933. }
  17934. if ($regex && !preg_match('{^'.$regex.'$}u', $value)) {
  17935. $this->warnings[] = $property.'.'.$key.' : invalid value ('.$value.'), must match '.$regex;
  17936. unset($this->config[$property][$key]);
  17937. $pass = false;
  17938. }
  17939. }
  17940. return $pass;
  17941. }
  17942. private function validateUrl($property, $mandatory = false)
  17943. {
  17944. if (!$this->validateString($property, $mandatory)) {
  17945. return false;
  17946. }
  17947. if (!$this->filterUrl($this->config[$property])) {
  17948. $this->warnings[] = $property.' : invalid value ('.$this->config[$property].'), must be an http/https URL';
  17949. unset($this->config[$property]);
  17950. return false;
  17951. }
  17952. return true;
  17953. }
  17954. private function filterUrl($value, array $schemes = array('http', 'https'))
  17955. {
  17956. if ($value === '') {
  17957. return true;
  17958. }
  17959. $bits = parse_url($value);
  17960. if (empty($bits['scheme']) || empty($bits['host'])) {
  17961. return false;
  17962. }
  17963. if (!in_array($bits['scheme'], $schemes, true)) {
  17964. return false;
  17965. }
  17966. return true;
  17967. }
  17968. }
  17969. <?php
  17970. namespace Composer\Package;
  17971. use Composer\Json\JsonFile;
  17972. use Composer\Installer\InstallationManager;
  17973. use Composer\Repository\RepositoryManager;
  17974. use Composer\Util\ProcessExecutor;
  17975. use Composer\Repository\ArrayRepository;
  17976. use Composer\Package\Dumper\ArrayDumper;
  17977. use Composer\Package\Loader\ArrayLoader;
  17978. use Composer\Util\Git as GitUtil;
  17979. use Composer\IO\IOInterface;
  17980. use Seld\JsonLint\ParsingException;
  17981. class Locker
  17982. {
  17983. private $lockFile;
  17984. private $repositoryManager;
  17985. private $installationManager;
  17986. private $hash;
  17987. private $contentHash;
  17988. private $loader;
  17989. private $dumper;
  17990. private $process;
  17991. private $lockDataCache;
  17992. public function __construct(IOInterface $io, JsonFile $lockFile, RepositoryManager $repositoryManager, InstallationManager $installationManager, $composerFileContents)
  17993. {
  17994. $this->lockFile = $lockFile;
  17995. $this->repositoryManager = $repositoryManager;
  17996. $this->installationManager = $installationManager;
  17997. $this->hash = md5($composerFileContents);
  17998. $this->contentHash = self::getContentHash($composerFileContents);
  17999. $this->loader = new ArrayLoader(null, true);
  18000. $this->dumper = new ArrayDumper();
  18001. $this->process = new ProcessExecutor($io);
  18002. }
  18003. public static function getContentHash($composerFileContents)
  18004. {
  18005. $content = json_decode($composerFileContents, true);
  18006. $relevantKeys = array(
  18007. 'name',
  18008. 'version',
  18009. 'require',
  18010. 'require-dev',
  18011. 'conflict',
  18012. 'replace',
  18013. 'provide',
  18014. 'minimum-stability',
  18015. 'prefer-stable',
  18016. 'repositories',
  18017. 'extra',
  18018. );
  18019. $relevantContent = array();
  18020. foreach (array_intersect($relevantKeys, array_keys($content)) as $key) {
  18021. $relevantContent[$key] = $content[$key];
  18022. }
  18023. if (isset($content['config']['platform'])) {
  18024. $relevantContent['config']['platform'] = $content['config']['platform'];
  18025. }
  18026. ksort($relevantContent);
  18027. return md5(json_encode($relevantContent));
  18028. }
  18029. public function isLocked()
  18030. {
  18031. if (!$this->lockFile->exists()) {
  18032. return false;
  18033. }
  18034. $data = $this->getLockData();
  18035. return isset($data['packages']);
  18036. }
  18037. public function isFresh()
  18038. {
  18039. $lock = $this->lockFile->read();
  18040. if (!empty($lock['content-hash'])) {
  18041. return $this->contentHash === $lock['content-hash'];
  18042. }
  18043. if (!empty($lock['hash'])) {
  18044. return $this->hash === $lock['hash'];
  18045. }
  18046. return false;
  18047. }
  18048. public function getLockedRepository($withDevReqs = false)
  18049. {
  18050. $lockData = $this->getLockData();
  18051. $packages = new ArrayRepository();
  18052. $lockedPackages = $lockData['packages'];
  18053. if ($withDevReqs) {
  18054. if (isset($lockData['packages-dev'])) {
  18055. $lockedPackages = array_merge($lockedPackages, $lockData['packages-dev']);
  18056. } else {
  18057. throw new \RuntimeException('The lock file does not contain require-dev information, run install with the --no-dev option or run update to install those packages.');
  18058. }
  18059. }
  18060. if (empty($lockedPackages)) {
  18061. return $packages;
  18062. }
  18063. if (isset($lockedPackages[0]['name'])) {
  18064. foreach ($lockedPackages as $info) {
  18065. $packages->addPackage($this->loader->load($info));
  18066. }
  18067. return $packages;
  18068. }
  18069. throw new \RuntimeException('Your composer.lock was created before 2012-09-15, and is not supported anymore. Run "composer update" to generate a new one.');
  18070. }
  18071. public function getPlatformRequirements($withDevReqs = false)
  18072. {
  18073. $lockData = $this->getLockData();
  18074. $requirements = array();
  18075. if (!empty($lockData['platform'])) {
  18076. $requirements = $this->loader->parseLinks(
  18077. '__ROOT__',
  18078. '1.0.0',
  18079. 'requires',
  18080. isset($lockData['platform']) ? $lockData['platform'] : array()
  18081. );
  18082. }
  18083. if ($withDevReqs && !empty($lockData['platform-dev'])) {
  18084. $devRequirements = $this->loader->parseLinks(
  18085. '__ROOT__',
  18086. '1.0.0',
  18087. 'requires',
  18088. isset($lockData['platform-dev']) ? $lockData['platform-dev'] : array()
  18089. );
  18090. $requirements = array_merge($requirements, $devRequirements);
  18091. }
  18092. return $requirements;
  18093. }
  18094. public function getMinimumStability()
  18095. {
  18096. $lockData = $this->getLockData();
  18097. return isset($lockData['minimum-stability']) ? $lockData['minimum-stability'] : 'stable';
  18098. }
  18099. public function getStabilityFlags()
  18100. {
  18101. $lockData = $this->getLockData();
  18102. return isset($lockData['stability-flags']) ? $lockData['stability-flags'] : array();
  18103. }
  18104. public function getPreferStable()
  18105. {
  18106. $lockData = $this->getLockData();
  18107. return isset($lockData['prefer-stable']) ? $lockData['prefer-stable'] : null;
  18108. }
  18109. public function getPreferLowest()
  18110. {
  18111. $lockData = $this->getLockData();
  18112. return isset($lockData['prefer-lowest']) ? $lockData['prefer-lowest'] : null;
  18113. }
  18114. public function getPlatformOverrides()
  18115. {
  18116. $lockData = $this->getLockData();
  18117. return isset($lockData['platform-overrides']) ? $lockData['platform-overrides'] : array();
  18118. }
  18119. public function getAliases()
  18120. {
  18121. $lockData = $this->getLockData();
  18122. return isset($lockData['aliases']) ? $lockData['aliases'] : array();
  18123. }
  18124. public function getLockData()
  18125. {
  18126. if (null !== $this->lockDataCache) {
  18127. return $this->lockDataCache;
  18128. }
  18129. if (!$this->lockFile->exists()) {
  18130. throw new \LogicException('No lockfile found. Unable to read locked packages');
  18131. }
  18132. return $this->lockDataCache = $this->lockFile->read();
  18133. }
  18134. public function setLockData(array $packages, $devPackages, array $platformReqs, $platformDevReqs, array $aliases, $minimumStability, array $stabilityFlags, $preferStable, $preferLowest, array $platformOverrides)
  18135. {
  18136. $lock = array(
  18137. '_readme' => array('This file locks the dependencies of your project to a known state',
  18138. 'Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies',
  18139. 'This file is @gener'.'ated automatically', ),
  18140. 'content-hash' => $this->contentHash,
  18141. 'packages' => null,
  18142. 'packages-dev' => null,
  18143. 'aliases' => array(),
  18144. 'minimum-stability' => $minimumStability,
  18145. 'stability-flags' => $stabilityFlags,
  18146. 'prefer-stable' => $preferStable,
  18147. 'prefer-lowest' => $preferLowest,
  18148. );
  18149. foreach ($aliases as $package => $versions) {
  18150. foreach ($versions as $version => $alias) {
  18151. $lock['aliases'][] = array(
  18152. 'alias' => $alias['alias'],
  18153. 'alias_normalized' => $alias['alias_normalized'],
  18154. 'version' => $version,
  18155. 'package' => $package,
  18156. );
  18157. }
  18158. }
  18159. $lock['packages'] = $this->lockPackages($packages);
  18160. if (null !== $devPackages) {
  18161. $lock['packages-dev'] = $this->lockPackages($devPackages);
  18162. }
  18163. $lock['platform'] = $platformReqs;
  18164. $lock['platform-dev'] = $platformDevReqs;
  18165. if ($platformOverrides) {
  18166. $lock['platform-overrides'] = $platformOverrides;
  18167. }
  18168. if (empty($lock['packages']) && empty($lock['packages-dev']) && empty($lock['platform']) && empty($lock['platform-dev'])) {
  18169. if ($this->lockFile->exists()) {
  18170. unlink($this->lockFile->getPath());
  18171. }
  18172. return false;
  18173. }
  18174. try {
  18175. $isLocked = $this->isLocked();
  18176. } catch (ParsingException $e) {
  18177. $isLocked = false;
  18178. }
  18179. if (!$isLocked || $lock !== $this->getLockData()) {
  18180. $this->lockFile->write($lock);
  18181. $this->lockDataCache = null;
  18182. return true;
  18183. }
  18184. return false;
  18185. }
  18186. private function lockPackages(array $packages)
  18187. {
  18188. $locked = array();
  18189. foreach ($packages as $package) {
  18190. if ($package instanceof AliasPackage) {
  18191. continue;
  18192. }
  18193. $name = $package->getPrettyName();
  18194. $version = $package->getPrettyVersion();
  18195. if (!$name || !$version) {
  18196. throw new \LogicException(sprintf(
  18197. 'Package "%s" has no version or name and can not be locked',
  18198. $package
  18199. ));
  18200. }
  18201. $spec = $this->dumper->dump($package);
  18202. unset($spec['version_normalized']);
  18203. $time = isset($spec['time']) ? $spec['time'] : null;
  18204. unset($spec['time']);
  18205. if ($package->isDev() && $package->getInstallationSource() === 'source') {
  18206. $time = $this->getPackageTime($package) ?: $time;
  18207. }
  18208. if (null !== $time) {
  18209. $spec['time'] = $time;
  18210. }
  18211. unset($spec['installation-source']);
  18212. $locked[] = $spec;
  18213. }
  18214. usort($locked, function ($a, $b) {
  18215. $comparison = strcmp($a['name'], $b['name']);
  18216. if (0 !== $comparison) {
  18217. return $comparison;
  18218. }
  18219. return strcmp($a['version'], $b['version']);
  18220. });
  18221. return $locked;
  18222. }
  18223. private function getPackageTime(PackageInterface $package)
  18224. {
  18225. if (!function_exists('proc_open')) {
  18226. return null;
  18227. }
  18228. $path = realpath($this->installationManager->getInstallPath($package));
  18229. $sourceType = $package->getSourceType();
  18230. $datetime = null;
  18231. if ($path && in_array($sourceType, array('git', 'hg'))) {
  18232. $sourceRef = $package->getSourceReference() ?: $package->getDistReference();
  18233. switch ($sourceType) {
  18234. case 'git':
  18235. GitUtil::cleanEnv();
  18236. if (0 === $this->process->execute('git log -n1 --pretty=%ct '.ProcessExecutor::escape($sourceRef), $output, $path) && preg_match('{^\s*\d+\s*$}', $output)) {
  18237. $datetime = new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  18238. }
  18239. break;
  18240. case 'hg':
  18241. if (0 === $this->process->execute('hg log --template "{date|hgdate}" -r '.ProcessExecutor::escape($sourceRef), $output, $path) && preg_match('{^\s*(\d+)\s*}', $output, $match)) {
  18242. $datetime = new \DateTime('@'.$match[1], new \DateTimeZone('UTC'));
  18243. }
  18244. break;
  18245. }
  18246. }
  18247. return $datetime ? $datetime->format(DATE_RFC3339) : null;
  18248. }
  18249. }
  18250. <?php
  18251. namespace Composer\Package;
  18252. use Composer\Package\Version\VersionParser;
  18253. use Composer\Util\ComposerMirror;
  18254. class Package extends BasePackage
  18255. {
  18256. protected $type;
  18257. protected $targetDir;
  18258. protected $installationSource;
  18259. protected $sourceType;
  18260. protected $sourceUrl;
  18261. protected $sourceReference;
  18262. protected $sourceMirrors;
  18263. protected $distType;
  18264. protected $distUrl;
  18265. protected $distReference;
  18266. protected $distSha1Checksum;
  18267. protected $distMirrors;
  18268. protected $version;
  18269. protected $prettyVersion;
  18270. protected $releaseDate;
  18271. protected $extra = array();
  18272. protected $binaries = array();
  18273. protected $dev;
  18274. protected $stability;
  18275. protected $notificationUrl;
  18276. protected $requires = array();
  18277. protected $conflicts = array();
  18278. protected $provides = array();
  18279. protected $replaces = array();
  18280. protected $devRequires = array();
  18281. protected $suggests = array();
  18282. protected $autoload = array();
  18283. protected $devAutoload = array();
  18284. protected $includePaths = array();
  18285. protected $archiveExcludes = array();
  18286. public function __construct($name, $version, $prettyVersion)
  18287. {
  18288. parent::__construct($name);
  18289. $this->version = $version;
  18290. $this->prettyVersion = $prettyVersion;
  18291. $this->stability = VersionParser::parseStability($version);
  18292. $this->dev = $this->stability === 'dev';
  18293. }
  18294. public function isDev()
  18295. {
  18296. return $this->dev;
  18297. }
  18298. public function setType($type)
  18299. {
  18300. $this->type = $type;
  18301. }
  18302. public function getType()
  18303. {
  18304. return $this->type ?: 'library';
  18305. }
  18306. public function getStability()
  18307. {
  18308. return $this->stability;
  18309. }
  18310. public function setTargetDir($targetDir)
  18311. {
  18312. $this->targetDir = $targetDir;
  18313. }
  18314. public function getTargetDir()
  18315. {
  18316. if (null === $this->targetDir) {
  18317. return;
  18318. }
  18319. return ltrim(preg_replace('{ (?:^|[\\\\/]+) \.\.? (?:[\\\\/]+|$) (?:\.\.? (?:[\\\\/]+|$) )*}x', '/', $this->targetDir), '/');
  18320. }
  18321. public function setExtra(array $extra)
  18322. {
  18323. $this->extra = $extra;
  18324. }
  18325. public function getExtra()
  18326. {
  18327. return $this->extra;
  18328. }
  18329. public function setBinaries(array $binaries)
  18330. {
  18331. $this->binaries = $binaries;
  18332. }
  18333. public function getBinaries()
  18334. {
  18335. return $this->binaries;
  18336. }
  18337. public function setInstallationSource($type)
  18338. {
  18339. $this->installationSource = $type;
  18340. }
  18341. public function getInstallationSource()
  18342. {
  18343. return $this->installationSource;
  18344. }
  18345. public function setSourceType($type)
  18346. {
  18347. $this->sourceType = $type;
  18348. }
  18349. public function getSourceType()
  18350. {
  18351. return $this->sourceType;
  18352. }
  18353. public function setSourceUrl($url)
  18354. {
  18355. $this->sourceUrl = $url;
  18356. }
  18357. public function getSourceUrl()
  18358. {
  18359. return $this->sourceUrl;
  18360. }
  18361. public function setSourceReference($reference)
  18362. {
  18363. $this->sourceReference = $reference;
  18364. }
  18365. public function getSourceReference()
  18366. {
  18367. return $this->sourceReference;
  18368. }
  18369. public function setSourceMirrors($mirrors)
  18370. {
  18371. $this->sourceMirrors = $mirrors;
  18372. }
  18373. public function getSourceMirrors()
  18374. {
  18375. return $this->sourceMirrors;
  18376. }
  18377. public function getSourceUrls()
  18378. {
  18379. return $this->getUrls($this->sourceUrl, $this->sourceMirrors, $this->sourceReference, $this->sourceType, 'source');
  18380. }
  18381. public function setDistType($type)
  18382. {
  18383. $this->distType = $type;
  18384. }
  18385. public function getDistType()
  18386. {
  18387. return $this->distType;
  18388. }
  18389. public function setDistUrl($url)
  18390. {
  18391. $this->distUrl = $url;
  18392. }
  18393. public function getDistUrl()
  18394. {
  18395. return $this->distUrl;
  18396. }
  18397. public function setDistReference($reference)
  18398. {
  18399. $this->distReference = $reference;
  18400. }
  18401. public function getDistReference()
  18402. {
  18403. return $this->distReference;
  18404. }
  18405. public function setDistSha1Checksum($sha1checksum)
  18406. {
  18407. $this->distSha1Checksum = $sha1checksum;
  18408. }
  18409. public function getDistSha1Checksum()
  18410. {
  18411. return $this->distSha1Checksum;
  18412. }
  18413. public function setDistMirrors($mirrors)
  18414. {
  18415. $this->distMirrors = $mirrors;
  18416. }
  18417. public function getDistMirrors()
  18418. {
  18419. return $this->distMirrors;
  18420. }
  18421. public function getDistUrls()
  18422. {
  18423. return $this->getUrls($this->distUrl, $this->distMirrors, $this->distReference, $this->distType, 'dist');
  18424. }
  18425. public function getVersion()
  18426. {
  18427. return $this->version;
  18428. }
  18429. public function getPrettyVersion()
  18430. {
  18431. return $this->prettyVersion;
  18432. }
  18433. public function setReleaseDate(\DateTime $releaseDate)
  18434. {
  18435. $this->releaseDate = $releaseDate;
  18436. }
  18437. public function getReleaseDate()
  18438. {
  18439. return $this->releaseDate;
  18440. }
  18441. public function setRequires(array $requires)
  18442. {
  18443. $this->requires = $requires;
  18444. }
  18445. public function getRequires()
  18446. {
  18447. return $this->requires;
  18448. }
  18449. public function setConflicts(array $conflicts)
  18450. {
  18451. $this->conflicts = $conflicts;
  18452. }
  18453. public function getConflicts()
  18454. {
  18455. return $this->conflicts;
  18456. }
  18457. public function setProvides(array $provides)
  18458. {
  18459. $this->provides = $provides;
  18460. }
  18461. public function getProvides()
  18462. {
  18463. return $this->provides;
  18464. }
  18465. public function setReplaces(array $replaces)
  18466. {
  18467. $this->replaces = $replaces;
  18468. }
  18469. public function getReplaces()
  18470. {
  18471. return $this->replaces;
  18472. }
  18473. public function setDevRequires(array $devRequires)
  18474. {
  18475. $this->devRequires = $devRequires;
  18476. }
  18477. public function getDevRequires()
  18478. {
  18479. return $this->devRequires;
  18480. }
  18481. public function setSuggests(array $suggests)
  18482. {
  18483. $this->suggests = $suggests;
  18484. }
  18485. public function getSuggests()
  18486. {
  18487. return $this->suggests;
  18488. }
  18489. public function setAutoload(array $autoload)
  18490. {
  18491. $this->autoload = $autoload;
  18492. }
  18493. public function getAutoload()
  18494. {
  18495. return $this->autoload;
  18496. }
  18497. public function setDevAutoload(array $devAutoload)
  18498. {
  18499. $this->devAutoload = $devAutoload;
  18500. }
  18501. public function getDevAutoload()
  18502. {
  18503. return $this->devAutoload;
  18504. }
  18505. public function setIncludePaths(array $includePaths)
  18506. {
  18507. $this->includePaths = $includePaths;
  18508. }
  18509. public function getIncludePaths()
  18510. {
  18511. return $this->includePaths;
  18512. }
  18513. public function setNotificationUrl($notificationUrl)
  18514. {
  18515. $this->notificationUrl = $notificationUrl;
  18516. }
  18517. public function getNotificationUrl()
  18518. {
  18519. return $this->notificationUrl;
  18520. }
  18521. public function setArchiveExcludes(array $excludes)
  18522. {
  18523. $this->archiveExcludes = $excludes;
  18524. }
  18525. public function getArchiveExcludes()
  18526. {
  18527. return $this->archiveExcludes;
  18528. }
  18529. public function replaceVersion($version, $prettyVersion)
  18530. {
  18531. $this->version = $version;
  18532. $this->prettyVersion = $prettyVersion;
  18533. $this->stability = VersionParser::parseStability($version);
  18534. $this->dev = $this->stability === 'dev';
  18535. }
  18536. protected function getUrls($url, $mirrors, $ref, $type, $urlType)
  18537. {
  18538. if (!$url) {
  18539. return array();
  18540. }
  18541. $urls = array($url);
  18542. if ($mirrors) {
  18543. foreach ($mirrors as $mirror) {
  18544. if ($urlType === 'dist') {
  18545. $mirrorUrl = ComposerMirror::processUrl($mirror['url'], $this->name, $this->version, $ref, $type);
  18546. } elseif ($urlType === 'source' && $type === 'git') {
  18547. $mirrorUrl = ComposerMirror::processGitUrl($mirror['url'], $this->name, $url, $type);
  18548. } elseif ($urlType === 'source' && $type === 'hg') {
  18549. $mirrorUrl = ComposerMirror::processHgUrl($mirror['url'], $this->name, $url, $type);
  18550. }
  18551. if (!in_array($mirrorUrl, $urls)) {
  18552. $func = $mirror['preferred'] ? 'array_unshift' : 'array_push';
  18553. $func($urls, $mirrorUrl);
  18554. }
  18555. }
  18556. }
  18557. return $urls;
  18558. }
  18559. }
  18560. <?php
  18561. namespace Composer\Package;
  18562. use Composer\Repository\RepositoryInterface;
  18563. interface PackageInterface
  18564. {
  18565. public function getName();
  18566. public function getPrettyName();
  18567. public function getNames();
  18568. public function setId($id);
  18569. public function getId();
  18570. public function isDev();
  18571. public function getType();
  18572. public function getTargetDir();
  18573. public function getExtra();
  18574. public function setInstallationSource($type);
  18575. public function getInstallationSource();
  18576. public function getSourceType();
  18577. public function getSourceUrl();
  18578. public function getSourceUrls();
  18579. public function getSourceReference();
  18580. public function getSourceMirrors();
  18581. public function getDistType();
  18582. public function getDistUrl();
  18583. public function getDistUrls();
  18584. public function getDistReference();
  18585. public function getDistSha1Checksum();
  18586. public function getDistMirrors();
  18587. public function getVersion();
  18588. public function getPrettyVersion();
  18589. public function getFullPrettyVersion($truncate = true);
  18590. public function getReleaseDate();
  18591. public function getStability();
  18592. public function getRequires();
  18593. public function getConflicts();
  18594. public function getProvides();
  18595. public function getReplaces();
  18596. public function getDevRequires();
  18597. public function getSuggests();
  18598. public function getAutoload();
  18599. public function getDevAutoload();
  18600. public function getIncludePaths();
  18601. public function setRepository(RepositoryInterface $repository);
  18602. public function getRepository();
  18603. public function getBinaries();
  18604. public function getUniqueName();
  18605. public function getNotificationUrl();
  18606. public function __toString();
  18607. public function getPrettyString();
  18608. public function getArchiveExcludes();
  18609. public function getTransportOptions();
  18610. }
  18611. <?php
  18612. namespace Composer\Package;
  18613. class RootAliasPackage extends AliasPackage implements RootPackageInterface
  18614. {
  18615. public function __construct(RootPackageInterface $aliasOf, $version, $prettyVersion)
  18616. {
  18617. parent::__construct($aliasOf, $version, $prettyVersion);
  18618. }
  18619. public function getAliases()
  18620. {
  18621. return $this->aliasOf->getAliases();
  18622. }
  18623. public function getMinimumStability()
  18624. {
  18625. return $this->aliasOf->getMinimumStability();
  18626. }
  18627. public function getStabilityFlags()
  18628. {
  18629. return $this->aliasOf->getStabilityFlags();
  18630. }
  18631. public function getReferences()
  18632. {
  18633. return $this->aliasOf->getReferences();
  18634. }
  18635. public function getPreferStable()
  18636. {
  18637. return $this->aliasOf->getPreferStable();
  18638. }
  18639. public function getConfig()
  18640. {
  18641. return $this->aliasOf->getConfig();
  18642. }
  18643. public function setRequires(array $require)
  18644. {
  18645. $this->requires = $this->replaceSelfVersionDependencies($require, 'requires');
  18646. $this->aliasOf->setRequires($require);
  18647. }
  18648. public function setDevRequires(array $devRequire)
  18649. {
  18650. $this->devRequires = $this->replaceSelfVersionDependencies($devRequire, 'devRequires');
  18651. $this->aliasOf->setDevRequires($devRequire);
  18652. }
  18653. public function setConflicts(array $conflicts)
  18654. {
  18655. $this->conflicts = $this->replaceSelfVersionDependencies($conflicts, 'conflicts');
  18656. $this->aliasOf->setConflicts($conflicts);
  18657. }
  18658. public function setProvides(array $provides)
  18659. {
  18660. $this->provides = $this->replaceSelfVersionDependencies($provides, 'provides');
  18661. $this->aliasOf->setProvides($provides);
  18662. }
  18663. public function setReplaces(array $replaces)
  18664. {
  18665. $this->replaces = $this->replaceSelfVersionDependencies($replaces, 'replaces');
  18666. $this->aliasOf->setReplaces($replaces);
  18667. }
  18668. public function setRepositories($repositories)
  18669. {
  18670. $this->aliasOf->setRepositories($repositories);
  18671. }
  18672. public function setAutoload(array $autoload)
  18673. {
  18674. $this->aliasOf->setAutoload($autoload);
  18675. }
  18676. public function setDevAutoload(array $devAutoload)
  18677. {
  18678. $this->aliasOf->setDevAutoload($devAutoload);
  18679. }
  18680. public function setStabilityFlags(array $stabilityFlags)
  18681. {
  18682. $this->aliasOf->setStabilityFlags($stabilityFlags);
  18683. }
  18684. public function setSuggests(array $suggests)
  18685. {
  18686. $this->aliasOf->setSuggests($suggests);
  18687. }
  18688. public function setExtra(array $extra)
  18689. {
  18690. $this->aliasOf->setExtra($extra);
  18691. }
  18692. public function __clone()
  18693. {
  18694. parent::__clone();
  18695. $this->aliasOf = clone $this->aliasOf;
  18696. }
  18697. }
  18698. <?php
  18699. namespace Composer\Package;
  18700. class RootPackage extends CompletePackage implements RootPackageInterface
  18701. {
  18702. protected $minimumStability = 'stable';
  18703. protected $preferStable = false;
  18704. protected $stabilityFlags = array();
  18705. protected $config = array();
  18706. protected $references = array();
  18707. protected $aliases = array();
  18708. public function setMinimumStability($minimumStability)
  18709. {
  18710. $this->minimumStability = $minimumStability;
  18711. }
  18712. public function getMinimumStability()
  18713. {
  18714. return $this->minimumStability;
  18715. }
  18716. public function setStabilityFlags(array $stabilityFlags)
  18717. {
  18718. $this->stabilityFlags = $stabilityFlags;
  18719. }
  18720. public function getStabilityFlags()
  18721. {
  18722. return $this->stabilityFlags;
  18723. }
  18724. public function setPreferStable($preferStable)
  18725. {
  18726. $this->preferStable = $preferStable;
  18727. }
  18728. public function getPreferStable()
  18729. {
  18730. return $this->preferStable;
  18731. }
  18732. public function setConfig(array $config)
  18733. {
  18734. $this->config = $config;
  18735. }
  18736. public function getConfig()
  18737. {
  18738. return $this->config;
  18739. }
  18740. public function setReferences(array $references)
  18741. {
  18742. $this->references = $references;
  18743. }
  18744. public function getReferences()
  18745. {
  18746. return $this->references;
  18747. }
  18748. public function setAliases(array $aliases)
  18749. {
  18750. $this->aliases = $aliases;
  18751. }
  18752. public function getAliases()
  18753. {
  18754. return $this->aliases;
  18755. }
  18756. }
  18757. <?php
  18758. namespace Composer\Package;
  18759. interface RootPackageInterface extends CompletePackageInterface
  18760. {
  18761. public function getAliases();
  18762. public function getMinimumStability();
  18763. public function getStabilityFlags();
  18764. public function getReferences();
  18765. public function getPreferStable();
  18766. public function getConfig();
  18767. public function setRequires(array $requires);
  18768. public function setDevRequires(array $devRequires);
  18769. public function setConflicts(array $conflicts);
  18770. public function setProvides(array $provides);
  18771. public function setReplaces(array $replaces);
  18772. public function setRepositories($repositories);
  18773. public function setAutoload(array $autoload);
  18774. public function setDevAutoload(array $devAutoload);
  18775. public function setStabilityFlags(array $stabilityFlags);
  18776. public function setSuggests(array $suggests);
  18777. public function setExtra(array $extra);
  18778. }
  18779. <?php
  18780. namespace Composer\Package\Version;
  18781. use Composer\Config;
  18782. use Composer\Repository\Vcs\HgDriver;
  18783. use Composer\IO\NullIO;
  18784. use Composer\Semver\VersionParser as SemverVersionParser;
  18785. use Composer\Util\Git as GitUtil;
  18786. use Composer\Util\ProcessExecutor;
  18787. use Composer\Util\Svn as SvnUtil;
  18788. class VersionGuesser
  18789. {
  18790. private $config;
  18791. private $process;
  18792. private $versionParser;
  18793. public function __construct(Config $config, ProcessExecutor $process, SemverVersionParser $versionParser)
  18794. {
  18795. $this->config = $config;
  18796. $this->process = $process;
  18797. $this->versionParser = $versionParser;
  18798. }
  18799. public function guessVersion(array $packageConfig, $path)
  18800. {
  18801. if (function_exists('proc_open')) {
  18802. $versionData = $this->guessGitVersion($packageConfig, $path);
  18803. if (null !== $versionData && null !== $versionData['version']) {
  18804. return $this->postprocess($versionData);
  18805. }
  18806. $versionData = $this->guessHgVersion($packageConfig, $path);
  18807. if (null !== $versionData && null !== $versionData['version']) {
  18808. return $this->postprocess($versionData);
  18809. }
  18810. $versionData = $this->guessFossilVersion($packageConfig, $path);
  18811. if (null !== $versionData && null !== $versionData['version']) {
  18812. return $this->postprocess($versionData);
  18813. }
  18814. $versionData = $this->guessSvnVersion($packageConfig, $path);
  18815. if (null !== $versionData && null !== $versionData['version']) {
  18816. return $this->postprocess($versionData);
  18817. }
  18818. }
  18819. }
  18820. private function postprocess(array $versionData)
  18821. {
  18822. if ('-dev' === substr($versionData['version'], -4) && preg_match('{\.9{7}}', $versionData['version'])) {
  18823. $versionData['pretty_version'] = preg_replace('{(\.9{7})+}', '.x', $versionData['version']);
  18824. }
  18825. return $versionData;
  18826. }
  18827. private function guessGitVersion(array $packageConfig, $path)
  18828. {
  18829. GitUtil::cleanEnv();
  18830. $commit = null;
  18831. $version = null;
  18832. $prettyVersion = null;
  18833. $isDetached = false;
  18834. if (0 === $this->process->execute('git branch --no-color --no-abbrev -v', $output, $path)) {
  18835. $branches = array();
  18836. $isFeatureBranch = false;
  18837. foreach ($this->process->splitLines($output) as $branch) {
  18838. if ($branch && preg_match('{^(?:\* ) *(\(no branch\)|\(detached from \S+\)|\(HEAD detached at \S+\)|\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  18839. if ($match[1] === '(no branch)' || substr($match[1], 0, 10) === '(detached ' || substr($match[1], 0, 17) === '(HEAD detached at') {
  18840. $version = 'dev-' . $match[2];
  18841. $prettyVersion = $version;
  18842. $isFeatureBranch = true;
  18843. $isDetached = true;
  18844. } else {
  18845. $version = $this->versionParser->normalizeBranch($match[1]);
  18846. $prettyVersion = 'dev-' . $match[1];
  18847. $isFeatureBranch = 0 === strpos($version, 'dev-');
  18848. }
  18849. if ($match[2]) {
  18850. $commit = $match[2];
  18851. }
  18852. }
  18853. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  18854. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  18855. $branches[] = $match[1];
  18856. }
  18857. }
  18858. }
  18859. if ($isFeatureBranch) {
  18860. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'git rev-list %candidate%..%branch%', $path);
  18861. $version = $result['version'];
  18862. $prettyVersion = $result['pretty_version'];
  18863. }
  18864. }
  18865. if (!$version || $isDetached) {
  18866. $result = $this->versionFromGitTags($path);
  18867. if ($result) {
  18868. $version = $result['version'];
  18869. $prettyVersion = $result['pretty_version'];
  18870. }
  18871. }
  18872. if (!$commit) {
  18873. $command = 'git log --pretty="%H" -n1 HEAD';
  18874. if (0 === $this->process->execute($command, $output, $path)) {
  18875. $commit = trim($output) ?: null;
  18876. }
  18877. }
  18878. return array('version' => $version, 'commit' => $commit, 'pretty_version' => $prettyVersion);
  18879. }
  18880. private function versionFromGitTags($path)
  18881. {
  18882. if (0 === $this->process->execute('git describe --exact-match --tags', $output, $path)) {
  18883. try {
  18884. $version = $this->versionParser->normalize(trim($output));
  18885. return array('version' => $version, 'pretty_version' => trim($output));
  18886. } catch (\Exception $e) {
  18887. }
  18888. }
  18889. return null;
  18890. }
  18891. private function guessHgVersion(array $packageConfig, $path)
  18892. {
  18893. if (0 === $this->process->execute('hg branch', $output, $path)) {
  18894. $branch = trim($output);
  18895. $version = $this->versionParser->normalizeBranch($branch);
  18896. $isFeatureBranch = 0 === strpos($version, 'dev-');
  18897. if ('9999999-dev' === $version) {
  18898. return array('version' => $version, 'commit' => null, 'pretty_version' => 'dev-'.$branch);
  18899. }
  18900. if (!$isFeatureBranch) {
  18901. return array('version' => $version, 'commit' => null, 'pretty_version' => $version);
  18902. }
  18903. $driver = new HgDriver(array('url' => $path), new NullIO(), $this->config, $this->process);
  18904. $branches = array_keys($driver->getBranches());
  18905. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'hg log -r "not ancestors(\'%candidate%\') and ancestors(\'%branch%\')" --template "{node}\\n"', $path);
  18906. $result['commit'] = '';
  18907. return $result;
  18908. }
  18909. }
  18910. private function guessFeatureVersion(array $packageConfig, $version, array $branches, $scmCmdline, $path)
  18911. {
  18912. $prettyVersion = $version;
  18913. if ((isset($packageConfig['extra']['branch-alias']) && !isset($packageConfig['extra']['branch-alias'][$version]))
  18914. || strpos(json_encode($packageConfig), '"self.version"')
  18915. ) {
  18916. $branch = preg_replace('{^dev-}', '', $version);
  18917. $length = PHP_INT_MAX;
  18918. $nonFeatureBranches = '';
  18919. if (!empty($packageConfig['non-feature-branches'])) {
  18920. $nonFeatureBranches = implode('|', $packageConfig['non-feature-branches']);
  18921. }
  18922. foreach ($branches as $candidate) {
  18923. if ($candidate === $branch && preg_match('{^(' . $nonFeatureBranches . ')$}', $candidate)) {
  18924. break;
  18925. }
  18926. if ($candidate === $branch || !preg_match('{^(' . $nonFeatureBranches . '|master|trunk|default|develop|\d+\..+)$}', $candidate, $match)) {
  18927. continue;
  18928. }
  18929. $cmdLine = str_replace(array('%candidate%', '%branch%'), array($candidate, $branch), $scmCmdline);
  18930. if (0 !== $this->process->execute($cmdLine, $output, $path)) {
  18931. continue;
  18932. }
  18933. if (strlen($output) < $length) {
  18934. $length = strlen($output);
  18935. $version = $this->versionParser->normalizeBranch($candidate);
  18936. $prettyVersion = 'dev-' . $match[1];
  18937. }
  18938. }
  18939. }
  18940. return array('version' => $version, 'pretty_version' => $prettyVersion);
  18941. }
  18942. private function guessFossilVersion(array $packageConfig, $path)
  18943. {
  18944. $version = null;
  18945. $prettyVersion = null;
  18946. if (0 === $this->process->execute('fossil branch list', $output, $path)) {
  18947. $branch = trim($output);
  18948. $version = $this->versionParser->normalizeBranch($branch);
  18949. $prettyVersion = 'dev-' . $branch;
  18950. }
  18951. if (0 === $this->process->execute('fossil tag list', $output, $path)) {
  18952. try {
  18953. $version = $this->versionParser->normalize(trim($output));
  18954. $prettyVersion = trim($output);
  18955. } catch (\Exception $e) {
  18956. }
  18957. }
  18958. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  18959. }
  18960. private function guessSvnVersion(array $packageConfig, $path)
  18961. {
  18962. SvnUtil::cleanEnv();
  18963. if (0 === $this->process->execute('svn info --xml', $output, $path)) {
  18964. $trunkPath = isset($packageConfig['trunk-path']) ? preg_quote($packageConfig['trunk-path'], '#') : 'trunk';
  18965. $branchesPath = isset($packageConfig['branches-path']) ? preg_quote($packageConfig['branches-path'], '#') : 'branches';
  18966. $tagsPath = isset($packageConfig['tags-path']) ? preg_quote($packageConfig['tags-path'], '#') : 'tags';
  18967. $urlPattern = '#<url>.*/(' . $trunkPath . '|(' . $branchesPath . '|' . $tagsPath . ')/(.*))</url>#';
  18968. if (preg_match($urlPattern, $output, $matches)) {
  18969. if (isset($matches[2]) && ($branchesPath === $matches[2] || $tagsPath === $matches[2])) {
  18970. $version = $this->versionParser->normalizeBranch($matches[3]);
  18971. $prettyVersion = 'dev-' . $matches[3];
  18972. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  18973. }
  18974. $prettyVersion = trim($matches[1]);
  18975. $version = $this->versionParser->normalize($prettyVersion);
  18976. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  18977. }
  18978. }
  18979. }
  18980. }
  18981. <?php
  18982. namespace Composer\Package\Version;
  18983. use Composer\Repository\PlatformRepository;
  18984. use Composer\Semver\VersionParser as SemverVersionParser;
  18985. use Composer\Semver\Semver;
  18986. class VersionParser extends SemverVersionParser
  18987. {
  18988. private static $constraints = array();
  18989. public function parseConstraints($constraints)
  18990. {
  18991. if (!isset(self::$constraints[$constraints])) {
  18992. self::$constraints[$constraints] = parent::parseConstraints($constraints);
  18993. }
  18994. return self::$constraints[$constraints];
  18995. }
  18996. public function parseNameVersionPairs(array $pairs)
  18997. {
  18998. $pairs = array_values($pairs);
  18999. $result = array();
  19000. for ($i = 0, $count = count($pairs); $i < $count; $i++) {
  19001. $pair = preg_replace('{^([^=: ]+)[=: ](.*)$}', '$1 $2', trim($pairs[$i]));
  19002. if (false === strpos($pair, ' ') && isset($pairs[$i + 1]) && false === strpos($pairs[$i + 1], '/') && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $pairs[$i + 1])) {
  19003. $pair .= ' '.$pairs[$i + 1];
  19004. $i++;
  19005. }
  19006. if (strpos($pair, ' ')) {
  19007. list($name, $version) = explode(' ', $pair, 2);
  19008. $result[] = array('name' => $name, 'version' => $version);
  19009. } else {
  19010. $result[] = array('name' => $pair);
  19011. }
  19012. }
  19013. return $result;
  19014. }
  19015. public static function isUpgrade($normalizedFrom, $normalizedTo)
  19016. {
  19017. if (substr($normalizedFrom, 0, 4) === 'dev-' || substr($normalizedTo, 0, 4) === 'dev-') {
  19018. return true;
  19019. }
  19020. $sorted = Semver::sort(array($normalizedTo, $normalizedFrom));
  19021. return $sorted[0] === $normalizedFrom;
  19022. }
  19023. }
  19024. <?php
  19025. namespace Composer\Package\Version;
  19026. use Composer\DependencyResolver\Pool;
  19027. use Composer\Package\BasePackage;
  19028. use Composer\Package\PackageInterface;
  19029. use Composer\Package\Loader\ArrayLoader;
  19030. use Composer\Package\Dumper\ArrayDumper;
  19031. use Composer\Semver\Constraint\Constraint;
  19032. class VersionSelector
  19033. {
  19034. private $pool;
  19035. private $parser;
  19036. public function __construct(Pool $pool)
  19037. {
  19038. $this->pool = $pool;
  19039. }
  19040. public function findBestCandidate($packageName, $targetPackageVersion = null, $targetPhpVersion = null, $preferredStability = 'stable')
  19041. {
  19042. $constraint = $targetPackageVersion ? $this->getParser()->parseConstraints($targetPackageVersion) : null;
  19043. $candidates = $this->pool->whatProvides(strtolower($packageName), $constraint, true);
  19044. if ($targetPhpVersion) {
  19045. $phpConstraint = new Constraint('==', $this->getParser()->normalize($targetPhpVersion));
  19046. $candidates = array_filter($candidates, function ($pkg) use ($phpConstraint) {
  19047. $reqs = $pkg->getRequires();
  19048. return !isset($reqs['php']) || $reqs['php']->getConstraint()->matches($phpConstraint);
  19049. });
  19050. }
  19051. if (!$candidates) {
  19052. return false;
  19053. }
  19054. $package = reset($candidates);
  19055. $minPriority = BasePackage::$stabilities[$preferredStability];
  19056. foreach ($candidates as $candidate) {
  19057. $candidatePriority = $candidate->getStabilityPriority();
  19058. $currentPriority = $package->getStabilityPriority();
  19059. if ($minPriority < $candidatePriority && $currentPriority < $candidatePriority) {
  19060. continue;
  19061. }
  19062. if ($minPriority < $candidatePriority && $candidatePriority < $currentPriority) {
  19063. $package = $candidate;
  19064. continue;
  19065. }
  19066. if ($minPriority >= $candidatePriority && $minPriority < $currentPriority) {
  19067. $package = $candidate;
  19068. continue;
  19069. }
  19070. if (version_compare($package->getVersion(), $candidate->getVersion(), '<')) {
  19071. $package = $candidate;
  19072. }
  19073. }
  19074. return $package;
  19075. }
  19076. public function findRecommendedRequireVersion(PackageInterface $package)
  19077. {
  19078. $version = $package->getVersion();
  19079. if (!$package->isDev()) {
  19080. return $this->transformVersion($version, $package->getPrettyVersion(), $package->getStability());
  19081. }
  19082. $loader = new ArrayLoader($this->getParser());
  19083. $dumper = new ArrayDumper();
  19084. $extra = $loader->getBranchAlias($dumper->dump($package));
  19085. if ($extra) {
  19086. $extra = preg_replace('{^(\d+\.\d+\.\d+)(\.9999999)-dev$}', '$1.0', $extra, -1, $count);
  19087. if ($count) {
  19088. $extra = str_replace('.9999999', '.0', $extra);
  19089. return $this->transformVersion($extra, $extra, 'dev');
  19090. }
  19091. }
  19092. return $package->getPrettyVersion();
  19093. }
  19094. private function transformVersion($version, $prettyVersion, $stability)
  19095. {
  19096. $semanticVersionParts = explode('.', $version);
  19097. if (count($semanticVersionParts) == 4 && preg_match('{^0\D?}', $semanticVersionParts[3])) {
  19098. if ($semanticVersionParts[0] === '0') {
  19099. unset($semanticVersionParts[3]);
  19100. } else {
  19101. unset($semanticVersionParts[2], $semanticVersionParts[3]);
  19102. }
  19103. $version = implode('.', $semanticVersionParts);
  19104. } else {
  19105. return $prettyVersion;
  19106. }
  19107. if ($stability != 'stable') {
  19108. $version .= '@'.$stability;
  19109. }
  19110. return '^' . $version;
  19111. }
  19112. private function getParser()
  19113. {
  19114. if ($this->parser === null) {
  19115. $this->parser = new VersionParser();
  19116. }
  19117. return $this->parser;
  19118. }
  19119. }
  19120. <?php
  19121. namespace Composer\Plugin\Capability;
  19122. interface Capability
  19123. {
  19124. }
  19125. <?php
  19126. namespace Composer\Plugin\Capability;
  19127. interface CommandProvider extends Capability
  19128. {
  19129. public function getCommands();
  19130. }
  19131. <?php
  19132. namespace Composer\Plugin;
  19133. interface Capable
  19134. {
  19135. public function getCapabilities();
  19136. }
  19137. <?php
  19138. namespace Composer\Plugin;
  19139. use Composer\EventDispatcher\Event;
  19140. use Symfony\Component\Console\Input\InputInterface;
  19141. use Symfony\Component\Console\Output\OutputInterface;
  19142. class CommandEvent extends Event
  19143. {
  19144. private $commandName;
  19145. private $input;
  19146. private $output;
  19147. public function __construct($name, $commandName, $input, $output, array $args = array(), array $flags = array())
  19148. {
  19149. parent::__construct($name, $args, $flags);
  19150. $this->commandName = $commandName;
  19151. $this->input = $input;
  19152. $this->output = $output;
  19153. }
  19154. public function getInput()
  19155. {
  19156. return $this->input;
  19157. }
  19158. public function getOutput()
  19159. {
  19160. return $this->output;
  19161. }
  19162. public function getCommandName()
  19163. {
  19164. return $this->commandName;
  19165. }
  19166. }
  19167. <?php
  19168. namespace Composer\Plugin;
  19169. class PluginEvents
  19170. {
  19171. const INIT = 'init';
  19172. const COMMAND = 'command';
  19173. const PRE_FILE_DOWNLOAD = 'pre-file-download';
  19174. const PRE_COMMAND_RUN = 'pre-command-run';
  19175. }
  19176. <?php
  19177. namespace Composer\Plugin;
  19178. use Composer\Composer;
  19179. use Composer\IO\IOInterface;
  19180. interface PluginInterface
  19181. {
  19182. const PLUGIN_API_VERSION = '1.1.0';
  19183. public function activate(Composer $composer, IOInterface $io);
  19184. }
  19185. <?php
  19186. namespace Composer\Plugin;
  19187. use Composer\Composer;
  19188. use Composer\EventDispatcher\EventSubscriberInterface;
  19189. use Composer\IO\IOInterface;
  19190. use Composer\Package\Package;
  19191. use Composer\Package\Version\VersionParser;
  19192. use Composer\Repository\RepositoryInterface;
  19193. use Composer\Package\AliasPackage;
  19194. use Composer\Package\PackageInterface;
  19195. use Composer\Package\Link;
  19196. use Composer\Semver\Constraint\Constraint;
  19197. use Composer\DependencyResolver\Pool;
  19198. use Composer\Plugin\Capability\Capability;
  19199. class PluginManager
  19200. {
  19201. protected $composer;
  19202. protected $io;
  19203. protected $globalComposer;
  19204. protected $versionParser;
  19205. protected $disablePlugins = false;
  19206. protected $plugins = array();
  19207. protected $registeredPlugins = array();
  19208. private static $classCounter = 0;
  19209. public function __construct(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  19210. {
  19211. $this->io = $io;
  19212. $this->composer = $composer;
  19213. $this->globalComposer = $globalComposer;
  19214. $this->versionParser = new VersionParser();
  19215. $this->disablePlugins = $disablePlugins;
  19216. }
  19217. public function loadInstalledPlugins()
  19218. {
  19219. if ($this->disablePlugins) {
  19220. return;
  19221. }
  19222. $repo = $this->composer->getRepositoryManager()->getLocalRepository();
  19223. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  19224. if ($repo) {
  19225. $this->loadRepository($repo);
  19226. }
  19227. if ($globalRepo) {
  19228. $this->loadRepository($globalRepo);
  19229. }
  19230. }
  19231. public function getPlugins()
  19232. {
  19233. return $this->plugins;
  19234. }
  19235. public function getGlobalComposer()
  19236. {
  19237. return $this->globalComposer;
  19238. }
  19239. public function registerPackage(PackageInterface $package, $failOnMissingClasses = false)
  19240. {
  19241. if ($this->disablePlugins) {
  19242. return;
  19243. }
  19244. if ($package->getType() === 'composer-plugin') {
  19245. $requiresComposer = null;
  19246. foreach ($package->getRequires() as $link) {
  19247. if ('composer-plugin-api' === $link->getTarget()) {
  19248. $requiresComposer = $link->getConstraint();
  19249. break;
  19250. }
  19251. }
  19252. if (!$requiresComposer) {
  19253. throw new \RuntimeException("Plugin ".$package->getName()." is missing a require statement for a version of the composer-plugin-api package.");
  19254. }
  19255. $currentPluginApiVersion = $this->getPluginApiVersion();
  19256. $currentPluginApiConstraint = new Constraint('==', $this->versionParser->normalize($currentPluginApiVersion));
  19257. if ($requiresComposer->getPrettyString() === '1.0.0' && $this->getPluginApiVersion() === '1.0.0') {
  19258. $this->io->writeError('<warning>The "' . $package->getName() . '" plugin requires composer-plugin-api 1.0.0, this *WILL* break in the future and it should be fixed ASAP (require ^1.0 for example).</warning>');
  19259. } elseif (!$requiresComposer->matches($currentPluginApiConstraint)) {
  19260. $this->io->writeError('<warning>The "' . $package->getName() . '" plugin was skipped because it requires a Plugin API version ("' . $requiresComposer->getPrettyString() . '") that does not match your Composer installation ("' . $currentPluginApiVersion . '"). You may need to run composer update with the "--no-plugins" option.</warning>');
  19261. return;
  19262. }
  19263. }
  19264. $oldInstallerPlugin = ($package->getType() === 'composer-installer');
  19265. if (in_array($package->getName(), $this->registeredPlugins)) {
  19266. return;
  19267. }
  19268. $extra = $package->getExtra();
  19269. if (empty($extra['class'])) {
  19270. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  19271. }
  19272. $classes = is_array($extra['class']) ? $extra['class'] : array($extra['class']);
  19273. $localRepo = $this->composer->getRepositoryManager()->getLocalRepository();
  19274. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  19275. $pool = new Pool('dev');
  19276. $pool->addRepository($localRepo);
  19277. if ($globalRepo) {
  19278. $pool->addRepository($globalRepo);
  19279. }
  19280. $autoloadPackages = array($package->getName() => $package);
  19281. $autoloadPackages = $this->collectDependencies($pool, $autoloadPackages, $package);
  19282. $generator = $this->composer->getAutoloadGenerator();
  19283. $autoloads = array();
  19284. foreach ($autoloadPackages as $autoloadPackage) {
  19285. $downloadPath = $this->getInstallPath($autoloadPackage, $globalRepo && $globalRepo->hasPackage($autoloadPackage));
  19286. $autoloads[] = array($autoloadPackage, $downloadPath);
  19287. }
  19288. $map = $generator->parseAutoloads($autoloads, new Package('dummy', '1.0.0.0', '1.0.0'));
  19289. $classLoader = $generator->createLoader($map);
  19290. $classLoader->register();
  19291. foreach ($classes as $class) {
  19292. if (class_exists($class, false)) {
  19293. $class = trim($class, '\\');
  19294. $path = $classLoader->findFile($class);
  19295. $code = file_get_contents($path);
  19296. $separatorPos = strrpos($class, '\\');
  19297. $className = $class;
  19298. if ($separatorPos) {
  19299. $className = substr($class, $separatorPos + 1);
  19300. }
  19301. $code = preg_replace('{^((?:final\s+)?(?:\s*))class\s+('.preg_quote($className).')}mi', '$1class $2_composer_tmp'.self::$classCounter, $code, 1);
  19302. $code = str_replace('__FILE__', var_export($path, true), $code);
  19303. $code = str_replace('__DIR__', var_export(dirname($path), true), $code);
  19304. $code = str_replace('__CLASS__', var_export($class, true), $code);
  19305. $code = preg_replace('/^\s*<\?(php)?/i', '', $code, 1);
  19306. eval($code);
  19307. $class .= '_composer_tmp'.self::$classCounter;
  19308. self::$classCounter++;
  19309. }
  19310. if ($oldInstallerPlugin) {
  19311. $installer = new $class($this->io, $this->composer);
  19312. $this->composer->getInstallationManager()->addInstaller($installer);
  19313. } elseif (class_exists($class)) {
  19314. $plugin = new $class();
  19315. $this->addPlugin($plugin);
  19316. $this->registeredPlugins[] = $package->getName();
  19317. } elseif ($failOnMissingClasses) {
  19318. throw new \UnexpectedValueException('Plugin '.$package->getName().' could not be initialized, class not found: '.$class);
  19319. }
  19320. }
  19321. }
  19322. protected function getPluginApiVersion()
  19323. {
  19324. return PluginInterface::PLUGIN_API_VERSION;
  19325. }
  19326. public function addPlugin(PluginInterface $plugin)
  19327. {
  19328. $this->io->writeError('Loading plugin '.get_class($plugin), true, IOInterface::DEBUG);
  19329. $this->plugins[] = $plugin;
  19330. $plugin->activate($this->composer, $this->io);
  19331. if ($plugin instanceof EventSubscriberInterface) {
  19332. $this->composer->getEventDispatcher()->addSubscriber($plugin);
  19333. }
  19334. }
  19335. private function loadRepository(RepositoryInterface $repo)
  19336. {
  19337. foreach ($repo->getPackages() as $package) {
  19338. if ($package instanceof AliasPackage) {
  19339. continue;
  19340. }
  19341. if ('composer-plugin' === $package->getType()) {
  19342. $this->registerPackage($package);
  19343. } elseif ('composer-installer' === $package->getType()) {
  19344. $this->registerPackage($package);
  19345. }
  19346. }
  19347. }
  19348. private function collectDependencies(Pool $pool, array $collected, PackageInterface $package)
  19349. {
  19350. $requires = array_merge(
  19351. $package->getRequires(),
  19352. $package->getDevRequires()
  19353. );
  19354. foreach ($requires as $requireLink) {
  19355. $requiredPackage = $this->lookupInstalledPackage($pool, $requireLink);
  19356. if ($requiredPackage && !isset($collected[$requiredPackage->getName()])) {
  19357. $collected[$requiredPackage->getName()] = $requiredPackage;
  19358. $collected = $this->collectDependencies($pool, $collected, $requiredPackage);
  19359. }
  19360. }
  19361. return $collected;
  19362. }
  19363. private function lookupInstalledPackage(Pool $pool, Link $link)
  19364. {
  19365. $packages = $pool->whatProvides($link->getTarget(), $link->getConstraint());
  19366. return !empty($packages) ? $packages[0] : null;
  19367. }
  19368. private function getInstallPath(PackageInterface $package, $global = false)
  19369. {
  19370. if (!$global) {
  19371. return $this->composer->getInstallationManager()->getInstallPath($package);
  19372. }
  19373. return $this->globalComposer->getInstallationManager()->getInstallPath($package);
  19374. }
  19375. protected function getCapabilityImplementationClassName(PluginInterface $plugin, $capability)
  19376. {
  19377. if (!($plugin instanceof Capable)) {
  19378. return null;
  19379. }
  19380. $capabilities = (array) $plugin->getCapabilities();
  19381. if (!empty($capabilities[$capability]) && is_string($capabilities[$capability]) && trim($capabilities[$capability])) {
  19382. return trim($capabilities[$capability]);
  19383. }
  19384. if (
  19385. array_key_exists($capability, $capabilities)
  19386. && (empty($capabilities[$capability]) || !is_string($capabilities[$capability]) || !trim($capabilities[$capability]))
  19387. ) {
  19388. throw new \UnexpectedValueException('Plugin '.get_class($plugin).' provided invalid capability class name(s), got '.var_export($capabilities[$capability], 1));
  19389. }
  19390. }
  19391. public function getPluginCapability(PluginInterface $plugin, $capabilityClassName, array $ctorArgs = array())
  19392. {
  19393. if ($capabilityClass = $this->getCapabilityImplementationClassName($plugin, $capabilityClassName)) {
  19394. if (!class_exists($capabilityClass)) {
  19395. throw new \RuntimeException("Cannot instantiate Capability, as class $capabilityClass from plugin ".get_class($plugin)." does not exist.");
  19396. }
  19397. $ctorArgs['plugin'] = $plugin;
  19398. $capabilityObj = new $capabilityClass($ctorArgs);
  19399. if (!$capabilityObj instanceof Capability || !$capabilityObj instanceof $capabilityClassName) {
  19400. throw new \RuntimeException(
  19401. 'Class ' . $capabilityClass . ' must implement both Composer\Plugin\Capability\Capability and '. $capabilityClassName . '.'
  19402. );
  19403. }
  19404. return $capabilityObj;
  19405. }
  19406. }
  19407. public function getPluginCapabilities($capabilityClassName, array $ctorArgs = array())
  19408. {
  19409. $capabilities = array();
  19410. foreach ($this->getPlugins() as $plugin) {
  19411. if ($capability = $this->getPluginCapability($plugin, $capabilityClassName, $ctorArgs)) {
  19412. $capabilities[] = $capability;
  19413. }
  19414. }
  19415. return $capabilities;
  19416. }
  19417. }
  19418. <?php
  19419. namespace Composer\Plugin;
  19420. use Composer\EventDispatcher\Event;
  19421. use Symfony\Component\Console\Input\InputInterface;
  19422. class PreCommandRunEvent extends Event
  19423. {
  19424. private $input;
  19425. private $command;
  19426. public function __construct($name, InputInterface $input, $command)
  19427. {
  19428. parent::__construct($name);
  19429. $this->input = $input;
  19430. $this->command = $command;
  19431. }
  19432. public function getInput()
  19433. {
  19434. return $this->input;
  19435. }
  19436. public function getCommand()
  19437. {
  19438. return $this->command;
  19439. }
  19440. }
  19441. <?php
  19442. namespace Composer\Plugin;
  19443. use Composer\EventDispatcher\Event;
  19444. use Composer\Util\RemoteFilesystem;
  19445. class PreFileDownloadEvent extends Event
  19446. {
  19447. private $rfs;
  19448. private $processedUrl;
  19449. public function __construct($name, RemoteFilesystem $rfs, $processedUrl)
  19450. {
  19451. parent::__construct($name);
  19452. $this->rfs = $rfs;
  19453. $this->processedUrl = $processedUrl;
  19454. }
  19455. public function getRemoteFilesystem()
  19456. {
  19457. return $this->rfs;
  19458. }
  19459. public function setRemoteFilesystem(RemoteFilesystem $rfs)
  19460. {
  19461. $this->rfs = $rfs;
  19462. }
  19463. public function getProcessedUrl()
  19464. {
  19465. return $this->processedUrl;
  19466. }
  19467. }
  19468. <?php
  19469. namespace Composer\Question;
  19470. use Symfony\Component\Console\Exception\InvalidArgumentException;
  19471. use Symfony\Component\Console\Question\Question;
  19472. class StrictConfirmationQuestion extends Question
  19473. {
  19474. private $trueAnswerRegex;
  19475. private $falseAnswerRegex;
  19476. public function __construct($question, $default = true, $trueAnswerRegex = '/^y(?:es)?$/i', $falseAnswerRegex = '/^no?$/i')
  19477. {
  19478. parent::__construct($question, (bool) $default);
  19479. $this->trueAnswerRegex = $trueAnswerRegex;
  19480. $this->falseAnswerRegex = $falseAnswerRegex;
  19481. $this->setNormalizer($this->getDefaultNormalizer());
  19482. $this->setValidator($this->getDefaultValidator());
  19483. }
  19484. private function getDefaultNormalizer()
  19485. {
  19486. $default = $this->getDefault();
  19487. $trueRegex = $this->trueAnswerRegex;
  19488. $falseRegex = $this->falseAnswerRegex;
  19489. return function ($answer) use ($default, $trueRegex, $falseRegex) {
  19490. if (is_bool($answer)) {
  19491. return $answer;
  19492. }
  19493. if (empty($answer) && !empty($default)) {
  19494. return $default;
  19495. }
  19496. if (preg_match($trueRegex, $answer)) {
  19497. return true;
  19498. }
  19499. if (preg_match($falseRegex, $answer)) {
  19500. return false;
  19501. }
  19502. return null;
  19503. };
  19504. }
  19505. private function getDefaultValidator()
  19506. {
  19507. return function ($answer) {
  19508. if (!is_bool($answer)) {
  19509. throw new InvalidArgumentException('Please answer yes, y, no, or n.');
  19510. }
  19511. return $answer;
  19512. };
  19513. }
  19514. }
  19515. <?php
  19516. namespace Composer\Repository;
  19517. use Composer\Package\AliasPackage;
  19518. use Composer\Package\PackageInterface;
  19519. use Composer\Package\CompletePackageInterface;
  19520. use Composer\Package\Version\VersionParser;
  19521. use Composer\Semver\Constraint\ConstraintInterface;
  19522. use Composer\Semver\Constraint\Constraint;
  19523. class ArrayRepository extends BaseRepository
  19524. {
  19525. protected $packages;
  19526. public function __construct(array $packages = array())
  19527. {
  19528. foreach ($packages as $package) {
  19529. $this->addPackage($package);
  19530. }
  19531. }
  19532. public function findPackage($name, $constraint)
  19533. {
  19534. $name = strtolower($name);
  19535. if (!$constraint instanceof ConstraintInterface) {
  19536. $versionParser = new VersionParser();
  19537. $constraint = $versionParser->parseConstraints($constraint);
  19538. }
  19539. foreach ($this->getPackages() as $package) {
  19540. if ($name === $package->getName()) {
  19541. $pkgConstraint = new Constraint('==', $package->getVersion());
  19542. if ($constraint->matches($pkgConstraint)) {
  19543. return $package;
  19544. }
  19545. }
  19546. }
  19547. return null;
  19548. }
  19549. public function findPackages($name, $constraint = null)
  19550. {
  19551. $name = strtolower($name);
  19552. $packages = array();
  19553. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  19554. $versionParser = new VersionParser();
  19555. $constraint = $versionParser->parseConstraints($constraint);
  19556. }
  19557. foreach ($this->getPackages() as $package) {
  19558. if ($name === $package->getName()) {
  19559. $pkgConstraint = new Constraint('==', $package->getVersion());
  19560. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  19561. $packages[] = $package;
  19562. }
  19563. }
  19564. }
  19565. return $packages;
  19566. }
  19567. public function search($query, $mode = 0, $type = null)
  19568. {
  19569. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  19570. $matches = array();
  19571. foreach ($this->getPackages() as $package) {
  19572. $name = $package->getName();
  19573. if (isset($matches[$name])) {
  19574. continue;
  19575. }
  19576. if (preg_match($regex, $name)
  19577. || ($mode === self::SEARCH_FULLTEXT && $package instanceof CompletePackageInterface && preg_match($regex, implode(' ', (array) $package->getKeywords()) . ' ' . $package->getDescription()))
  19578. ) {
  19579. if (null !== $type && $package->getType() !== $type) {
  19580. continue;
  19581. }
  19582. $matches[$name] = array(
  19583. 'name' => $package->getPrettyName(),
  19584. 'description' => $package instanceof CompletePackageInterface ? $package->getDescription() : null,
  19585. );
  19586. }
  19587. }
  19588. return array_values($matches);
  19589. }
  19590. public function hasPackage(PackageInterface $package)
  19591. {
  19592. $packageId = $package->getUniqueName();
  19593. foreach ($this->getPackages() as $repoPackage) {
  19594. if ($packageId === $repoPackage->getUniqueName()) {
  19595. return true;
  19596. }
  19597. }
  19598. return false;
  19599. }
  19600. public function addPackage(PackageInterface $package)
  19601. {
  19602. if (null === $this->packages) {
  19603. $this->initialize();
  19604. }
  19605. $package->setRepository($this);
  19606. $this->packages[] = $package;
  19607. if ($package instanceof AliasPackage) {
  19608. $aliasedPackage = $package->getAliasOf();
  19609. if (null === $aliasedPackage->getRepository()) {
  19610. $this->addPackage($aliasedPackage);
  19611. }
  19612. }
  19613. }
  19614. protected function createAliasPackage(PackageInterface $package, $alias, $prettyAlias)
  19615. {
  19616. return new AliasPackage($package instanceof AliasPackage ? $package->getAliasOf() : $package, $alias, $prettyAlias);
  19617. }
  19618. public function removePackage(PackageInterface $package)
  19619. {
  19620. $packageId = $package->getUniqueName();
  19621. foreach ($this->getPackages() as $key => $repoPackage) {
  19622. if ($packageId === $repoPackage->getUniqueName()) {
  19623. array_splice($this->packages, $key, 1);
  19624. return;
  19625. }
  19626. }
  19627. }
  19628. public function getPackages()
  19629. {
  19630. if (null === $this->packages) {
  19631. $this->initialize();
  19632. }
  19633. return $this->packages;
  19634. }
  19635. public function count()
  19636. {
  19637. return count($this->packages);
  19638. }
  19639. protected function initialize()
  19640. {
  19641. $this->packages = array();
  19642. }
  19643. }
  19644. <?php
  19645. namespace Composer\Repository;
  19646. use Composer\IO\IOInterface;
  19647. use Composer\Json\JsonFile;
  19648. use Composer\Package\Loader\ArrayLoader;
  19649. use Composer\Package\Loader\LoaderInterface;
  19650. class ArtifactRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  19651. {
  19652. protected $loader;
  19653. protected $lookup;
  19654. protected $repoConfig;
  19655. private $io;
  19656. public function __construct(array $repoConfig, IOInterface $io)
  19657. {
  19658. parent::__construct();
  19659. if (!extension_loaded('zip')) {
  19660. throw new \RuntimeException('The artifact repository requires PHP\'s zip extension');
  19661. }
  19662. $this->loader = new ArrayLoader();
  19663. $this->lookup = $repoConfig['url'];
  19664. $this->io = $io;
  19665. $this->repoConfig = $repoConfig;
  19666. }
  19667. public function getRepoConfig()
  19668. {
  19669. return $this->repoConfig;
  19670. }
  19671. protected function initialize()
  19672. {
  19673. parent::initialize();
  19674. $this->scanDirectory($this->lookup);
  19675. }
  19676. private function scanDirectory($path)
  19677. {
  19678. $io = $this->io;
  19679. $directory = new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
  19680. $iterator = new \RecursiveIteratorIterator($directory);
  19681. $regex = new \RegexIterator($iterator, '/^.+\.(zip|phar)$/i');
  19682. foreach ($regex as $file) {
  19683. if (!$file->isFile()) {
  19684. continue;
  19685. }
  19686. $package = $this->getComposerInformation($file);
  19687. if (!$package) {
  19688. $io->writeError("File <comment>{$file->getBasename()}</comment> doesn't seem to hold a package", true, IOInterface::VERBOSE);
  19689. continue;
  19690. }
  19691. $template = 'Found package <info>%s</info> (<comment>%s</comment>) in file <info>%s</info>';
  19692. $io->writeError(sprintf($template, $package->getName(), $package->getPrettyVersion(), $file->getBasename()), true, IOInterface::VERBOSE);
  19693. $this->addPackage($package);
  19694. }
  19695. }
  19696. private function locateFile(\ZipArchive $zip, $filename)
  19697. {
  19698. $indexOfShortestMatch = false;
  19699. $lengthOfShortestMatch = -1;
  19700. for ($i = 0; $i < $zip->numFiles; $i++) {
  19701. $stat = $zip->statIndex($i);
  19702. if (strcmp(basename($stat['name']), $filename) === 0) {
  19703. $directoryName = dirname($stat['name']);
  19704. if ($directoryName == '.') {
  19705. return $i;
  19706. }
  19707. if (strpos($directoryName, '\\') !== false ||
  19708. strpos($directoryName, '/') !== false) {
  19709. continue;
  19710. }
  19711. $length = strlen($stat['name']);
  19712. if ($indexOfShortestMatch === false || $length < $lengthOfShortestMatch) {
  19713. $contents = $zip->getFromIndex($i);
  19714. if ($contents !== false) {
  19715. $indexOfShortestMatch = $i;
  19716. $lengthOfShortestMatch = $length;
  19717. }
  19718. }
  19719. }
  19720. }
  19721. return $indexOfShortestMatch;
  19722. }
  19723. private function getComposerInformation(\SplFileInfo $file)
  19724. {
  19725. $zip = new \ZipArchive();
  19726. if ($zip->open($file->getPathname()) !== true) {
  19727. return false;
  19728. }
  19729. if (0 == $zip->numFiles) {
  19730. $zip->close();
  19731. return false;
  19732. }
  19733. $foundFileIndex = $this->locateFile($zip, 'composer.json');
  19734. if (false === $foundFileIndex) {
  19735. $zip->close();
  19736. return false;
  19737. }
  19738. $configurationFileName = $zip->getNameIndex($foundFileIndex);
  19739. $zip->close();
  19740. $composerFile = "zip://{$file->getPathname()}#$configurationFileName";
  19741. $json = file_get_contents($composerFile);
  19742. $package = JsonFile::parseJson($json, $composerFile);
  19743. $package['dist'] = array(
  19744. 'type' => 'zip',
  19745. 'url' => strtr($file->getPathname(), '\\', '/'),
  19746. 'shasum' => sha1_file($file->getRealPath()),
  19747. );
  19748. try {
  19749. $package = $this->loader->load($package);
  19750. } catch (\UnexpectedValueException $e) {
  19751. throw new \UnexpectedValueException('Failed loading package in '.$file.': '.$e->getMessage(), 0, $e);
  19752. }
  19753. return $package;
  19754. }
  19755. }
  19756. <?php
  19757. namespace Composer\Repository;
  19758. use Composer\Package\RootPackageInterface;
  19759. use Composer\Semver\Constraint\ConstraintInterface;
  19760. use Composer\Semver\Constraint\Constraint;
  19761. use Composer\Package\Link;
  19762. abstract class BaseRepository implements RepositoryInterface
  19763. {
  19764. public function getDependents($needle, $constraint = null, $invert = false, $recurse = true, $packagesFound = null)
  19765. {
  19766. $needles = array_map('strtolower', (array) $needle);
  19767. $results = array();
  19768. if (null === $packagesFound) {
  19769. $packagesFound = $needles;
  19770. }
  19771. $rootPackage = null;
  19772. foreach ($this->getPackages() as $package) {
  19773. if ($package instanceof RootPackageInterface) {
  19774. $rootPackage = $package;
  19775. break;
  19776. }
  19777. }
  19778. foreach ($this->getPackages() as $package) {
  19779. $links = $package->getRequires();
  19780. $packagesInTree = $packagesFound;
  19781. if (!$invert) {
  19782. $links += $package->getReplaces();
  19783. }
  19784. if ($package instanceof RootPackageInterface) {
  19785. $links += $package->getDevRequires();
  19786. }
  19787. foreach ($links as $link) {
  19788. foreach ($needles as $needle) {
  19789. if ($link->getTarget() === $needle) {
  19790. if ($constraint === null || ($link->getConstraint()->matches($constraint) === !$invert)) {
  19791. if (in_array($link->getSource(), $packagesInTree)) {
  19792. $results[$link->getSource()] = array($package, $link, false);
  19793. continue;
  19794. }
  19795. $packagesInTree[] = $link->getSource();
  19796. $dependents = $recurse ? $this->getDependents($link->getSource(), null, false, true, $packagesInTree) : array();
  19797. $results[$link->getSource()] = array($package, $link, $dependents);
  19798. }
  19799. }
  19800. }
  19801. }
  19802. if ($invert && in_array($package->getName(), $needles)) {
  19803. foreach ($package->getConflicts() as $link) {
  19804. foreach ($this->findPackages($link->getTarget()) as $pkg) {
  19805. $version = new Constraint('=', $pkg->getVersion());
  19806. if ($link->getConstraint()->matches($version) === $invert) {
  19807. $results[] = array($package, $link, false);
  19808. }
  19809. }
  19810. }
  19811. }
  19812. if ($invert && $constraint && in_array($package->getName(), $needles) && $constraint->matches(new Constraint('=', $package->getVersion()))) {
  19813. foreach ($package->getRequires() as $link) {
  19814. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  19815. if ($this->findPackage($link->getTarget(), $link->getConstraint())) {
  19816. continue;
  19817. }
  19818. $platformPkg = $this->findPackage($link->getTarget(), '*');
  19819. $description = $platformPkg ? 'but '.$platformPkg->getPrettyVersion().' is installed' : 'but it is missing';
  19820. $results[] = array($package, new Link($package->getName(), $link->getTarget(), null, 'requires', $link->getPrettyConstraint().' '.$description), false);
  19821. continue;
  19822. }
  19823. foreach ($this->getPackages() as $pkg) {
  19824. if (!in_array($link->getTarget(), $pkg->getNames())) {
  19825. continue;
  19826. }
  19827. $version = new Constraint('=', $pkg->getVersion());
  19828. if (!$link->getConstraint()->matches($version)) {
  19829. if ($rootPackage) {
  19830. foreach (array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()) as $rootReq) {
  19831. if (in_array($rootReq->getTarget(), $pkg->getNames()) && !$rootReq->getConstraint()->matches($link->getConstraint())) {
  19832. $results[] = array($package, $link, false);
  19833. $results[] = array($rootPackage, $rootReq, false);
  19834. continue 3;
  19835. }
  19836. }
  19837. $results[] = array($package, $link, false);
  19838. $results[] = array($rootPackage, new Link($rootPackage->getName(), $link->getTarget(), null, 'does not require', 'but ' . $pkg->getPrettyVersion() . ' is installed'), false);
  19839. } else {
  19840. $results[] = array($package, $link, false);
  19841. }
  19842. }
  19843. continue 2;
  19844. }
  19845. }
  19846. }
  19847. }
  19848. ksort($results);
  19849. return $results;
  19850. }
  19851. }
  19852. <?php
  19853. namespace Composer\Repository;
  19854. use Composer\Package\Loader\ArrayLoader;
  19855. use Composer\Package\PackageInterface;
  19856. use Composer\Package\AliasPackage;
  19857. use Composer\Package\Version\VersionParser;
  19858. use Composer\DependencyResolver\Pool;
  19859. use Composer\Json\JsonFile;
  19860. use Composer\Cache;
  19861. use Composer\Config;
  19862. use Composer\Factory;
  19863. use Composer\IO\IOInterface;
  19864. use Composer\Util\RemoteFilesystem;
  19865. use Composer\Plugin\PluginEvents;
  19866. use Composer\Plugin\PreFileDownloadEvent;
  19867. use Composer\EventDispatcher\EventDispatcher;
  19868. use Composer\Downloader\TransportException;
  19869. use Composer\Semver\Constraint\ConstraintInterface;
  19870. use Composer\Semver\Constraint\Constraint;
  19871. class ComposerRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  19872. {
  19873. protected $config;
  19874. protected $repoConfig;
  19875. protected $options;
  19876. protected $url;
  19877. protected $baseUrl;
  19878. protected $io;
  19879. protected $rfs;
  19880. protected $cache;
  19881. protected $notifyUrl;
  19882. protected $searchUrl;
  19883. protected $hasProviders = false;
  19884. protected $providersUrl;
  19885. protected $lazyProvidersUrl;
  19886. protected $providerListing;
  19887. protected $providers = array();
  19888. protected $providersByUid = array();
  19889. protected $loader;
  19890. protected $rootAliases;
  19891. protected $allowSslDowngrade = false;
  19892. protected $eventDispatcher;
  19893. protected $sourceMirrors;
  19894. protected $distMirrors;
  19895. private $degradedMode = false;
  19896. private $rootData;
  19897. private $hasPartialPackages;
  19898. private $partialPackagesByName;
  19899. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  19900. {
  19901. parent::__construct();
  19902. if (!preg_match('{^[\w.]+\??://}', $repoConfig['url'])) {
  19903. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  19904. }
  19905. $repoConfig['url'] = rtrim($repoConfig['url'], '/');
  19906. if ('https?' === substr($repoConfig['url'], 0, 6)) {
  19907. $repoConfig['url'] = (extension_loaded('openssl') ? 'https' : 'http') . substr($repoConfig['url'], 6);
  19908. }
  19909. $urlBits = parse_url($repoConfig['url']);
  19910. if ($urlBits === false || empty($urlBits['scheme'])) {
  19911. throw new \UnexpectedValueException('Invalid url given for Composer repository: '.$repoConfig['url']);
  19912. }
  19913. if (!isset($repoConfig['options'])) {
  19914. $repoConfig['options'] = array();
  19915. }
  19916. if (isset($repoConfig['allow_ssl_downgrade']) && true === $repoConfig['allow_ssl_downgrade']) {
  19917. $this->allowSslDowngrade = true;
  19918. }
  19919. $this->config = $config;
  19920. $this->options = $repoConfig['options'];
  19921. $this->url = $repoConfig['url'];
  19922. if (preg_match('{^(?P<proto>https?)://packagist\.org/?$}i', $this->url, $match)) {
  19923. $this->url = $match['proto'].'://repo.packagist.org';
  19924. }
  19925. $this->baseUrl = rtrim(preg_replace('{(?:/[^/\\\\]+\.json)?(?:[?#].*)?$}', '', $this->url), '/');
  19926. $this->io = $io;
  19927. $this->cache = new Cache($io, $config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->url), 'a-z0-9.$');
  19928. $this->loader = new ArrayLoader();
  19929. if ($rfs && $this->options) {
  19930. $rfs = clone $rfs;
  19931. $rfs->setOptions($this->options);
  19932. }
  19933. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $this->config, $this->options);
  19934. $this->eventDispatcher = $eventDispatcher;
  19935. $this->repoConfig = $repoConfig;
  19936. }
  19937. public function getRepoConfig()
  19938. {
  19939. return $this->repoConfig;
  19940. }
  19941. public function setRootAliases(array $rootAliases)
  19942. {
  19943. $this->rootAliases = $rootAliases;
  19944. }
  19945. public function findPackage($name, $constraint)
  19946. {
  19947. if (!$this->hasProviders()) {
  19948. return parent::findPackage($name, $constraint);
  19949. }
  19950. $name = strtolower($name);
  19951. if (!$constraint instanceof ConstraintInterface) {
  19952. $versionParser = new VersionParser();
  19953. $constraint = $versionParser->parseConstraints($constraint);
  19954. }
  19955. foreach ($this->getProviderNames() as $providerName) {
  19956. if ($name === $providerName) {
  19957. $packages = $this->whatProvides(new Pool('dev'), $providerName);
  19958. foreach ($packages as $package) {
  19959. if ($name === $package->getName()) {
  19960. $pkgConstraint = new Constraint('==', $package->getVersion());
  19961. if ($constraint->matches($pkgConstraint)) {
  19962. return $package;
  19963. }
  19964. }
  19965. }
  19966. break;
  19967. }
  19968. }
  19969. }
  19970. public function findPackages($name, $constraint = null)
  19971. {
  19972. if (!$this->hasProviders()) {
  19973. return parent::findPackages($name, $constraint);
  19974. }
  19975. $name = strtolower($name);
  19976. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  19977. $versionParser = new VersionParser();
  19978. $constraint = $versionParser->parseConstraints($constraint);
  19979. }
  19980. $packages = array();
  19981. foreach ($this->getProviderNames() as $providerName) {
  19982. if ($name === $providerName) {
  19983. $candidates = $this->whatProvides(new Pool('dev'), $providerName);
  19984. foreach ($candidates as $package) {
  19985. if ($name === $package->getName()) {
  19986. $pkgConstraint = new Constraint('==', $package->getVersion());
  19987. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  19988. $packages[] = $package;
  19989. }
  19990. }
  19991. }
  19992. break;
  19993. }
  19994. }
  19995. return $packages;
  19996. }
  19997. public function getPackages()
  19998. {
  19999. if ($this->hasProviders()) {
  20000. throw new \LogicException('Composer repositories that have providers can not load the complete list of packages, use getProviderNames instead.');
  20001. }
  20002. return parent::getPackages();
  20003. }
  20004. public function search($query, $mode = 0, $type = null)
  20005. {
  20006. $this->loadRootServerFile();
  20007. if ($this->searchUrl && $mode === self::SEARCH_FULLTEXT) {
  20008. $url = str_replace(array('%query%', '%type%'), array($query, $type), $this->searchUrl);
  20009. $hostname = parse_url($url, PHP_URL_HOST) ?: $url;
  20010. $json = $this->rfs->getContents($hostname, $url, false);
  20011. $search = JsonFile::parseJson($json, $url);
  20012. if (empty($search['results'])) {
  20013. return array();
  20014. }
  20015. $results = array();
  20016. foreach ($search['results'] as $result) {
  20017. if (empty($result['virtual'])) {
  20018. $results[] = $result;
  20019. }
  20020. }
  20021. return $results;
  20022. }
  20023. if ($this->hasProviders()) {
  20024. $results = array();
  20025. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  20026. foreach ($this->getProviderNames() as $name) {
  20027. if (preg_match($regex, $name)) {
  20028. $results[] = array('name' => $name);
  20029. }
  20030. }
  20031. return $results;
  20032. }
  20033. return parent::search($query, $mode);
  20034. }
  20035. public function getProviderNames()
  20036. {
  20037. $this->loadRootServerFile();
  20038. if (null === $this->providerListing) {
  20039. $this->loadProviderListings($this->loadRootServerFile());
  20040. }
  20041. if ($this->lazyProvidersUrl) {
  20042. return array();
  20043. }
  20044. if ($this->providersUrl) {
  20045. return array_keys($this->providerListing);
  20046. }
  20047. return array();
  20048. }
  20049. protected function configurePackageTransportOptions(PackageInterface $package)
  20050. {
  20051. foreach ($package->getDistUrls() as $url) {
  20052. if (strpos($url, $this->baseUrl) === 0) {
  20053. $package->setTransportOptions($this->options);
  20054. return;
  20055. }
  20056. }
  20057. }
  20058. public function hasProviders()
  20059. {
  20060. $this->loadRootServerFile();
  20061. return $this->hasProviders;
  20062. }
  20063. public function resetPackageIds()
  20064. {
  20065. foreach ($this->providersByUid as $package) {
  20066. if ($package instanceof AliasPackage) {
  20067. $package->getAliasOf()->setId(-1);
  20068. }
  20069. $package->setId(-1);
  20070. }
  20071. }
  20072. public function whatProvides(Pool $pool, $name, $bypassFilters = false)
  20073. {
  20074. if (isset($this->providers[$name]) && !$bypassFilters) {
  20075. return $this->providers[$name];
  20076. }
  20077. if ($this->hasPartialPackages && null === $this->partialPackagesByName) {
  20078. $this->initializePartialPackages();
  20079. }
  20080. if (!$this->hasPartialPackages || !isset($this->partialPackagesByName[$name])) {
  20081. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name) || '__root__' === $name || 'composer-plugin-api' === $name) {
  20082. return array();
  20083. }
  20084. if (null === $this->providerListing) {
  20085. $this->loadProviderListings($this->loadRootServerFile());
  20086. }
  20087. $useLastModifiedCheck = false;
  20088. if ($this->lazyProvidersUrl && !isset($this->providerListing[$name])) {
  20089. $hash = null;
  20090. $url = str_replace('%package%', $name, $this->lazyProvidersUrl);
  20091. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  20092. $useLastModifiedCheck = true;
  20093. } elseif ($this->providersUrl) {
  20094. if (!isset($this->providerListing[$name])) {
  20095. return array();
  20096. }
  20097. $hash = $this->providerListing[$name]['sha256'];
  20098. $url = str_replace(array('%package%', '%hash%'), array($name, $hash), $this->providersUrl);
  20099. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  20100. } else {
  20101. return array();
  20102. }
  20103. $packages = null;
  20104. if ($cacheKey) {
  20105. if (!$useLastModifiedCheck && $hash && $this->cache->sha256($cacheKey) === $hash) {
  20106. $packages = json_decode($this->cache->read($cacheKey), true);
  20107. } elseif ($useLastModifiedCheck) {
  20108. if ($contents = $this->cache->read($cacheKey)) {
  20109. $contents = json_decode($contents, true);
  20110. if (isset($contents['last-modified'])) {
  20111. $response = $this->fetchFileIfLastModified($url, $cacheKey, $contents['last-modified']);
  20112. if (true === $response) {
  20113. $packages = $contents;
  20114. } elseif ($response) {
  20115. $packages = $response;
  20116. }
  20117. }
  20118. }
  20119. }
  20120. }
  20121. if (!$packages) {
  20122. try {
  20123. $packages = $this->fetchFile($url, $cacheKey, $hash, $useLastModifiedCheck);
  20124. } catch (TransportException $e) {
  20125. if ($e->getStatusCode() === 404 && $this->lazyProvidersUrl) {
  20126. $packages = array('packages' => array());
  20127. } else {
  20128. throw $e;
  20129. }
  20130. }
  20131. }
  20132. $loadingPartialPackage = false;
  20133. } else {
  20134. $packages = array('packages' => array('versions' => $this->partialPackagesByName[$name]));
  20135. $loadingPartialPackage = true;
  20136. }
  20137. $this->providers[$name] = array();
  20138. foreach ($packages['packages'] as $versions) {
  20139. foreach ($versions as $version) {
  20140. if (!$loadingPartialPackage && $this->hasPartialPackages && isset($this->partialPackagesByName[$version['name']])) {
  20141. continue;
  20142. }
  20143. if (isset($this->providersByUid[$version['uid']])) {
  20144. if (!isset($this->providers[$name][$version['uid']])) {
  20145. if ($this->providersByUid[$version['uid']] instanceof AliasPackage) {
  20146. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']]->getAliasOf();
  20147. $this->providers[$name][$version['uid'].'-alias'] = $this->providersByUid[$version['uid']];
  20148. } else {
  20149. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']];
  20150. }
  20151. if (isset($this->providersByUid[$version['uid'].'-root'])) {
  20152. $this->providers[$name][$version['uid'].'-root'] = $this->providersByUid[$version['uid'].'-root'];
  20153. }
  20154. }
  20155. } else {
  20156. if (!$bypassFilters && !$pool->isPackageAcceptable(strtolower($version['name']), VersionParser::parseStability($version['version']))) {
  20157. continue;
  20158. }
  20159. $package = $this->createPackage($version, 'Composer\Package\CompletePackage');
  20160. $package->setRepository($this);
  20161. if ($package instanceof AliasPackage) {
  20162. $aliased = $package->getAliasOf();
  20163. $aliased->setRepository($this);
  20164. $this->providers[$name][$version['uid']] = $aliased;
  20165. $this->providers[$name][$version['uid'].'-alias'] = $package;
  20166. $this->providersByUid[$version['uid']] = $package;
  20167. } else {
  20168. $this->providers[$name][$version['uid']] = $package;
  20169. $this->providersByUid[$version['uid']] = $package;
  20170. }
  20171. unset($rootAliasData);
  20172. if (isset($this->rootAliases[$package->getName()][$package->getVersion()])) {
  20173. $rootAliasData = $this->rootAliases[$package->getName()][$package->getVersion()];
  20174. } elseif ($package instanceof AliasPackage && isset($this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()])) {
  20175. $rootAliasData = $this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()];
  20176. }
  20177. if (isset($rootAliasData)) {
  20178. $alias = $this->createAliasPackage($package, $rootAliasData['alias_normalized'], $rootAliasData['alias']);
  20179. $alias->setRepository($this);
  20180. $this->providers[$name][$version['uid'].'-root'] = $alias;
  20181. $this->providersByUid[$version['uid'].'-root'] = $alias;
  20182. }
  20183. }
  20184. }
  20185. }
  20186. $result = $this->providers[$name];
  20187. if ($bypassFilters) {
  20188. foreach ($this->providers[$name] as $uid => $provider) {
  20189. unset($this->providersByUid[$uid]);
  20190. }
  20191. unset($this->providers[$name]);
  20192. }
  20193. return $result;
  20194. }
  20195. protected function initialize()
  20196. {
  20197. parent::initialize();
  20198. $repoData = $this->loadDataFromServer();
  20199. foreach ($repoData as $package) {
  20200. $this->addPackage($this->createPackage($package, 'Composer\Package\CompletePackage'));
  20201. }
  20202. }
  20203. public function addPackage(PackageInterface $package)
  20204. {
  20205. parent::addPackage($package);
  20206. $this->configurePackageTransportOptions($package);
  20207. }
  20208. protected function loadRootServerFile()
  20209. {
  20210. if (null !== $this->rootData) {
  20211. return $this->rootData;
  20212. }
  20213. if (!extension_loaded('openssl') && 'https' === substr($this->url, 0, 5)) {
  20214. throw new \RuntimeException('You must enable the openssl extension in your php.ini to load information from '.$this->url);
  20215. }
  20216. $jsonUrlParts = parse_url($this->url);
  20217. if (isset($jsonUrlParts['path']) && false !== strpos($jsonUrlParts['path'], '.json')) {
  20218. $jsonUrl = $this->url;
  20219. } else {
  20220. $jsonUrl = $this->url . '/packages.json';
  20221. }
  20222. $data = $this->fetchFile($jsonUrl, 'packages.json');
  20223. if (!empty($data['notify-batch'])) {
  20224. $this->notifyUrl = $this->canonicalizeUrl($data['notify-batch']);
  20225. } elseif (!empty($data['notify'])) {
  20226. $this->notifyUrl = $this->canonicalizeUrl($data['notify']);
  20227. }
  20228. if (!empty($data['search'])) {
  20229. $this->searchUrl = $this->canonicalizeUrl($data['search']);
  20230. }
  20231. if (!empty($data['mirrors'])) {
  20232. foreach ($data['mirrors'] as $mirror) {
  20233. if (!empty($mirror['git-url'])) {
  20234. $this->sourceMirrors['git'][] = array('url' => $mirror['git-url'], 'preferred' => !empty($mirror['preferred']));
  20235. }
  20236. if (!empty($mirror['hg-url'])) {
  20237. $this->sourceMirrors['hg'][] = array('url' => $mirror['hg-url'], 'preferred' => !empty($mirror['preferred']));
  20238. }
  20239. if (!empty($mirror['dist-url'])) {
  20240. $this->distMirrors[] = array(
  20241. 'url' => $this->canonicalizeUrl($mirror['dist-url']),
  20242. 'preferred' => !empty($mirror['preferred']),
  20243. );
  20244. }
  20245. }
  20246. }
  20247. if (!empty($data['providers-lazy-url'])) {
  20248. $this->lazyProvidersUrl = $this->canonicalizeUrl($data['providers-lazy-url']);
  20249. $this->hasProviders = true;
  20250. $this->hasPartialPackages = !empty($data['packages']) && is_array($data['packages']);
  20251. }
  20252. if ($this->allowSslDowngrade) {
  20253. $this->url = str_replace('https://', 'http://', $this->url);
  20254. $this->baseUrl = str_replace('https://', 'http://', $this->baseUrl);
  20255. }
  20256. if (!empty($data['providers-url'])) {
  20257. $this->providersUrl = $this->canonicalizeUrl($data['providers-url']);
  20258. $this->hasProviders = true;
  20259. }
  20260. if (!empty($data['providers']) || !empty($data['providers-includes'])) {
  20261. $this->hasProviders = true;
  20262. }
  20263. if (preg_match('{^https?://repo\.packagist\.org/?$}i', $this->url) && !empty($this->repoConfig['force-lazy-providers'])) {
  20264. $this->url = 'https://repo.packagist.org';
  20265. $this->baseUrl = 'https://repo.packagist.org';
  20266. $this->lazyProvidersUrl = $this->canonicalizeUrl('https://repo.packagist.org/p/%package%.json');
  20267. $this->providersUrl = null;
  20268. } elseif (!empty($this->repoConfig['force-lazy-providers'])) {
  20269. $this->lazyProvidersUrl = $this->canonicalizeUrl('/p/%package%.json');
  20270. $this->providersUrl = null;
  20271. }
  20272. return $this->rootData = $data;
  20273. }
  20274. protected function canonicalizeUrl($url)
  20275. {
  20276. if ('/' === $url[0]) {
  20277. return preg_replace('{(https?://[^/]+).*}i', '$1' . $url, $this->url);
  20278. }
  20279. return $url;
  20280. }
  20281. protected function loadDataFromServer()
  20282. {
  20283. $data = $this->loadRootServerFile();
  20284. return $this->loadIncludes($data);
  20285. }
  20286. protected function loadProviderListings($data)
  20287. {
  20288. if (isset($data['providers'])) {
  20289. if (!is_array($this->providerListing)) {
  20290. $this->providerListing = array();
  20291. }
  20292. $this->providerListing = array_merge($this->providerListing, $data['providers']);
  20293. }
  20294. if ($this->providersUrl && isset($data['provider-includes'])) {
  20295. $includes = $data['provider-includes'];
  20296. foreach ($includes as $include => $metadata) {
  20297. $url = $this->baseUrl . '/' . str_replace('%hash%', $metadata['sha256'], $include);
  20298. $cacheKey = str_replace(array('%hash%','$'), '', $include);
  20299. if ($this->cache->sha256($cacheKey) === $metadata['sha256']) {
  20300. $includedData = json_decode($this->cache->read($cacheKey), true);
  20301. } else {
  20302. $includedData = $this->fetchFile($url, $cacheKey, $metadata['sha256']);
  20303. }
  20304. $this->loadProviderListings($includedData);
  20305. }
  20306. }
  20307. }
  20308. protected function loadIncludes($data)
  20309. {
  20310. $packages = array();
  20311. if (!isset($data['packages']) && !isset($data['includes'])) {
  20312. foreach ($data as $pkg) {
  20313. foreach ($pkg['versions'] as $metadata) {
  20314. $packages[] = $metadata;
  20315. }
  20316. }
  20317. return $packages;
  20318. }
  20319. if (isset($data['packages'])) {
  20320. foreach ($data['packages'] as $package => $versions) {
  20321. foreach ($versions as $version => $metadata) {
  20322. $packages[] = $metadata;
  20323. }
  20324. }
  20325. }
  20326. if (isset($data['includes'])) {
  20327. foreach ($data['includes'] as $include => $metadata) {
  20328. if ($this->cache->sha1($include) === $metadata['sha1']) {
  20329. $includedData = json_decode($this->cache->read($include), true);
  20330. } else {
  20331. $includedData = $this->fetchFile($include);
  20332. }
  20333. $packages = array_merge($packages, $this->loadIncludes($includedData));
  20334. }
  20335. }
  20336. return $packages;
  20337. }
  20338. protected function createPackage(array $data, $class = 'Composer\Package\CompletePackage')
  20339. {
  20340. try {
  20341. if (!isset($data['notification-url'])) {
  20342. $data['notification-url'] = $this->notifyUrl;
  20343. }
  20344. $package = $this->loader->load($data, $class);
  20345. if (isset($this->sourceMirrors[$package->getSourceType()])) {
  20346. $package->setSourceMirrors($this->sourceMirrors[$package->getSourceType()]);
  20347. }
  20348. $package->setDistMirrors($this->distMirrors);
  20349. $this->configurePackageTransportOptions($package);
  20350. return $package;
  20351. } catch (\Exception $e) {
  20352. throw new \RuntimeException('Could not load package '.(isset($data['name']) ? $data['name'] : json_encode($data)).' in '.$this->url.': ['.get_class($e).'] '.$e->getMessage(), 0, $e);
  20353. }
  20354. }
  20355. protected function fetchFile($filename, $cacheKey = null, $sha256 = null, $storeLastModifiedTime = false)
  20356. {
  20357. if (null === $cacheKey) {
  20358. $cacheKey = $filename;
  20359. $filename = $this->baseUrl.'/'.$filename;
  20360. }
  20361. if (($pos = strpos($filename, '$')) && preg_match('{^https?://.*}i', $filename)) {
  20362. $filename = substr($filename, 0, $pos) . '%24' . substr($filename, $pos + 1);
  20363. }
  20364. $retries = 3;
  20365. while ($retries--) {
  20366. try {
  20367. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  20368. if ($this->eventDispatcher) {
  20369. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  20370. }
  20371. $hostname = parse_url($filename, PHP_URL_HOST) ?: $filename;
  20372. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  20373. $json = $rfs->getContents($hostname, $filename, false);
  20374. if ($sha256 && $sha256 !== hash('sha256', $json)) {
  20375. if ($this->allowSslDowngrade) {
  20376. $this->url = str_replace('http://', 'https://', $this->url);
  20377. $this->baseUrl = str_replace('http://', 'https://', $this->baseUrl);
  20378. $filename = str_replace('http://', 'https://', $filename);
  20379. }
  20380. if ($retries) {
  20381. usleep(100000);
  20382. continue;
  20383. }
  20384. throw new RepositorySecurityException('The contents of '.$filename.' do not match its signature. This could indicate a man-in-the-middle attack or e.g. antivirus software corrupting files. Try running composer again and report this if you think it is a mistake.');
  20385. }
  20386. $data = JsonFile::parseJson($json, $filename);
  20387. if (!empty($data['warning'])) {
  20388. $this->io->writeError('<warning>Warning from '.$this->url.': '.$data['warning'].'</warning>');
  20389. }
  20390. if (!empty($data['info'])) {
  20391. $this->io->writeError('<info>Info from '.$this->url.': '.$data['info'].'</info>');
  20392. }
  20393. if ($cacheKey) {
  20394. if ($storeLastModifiedTime) {
  20395. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  20396. if ($lastModifiedDate) {
  20397. $data['last-modified'] = $lastModifiedDate;
  20398. $json = json_encode($data);
  20399. }
  20400. }
  20401. $this->cache->write($cacheKey, $json);
  20402. }
  20403. break;
  20404. } catch (\Exception $e) {
  20405. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  20406. throw $e;
  20407. }
  20408. if ($retries) {
  20409. usleep(100000);
  20410. continue;
  20411. }
  20412. if ($e instanceof RepositorySecurityException) {
  20413. throw $e;
  20414. }
  20415. if ($cacheKey && ($contents = $this->cache->read($cacheKey))) {
  20416. if (!$this->degradedMode) {
  20417. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  20418. $this->io->writeError('<warning>'.$this->url.' could not be fully loaded, package information was loaded from the local cache and may be out of date</warning>');
  20419. }
  20420. $this->degradedMode = true;
  20421. $data = JsonFile::parseJson($contents, $this->cache->getRoot().$cacheKey);
  20422. break;
  20423. }
  20424. throw $e;
  20425. }
  20426. }
  20427. return $data;
  20428. }
  20429. protected function fetchFileIfLastModified($filename, $cacheKey, $lastModifiedTime)
  20430. {
  20431. $retries = 3;
  20432. while ($retries--) {
  20433. try {
  20434. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  20435. if ($this->eventDispatcher) {
  20436. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  20437. }
  20438. $hostname = parse_url($filename, PHP_URL_HOST) ?: $filename;
  20439. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  20440. $options = array('http' => array('header' => array('If-Modified-Since: '.$lastModifiedTime)));
  20441. $json = $rfs->getContents($hostname, $filename, false, $options);
  20442. if ($json === '' && $rfs->findStatusCode($rfs->getLastHeaders()) === 304) {
  20443. return true;
  20444. }
  20445. $data = JsonFile::parseJson($json, $filename);
  20446. if (!empty($data['warning'])) {
  20447. $this->io->writeError('<warning>Warning from '.$this->url.': '.$data['warning'].'</warning>');
  20448. }
  20449. if (!empty($data['info'])) {
  20450. $this->io->writeError('<info>Info from '.$this->url.': '.$data['info'].'</info>');
  20451. }
  20452. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  20453. if ($lastModifiedDate) {
  20454. $data['last-modified'] = $lastModifiedDate;
  20455. $json = json_encode($data);
  20456. }
  20457. $this->cache->write($cacheKey, $json);
  20458. return $data;
  20459. } catch (\Exception $e) {
  20460. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  20461. throw $e;
  20462. }
  20463. if ($retries) {
  20464. usleep(100000);
  20465. continue;
  20466. }
  20467. if (!$this->degradedMode) {
  20468. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  20469. $this->io->writeError('<warning>'.$this->url.' could not be fully loaded, package information was loaded from the local cache and may be out of date</warning>');
  20470. }
  20471. $this->degradedMode = true;
  20472. return true;
  20473. }
  20474. }
  20475. }
  20476. private function initializePartialPackages()
  20477. {
  20478. $rootData = $this->loadRootServerFile();
  20479. $this->partialPackagesByName = array();
  20480. foreach ($rootData['packages'] as $package => $versions) {
  20481. $package = strtolower($package);
  20482. foreach ($versions as $version) {
  20483. $this->partialPackagesByName[$package][] = $version;
  20484. if (!empty($version['provide']) && is_array($version['provide'])) {
  20485. foreach ($version['provide'] as $provided => $providedVersion) {
  20486. $this->partialPackagesByName[strtolower($provided)][] = $version;
  20487. }
  20488. }
  20489. if (!empty($version['replace']) && is_array($version['replace'])) {
  20490. foreach ($version['replace'] as $provided => $providedVersion) {
  20491. $this->partialPackagesByName[strtolower($provided)][] = $version;
  20492. }
  20493. }
  20494. }
  20495. }
  20496. $this->rootData = true;
  20497. }
  20498. }
  20499. <?php
  20500. namespace Composer\Repository;
  20501. use Composer\Package\PackageInterface;
  20502. class CompositeRepository extends BaseRepository
  20503. {
  20504. private $repositories;
  20505. public function __construct(array $repositories)
  20506. {
  20507. $this->repositories = array();
  20508. foreach ($repositories as $repo) {
  20509. $this->addRepository($repo);
  20510. }
  20511. }
  20512. public function getRepositories()
  20513. {
  20514. return $this->repositories;
  20515. }
  20516. public function hasPackage(PackageInterface $package)
  20517. {
  20518. foreach ($this->repositories as $repository) {
  20519. if ($repository->hasPackage($package)) {
  20520. return true;
  20521. }
  20522. }
  20523. return false;
  20524. }
  20525. public function findPackage($name, $constraint)
  20526. {
  20527. foreach ($this->repositories as $repository) {
  20528. $package = $repository->findPackage($name, $constraint);
  20529. if (null !== $package) {
  20530. return $package;
  20531. }
  20532. }
  20533. return null;
  20534. }
  20535. public function findPackages($name, $constraint = null)
  20536. {
  20537. $packages = array();
  20538. foreach ($this->repositories as $repository) {
  20539. $packages[] = $repository->findPackages($name, $constraint);
  20540. }
  20541. return $packages ? call_user_func_array('array_merge', $packages) : array();
  20542. }
  20543. public function search($query, $mode = 0, $type = null)
  20544. {
  20545. $matches = array();
  20546. foreach ($this->repositories as $repository) {
  20547. $matches[] = $repository->search($query, $mode, $type);
  20548. }
  20549. return $matches ? call_user_func_array('array_merge', $matches) : array();
  20550. }
  20551. public function getPackages()
  20552. {
  20553. $packages = array();
  20554. foreach ($this->repositories as $repository) {
  20555. $packages[] = $repository->getPackages();
  20556. }
  20557. return $packages ? call_user_func_array('array_merge', $packages) : array();
  20558. }
  20559. public function removePackage(PackageInterface $package)
  20560. {
  20561. foreach ($this->repositories as $repository) {
  20562. $repository->removePackage($package);
  20563. }
  20564. }
  20565. public function count()
  20566. {
  20567. $total = 0;
  20568. foreach ($this->repositories as $repository) {
  20569. $total += $repository->count();
  20570. }
  20571. return $total;
  20572. }
  20573. public function addRepository(RepositoryInterface $repository)
  20574. {
  20575. if ($repository instanceof self) {
  20576. foreach ($repository->getRepositories() as $repo) {
  20577. $this->addRepository($repo);
  20578. }
  20579. } else {
  20580. $this->repositories[] = $repository;
  20581. }
  20582. }
  20583. }
  20584. <?php
  20585. namespace Composer\Repository;
  20586. interface ConfigurableRepositoryInterface
  20587. {
  20588. public function getRepoConfig();
  20589. }
  20590. <?php
  20591. namespace Composer\Repository;
  20592. use Composer\Json\JsonFile;
  20593. use Composer\Package\Loader\ArrayLoader;
  20594. use Composer\Package\Dumper\ArrayDumper;
  20595. class FilesystemRepository extends WritableArrayRepository
  20596. {
  20597. private $file;
  20598. public function __construct(JsonFile $repositoryFile)
  20599. {
  20600. parent::__construct();
  20601. $this->file = $repositoryFile;
  20602. }
  20603. protected function initialize()
  20604. {
  20605. parent::initialize();
  20606. if (!$this->file->exists()) {
  20607. return;
  20608. }
  20609. try {
  20610. $packages = $this->file->read();
  20611. if (!is_array($packages)) {
  20612. throw new \UnexpectedValueException('Could not parse package list from the repository');
  20613. }
  20614. } catch (\Exception $e) {
  20615. throw new InvalidRepositoryException('Invalid repository data in '.$this->file->getPath().', packages could not be loaded: ['.get_class($e).'] '.$e->getMessage());
  20616. }
  20617. $loader = new ArrayLoader(null, true);
  20618. foreach ($packages as $packageData) {
  20619. $package = $loader->load($packageData);
  20620. $this->addPackage($package);
  20621. }
  20622. }
  20623. public function reload()
  20624. {
  20625. $this->packages = null;
  20626. $this->initialize();
  20627. }
  20628. public function write()
  20629. {
  20630. $data = array();
  20631. $dumper = new ArrayDumper();
  20632. foreach ($this->getCanonicalPackages() as $package) {
  20633. $data[] = $dumper->dump($package);
  20634. }
  20635. usort($data, function ($a, $b) {
  20636. return strcmp($a['name'], $b['name']);
  20637. });
  20638. $this->file->write($data);
  20639. }
  20640. }
  20641. <?php
  20642. namespace Composer\Repository;
  20643. class InstalledArrayRepository extends WritableArrayRepository implements InstalledRepositoryInterface
  20644. {
  20645. }
  20646. <?php
  20647. namespace Composer\Repository;
  20648. class InstalledFilesystemRepository extends FilesystemRepository implements InstalledRepositoryInterface
  20649. {
  20650. }
  20651. <?php
  20652. namespace Composer\Repository;
  20653. interface InstalledRepositoryInterface extends WritableRepositoryInterface
  20654. {
  20655. }
  20656. <?php
  20657. namespace Composer\Repository;
  20658. class InvalidRepositoryException extends \Exception
  20659. {
  20660. }
  20661. <?php
  20662. namespace Composer\Repository;
  20663. use Composer\Package\Loader\ArrayLoader;
  20664. use Composer\Package\Loader\ValidatingArrayLoader;
  20665. class PackageRepository extends ArrayRepository
  20666. {
  20667. private $config;
  20668. public function __construct(array $config)
  20669. {
  20670. parent::__construct();
  20671. $this->config = $config['package'];
  20672. if (!is_numeric(key($this->config))) {
  20673. $this->config = array($this->config);
  20674. }
  20675. }
  20676. protected function initialize()
  20677. {
  20678. parent::initialize();
  20679. $loader = new ValidatingArrayLoader(new ArrayLoader(null, true), false);
  20680. foreach ($this->config as $package) {
  20681. try {
  20682. $package = $loader->load($package);
  20683. } catch (\Exception $e) {
  20684. throw new InvalidRepositoryException('A repository of type "package" contains an invalid package definition: '.$e->getMessage()."\n\nInvalid package definition:\n".json_encode($package));
  20685. }
  20686. $this->addPackage($package);
  20687. }
  20688. }
  20689. }
  20690. <?php
  20691. namespace Composer\Repository;
  20692. use Composer\Config;
  20693. use Composer\IO\IOInterface;
  20694. use Composer\Json\JsonFile;
  20695. use Composer\Package\Loader\ArrayLoader;
  20696. use Composer\Package\Version\VersionGuesser;
  20697. use Composer\Package\Version\VersionParser;
  20698. use Composer\Util\Platform;
  20699. use Composer\Util\ProcessExecutor;
  20700. class PathRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  20701. {
  20702. private $loader;
  20703. private $versionGuesser;
  20704. private $url;
  20705. private $repoConfig;
  20706. private $process;
  20707. private $options;
  20708. public function __construct(array $repoConfig, IOInterface $io, Config $config)
  20709. {
  20710. if (!isset($repoConfig['url'])) {
  20711. throw new \RuntimeException('You must specify the `url` configuration for the path repository');
  20712. }
  20713. $this->loader = new ArrayLoader(null, true);
  20714. $this->url = Platform::expandPath($repoConfig['url']);
  20715. $this->process = new ProcessExecutor($io);
  20716. $this->versionGuesser = new VersionGuesser($config, $this->process, new VersionParser());
  20717. $this->repoConfig = $repoConfig;
  20718. $this->options = isset($repoConfig['options']) ? $repoConfig['options'] : array();
  20719. parent::__construct();
  20720. }
  20721. public function getRepoConfig()
  20722. {
  20723. return $this->repoConfig;
  20724. }
  20725. protected function initialize()
  20726. {
  20727. parent::initialize();
  20728. foreach ($this->getUrlMatches() as $url) {
  20729. $path = realpath($url) . DIRECTORY_SEPARATOR;
  20730. $composerFilePath = $path.'composer.json';
  20731. if (!file_exists($composerFilePath)) {
  20732. continue;
  20733. }
  20734. $json = file_get_contents($composerFilePath);
  20735. $package = JsonFile::parseJson($json, $composerFilePath);
  20736. $package['dist'] = array(
  20737. 'type' => 'path',
  20738. 'url' => $url,
  20739. 'reference' => sha1($json . serialize($this->options)),
  20740. );
  20741. $package['transport-options'] = $this->options;
  20742. if (!isset($package['version']) && ($rootVersion = getenv('COMPOSER_ROOT_VERSION'))) {
  20743. if (
  20744. 0 === $this->process->execute('git rev-parse HEAD', $ref1, $path)
  20745. && 0 === $this->process->execute('git rev-parse HEAD', $ref2)
  20746. && $ref1 === $ref2
  20747. ) {
  20748. $package['version'] = $rootVersion;
  20749. }
  20750. }
  20751. if (!isset($package['version'])) {
  20752. $versionData = $this->versionGuesser->guessVersion($package, $path);
  20753. $package['version'] = $versionData['pretty_version'] ?: 'dev-master';
  20754. }
  20755. $output = '';
  20756. if (is_dir($path . DIRECTORY_SEPARATOR . '.git') && 0 === $this->process->execute('git log -n1 --pretty=%H', $output, $path)) {
  20757. $package['dist']['reference'] = trim($output);
  20758. }
  20759. $package = $this->loader->load($package);
  20760. $this->addPackage($package);
  20761. }
  20762. }
  20763. private function getUrlMatches()
  20764. {
  20765. $flags = GLOB_MARK | GLOB_ONLYDIR;
  20766. if (defined('GLOB_BRACE')) {
  20767. $flags |= GLOB_BRACE;
  20768. } elseif (strpos($this->url, '{') !== false || strpos($this->url, '}') !== false) {
  20769. throw new \RuntimeException('The operating system does not support GLOB_BRACE which is required for the url '. $this->url);
  20770. }
  20771. return array_map(function ($val) {
  20772. return rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $val), '/');
  20773. }, glob($this->url, $flags));
  20774. }
  20775. }
  20776. <?php
  20777. namespace Composer\Repository\Pear;
  20778. use Composer\Util\RemoteFilesystem;
  20779. abstract class BaseChannelReader
  20780. {
  20781. const CHANNEL_NS = 'http://pear.php.net/channel-1.0';
  20782. const ALL_CATEGORIES_NS = 'http://pear.php.net/dtd/rest.allcategories';
  20783. const CATEGORY_PACKAGES_INFO_NS = 'http://pear.php.net/dtd/rest.categorypackageinfo';
  20784. const ALL_PACKAGES_NS = 'http://pear.php.net/dtd/rest.allpackages';
  20785. const ALL_RELEASES_NS = 'http://pear.php.net/dtd/rest.allreleases';
  20786. const PACKAGE_INFO_NS = 'http://pear.php.net/dtd/rest.package';
  20787. private $rfs;
  20788. protected function __construct(RemoteFilesystem $rfs)
  20789. {
  20790. $this->rfs = $rfs;
  20791. }
  20792. protected function requestContent($origin, $path)
  20793. {
  20794. $url = rtrim($origin, '/') . '/' . ltrim($path, '/');
  20795. $content = $this->rfs->getContents($origin, $url, false);
  20796. if (!$content) {
  20797. throw new \UnexpectedValueException('The PEAR channel at ' . $url . ' did not respond.');
  20798. }
  20799. return str_replace('http://pear.php.net/rest/', 'https://pear.php.net/rest/', $content);
  20800. }
  20801. protected function requestXml($origin, $path)
  20802. {
  20803. $xml = simplexml_load_string($this->requestContent($origin, $path), "SimpleXMLElement", LIBXML_NOERROR);
  20804. if (false === $xml) {
  20805. throw new \UnexpectedValueException(sprintf('The PEAR channel at ' . $origin . ' is broken. (Invalid XML at file `%s`)', $path));
  20806. }
  20807. return $xml;
  20808. }
  20809. }
  20810. <?php
  20811. namespace Composer\Repository\Pear;
  20812. class ChannelInfo
  20813. {
  20814. private $name;
  20815. private $alias;
  20816. private $packages;
  20817. public function __construct($name, $alias, array $packages)
  20818. {
  20819. $this->name = $name;
  20820. $this->alias = $alias;
  20821. $this->packages = $packages;
  20822. }
  20823. public function getName()
  20824. {
  20825. return $this->name;
  20826. }
  20827. public function getAlias()
  20828. {
  20829. return $this->alias;
  20830. }
  20831. public function getPackages()
  20832. {
  20833. return $this->packages;
  20834. }
  20835. }
  20836. <?php
  20837. namespace Composer\Repository\Pear;
  20838. use Composer\Util\RemoteFilesystem;
  20839. class ChannelReader extends BaseChannelReader
  20840. {
  20841. private $readerMap;
  20842. public function __construct(RemoteFilesystem $rfs)
  20843. {
  20844. parent::__construct($rfs);
  20845. $rest10reader = new ChannelRest10Reader($rfs);
  20846. $rest11reader = new ChannelRest11Reader($rfs);
  20847. $this->readerMap = array(
  20848. 'REST1.3' => $rest11reader,
  20849. 'REST1.2' => $rest11reader,
  20850. 'REST1.1' => $rest11reader,
  20851. 'REST1.0' => $rest10reader,
  20852. );
  20853. }
  20854. public function read($url)
  20855. {
  20856. $xml = $this->requestXml($url, "/channel.xml");
  20857. $channelName = (string) $xml->name;
  20858. $channelAlias = (string) $xml->suggestedalias;
  20859. $supportedVersions = array_keys($this->readerMap);
  20860. $selectedRestVersion = $this->selectRestVersion($xml, $supportedVersions);
  20861. if (!$selectedRestVersion) {
  20862. throw new \UnexpectedValueException(sprintf('PEAR repository %s does not supports any of %s protocols.', $url, implode(', ', $supportedVersions)));
  20863. }
  20864. $reader = $this->readerMap[$selectedRestVersion['version']];
  20865. $packageDefinitions = $reader->read($selectedRestVersion['baseUrl']);
  20866. return new ChannelInfo($channelName, $channelAlias, $packageDefinitions);
  20867. }
  20868. private function selectRestVersion($channelXml, $supportedVersions)
  20869. {
  20870. $channelXml->registerXPathNamespace('ns', self::CHANNEL_NS);
  20871. foreach ($supportedVersions as $version) {
  20872. $xpathTest = "ns:servers/ns:*/ns:rest/ns:baseurl[@type='{$version}']";
  20873. $testResult = $channelXml->xpath($xpathTest);
  20874. foreach ($testResult as $result) {
  20875. $result = (string) $result;
  20876. if (preg_match('{^https://}i', $result)) {
  20877. return array('version' => $version, 'baseUrl' => $result);
  20878. }
  20879. }
  20880. if (count($testResult) > 0) {
  20881. return array('version' => $version, 'baseUrl' => (string) $testResult[0]);
  20882. }
  20883. }
  20884. return null;
  20885. }
  20886. }
  20887. <?php
  20888. namespace Composer\Repository\Pear;
  20889. use Composer\Downloader\TransportException;
  20890. class ChannelRest10Reader extends BaseChannelReader
  20891. {
  20892. private $dependencyReader;
  20893. public function __construct($rfs)
  20894. {
  20895. parent::__construct($rfs);
  20896. $this->dependencyReader = new PackageDependencyParser();
  20897. }
  20898. public function read($baseUrl)
  20899. {
  20900. return $this->readPackages($baseUrl);
  20901. }
  20902. private function readPackages($baseUrl)
  20903. {
  20904. $result = array();
  20905. $xmlPath = '/p/packages.xml';
  20906. $xml = $this->requestXml($baseUrl, $xmlPath);
  20907. $xml->registerXPathNamespace('ns', self::ALL_PACKAGES_NS);
  20908. foreach ($xml->xpath('ns:p') as $node) {
  20909. $packageName = (string) $node;
  20910. $packageInfo = $this->readPackage($baseUrl, $packageName);
  20911. $result[] = $packageInfo;
  20912. }
  20913. return $result;
  20914. }
  20915. private function readPackage($baseUrl, $packageName)
  20916. {
  20917. $xmlPath = '/p/' . strtolower($packageName) . '/info.xml';
  20918. $xml = $this->requestXml($baseUrl, $xmlPath);
  20919. $xml->registerXPathNamespace('ns', self::PACKAGE_INFO_NS);
  20920. $channelName = (string) $xml->c;
  20921. $packageName = (string) $xml->n;
  20922. $license = (string) $xml->l;
  20923. $shortDescription = (string) $xml->s;
  20924. $description = (string) $xml->d;
  20925. return new PackageInfo(
  20926. $channelName,
  20927. $packageName,
  20928. $license,
  20929. $shortDescription,
  20930. $description,
  20931. $this->readPackageReleases($baseUrl, $packageName)
  20932. );
  20933. }
  20934. private function readPackageReleases($baseUrl, $packageName)
  20935. {
  20936. $result = array();
  20937. try {
  20938. $xmlPath = '/r/' . strtolower($packageName) . '/allreleases.xml';
  20939. $xml = $this->requestXml($baseUrl, $xmlPath);
  20940. $xml->registerXPathNamespace('ns', self::ALL_RELEASES_NS);
  20941. foreach ($xml->xpath('ns:r') as $node) {
  20942. $releaseVersion = (string) $node->v;
  20943. $releaseStability = (string) $node->s;
  20944. try {
  20945. $result[$releaseVersion] = new ReleaseInfo(
  20946. $releaseStability,
  20947. $this->readPackageReleaseDependencies($baseUrl, $packageName, $releaseVersion)
  20948. );
  20949. } catch (TransportException $exception) {
  20950. if ($exception->getCode() != 404) {
  20951. throw $exception;
  20952. }
  20953. }
  20954. }
  20955. } catch (TransportException $exception) {
  20956. if ($exception->getCode() != 404) {
  20957. throw $exception;
  20958. }
  20959. }
  20960. return $result;
  20961. }
  20962. private function readPackageReleaseDependencies($baseUrl, $packageName, $version)
  20963. {
  20964. $dependencyReader = new PackageDependencyParser();
  20965. $depthPath = '/r/' . strtolower($packageName) . '/deps.' . $version . '.txt';
  20966. $content = $this->requestContent($baseUrl, $depthPath);
  20967. $dependencyArray = unserialize($content);
  20968. return $dependencyReader->buildDependencyInfo($dependencyArray);
  20969. }
  20970. }
  20971. <?php
  20972. namespace Composer\Repository\Pear;
  20973. class ChannelRest11Reader extends BaseChannelReader
  20974. {
  20975. private $dependencyReader;
  20976. public function __construct($rfs)
  20977. {
  20978. parent::__construct($rfs);
  20979. $this->dependencyReader = new PackageDependencyParser();
  20980. }
  20981. public function read($baseUrl)
  20982. {
  20983. return $this->readChannelPackages($baseUrl);
  20984. }
  20985. private function readChannelPackages($baseUrl)
  20986. {
  20987. $result = array();
  20988. $xml = $this->requestXml($baseUrl, "/c/categories.xml");
  20989. $xml->registerXPathNamespace('ns', self::ALL_CATEGORIES_NS);
  20990. foreach ($xml->xpath('ns:c') as $node) {
  20991. $categoryName = (string) $node;
  20992. $categoryPackages = $this->readCategoryPackages($baseUrl, $categoryName);
  20993. $result = array_merge($result, $categoryPackages);
  20994. }
  20995. return $result;
  20996. }
  20997. private function readCategoryPackages($baseUrl, $categoryName)
  20998. {
  20999. $result = array();
  21000. $categoryPath = '/c/'.urlencode($categoryName).'/packagesinfo.xml';
  21001. $xml = $this->requestXml($baseUrl, $categoryPath);
  21002. $xml->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  21003. foreach ($xml->xpath('ns:pi') as $node) {
  21004. $packageInfo = $this->parsePackage($node);
  21005. $result[] = $packageInfo;
  21006. }
  21007. return $result;
  21008. }
  21009. private function parsePackage($packageInfo)
  21010. {
  21011. $packageInfo->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  21012. $channelName = (string) $packageInfo->p->c;
  21013. $packageName = (string) $packageInfo->p->n;
  21014. $license = (string) $packageInfo->p->l;
  21015. $shortDescription = (string) $packageInfo->p->s;
  21016. $description = (string) $packageInfo->p->d;
  21017. $dependencies = array();
  21018. foreach ($packageInfo->xpath('ns:deps') as $node) {
  21019. $dependencyVersion = (string) $node->v;
  21020. $dependencyArray = unserialize((string) $node->d);
  21021. $dependencyInfo = $this->dependencyReader->buildDependencyInfo($dependencyArray);
  21022. $dependencies[$dependencyVersion] = $dependencyInfo;
  21023. }
  21024. $releases = array();
  21025. $releasesInfo = $packageInfo->xpath('ns:a/ns:r');
  21026. if ($releasesInfo) {
  21027. foreach ($releasesInfo as $node) {
  21028. $releaseVersion = (string) $node->v;
  21029. $releaseStability = (string) $node->s;
  21030. $releases[$releaseVersion] = new ReleaseInfo(
  21031. $releaseStability,
  21032. isset($dependencies[$releaseVersion]) ? $dependencies[$releaseVersion] : new DependencyInfo(array(), array())
  21033. );
  21034. }
  21035. }
  21036. return new PackageInfo(
  21037. $channelName,
  21038. $packageName,
  21039. $license,
  21040. $shortDescription,
  21041. $description,
  21042. $releases
  21043. );
  21044. }
  21045. }
  21046. <?php
  21047. namespace Composer\Repository\Pear;
  21048. class DependencyConstraint
  21049. {
  21050. private $type;
  21051. private $constraint;
  21052. private $channelName;
  21053. private $packageName;
  21054. public function __construct($type, $constraint, $channelName, $packageName)
  21055. {
  21056. $this->type = $type;
  21057. $this->constraint = $constraint;
  21058. $this->channelName = $channelName;
  21059. $this->packageName = $packageName;
  21060. }
  21061. public function getChannelName()
  21062. {
  21063. return $this->channelName;
  21064. }
  21065. public function getConstraint()
  21066. {
  21067. return $this->constraint;
  21068. }
  21069. public function getPackageName()
  21070. {
  21071. return $this->packageName;
  21072. }
  21073. public function getType()
  21074. {
  21075. return $this->type;
  21076. }
  21077. }
  21078. <?php
  21079. namespace Composer\Repository\Pear;
  21080. class DependencyInfo
  21081. {
  21082. private $requires;
  21083. private $optionals;
  21084. public function __construct($requires, $optionals)
  21085. {
  21086. $this->requires = $requires;
  21087. $this->optionals = $optionals;
  21088. }
  21089. public function getRequires()
  21090. {
  21091. return $this->requires;
  21092. }
  21093. public function getOptionals()
  21094. {
  21095. return $this->optionals;
  21096. }
  21097. }
  21098. <?php
  21099. namespace Composer\Repository\Pear;
  21100. class PackageDependencyParser
  21101. {
  21102. public function buildDependencyInfo($depArray)
  21103. {
  21104. if (!is_array($depArray)) {
  21105. return new DependencyInfo(array(), array());
  21106. }
  21107. if (!$this->isHash($depArray)) {
  21108. return new DependencyInfo($this->buildDependency10Info($depArray), array());
  21109. }
  21110. return $this->buildDependency20Info($depArray);
  21111. }
  21112. private function buildDependency10Info($depArray)
  21113. {
  21114. static $dep10toOperatorMap = array('has' => '==', 'eq' => '==', 'ge' => '>=', 'gt' => '>', 'le' => '<=', 'lt' => '<', 'not' => '!=');
  21115. $result = array();
  21116. foreach ($depArray as $depItem) {
  21117. if (empty($depItem['rel']) || !array_key_exists($depItem['rel'], $dep10toOperatorMap)) {
  21118. continue;
  21119. }
  21120. $depType = !empty($depItem['optional']) && 'yes' == $depItem['optional']
  21121. ? 'optional'
  21122. : 'required';
  21123. $depType = 'not' == $depItem['rel']
  21124. ? 'conflicts'
  21125. : $depType;
  21126. $depVersion = !empty($depItem['version']) ? $this->parseVersion($depItem['version']) : '*';
  21127. $depVersionConstraint = ('has' == $depItem['rel'] || 'not' == $depItem['rel']) && '*' == $depVersion
  21128. ? '*'
  21129. : $dep10toOperatorMap[$depItem['rel']] . $depVersion;
  21130. switch ($depItem['type']) {
  21131. case 'php':
  21132. $depChannelName = 'php';
  21133. $depPackageName = '';
  21134. break;
  21135. case 'pkg':
  21136. $depChannelName = !empty($depItem['channel']) ? $depItem['channel'] : 'pear.php.net';
  21137. $depPackageName = $depItem['name'];
  21138. break;
  21139. case 'ext':
  21140. $depChannelName = 'ext';
  21141. $depPackageName = $depItem['name'];
  21142. break;
  21143. case 'os':
  21144. case 'sapi':
  21145. $depChannelName = '';
  21146. $depPackageName = '';
  21147. break;
  21148. default:
  21149. $depChannelName = '';
  21150. $depPackageName = '';
  21151. break;
  21152. }
  21153. if ('' != $depChannelName) {
  21154. $result[] = new DependencyConstraint(
  21155. $depType,
  21156. $depVersionConstraint,
  21157. $depChannelName,
  21158. $depPackageName
  21159. );
  21160. }
  21161. }
  21162. return $result;
  21163. }
  21164. private function buildDependency20Info($depArray)
  21165. {
  21166. $result = array();
  21167. $optionals = array();
  21168. $defaultOptionals = array();
  21169. foreach ($depArray as $depType => $depTypeGroup) {
  21170. if (!is_array($depTypeGroup)) {
  21171. continue;
  21172. }
  21173. if ('required' == $depType || 'optional' == $depType) {
  21174. foreach ($depTypeGroup as $depItemType => $depItem) {
  21175. switch ($depItemType) {
  21176. case 'php':
  21177. $result[] = new DependencyConstraint(
  21178. $depType,
  21179. $this->parse20VersionConstraint($depItem),
  21180. 'php',
  21181. ''
  21182. );
  21183. break;
  21184. case 'package':
  21185. $deps = $this->buildDepPackageConstraints($depItem, $depType);
  21186. $result = array_merge($result, $deps);
  21187. break;
  21188. case 'extension':
  21189. $deps = $this->buildDepExtensionConstraints($depItem, $depType);
  21190. $result = array_merge($result, $deps);
  21191. break;
  21192. case 'subpackage':
  21193. $deps = $this->buildDepPackageConstraints($depItem, 'replaces');
  21194. $defaultOptionals += $deps;
  21195. break;
  21196. case 'os':
  21197. case 'pearinstaller':
  21198. break;
  21199. default:
  21200. break;
  21201. }
  21202. }
  21203. } elseif ('group' == $depType) {
  21204. if ($this->isHash($depTypeGroup)) {
  21205. $depTypeGroup = array($depTypeGroup);
  21206. }
  21207. foreach ($depTypeGroup as $depItem) {
  21208. $groupName = $depItem['attribs']['name'];
  21209. if (!isset($optionals[$groupName])) {
  21210. $optionals[$groupName] = array();
  21211. }
  21212. if (isset($depItem['subpackage'])) {
  21213. $optionals[$groupName] += $this->buildDepPackageConstraints($depItem['subpackage'], 'replaces');
  21214. } else {
  21215. $result += $this->buildDepPackageConstraints($depItem['package'], 'optional');
  21216. }
  21217. }
  21218. }
  21219. }
  21220. if (count($defaultOptionals) > 0) {
  21221. $optionals['*'] = $defaultOptionals;
  21222. }
  21223. return new DependencyInfo($result, $optionals);
  21224. }
  21225. private function buildDepExtensionConstraints($depItem, $depType)
  21226. {
  21227. if ($this->isHash($depItem)) {
  21228. $depItem = array($depItem);
  21229. }
  21230. $result = array();
  21231. foreach ($depItem as $subDepItem) {
  21232. $depChannelName = 'ext';
  21233. $depPackageName = $subDepItem['name'];
  21234. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  21235. $result[] = new DependencyConstraint(
  21236. $depType,
  21237. $depVersionConstraint,
  21238. $depChannelName,
  21239. $depPackageName
  21240. );
  21241. }
  21242. return $result;
  21243. }
  21244. private function buildDepPackageConstraints($depItem, $depType)
  21245. {
  21246. if ($this->isHash($depItem)) {
  21247. $depItem = array($depItem);
  21248. }
  21249. $result = array();
  21250. foreach ($depItem as $subDepItem) {
  21251. if (!array_key_exists('channel', $subDepItem)) {
  21252. $subDepItem['channel'] = $subDepItem['uri'];
  21253. }
  21254. $depChannelName = $subDepItem['channel'];
  21255. $depPackageName = $subDepItem['name'];
  21256. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  21257. if (isset($subDepItem['conflicts'])) {
  21258. $depType = 'conflicts';
  21259. }
  21260. $result[] = new DependencyConstraint(
  21261. $depType,
  21262. $depVersionConstraint,
  21263. $depChannelName,
  21264. $depPackageName
  21265. );
  21266. }
  21267. return $result;
  21268. }
  21269. private function parse20VersionConstraint(array $data)
  21270. {
  21271. static $dep20toOperatorMap = array('has' => '==', 'min' => '>=', 'max' => '<=', 'exclude' => '!=');
  21272. $versions = array();
  21273. $values = array_intersect_key($data, $dep20toOperatorMap);
  21274. if (0 == count($values)) {
  21275. return '*';
  21276. }
  21277. if (isset($values['min']) && isset($values['exclude']) && $data['min'] == $data['exclude']) {
  21278. $versions[] = '>' . $this->parseVersion($values['min']);
  21279. } elseif (isset($values['max']) && isset($values['exclude']) && $data['max'] == $data['exclude']) {
  21280. $versions[] = '<' . $this->parseVersion($values['max']);
  21281. } else {
  21282. foreach ($values as $op => $version) {
  21283. if ('exclude' == $op && is_array($version)) {
  21284. foreach ($version as $versionPart) {
  21285. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($versionPart);
  21286. }
  21287. } else {
  21288. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($version);
  21289. }
  21290. }
  21291. }
  21292. return implode(',', $versions);
  21293. }
  21294. private function parseVersion($version)
  21295. {
  21296. if (preg_match('{^v?(\d{1,3})(\.\d+)?(\.\d+)?(\.\d+)?}i', $version, $matches)) {
  21297. $version = $matches[1]
  21298. .(!empty($matches[2]) ? $matches[2] : '.0')
  21299. .(!empty($matches[3]) ? $matches[3] : '.0')
  21300. .(!empty($matches[4]) ? $matches[4] : '.0');
  21301. return $version;
  21302. }
  21303. return null;
  21304. }
  21305. private function isHash(array $array)
  21306. {
  21307. return !array_key_exists(1, $array) && !array_key_exists(0, $array);
  21308. }
  21309. }
  21310. <?php
  21311. namespace Composer\Repository\Pear;
  21312. class PackageInfo
  21313. {
  21314. private $channelName;
  21315. private $packageName;
  21316. private $license;
  21317. private $shortDescription;
  21318. private $description;
  21319. private $releases;
  21320. public function __construct($channelName, $packageName, $license, $shortDescription, $description, $releases)
  21321. {
  21322. $this->channelName = $channelName;
  21323. $this->packageName = $packageName;
  21324. $this->license = $license;
  21325. $this->shortDescription = $shortDescription;
  21326. $this->description = $description;
  21327. $this->releases = $releases;
  21328. }
  21329. public function getChannelName()
  21330. {
  21331. return $this->channelName;
  21332. }
  21333. public function getPackageName()
  21334. {
  21335. return $this->packageName;
  21336. }
  21337. public function getDescription()
  21338. {
  21339. return $this->description;
  21340. }
  21341. public function getShortDescription()
  21342. {
  21343. return $this->shortDescription;
  21344. }
  21345. public function getLicense()
  21346. {
  21347. return $this->license;
  21348. }
  21349. public function getReleases()
  21350. {
  21351. return $this->releases;
  21352. }
  21353. }
  21354. <?php
  21355. namespace Composer\Repository\Pear;
  21356. class ReleaseInfo
  21357. {
  21358. private $stability;
  21359. private $dependencyInfo;
  21360. public function __construct($stability, $dependencyInfo)
  21361. {
  21362. $this->stability = $stability;
  21363. $this->dependencyInfo = $dependencyInfo;
  21364. }
  21365. public function getDependencyInfo()
  21366. {
  21367. return $this->dependencyInfo;
  21368. }
  21369. public function getStability()
  21370. {
  21371. return $this->stability;
  21372. }
  21373. }
  21374. <?php
  21375. namespace Composer\Repository;
  21376. use Composer\IO\IOInterface;
  21377. use Composer\Semver\VersionParser as SemverVersionParser;
  21378. use Composer\Package\Version\VersionParser;
  21379. use Composer\Repository\Pear\ChannelReader;
  21380. use Composer\Package\CompletePackage;
  21381. use Composer\Repository\Pear\ChannelInfo;
  21382. use Composer\EventDispatcher\EventDispatcher;
  21383. use Composer\Package\Link;
  21384. use Composer\Semver\Constraint\Constraint;
  21385. use Composer\Util\RemoteFilesystem;
  21386. use Composer\Config;
  21387. use Composer\Factory;
  21388. class PearRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  21389. {
  21390. private $url;
  21391. private $io;
  21392. private $rfs;
  21393. private $versionParser;
  21394. private $repoConfig;
  21395. private $vendorAlias;
  21396. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, RemoteFilesystem $rfs = null)
  21397. {
  21398. parent::__construct();
  21399. if (!preg_match('{^https?://}', $repoConfig['url'])) {
  21400. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  21401. }
  21402. $urlBits = parse_url($repoConfig['url']);
  21403. if (empty($urlBits['scheme']) || empty($urlBits['host'])) {
  21404. throw new \UnexpectedValueException('Invalid url given for PEAR repository: '.$repoConfig['url']);
  21405. }
  21406. $this->url = rtrim($repoConfig['url'], '/');
  21407. $this->io = $io;
  21408. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  21409. $this->vendorAlias = isset($repoConfig['vendor-alias']) ? $repoConfig['vendor-alias'] : null;
  21410. $this->versionParser = new VersionParser();
  21411. $this->repoConfig = $repoConfig;
  21412. }
  21413. public function getRepoConfig()
  21414. {
  21415. return $this->repoConfig;
  21416. }
  21417. protected function initialize()
  21418. {
  21419. parent::initialize();
  21420. $this->io->writeError('Initializing PEAR repository '.$this->url);
  21421. $reader = new ChannelReader($this->rfs);
  21422. try {
  21423. $channelInfo = $reader->read($this->url);
  21424. } catch (\Exception $e) {
  21425. $this->io->writeError('<warning>PEAR repository from '.$this->url.' could not be loaded. '.$e->getMessage().'</warning>');
  21426. return;
  21427. }
  21428. $packages = $this->buildComposerPackages($channelInfo, $this->versionParser);
  21429. foreach ($packages as $package) {
  21430. $this->addPackage($package);
  21431. }
  21432. }
  21433. private function buildComposerPackages(ChannelInfo $channelInfo, SemverVersionParser $versionParser)
  21434. {
  21435. $result = array();
  21436. foreach ($channelInfo->getPackages() as $packageDefinition) {
  21437. foreach ($packageDefinition->getReleases() as $version => $releaseInfo) {
  21438. try {
  21439. $normalizedVersion = $versionParser->normalize($version);
  21440. } catch (\UnexpectedValueException $e) {
  21441. $this->io->writeError('Could not load '.$packageDefinition->getPackageName().' '.$version.': '.$e->getMessage(), true, IOInterface::VERBOSE);
  21442. continue;
  21443. }
  21444. $composerPackageName = $this->buildComposerPackageName($packageDefinition->getChannelName(), $packageDefinition->getPackageName());
  21445. $urlBits = parse_url($this->url);
  21446. $scheme = (isset($urlBits['scheme']) && 'https' === $urlBits['scheme'] && extension_loaded('openssl')) ? 'https' : 'http';
  21447. $distUrl = "{$scheme}://{$packageDefinition->getChannelName()}/get/{$packageDefinition->getPackageName()}-{$version}.tgz";
  21448. $requires = array();
  21449. $suggests = array();
  21450. $conflicts = array();
  21451. $replaces = array();
  21452. if ($channelInfo->getName() == $packageDefinition->getChannelName()) {
  21453. $composerPackageAlias = $this->buildComposerPackageName($channelInfo->getAlias(), $packageDefinition->getPackageName());
  21454. $aliasConstraint = new Constraint('==', $normalizedVersion);
  21455. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  21456. }
  21457. if (!empty($this->vendorAlias)
  21458. && ($this->vendorAlias != 'pear-'.$channelInfo->getAlias() || $channelInfo->getName() != $packageDefinition->getChannelName())
  21459. ) {
  21460. $composerPackageAlias = "{$this->vendorAlias}/{$packageDefinition->getPackageName()}";
  21461. $aliasConstraint = new Constraint('==', $normalizedVersion);
  21462. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  21463. }
  21464. foreach ($releaseInfo->getDependencyInfo()->getRequires() as $dependencyConstraint) {
  21465. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  21466. $constraint = $versionParser->parseConstraints($dependencyConstraint->getConstraint());
  21467. $link = new Link($composerPackageName, $dependencyPackageName, $constraint, $dependencyConstraint->getType(), $dependencyConstraint->getConstraint());
  21468. switch ($dependencyConstraint->getType()) {
  21469. case 'required':
  21470. $requires[] = $link;
  21471. break;
  21472. case 'conflicts':
  21473. $conflicts[] = $link;
  21474. break;
  21475. case 'replaces':
  21476. $replaces[] = $link;
  21477. break;
  21478. }
  21479. }
  21480. foreach ($releaseInfo->getDependencyInfo()->getOptionals() as $group => $dependencyConstraints) {
  21481. foreach ($dependencyConstraints as $dependencyConstraint) {
  21482. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  21483. $suggests[$group.'-'.$dependencyPackageName] = $dependencyConstraint->getConstraint();
  21484. }
  21485. }
  21486. $package = new CompletePackage($composerPackageName, $normalizedVersion, $version);
  21487. $package->setType('pear-library');
  21488. $package->setDescription($packageDefinition->getDescription());
  21489. $package->setLicense(array($packageDefinition->getLicense()));
  21490. $package->setDistType('file');
  21491. $package->setDistUrl($distUrl);
  21492. $package->setAutoload(array('classmap' => array('')));
  21493. $package->setIncludePaths(array('/'));
  21494. $package->setRequires($requires);
  21495. $package->setConflicts($conflicts);
  21496. $package->setSuggests($suggests);
  21497. $package->setReplaces($replaces);
  21498. $result[] = $package;
  21499. }
  21500. }
  21501. return $result;
  21502. }
  21503. private function buildComposerPackageName($channelName, $packageName)
  21504. {
  21505. if ('php' === $channelName) {
  21506. return "php";
  21507. }
  21508. if ('ext' === $channelName) {
  21509. return "ext-{$packageName}";
  21510. }
  21511. return "pear-{$channelName}/{$packageName}";
  21512. }
  21513. }
  21514. <?php
  21515. namespace Composer\Repository;
  21516. use Composer\Package\CompletePackage;
  21517. use Composer\Package\PackageInterface;
  21518. use Composer\Package\Version\VersionParser;
  21519. use Composer\Plugin\PluginInterface;
  21520. use Composer\Util\Silencer;
  21521. use Composer\XdebugHandler\XdebugHandler;
  21522. class PlatformRepository extends ArrayRepository
  21523. {
  21524. const PLATFORM_PACKAGE_REGEX = '{^(?:php(?:-64bit|-ipv6|-zts|-debug)?|hhvm|(?:ext|lib)-[^/ ]+)$}i';
  21525. private $versionParser;
  21526. private $overrides = array();
  21527. public function __construct(array $packages = array(), array $overrides = array())
  21528. {
  21529. foreach ($overrides as $name => $version) {
  21530. $this->overrides[strtolower($name)] = array('name' => $name, 'version' => $version);
  21531. }
  21532. parent::__construct($packages);
  21533. }
  21534. protected function initialize()
  21535. {
  21536. parent::initialize();
  21537. $this->versionParser = new VersionParser();
  21538. foreach ($this->overrides as $override) {
  21539. if (!preg_match(self::PLATFORM_PACKAGE_REGEX, $override['name'])) {
  21540. throw new \InvalidArgumentException('Invalid platform package name in config.platform: '.$override['name']);
  21541. }
  21542. $this->addOverriddenPackage($override);
  21543. }
  21544. $prettyVersion = PluginInterface::PLUGIN_API_VERSION;
  21545. $version = $this->versionParser->normalize($prettyVersion);
  21546. $composerPluginApi = new CompletePackage('composer-plugin-api', $version, $prettyVersion);
  21547. $composerPluginApi->setDescription('The Composer Plugin API');
  21548. $this->addPackage($composerPluginApi);
  21549. try {
  21550. $prettyVersion = PHP_VERSION;
  21551. $version = $this->versionParser->normalize($prettyVersion);
  21552. } catch (\UnexpectedValueException $e) {
  21553. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', PHP_VERSION);
  21554. $version = $this->versionParser->normalize($prettyVersion);
  21555. }
  21556. $php = new CompletePackage('php', $version, $prettyVersion);
  21557. $php->setDescription('The PHP interpreter');
  21558. $this->addPackage($php);
  21559. if (PHP_DEBUG) {
  21560. $phpdebug = new CompletePackage('php-debug', $version, $prettyVersion);
  21561. $phpdebug->setDescription('The PHP interpreter, with debugging symbols');
  21562. $this->addPackage($phpdebug);
  21563. }
  21564. if (defined('PHP_ZTS') && PHP_ZTS) {
  21565. $phpzts = new CompletePackage('php-zts', $version, $prettyVersion);
  21566. $phpzts->setDescription('The PHP interpreter, with Zend Thread Safety');
  21567. $this->addPackage($phpzts);
  21568. }
  21569. if (PHP_INT_SIZE === 8) {
  21570. $php64 = new CompletePackage('php-64bit', $version, $prettyVersion);
  21571. $php64->setDescription('The PHP interpreter, 64bit');
  21572. $this->addPackage($php64);
  21573. }
  21574. if (defined('AF_INET6') || Silencer::call('inet_pton', '::') !== false) {
  21575. $phpIpv6 = new CompletePackage('php-ipv6', $version, $prettyVersion);
  21576. $phpIpv6->setDescription('The PHP interpreter, with IPv6 support');
  21577. $this->addPackage($phpIpv6);
  21578. }
  21579. $loadedExtensions = get_loaded_extensions();
  21580. foreach ($loadedExtensions as $name) {
  21581. if (in_array($name, array('standard', 'Core'))) {
  21582. continue;
  21583. }
  21584. $reflExt = new \ReflectionExtension($name);
  21585. $prettyVersion = $reflExt->getVersion();
  21586. $this->addExtension($name, $prettyVersion);
  21587. }
  21588. if (!in_array('xdebug', $loadedExtensions, true) && ($prettyVersion = XdebugHandler::getSkippedVersion())) {
  21589. $this->addExtension('xdebug', $prettyVersion);
  21590. }
  21591. foreach ($loadedExtensions as $name) {
  21592. $prettyVersion = null;
  21593. $description = 'The '.$name.' PHP library';
  21594. switch ($name) {
  21595. case 'curl':
  21596. $curlVersion = curl_version();
  21597. $prettyVersion = $curlVersion['version'];
  21598. break;
  21599. case 'iconv':
  21600. $prettyVersion = ICONV_VERSION;
  21601. break;
  21602. case 'intl':
  21603. $name = 'ICU';
  21604. if (defined('INTL_ICU_VERSION')) {
  21605. $prettyVersion = INTL_ICU_VERSION;
  21606. } else {
  21607. $reflector = new \ReflectionExtension('intl');
  21608. ob_start();
  21609. $reflector->info();
  21610. $output = ob_get_clean();
  21611. preg_match('/^ICU version => (.*)$/m', $output, $matches);
  21612. $prettyVersion = $matches[1];
  21613. }
  21614. break;
  21615. case 'libxml':
  21616. $prettyVersion = LIBXML_DOTTED_VERSION;
  21617. break;
  21618. case 'openssl':
  21619. $prettyVersion = preg_replace_callback('{^(?:OpenSSL|LibreSSL)?\s*([0-9.]+)([a-z]*).*}i', function ($match) {
  21620. if (empty($match[2])) {
  21621. return $match[1];
  21622. }
  21623. if (!preg_match('{^z*[a-z]$}', $match[2])) {
  21624. return 0;
  21625. }
  21626. $len = strlen($match[2]);
  21627. $patchVersion = ($len - 1) * 26;
  21628. $patchVersion += ord($match[2][$len - 1]) - 96;
  21629. return $match[1].'.'.$patchVersion;
  21630. }, OPENSSL_VERSION_TEXT);
  21631. $description = OPENSSL_VERSION_TEXT;
  21632. break;
  21633. case 'pcre':
  21634. $prettyVersion = preg_replace('{^(\S+).*}', '$1', PCRE_VERSION);
  21635. break;
  21636. case 'uuid':
  21637. $prettyVersion = phpversion('uuid');
  21638. break;
  21639. case 'xsl':
  21640. $prettyVersion = LIBXSLT_DOTTED_VERSION;
  21641. break;
  21642. default:
  21643. continue 2;
  21644. }
  21645. try {
  21646. $version = $this->versionParser->normalize($prettyVersion);
  21647. } catch (\UnexpectedValueException $e) {
  21648. continue;
  21649. }
  21650. $lib = new CompletePackage('lib-'.$name, $version, $prettyVersion);
  21651. $lib->setDescription($description);
  21652. $this->addPackage($lib);
  21653. }
  21654. if (defined('HHVM_VERSION')) {
  21655. try {
  21656. $prettyVersion = HHVM_VERSION;
  21657. $version = $this->versionParser->normalize($prettyVersion);
  21658. } catch (\UnexpectedValueException $e) {
  21659. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', HHVM_VERSION);
  21660. $version = $this->versionParser->normalize($prettyVersion);
  21661. }
  21662. $hhvm = new CompletePackage('hhvm', $version, $prettyVersion);
  21663. $hhvm->setDescription('The HHVM Runtime (64bit)');
  21664. $this->addPackage($hhvm);
  21665. }
  21666. }
  21667. public function addPackage(PackageInterface $package)
  21668. {
  21669. if (isset($this->overrides[$package->getName()])) {
  21670. $overrider = $this->findPackage($package->getName(), '*');
  21671. if ($package->getVersion() === $overrider->getVersion()) {
  21672. $actualText = 'same as actual';
  21673. } else {
  21674. $actualText = 'actual: '.$package->getPrettyVersion();
  21675. }
  21676. $overrider->setDescription($overrider->getDescription().' ('.$actualText.')');
  21677. return;
  21678. }
  21679. if (isset($this->overrides['php']) && 0 === strpos($package->getName(), 'php-')) {
  21680. $overrider = $this->addOverriddenPackage($this->overrides['php'], $package->getPrettyName());
  21681. if ($package->getVersion() === $overrider->getVersion()) {
  21682. $actualText = 'same as actual';
  21683. } else {
  21684. $actualText = 'actual: '.$package->getPrettyVersion();
  21685. }
  21686. $overrider->setDescription($overrider->getDescription().' ('.$actualText.')');
  21687. return;
  21688. }
  21689. parent::addPackage($package);
  21690. }
  21691. private function addOverriddenPackage(array $override, $name = null)
  21692. {
  21693. $version = $this->versionParser->normalize($override['version']);
  21694. $package = new CompletePackage($name ?: $override['name'], $version, $override['version']);
  21695. $package->setDescription('Package overridden via config.platform');
  21696. $package->setExtra(array('config.platform' => true));
  21697. parent::addPackage($package);
  21698. return $package;
  21699. }
  21700. private function addExtension($name, $prettyVersion)
  21701. {
  21702. $extraDescription = null;
  21703. try {
  21704. $version = $this->versionParser->normalize($prettyVersion);
  21705. } catch (\UnexpectedValueException $e) {
  21706. $extraDescription = ' (actual version: '.$prettyVersion.')';
  21707. if (preg_match('{^(\d+\.\d+\.\d+(?:\.\d+)?)}', $prettyVersion, $match)) {
  21708. $prettyVersion = $match[1];
  21709. } else {
  21710. $prettyVersion = '0';
  21711. }
  21712. $version = $this->versionParser->normalize($prettyVersion);
  21713. }
  21714. $packageName = $this->buildPackageName($name);
  21715. $ext = new CompletePackage($packageName, $version, $prettyVersion);
  21716. $ext->setDescription('The '.$name.' PHP extension'.$extraDescription);
  21717. $this->addPackage($ext);
  21718. }
  21719. private function buildPackageName($name)
  21720. {
  21721. return 'ext-' . str_replace(' ', '-', $name);
  21722. }
  21723. }
  21724. <?php
  21725. namespace Composer\Repository;
  21726. use Composer\Factory;
  21727. use Composer\IO\IOInterface;
  21728. use Composer\Config;
  21729. use Composer\EventDispatcher\EventDispatcher;
  21730. use Composer\Util\RemoteFilesystem;
  21731. use Composer\Json\JsonFile;
  21732. class RepositoryFactory
  21733. {
  21734. public static function configFromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
  21735. {
  21736. if (0 === strpos($repository, 'http')) {
  21737. $repoConfig = array('type' => 'composer', 'url' => $repository);
  21738. } elseif ("json" === pathinfo($repository, PATHINFO_EXTENSION)) {
  21739. $json = new JsonFile($repository, Factory::createRemoteFilesystem($io, $config));
  21740. $data = $json->read();
  21741. if (!empty($data['packages']) || !empty($data['includes']) || !empty($data['provider-includes'])) {
  21742. $repoConfig = array('type' => 'composer', 'url' => 'file://' . strtr(realpath($repository), '\\', '/'));
  21743. } elseif ($allowFilesystem) {
  21744. $repoConfig = array('type' => 'filesystem', 'json' => $json);
  21745. } else {
  21746. throw new \InvalidArgumentException("Invalid repository URL ($repository) given. This file does not contain a valid composer repository.");
  21747. }
  21748. } elseif ('{' === substr($repository, 0, 1)) {
  21749. $repoConfig = JsonFile::parseJson($repository);
  21750. } else {
  21751. throw new \InvalidArgumentException("Invalid repository url ($repository) given. Has to be a .json file, an http url or a JSON object.");
  21752. }
  21753. return $repoConfig;
  21754. }
  21755. public static function fromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
  21756. {
  21757. $repoConfig = static::configFromString($io, $config, $repository, $allowFilesystem);
  21758. return static::createRepo($io, $config, $repoConfig);
  21759. }
  21760. public static function createRepo(IOInterface $io, Config $config, array $repoConfig)
  21761. {
  21762. $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
  21763. $repos = static::createRepos($rm, array($repoConfig));
  21764. return reset($repos);
  21765. }
  21766. public static function defaultRepos(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  21767. {
  21768. if (!$config) {
  21769. $config = Factory::createConfig($io);
  21770. }
  21771. if (!$rm) {
  21772. if (!$io) {
  21773. throw new \InvalidArgumentException('This function requires either an IOInterface or a RepositoryManager');
  21774. }
  21775. $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
  21776. }
  21777. return static::createRepos($rm, $config->getRepositories());
  21778. }
  21779. public static function manager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  21780. {
  21781. $rm = new RepositoryManager($io, $config, $eventDispatcher, $rfs);
  21782. $rm->setRepositoryClass('composer', 'Composer\Repository\ComposerRepository');
  21783. $rm->setRepositoryClass('vcs', 'Composer\Repository\VcsRepository');
  21784. $rm->setRepositoryClass('package', 'Composer\Repository\PackageRepository');
  21785. $rm->setRepositoryClass('pear', 'Composer\Repository\PearRepository');
  21786. $rm->setRepositoryClass('git', 'Composer\Repository\VcsRepository');
  21787. $rm->setRepositoryClass('git-bitbucket', 'Composer\Repository\VcsRepository');
  21788. $rm->setRepositoryClass('github', 'Composer\Repository\VcsRepository');
  21789. $rm->setRepositoryClass('gitlab', 'Composer\Repository\VcsRepository');
  21790. $rm->setRepositoryClass('svn', 'Composer\Repository\VcsRepository');
  21791. $rm->setRepositoryClass('fossil', 'Composer\Repository\VcsRepository');
  21792. $rm->setRepositoryClass('perforce', 'Composer\Repository\VcsRepository');
  21793. $rm->setRepositoryClass('hg', 'Composer\Repository\VcsRepository');
  21794. $rm->setRepositoryClass('hg-bitbucket', 'Composer\Repository\VcsRepository');
  21795. $rm->setRepositoryClass('artifact', 'Composer\Repository\ArtifactRepository');
  21796. $rm->setRepositoryClass('path', 'Composer\Repository\PathRepository');
  21797. return $rm;
  21798. }
  21799. private static function createRepos(RepositoryManager $rm, array $repoConfigs)
  21800. {
  21801. $repos = array();
  21802. foreach ($repoConfigs as $index => $repo) {
  21803. if (is_string($repo)) {
  21804. throw new \UnexpectedValueException('"repositories" should be an array of repository definitions, only a single repository was given');
  21805. }
  21806. if (!is_array($repo)) {
  21807. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') should be an array, '.gettype($repo).' given');
  21808. }
  21809. if (!isset($repo['type'])) {
  21810. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') must have a type defined');
  21811. }
  21812. $name = is_int($index) && isset($repo['url']) ? preg_replace('{^https?://}i', '', $repo['url']) : $index;
  21813. while (isset($repos[$name])) {
  21814. $name .= '2';
  21815. }
  21816. if ($repo['type'] === 'filesystem') {
  21817. $repos[$name] = new FilesystemRepository($repo['json']);
  21818. } else {
  21819. $repos[$name] = $rm->createRepository($repo['type'], $repo, $index);
  21820. }
  21821. }
  21822. return $repos;
  21823. }
  21824. }
  21825. <?php
  21826. namespace Composer\Repository;
  21827. use Composer\Package\PackageInterface;
  21828. interface RepositoryInterface extends \Countable
  21829. {
  21830. const SEARCH_FULLTEXT = 0;
  21831. const SEARCH_NAME = 1;
  21832. public function hasPackage(PackageInterface $package);
  21833. public function findPackage($name, $constraint);
  21834. public function findPackages($name, $constraint = null);
  21835. public function getPackages();
  21836. public function search($query, $mode = 0);
  21837. }
  21838. <?php
  21839. namespace Composer\Repository;
  21840. use Composer\IO\IOInterface;
  21841. use Composer\Config;
  21842. use Composer\EventDispatcher\EventDispatcher;
  21843. use Composer\Package\PackageInterface;
  21844. use Composer\Util\RemoteFilesystem;
  21845. class RepositoryManager
  21846. {
  21847. private $localRepository;
  21848. private $repositories = array();
  21849. private $repositoryClasses = array();
  21850. private $io;
  21851. private $config;
  21852. private $eventDispatcher;
  21853. private $rfs;
  21854. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  21855. {
  21856. $this->io = $io;
  21857. $this->config = $config;
  21858. $this->eventDispatcher = $eventDispatcher;
  21859. $this->rfs = $rfs;
  21860. }
  21861. public function findPackage($name, $constraint)
  21862. {
  21863. foreach ($this->repositories as $repository) {
  21864. if ($package = $repository->findPackage($name, $constraint)) {
  21865. return $package;
  21866. }
  21867. }
  21868. return null;
  21869. }
  21870. public function findPackages($name, $constraint)
  21871. {
  21872. $packages = array();
  21873. foreach ($this->getRepositories() as $repository) {
  21874. $packages = array_merge($packages, $repository->findPackages($name, $constraint));
  21875. }
  21876. return $packages;
  21877. }
  21878. public function addRepository(RepositoryInterface $repository)
  21879. {
  21880. $this->repositories[] = $repository;
  21881. }
  21882. public function prependRepository(RepositoryInterface $repository)
  21883. {
  21884. array_unshift($this->repositories, $repository);
  21885. }
  21886. public function createRepository($type, $config, $name = null)
  21887. {
  21888. if (!isset($this->repositoryClasses[$type])) {
  21889. throw new \InvalidArgumentException('Repository type is not registered: '.$type);
  21890. }
  21891. if (isset($config['packagist']) && false === $config['packagist']) {
  21892. $this->io->writeError('<warning>Repository "'.$name.'" ('.json_encode($config).') has a packagist key which should be in its own repository definition</warning>');
  21893. }
  21894. $class = $this->repositoryClasses[$type];
  21895. $reflMethod = new \ReflectionMethod($class, '__construct');
  21896. $params = $reflMethod->getParameters();
  21897. if (isset($params[4]) && $params[4]->getClass() && $params[4]->getClass()->getName() === 'Composer\Util\RemoteFilesystem') {
  21898. return new $class($config, $this->io, $this->config, $this->eventDispatcher, $this->rfs);
  21899. }
  21900. return new $class($config, $this->io, $this->config, $this->eventDispatcher);
  21901. }
  21902. public function setRepositoryClass($type, $class)
  21903. {
  21904. $this->repositoryClasses[$type] = $class;
  21905. }
  21906. public function getRepositories()
  21907. {
  21908. return $this->repositories;
  21909. }
  21910. public function setLocalRepository(WritableRepositoryInterface $repository)
  21911. {
  21912. $this->localRepository = $repository;
  21913. }
  21914. public function getLocalRepository()
  21915. {
  21916. return $this->localRepository;
  21917. }
  21918. }
  21919. <?php
  21920. namespace Composer\Repository;
  21921. class RepositorySecurityException extends \Exception
  21922. {
  21923. }
  21924. <?php
  21925. namespace Composer\Repository\Vcs;
  21926. use Composer\Cache;
  21927. use Composer\Downloader\TransportException;
  21928. use Composer\Json\JsonFile;
  21929. use Composer\Util\Bitbucket;
  21930. abstract class BitbucketDriver extends VcsDriver
  21931. {
  21932. protected $cache;
  21933. protected $owner;
  21934. protected $repository;
  21935. protected $hasIssues;
  21936. protected $rootIdentifier;
  21937. protected $tags;
  21938. protected $branches;
  21939. protected $infoCache = array();
  21940. protected $branchesUrl = '';
  21941. protected $tagsUrl = '';
  21942. protected $homeUrl = '';
  21943. protected $website = '';
  21944. protected $cloneHttpsUrl = '';
  21945. protected $fallbackDriver;
  21946. protected $vcsType;
  21947. public function initialize()
  21948. {
  21949. preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+?)(\.git|/?)$#', $this->url, $match);
  21950. $this->owner = $match[1];
  21951. $this->repository = $match[2];
  21952. $this->originUrl = 'bitbucket.org';
  21953. $this->cache = new Cache(
  21954. $this->io,
  21955. implode('/', array(
  21956. $this->config->get('cache-repo-dir'),
  21957. $this->originUrl,
  21958. $this->owner,
  21959. $this->repository,
  21960. ))
  21961. );
  21962. }
  21963. public function getUrl()
  21964. {
  21965. if ($this->fallbackDriver) {
  21966. return $this->fallbackDriver->getUrl();
  21967. }
  21968. return $this->cloneHttpsUrl;
  21969. }
  21970. protected function getRepoData()
  21971. {
  21972. $resource = sprintf(
  21973. 'https://api.bitbucket.org/2.0/repositories/%s/%s?%s',
  21974. $this->owner,
  21975. $this->repository,
  21976. http_build_query(
  21977. array('fields' => '-project,-owner'),
  21978. null,
  21979. '&'
  21980. )
  21981. );
  21982. $repoData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource, true), $resource);
  21983. if ($this->fallbackDriver) {
  21984. return false;
  21985. }
  21986. $this->parseCloneUrls($repoData['links']['clone']);
  21987. $this->hasIssues = !empty($repoData['has_issues']);
  21988. $this->branchesUrl = $repoData['links']['branches']['href'];
  21989. $this->tagsUrl = $repoData['links']['tags']['href'];
  21990. $this->homeUrl = $repoData['links']['html']['href'];
  21991. $this->website = $repoData['website'];
  21992. $this->vcsType = $repoData['scm'];
  21993. return true;
  21994. }
  21995. public function getComposerInformation($identifier)
  21996. {
  21997. if ($this->fallbackDriver) {
  21998. return $this->fallbackDriver->getComposerInformation($identifier);
  21999. }
  22000. if (!isset($this->infoCache[$identifier])) {
  22001. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  22002. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  22003. }
  22004. $composer = $this->getBaseComposerInformation($identifier);
  22005. if (!isset($composer['support']['source'])) {
  22006. $label = array_search(
  22007. $identifier,
  22008. $this->getTags()
  22009. ) ?: array_search(
  22010. $identifier,
  22011. $this->getBranches()
  22012. ) ?: $identifier;
  22013. if (array_key_exists($label, $tags = $this->getTags())) {
  22014. $hash = $tags[$label];
  22015. } elseif (array_key_exists($label, $branches = $this->getBranches())) {
  22016. $hash = $branches[$label];
  22017. }
  22018. if (! isset($hash)) {
  22019. $composer['support']['source'] = sprintf(
  22020. 'https://%s/%s/%s/src',
  22021. $this->originUrl,
  22022. $this->owner,
  22023. $this->repository
  22024. );
  22025. } else {
  22026. $composer['support']['source'] = sprintf(
  22027. 'https://%s/%s/%s/src/%s/?at=%s',
  22028. $this->originUrl,
  22029. $this->owner,
  22030. $this->repository,
  22031. $hash,
  22032. $label
  22033. );
  22034. }
  22035. }
  22036. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  22037. $composer['support']['issues'] = sprintf(
  22038. 'https://%s/%s/%s/issues',
  22039. $this->originUrl,
  22040. $this->owner,
  22041. $this->repository
  22042. );
  22043. }
  22044. if (!isset($composer['homepage'])) {
  22045. $composer['homepage'] = empty($this->website) ? $this->homeUrl : $this->website;
  22046. }
  22047. $this->infoCache[$identifier] = $composer;
  22048. if ($this->shouldCache($identifier)) {
  22049. $this->cache->write($identifier, json_encode($composer));
  22050. }
  22051. }
  22052. return $this->infoCache[$identifier];
  22053. }
  22054. public function getFileContent($file, $identifier)
  22055. {
  22056. if ($this->fallbackDriver) {
  22057. return $this->fallbackDriver->getFileContent($file, $identifier);
  22058. }
  22059. if (strpos($identifier, '/') !== false) {
  22060. $branches = $this->getBranches();
  22061. if (isset($branches[$identifier])) {
  22062. $identifier = $branches[$identifier];
  22063. }
  22064. }
  22065. $resource = sprintf(
  22066. 'https://api.bitbucket.org/2.0/repositories/%s/%s/src/%s/%s',
  22067. $this->owner,
  22068. $this->repository,
  22069. $identifier,
  22070. $file
  22071. );
  22072. return $this->getContentsWithOAuthCredentials($resource);
  22073. }
  22074. public function getChangeDate($identifier)
  22075. {
  22076. if ($this->fallbackDriver) {
  22077. return $this->fallbackDriver->getChangeDate($identifier);
  22078. }
  22079. $resource = sprintf(
  22080. 'https://api.bitbucket.org/2.0/repositories/%s/%s/commit/%s?fields=date',
  22081. $this->owner,
  22082. $this->repository,
  22083. $identifier
  22084. );
  22085. $commit = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  22086. return new \DateTime($commit['date']);
  22087. }
  22088. public function getSource($identifier)
  22089. {
  22090. if ($this->fallbackDriver) {
  22091. return $this->fallbackDriver->getSource($identifier);
  22092. }
  22093. return array('type' => $this->vcsType, 'url' => $this->getUrl(), 'reference' => $identifier);
  22094. }
  22095. public function getDist($identifier)
  22096. {
  22097. if ($this->fallbackDriver) {
  22098. return $this->fallbackDriver->getDist($identifier);
  22099. }
  22100. $url = sprintf(
  22101. 'https://bitbucket.org/%s/%s/get/%s.zip',
  22102. $this->owner,
  22103. $this->repository,
  22104. $identifier
  22105. );
  22106. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  22107. }
  22108. public function getTags()
  22109. {
  22110. if ($this->fallbackDriver) {
  22111. return $this->fallbackDriver->getTags();
  22112. }
  22113. if (null === $this->tags) {
  22114. $this->tags = array();
  22115. $resource = sprintf(
  22116. '%s?%s',
  22117. $this->tagsUrl,
  22118. http_build_query(
  22119. array(
  22120. 'pagelen' => 100,
  22121. 'fields' => 'values.name,values.target.hash,next',
  22122. 'sort' => '-target.date',
  22123. ),
  22124. null,
  22125. '&'
  22126. )
  22127. );
  22128. $hasNext = true;
  22129. while ($hasNext) {
  22130. $tagsData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  22131. foreach ($tagsData['values'] as $data) {
  22132. $this->tags[$data['name']] = $data['target']['hash'];
  22133. }
  22134. if (empty($tagsData['next'])) {
  22135. $hasNext = false;
  22136. } else {
  22137. $resource = $tagsData['next'];
  22138. }
  22139. }
  22140. if ($this->vcsType === 'hg') {
  22141. unset($this->tags['tip']);
  22142. }
  22143. }
  22144. return $this->tags;
  22145. }
  22146. public function getBranches()
  22147. {
  22148. if ($this->fallbackDriver) {
  22149. return $this->fallbackDriver->getBranches();
  22150. }
  22151. if (null === $this->branches) {
  22152. $this->branches = array();
  22153. $resource = sprintf(
  22154. '%s?%s',
  22155. $this->branchesUrl,
  22156. http_build_query(
  22157. array(
  22158. 'pagelen' => 100,
  22159. 'fields' => 'values.name,values.target.hash,values.heads,next',
  22160. 'sort' => '-target.date',
  22161. ),
  22162. null,
  22163. '&'
  22164. )
  22165. );
  22166. $hasNext = true;
  22167. while ($hasNext) {
  22168. $branchData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  22169. foreach ($branchData['values'] as $data) {
  22170. if ($this->vcsType === 'hg' && empty($data['heads'])) {
  22171. continue;
  22172. }
  22173. $this->branches[$data['name']] = $data['target']['hash'];
  22174. }
  22175. if (empty($branchData['next'])) {
  22176. $hasNext = false;
  22177. } else {
  22178. $resource = $branchData['next'];
  22179. }
  22180. }
  22181. }
  22182. return $this->branches;
  22183. }
  22184. protected function getContentsWithOAuthCredentials($url, $fetchingRepoData = false)
  22185. {
  22186. try {
  22187. return parent::getContents($url);
  22188. } catch (TransportException $e) {
  22189. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process, $this->remoteFilesystem);
  22190. if (403 === $e->getCode() || (401 === $e->getCode() && strpos($e->getMessage(), 'Could not authenticate against') === 0)) {
  22191. if (!$this->io->hasAuthentication($this->originUrl)
  22192. && $bitbucketUtil->authorizeOAuth($this->originUrl)
  22193. ) {
  22194. return parent::getContents($url);
  22195. }
  22196. if (!$this->io->isInteractive() && $fetchingRepoData) {
  22197. return $this->attemptCloneFallback();
  22198. }
  22199. }
  22200. throw $e;
  22201. }
  22202. }
  22203. abstract protected function generateSshUrl();
  22204. protected function attemptCloneFallback()
  22205. {
  22206. try {
  22207. $this->setupFallbackDriver($this->generateSshUrl());
  22208. } catch (\RuntimeException $e) {
  22209. $this->fallbackDriver = null;
  22210. $this->io->writeError(
  22211. '<error>Failed to clone the ' . $this->generateSshUrl() . ' repository, try running in interactive mode'
  22212. . ' so that you can enter your Bitbucket OAuth consumer credentials</error>'
  22213. );
  22214. throw $e;
  22215. }
  22216. }
  22217. abstract protected function setupFallbackDriver($url);
  22218. protected function parseCloneUrls(array $cloneLinks)
  22219. {
  22220. foreach ($cloneLinks as $cloneLink) {
  22221. if ($cloneLink['name'] === 'https') {
  22222. $this->cloneHttpsUrl = preg_replace('/https:\/\/([^@]+@)?/', 'https://', $cloneLink['href']);
  22223. }
  22224. }
  22225. }
  22226. protected function getMainBranchData()
  22227. {
  22228. $resource = sprintf(
  22229. 'https://api.bitbucket.org/2.0/repositories/%s/%s?fields=mainbranch',
  22230. $this->owner,
  22231. $this->repository
  22232. );
  22233. $data = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  22234. if (isset($data['mainbranch'])) {
  22235. return $data['mainbranch'];
  22236. }
  22237. return null;
  22238. }
  22239. }
  22240. <?php
  22241. namespace Composer\Repository\Vcs;
  22242. use Composer\Config;
  22243. use Composer\Util\ProcessExecutor;
  22244. use Composer\Util\Filesystem;
  22245. use Composer\IO\IOInterface;
  22246. class FossilDriver extends VcsDriver
  22247. {
  22248. protected $tags;
  22249. protected $branches;
  22250. protected $rootIdentifier;
  22251. protected $repoFile;
  22252. protected $checkoutDir;
  22253. protected $infoCache = array();
  22254. public function initialize()
  22255. {
  22256. $this->checkFossil();
  22257. $this->config->prohibitUrlByConfig($this->url, $this->io);
  22258. if (Filesystem::isLocalPath($this->url) && is_dir($this->url)) {
  22259. $this->checkoutDir = $this->url;
  22260. } else {
  22261. $localName = preg_replace('{[^a-z0-9]}i', '-', $this->url);
  22262. $this->repoFile = $this->config->get('cache-repo-dir') . '/' . $localName . '.fossil';
  22263. $this->checkoutDir = $this->config->get('cache-vcs-dir') . '/' . $localName . '/';
  22264. $this->updateLocalRepo();
  22265. }
  22266. $this->getTags();
  22267. $this->getBranches();
  22268. }
  22269. protected function checkFossil()
  22270. {
  22271. if (0 !== $this->process->execute('fossil version', $ignoredOutput)) {
  22272. throw new \RuntimeException("fossil was not found, check that it is installed and in your PATH env.\n\n" . $this->process->getErrorOutput());
  22273. }
  22274. }
  22275. protected function updateLocalRepo()
  22276. {
  22277. $fs = new Filesystem();
  22278. $fs->ensureDirectoryExists($this->checkoutDir);
  22279. if (!is_writable(dirname($this->checkoutDir))) {
  22280. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$this->checkoutDir.'" directory is not writable by the current user.');
  22281. }
  22282. if (is_file($this->repoFile) && is_dir($this->checkoutDir) && 0 === $this->process->execute('fossil info', $output, $this->checkoutDir)) {
  22283. if (0 !== $this->process->execute('fossil pull', $output, $this->checkoutDir)) {
  22284. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  22285. }
  22286. } else {
  22287. $fs->removeDirectory($this->checkoutDir);
  22288. $fs->remove($this->repoFile);
  22289. $fs->ensureDirectoryExists($this->checkoutDir);
  22290. if (0 !== $this->process->execute(sprintf('fossil clone %s %s', ProcessExecutor::escape($this->url), ProcessExecutor::escape($this->repoFile)), $output)) {
  22291. $output = $this->process->getErrorOutput();
  22292. throw new \RuntimeException('Failed to clone '.$this->url.' to repository ' . $this->repoFile . "\n\n" .$output);
  22293. }
  22294. if (0 !== $this->process->execute(sprintf('fossil open %s --nested', ProcessExecutor::escape($this->repoFile)), $output, $this->checkoutDir)) {
  22295. $output = $this->process->getErrorOutput();
  22296. throw new \RuntimeException('Failed to open repository '.$this->repoFile.' in ' . $this->checkoutDir . "\n\n" .$output);
  22297. }
  22298. }
  22299. }
  22300. public function getRootIdentifier()
  22301. {
  22302. if (null === $this->rootIdentifier) {
  22303. $this->rootIdentifier = 'trunk';
  22304. }
  22305. return $this->rootIdentifier;
  22306. }
  22307. public function getUrl()
  22308. {
  22309. return $this->url;
  22310. }
  22311. public function getSource($identifier)
  22312. {
  22313. return array('type' => 'fossil', 'url' => $this->getUrl(), 'reference' => $identifier);
  22314. }
  22315. public function getDist($identifier)
  22316. {
  22317. return null;
  22318. }
  22319. public function getFileContent($file, $identifier)
  22320. {
  22321. $command = sprintf('fossil cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  22322. $this->process->execute($command, $content, $this->checkoutDir);
  22323. if (!trim($content)) {
  22324. return null;
  22325. }
  22326. return $content;
  22327. }
  22328. public function getChangeDate($identifier)
  22329. {
  22330. $this->process->execute('fossil finfo -b -n 1 composer.json', $output, $this->checkoutDir);
  22331. list($ckout, $date, $message) = explode(' ', trim($output), 3);
  22332. return new \DateTime($date, new \DateTimeZone('UTC'));
  22333. }
  22334. public function getTags()
  22335. {
  22336. if (null === $this->tags) {
  22337. $tags = array();
  22338. $this->process->execute('fossil tag list', $output, $this->checkoutDir);
  22339. foreach ($this->process->splitLines($output) as $tag) {
  22340. $tags[$tag] = $tag;
  22341. }
  22342. $this->tags = $tags;
  22343. }
  22344. return $this->tags;
  22345. }
  22346. public function getBranches()
  22347. {
  22348. if (null === $this->branches) {
  22349. $branches = array();
  22350. $bookmarks = array();
  22351. $this->process->execute('fossil branch list', $output, $this->checkoutDir);
  22352. foreach ($this->process->splitLines($output) as $branch) {
  22353. $branch = trim(preg_replace('/^\*/', '', trim($branch)));
  22354. $branches[$branch] = $branch;
  22355. }
  22356. $this->branches = $branches;
  22357. }
  22358. return $this->branches;
  22359. }
  22360. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22361. {
  22362. if (preg_match('#(^(?:https?|ssh)://(?:[^@]@)?(?:chiselapp\.com|fossil\.))#i', $url)) {
  22363. return true;
  22364. }
  22365. if (preg_match('!/fossil/|\.fossil!', $url)) {
  22366. return true;
  22367. }
  22368. if (Filesystem::isLocalPath($url)) {
  22369. $url = Filesystem::getPlatformPath($url);
  22370. if (!is_dir($url)) {
  22371. return false;
  22372. }
  22373. $process = new ProcessExecutor($io);
  22374. if ($process->execute('fossil info', $output, $url) === 0) {
  22375. return true;
  22376. }
  22377. }
  22378. return false;
  22379. }
  22380. }
  22381. <?php
  22382. namespace Composer\Repository\Vcs;
  22383. use Composer\Config;
  22384. use Composer\IO\IOInterface;
  22385. class GitBitbucketDriver extends BitbucketDriver
  22386. {
  22387. public function getRootIdentifier()
  22388. {
  22389. if ($this->fallbackDriver) {
  22390. return $this->fallbackDriver->getRootIdentifier();
  22391. }
  22392. if (null === $this->rootIdentifier) {
  22393. if (! $this->getRepoData()) {
  22394. return $this->fallbackDriver->getRootIdentifier();
  22395. }
  22396. if ($this->vcsType !== 'git') {
  22397. throw new \RuntimeException(
  22398. $this->url.' does not appear to be a git repository, use '.
  22399. $this->cloneHttpsUrl.' if this is a mercurial bitbucket repository'
  22400. );
  22401. }
  22402. $mainBranchData = $this->getMainBranchData();
  22403. $this->rootIdentifier = !empty($mainBranchData['name']) ? $mainBranchData['name'] : 'master';
  22404. }
  22405. return $this->rootIdentifier;
  22406. }
  22407. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22408. {
  22409. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/(.+?)\.git$#', $url)) {
  22410. return false;
  22411. }
  22412. if (!extension_loaded('openssl')) {
  22413. $io->writeError('Skipping Bitbucket git driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  22414. return false;
  22415. }
  22416. return true;
  22417. }
  22418. protected function setupFallbackDriver($url)
  22419. {
  22420. $this->fallbackDriver = new GitDriver(
  22421. array('url' => $url),
  22422. $this->io,
  22423. $this->config,
  22424. $this->process,
  22425. $this->remoteFilesystem
  22426. );
  22427. $this->fallbackDriver->initialize();
  22428. }
  22429. protected function generateSshUrl()
  22430. {
  22431. return 'git@' . $this->originUrl . ':' . $this->owner.'/'.$this->repository.'.git';
  22432. }
  22433. }
  22434. <?php
  22435. namespace Composer\Repository\Vcs;
  22436. use Composer\Util\ProcessExecutor;
  22437. use Composer\Util\Filesystem;
  22438. use Composer\Util\Git as GitUtil;
  22439. use Composer\IO\IOInterface;
  22440. use Composer\Cache;
  22441. use Composer\Config;
  22442. class GitDriver extends VcsDriver
  22443. {
  22444. protected $cache;
  22445. protected $tags;
  22446. protected $branches;
  22447. protected $rootIdentifier;
  22448. protected $repoDir;
  22449. protected $infoCache = array();
  22450. public function initialize()
  22451. {
  22452. if (Filesystem::isLocalPath($this->url)) {
  22453. $this->url = preg_replace('{[\\/]\.git/?$}', '', $this->url);
  22454. $this->repoDir = $this->url;
  22455. $cacheUrl = realpath($this->url);
  22456. } else {
  22457. $this->repoDir = $this->config->get('cache-vcs-dir') . '/' . preg_replace('{[^a-z0-9.]}i', '-', $this->url) . '/';
  22458. GitUtil::cleanEnv();
  22459. $fs = new Filesystem();
  22460. $fs->ensureDirectoryExists(dirname($this->repoDir));
  22461. if (!is_writable(dirname($this->repoDir))) {
  22462. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.dirname($this->repoDir).'" directory is not writable by the current user.');
  22463. }
  22464. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $this->url)) {
  22465. throw new \InvalidArgumentException('The source URL '.$this->url.' is invalid, ssh URLs should have a port number after ":".'."\n".'Use ssh://git@example.com:22/path or just git@example.com:path if you do not want to provide a password or custom port.');
  22466. }
  22467. $gitUtil = new GitUtil($this->io, $this->config, $this->process, $fs);
  22468. if (!$gitUtil->syncMirror($this->url, $this->repoDir)) {
  22469. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated</error>');
  22470. }
  22471. $cacheUrl = $this->url;
  22472. }
  22473. $this->getTags();
  22474. $this->getBranches();
  22475. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $cacheUrl));
  22476. }
  22477. public function getRootIdentifier()
  22478. {
  22479. if (null === $this->rootIdentifier) {
  22480. $this->rootIdentifier = 'master';
  22481. $this->process->execute('git branch --no-color', $output, $this->repoDir);
  22482. $branches = $this->process->splitLines($output);
  22483. if (!in_array('* master', $branches)) {
  22484. foreach ($branches as $branch) {
  22485. if ($branch && preg_match('{^\* +(\S+)}', $branch, $match)) {
  22486. $this->rootIdentifier = $match[1];
  22487. break;
  22488. }
  22489. }
  22490. }
  22491. }
  22492. return $this->rootIdentifier;
  22493. }
  22494. public function getUrl()
  22495. {
  22496. return $this->url;
  22497. }
  22498. public function getSource($identifier)
  22499. {
  22500. return array('type' => 'git', 'url' => $this->getUrl(), 'reference' => $identifier);
  22501. }
  22502. public function getDist($identifier)
  22503. {
  22504. return null;
  22505. }
  22506. public function getFileContent($file, $identifier)
  22507. {
  22508. $resource = sprintf('%s:%s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  22509. $this->process->execute(sprintf('git show %s', $resource), $content, $this->repoDir);
  22510. if (!trim($content)) {
  22511. return null;
  22512. }
  22513. return $content;
  22514. }
  22515. public function getChangeDate($identifier)
  22516. {
  22517. $this->process->execute(sprintf(
  22518. 'git log -1 --format=%%at %s',
  22519. ProcessExecutor::escape($identifier)
  22520. ), $output, $this->repoDir);
  22521. return new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  22522. }
  22523. public function getTags()
  22524. {
  22525. if (null === $this->tags) {
  22526. $this->tags = array();
  22527. $this->process->execute('git show-ref --tags --dereference', $output, $this->repoDir);
  22528. foreach ($output = $this->process->splitLines($output) as $tag) {
  22529. if ($tag && preg_match('{^([a-f0-9]{40}) refs/tags/(\S+?)(\^\{\})?$}', $tag, $match)) {
  22530. $this->tags[$match[2]] = $match[1];
  22531. }
  22532. }
  22533. }
  22534. return $this->tags;
  22535. }
  22536. public function getBranches()
  22537. {
  22538. if (null === $this->branches) {
  22539. $branches = array();
  22540. $this->process->execute('git branch --no-color --no-abbrev -v', $output, $this->repoDir);
  22541. foreach ($this->process->splitLines($output) as $branch) {
  22542. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  22543. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+)(?: .*)?$}', $branch, $match)) {
  22544. $branches[$match[1]] = $match[2];
  22545. }
  22546. }
  22547. }
  22548. $this->branches = $branches;
  22549. }
  22550. return $this->branches;
  22551. }
  22552. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22553. {
  22554. if (preg_match('#(^git://|\.git/?$|git(?:olite)?@|//git\.|//github.com/)#i', $url)) {
  22555. return true;
  22556. }
  22557. if (Filesystem::isLocalPath($url)) {
  22558. $url = Filesystem::getPlatformPath($url);
  22559. if (!is_dir($url)) {
  22560. return false;
  22561. }
  22562. $process = new ProcessExecutor($io);
  22563. if ($process->execute('git tag', $output, $url) === 0) {
  22564. return true;
  22565. }
  22566. }
  22567. if (!$deep) {
  22568. return false;
  22569. }
  22570. $process = new ProcessExecutor($io);
  22571. return $process->execute('git ls-remote --heads ' . ProcessExecutor::escape($url), $output) === 0;
  22572. }
  22573. }
  22574. <?php
  22575. namespace Composer\Repository\Vcs;
  22576. use Composer\Config;
  22577. use Composer\Downloader\TransportException;
  22578. use Composer\Json\JsonFile;
  22579. use Composer\Cache;
  22580. use Composer\IO\IOInterface;
  22581. use Composer\Util\GitHub;
  22582. class GitHubDriver extends VcsDriver
  22583. {
  22584. protected $cache;
  22585. protected $owner;
  22586. protected $repository;
  22587. protected $tags;
  22588. protected $branches;
  22589. protected $rootIdentifier;
  22590. protected $repoData;
  22591. protected $hasIssues;
  22592. protected $infoCache = array();
  22593. protected $isPrivate = false;
  22594. protected $gitDriver;
  22595. public function initialize()
  22596. {
  22597. preg_match('#^(?:(?:https?|git)://([^/]+)/|git@([^:]+):)([^/]+)/(.+?)(?:\.git|/)?$#', $this->url, $match);
  22598. $this->owner = $match[3];
  22599. $this->repository = $match[4];
  22600. $this->originUrl = !empty($match[1]) ? $match[1] : $match[2];
  22601. if ($this->originUrl === 'www.github.com') {
  22602. $this->originUrl = 'github.com';
  22603. }
  22604. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
  22605. if (isset($this->repoConfig['no-api']) && $this->repoConfig['no-api']) {
  22606. $this->setupGitDriver($this->url);
  22607. return;
  22608. }
  22609. $this->fetchRootIdentifier();
  22610. }
  22611. public function getRepositoryUrl()
  22612. {
  22613. return 'https://'.$this->originUrl.'/'.$this->owner.'/'.$this->repository;
  22614. }
  22615. public function getRootIdentifier()
  22616. {
  22617. if ($this->gitDriver) {
  22618. return $this->gitDriver->getRootIdentifier();
  22619. }
  22620. return $this->rootIdentifier;
  22621. }
  22622. public function getUrl()
  22623. {
  22624. if ($this->gitDriver) {
  22625. return $this->gitDriver->getUrl();
  22626. }
  22627. return 'https://' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
  22628. }
  22629. protected function getApiUrl()
  22630. {
  22631. if ('github.com' === $this->originUrl) {
  22632. $apiUrl = 'api.github.com';
  22633. } else {
  22634. $apiUrl = $this->originUrl . '/api/v3';
  22635. }
  22636. return 'https://' . $apiUrl;
  22637. }
  22638. public function getSource($identifier)
  22639. {
  22640. if ($this->gitDriver) {
  22641. return $this->gitDriver->getSource($identifier);
  22642. }
  22643. if ($this->isPrivate) {
  22644. $url = $this->generateSshUrl();
  22645. } else {
  22646. $url = $this->getUrl();
  22647. }
  22648. return array('type' => 'git', 'url' => $url, 'reference' => $identifier);
  22649. }
  22650. public function getDist($identifier)
  22651. {
  22652. $url = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/zipball/'.$identifier;
  22653. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  22654. }
  22655. public function getComposerInformation($identifier)
  22656. {
  22657. if ($this->gitDriver) {
  22658. return $this->gitDriver->getComposerInformation($identifier);
  22659. }
  22660. if (!isset($this->infoCache[$identifier])) {
  22661. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  22662. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  22663. }
  22664. $composer = $this->getBaseComposerInformation($identifier);
  22665. if ($composer) {
  22666. if (!isset($composer['support']['source'])) {
  22667. $label = array_search($identifier, $this->getTags()) ?: array_search($identifier, $this->getBranches()) ?: $identifier;
  22668. $composer['support']['source'] = sprintf('https://%s/%s/%s/tree/%s', $this->originUrl, $this->owner, $this->repository, $label);
  22669. }
  22670. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  22671. $composer['support']['issues'] = sprintf('https://%s/%s/%s/issues', $this->originUrl, $this->owner, $this->repository);
  22672. }
  22673. }
  22674. if ($this->shouldCache($identifier)) {
  22675. $this->cache->write($identifier, json_encode($composer));
  22676. }
  22677. $this->infoCache[$identifier] = $composer;
  22678. }
  22679. return $this->infoCache[$identifier];
  22680. }
  22681. public function getFileContent($file, $identifier)
  22682. {
  22683. if ($this->gitDriver) {
  22684. return $this->gitDriver->getFileContent($file, $identifier);
  22685. }
  22686. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/' . $file . '?ref='.urlencode($identifier);
  22687. $resource = JsonFile::parseJson($this->getContents($resource));
  22688. if (empty($resource['content']) || $resource['encoding'] !== 'base64' || !($content = base64_decode($resource['content']))) {
  22689. throw new \RuntimeException('Could not retrieve ' . $file . ' for '.$identifier);
  22690. }
  22691. return $content;
  22692. }
  22693. public function getChangeDate($identifier)
  22694. {
  22695. if ($this->gitDriver) {
  22696. return $this->gitDriver->getChangeDate($identifier);
  22697. }
  22698. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/commits/'.urlencode($identifier);
  22699. $commit = JsonFile::parseJson($this->getContents($resource), $resource);
  22700. return new \DateTime($commit['commit']['committer']['date']);
  22701. }
  22702. public function getTags()
  22703. {
  22704. if ($this->gitDriver) {
  22705. return $this->gitDriver->getTags();
  22706. }
  22707. if (null === $this->tags) {
  22708. $this->tags = array();
  22709. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/tags?per_page=100';
  22710. do {
  22711. $tagsData = JsonFile::parseJson($this->getContents($resource), $resource);
  22712. foreach ($tagsData as $tag) {
  22713. $this->tags[$tag['name']] = $tag['commit']['sha'];
  22714. }
  22715. $resource = $this->getNextPage();
  22716. } while ($resource);
  22717. }
  22718. return $this->tags;
  22719. }
  22720. public function getBranches()
  22721. {
  22722. if ($this->gitDriver) {
  22723. return $this->gitDriver->getBranches();
  22724. }
  22725. if (null === $this->branches) {
  22726. $this->branches = array();
  22727. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/git/refs/heads?per_page=100';
  22728. $branchBlacklist = array('gh-pages');
  22729. do {
  22730. $branchData = JsonFile::parseJson($this->getContents($resource), $resource);
  22731. foreach ($branchData as $branch) {
  22732. $name = substr($branch['ref'], 11);
  22733. if (!in_array($name, $branchBlacklist)) {
  22734. $this->branches[$name] = $branch['object']['sha'];
  22735. }
  22736. }
  22737. $resource = $this->getNextPage();
  22738. } while ($resource);
  22739. }
  22740. return $this->branches;
  22741. }
  22742. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22743. {
  22744. if (!preg_match('#^((?:https?|git)://([^/]+)/|git@([^:]+):)([^/]+)/(.+?)(?:\.git|/)?$#', $url, $matches)) {
  22745. return false;
  22746. }
  22747. $originUrl = !empty($matches[2]) ? $matches[2] : $matches[3];
  22748. if (!in_array(preg_replace('{^www\.}i', '', $originUrl), $config->get('github-domains'))) {
  22749. return false;
  22750. }
  22751. if (!extension_loaded('openssl')) {
  22752. $io->writeError('Skipping GitHub driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  22753. return false;
  22754. }
  22755. return true;
  22756. }
  22757. public function getRepoData()
  22758. {
  22759. $this->fetchRootIdentifier();
  22760. return $this->repoData;
  22761. }
  22762. protected function generateSshUrl()
  22763. {
  22764. return 'git@' . $this->originUrl . ':'.$this->owner.'/'.$this->repository.'.git';
  22765. }
  22766. protected function getContents($url, $fetchingRepoData = false)
  22767. {
  22768. try {
  22769. return parent::getContents($url);
  22770. } catch (TransportException $e) {
  22771. $gitHubUtil = new GitHub($this->io, $this->config, $this->process, $this->remoteFilesystem);
  22772. switch ($e->getCode()) {
  22773. case 401:
  22774. case 404:
  22775. if (!$fetchingRepoData) {
  22776. throw $e;
  22777. }
  22778. if ($gitHubUtil->authorizeOAuth($this->originUrl)) {
  22779. return parent::getContents($url);
  22780. }
  22781. if (!$this->io->isInteractive()) {
  22782. return $this->attemptCloneFallback();
  22783. }
  22784. $scopesIssued = array();
  22785. $scopesNeeded = array();
  22786. if ($headers = $e->getHeaders()) {
  22787. if ($scopes = $this->remoteFilesystem->findHeaderValue($headers, 'X-OAuth-Scopes')) {
  22788. $scopesIssued = explode(' ', $scopes);
  22789. }
  22790. if ($scopes = $this->remoteFilesystem->findHeaderValue($headers, 'X-Accepted-OAuth-Scopes')) {
  22791. $scopesNeeded = explode(' ', $scopes);
  22792. }
  22793. }
  22794. $scopesFailed = array_diff($scopesNeeded, $scopesIssued);
  22795. if (!$headers || !count($scopesNeeded) || count($scopesFailed)) {
  22796. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'Your GitHub credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  22797. }
  22798. return parent::getContents($url);
  22799. case 403:
  22800. if (!$this->io->hasAuthentication($this->originUrl) && $gitHubUtil->authorizeOAuth($this->originUrl)) {
  22801. return parent::getContents($url);
  22802. }
  22803. if (!$this->io->isInteractive() && $fetchingRepoData) {
  22804. return $this->attemptCloneFallback();
  22805. }
  22806. $rateLimited = $gitHubUtil->isRateLimited($e->getHeaders());
  22807. if (!$this->io->hasAuthentication($this->originUrl)) {
  22808. if (!$this->io->isInteractive()) {
  22809. $this->io->writeError('<error>GitHub API limit exhausted. Failed to get metadata for the '.$this->url.' repository, try running in interactive mode so that you can enter your GitHub credentials to increase the API limit</error>');
  22810. throw $e;
  22811. }
  22812. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'API limit exhausted. Enter your GitHub credentials to get a larger API limit (<info>'.$this->url.'</info>)');
  22813. return parent::getContents($url);
  22814. }
  22815. if ($rateLimited) {
  22816. $rateLimit = $gitHubUtil->getRateLimit($e->getHeaders());
  22817. $this->io->writeError(sprintf(
  22818. '<error>GitHub API limit (%d calls/hr) is exhausted. You are already authorized so you have to wait until %s before doing more requests</error>',
  22819. $rateLimit['limit'],
  22820. $rateLimit['reset']
  22821. ));
  22822. }
  22823. throw $e;
  22824. default:
  22825. throw $e;
  22826. }
  22827. }
  22828. }
  22829. protected function fetchRootIdentifier()
  22830. {
  22831. if ($this->repoData) {
  22832. return;
  22833. }
  22834. $repoDataUrl = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository;
  22835. $this->repoData = JsonFile::parseJson($this->getContents($repoDataUrl, true), $repoDataUrl);
  22836. if (null === $this->repoData && null !== $this->gitDriver) {
  22837. return;
  22838. }
  22839. $this->owner = $this->repoData['owner']['login'];
  22840. $this->repository = $this->repoData['name'];
  22841. $this->isPrivate = !empty($this->repoData['private']);
  22842. if (isset($this->repoData['default_branch'])) {
  22843. $this->rootIdentifier = $this->repoData['default_branch'];
  22844. } elseif (isset($this->repoData['master_branch'])) {
  22845. $this->rootIdentifier = $this->repoData['master_branch'];
  22846. } else {
  22847. $this->rootIdentifier = 'master';
  22848. }
  22849. $this->hasIssues = !empty($this->repoData['has_issues']);
  22850. }
  22851. protected function attemptCloneFallback()
  22852. {
  22853. $this->isPrivate = true;
  22854. try {
  22855. $this->setupGitDriver($this->generateSshUrl());
  22856. return;
  22857. } catch (\RuntimeException $e) {
  22858. $this->gitDriver = null;
  22859. $this->io->writeError('<error>Failed to clone the '.$this->generateSshUrl().' repository, try running in interactive mode so that you can enter your GitHub credentials</error>');
  22860. throw $e;
  22861. }
  22862. }
  22863. protected function setupGitDriver($url)
  22864. {
  22865. $this->gitDriver = new GitDriver(
  22866. array('url' => $url),
  22867. $this->io,
  22868. $this->config,
  22869. $this->process,
  22870. $this->remoteFilesystem
  22871. );
  22872. $this->gitDriver->initialize();
  22873. }
  22874. protected function getNextPage()
  22875. {
  22876. $headers = $this->remoteFilesystem->getLastHeaders();
  22877. foreach ($headers as $header) {
  22878. if (preg_match('{^link:\s*(.+?)\s*$}i', $header, $match)) {
  22879. $links = explode(',', $match[1]);
  22880. foreach ($links as $link) {
  22881. if (preg_match('{<(.+?)>; *rel="next"}', $link, $match)) {
  22882. return $match[1];
  22883. }
  22884. }
  22885. }
  22886. }
  22887. }
  22888. }
  22889. <?php
  22890. namespace Composer\Repository\Vcs;
  22891. use Composer\Config;
  22892. use Composer\Cache;
  22893. use Composer\IO\IOInterface;
  22894. use Composer\Json\JsonFile;
  22895. use Composer\Downloader\TransportException;
  22896. use Composer\Util\RemoteFilesystem;
  22897. use Composer\Util\GitLab;
  22898. class GitLabDriver extends VcsDriver
  22899. {
  22900. private $scheme;
  22901. private $namespace;
  22902. private $repository;
  22903. private $project;
  22904. private $commits = array();
  22905. private $tags;
  22906. private $branches;
  22907. protected $gitDriver;
  22908. private $isPrivate = true;
  22909. protected $portNumber;
  22910. const URL_REGEX = '#^(?:(?P<scheme>https?)://(?P<domain>.+?)(?::(?P<port>[0-9]+))?/|git@(?P<domain2>[^:]+):)(?P<parts>.+)/(?P<repo>[^/]+?)(?:\.git|/)?$#';
  22911. public function initialize()
  22912. {
  22913. if (!preg_match(self::URL_REGEX, $this->url, $match)) {
  22914. throw new \InvalidArgumentException('The URL provided is invalid. It must be the HTTP URL of a GitLab project.');
  22915. }
  22916. $guessedDomain = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  22917. $configuredDomains = $this->config->get('gitlab-domains');
  22918. $urlParts = explode('/', $match['parts']);
  22919. $this->scheme = !empty($match['scheme'])
  22920. ? $match['scheme']
  22921. : (isset($this->repoConfig['secure-http']) && $this->repoConfig['secure-http'] === false ? 'http' : 'https')
  22922. ;
  22923. $this->originUrl = $this->determineOrigin($configuredDomains, $guessedDomain, $urlParts);
  22924. if (!empty($match['port']) && true === is_numeric($match['port'])) {
  22925. $this->portNumber = (int) $match['port'];
  22926. }
  22927. $this->namespace = implode('/', $urlParts);
  22928. $this->repository = preg_replace('#(\.git)$#', '', $match['repo']);
  22929. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->namespace.'/'.$this->repository);
  22930. $this->fetchProject();
  22931. }
  22932. public function setRemoteFilesystem(RemoteFilesystem $remoteFilesystem)
  22933. {
  22934. $this->remoteFilesystem = $remoteFilesystem;
  22935. }
  22936. public function getFileContent($file, $identifier)
  22937. {
  22938. if ($this->gitDriver) {
  22939. return $this->gitDriver->getFileContent($file, $identifier);
  22940. }
  22941. if (!preg_match('{[a-f0-9]{40}}i', $identifier)) {
  22942. $branches = $this->getBranches();
  22943. if (isset($branches[$identifier])) {
  22944. $identifier = $branches[$identifier];
  22945. }
  22946. }
  22947. $resource = $this->getApiUrl().'/repository/files/'.$this->urlEncodeAll($file).'/raw?ref='.$identifier;
  22948. try {
  22949. $content = $this->getContents($resource);
  22950. } catch (TransportException $e) {
  22951. if ($e->getCode() !== 404) {
  22952. throw $e;
  22953. }
  22954. return null;
  22955. }
  22956. return $content;
  22957. }
  22958. public function getChangeDate($identifier)
  22959. {
  22960. if ($this->gitDriver) {
  22961. return $this->gitDriver->getChangeDate($identifier);
  22962. }
  22963. if (isset($this->commits[$identifier])) {
  22964. return new \DateTime($this->commits[$identifier]['committed_date']);
  22965. }
  22966. return new \DateTime();
  22967. }
  22968. public function getRepositoryUrl()
  22969. {
  22970. return $this->isPrivate ? $this->project['ssh_url_to_repo'] : $this->project['http_url_to_repo'];
  22971. }
  22972. public function getUrl()
  22973. {
  22974. if ($this->gitDriver) {
  22975. return $this->gitDriver->getUrl();
  22976. }
  22977. return $this->project['web_url'];
  22978. }
  22979. public function getDist($identifier)
  22980. {
  22981. $url = $this->getApiUrl().'/repository/archive.zip?sha='.$identifier;
  22982. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  22983. }
  22984. public function getSource($identifier)
  22985. {
  22986. if ($this->gitDriver) {
  22987. return $this->gitDriver->getSource($identifier);
  22988. }
  22989. return array('type' => 'git', 'url' => $this->getRepositoryUrl(), 'reference' => $identifier);
  22990. }
  22991. public function getRootIdentifier()
  22992. {
  22993. if ($this->gitDriver) {
  22994. return $this->gitDriver->getRootIdentifier();
  22995. }
  22996. return $this->project['default_branch'];
  22997. }
  22998. public function getBranches()
  22999. {
  23000. if ($this->gitDriver) {
  23001. return $this->gitDriver->getBranches();
  23002. }
  23003. if (!$this->branches) {
  23004. $this->branches = $this->getReferences('branches');
  23005. }
  23006. return $this->branches;
  23007. }
  23008. public function getTags()
  23009. {
  23010. if ($this->gitDriver) {
  23011. return $this->gitDriver->getTags();
  23012. }
  23013. if (!$this->tags) {
  23014. $this->tags = $this->getReferences('tags');
  23015. }
  23016. return $this->tags;
  23017. }
  23018. public function getApiUrl()
  23019. {
  23020. $domainName = $this->originUrl;
  23021. $portNumber = (true === is_numeric($this->portNumber)) ? sprintf(':%s', $this->portNumber) : '';
  23022. return $this->scheme.'://'.$domainName.$portNumber.'/api/v4/projects/'.$this->urlEncodeAll($this->namespace).'%2F'.$this->urlEncodeAll($this->repository);
  23023. }
  23024. private function urlEncodeAll($string)
  23025. {
  23026. $encoded = '';
  23027. for ($i = 0; isset($string[$i]); $i++) {
  23028. $character = $string[$i];
  23029. if (!ctype_alnum($character) && !in_array($character, array('-', '_'), true)) {
  23030. $character = '%' . sprintf('%02X', ord($character));
  23031. }
  23032. $encoded .= $character;
  23033. }
  23034. return $encoded;
  23035. }
  23036. protected function getReferences($type)
  23037. {
  23038. $perPage = 100;
  23039. $resource = $this->getApiUrl().'/repository/'.$type.'?per_page='.$perPage;
  23040. $references = array();
  23041. do {
  23042. $data = JsonFile::parseJson($this->getContents($resource), $resource);
  23043. foreach ($data as $datum) {
  23044. $references[$datum['name']] = $datum['commit']['id'];
  23045. $this->commits[$datum['commit']['id']] = $datum['commit'];
  23046. }
  23047. if (count($data) >= $perPage) {
  23048. $resource = $this->getNextPage();
  23049. } else {
  23050. $resource = false;
  23051. }
  23052. } while ($resource);
  23053. return $references;
  23054. }
  23055. protected function fetchProject()
  23056. {
  23057. $resource = $this->getApiUrl();
  23058. $this->project = JsonFile::parseJson($this->getContents($resource, true), $resource);
  23059. if (isset($this->project['visibility'])) {
  23060. $this->isPrivate = $this->project['visibility'] !== 'public';
  23061. } else {
  23062. $this->isPrivate = false;
  23063. }
  23064. }
  23065. protected function attemptCloneFallback()
  23066. {
  23067. try {
  23068. if ($this->isPrivate === false) {
  23069. $url = $this->generatePublicUrl();
  23070. } else {
  23071. $url = $this->generateSshUrl();
  23072. }
  23073. $this->setupGitDriver($url);
  23074. return;
  23075. } catch (\RuntimeException $e) {
  23076. $this->gitDriver = null;
  23077. $this->io->writeError('<error>Failed to clone the '.$url.' repository, try running in interactive mode so that you can enter your credentials</error>');
  23078. throw $e;
  23079. }
  23080. }
  23081. protected function generateSshUrl()
  23082. {
  23083. return 'git@' . $this->originUrl . ':'.$this->namespace.'/'.$this->repository.'.git';
  23084. }
  23085. protected function generatePublicUrl()
  23086. {
  23087. return $this->scheme . '://' . $this->originUrl . '/'.$this->namespace.'/'.$this->repository.'.git';
  23088. }
  23089. protected function setupGitDriver($url)
  23090. {
  23091. $this->gitDriver = new GitDriver(
  23092. array('url' => $url),
  23093. $this->io,
  23094. $this->config,
  23095. $this->process,
  23096. $this->remoteFilesystem
  23097. );
  23098. $this->gitDriver->initialize();
  23099. }
  23100. protected function getContents($url, $fetchingRepoData = false)
  23101. {
  23102. try {
  23103. $res = parent::getContents($url);
  23104. if ($fetchingRepoData) {
  23105. $json = JsonFile::parseJson($res, $url);
  23106. if (!isset($json['default_branch'])) {
  23107. if (!empty($json['id'])) {
  23108. $this->isPrivate = false;
  23109. }
  23110. throw new TransportException('GitLab API seems to not be authenticated as it did not return a default_branch', 401);
  23111. }
  23112. }
  23113. return $res;
  23114. } catch (TransportException $e) {
  23115. $gitLabUtil = new GitLab($this->io, $this->config, $this->process, $this->remoteFilesystem);
  23116. switch ($e->getCode()) {
  23117. case 401:
  23118. case 404:
  23119. if (!$fetchingRepoData) {
  23120. throw $e;
  23121. }
  23122. if ($gitLabUtil->authorizeOAuth($this->originUrl)) {
  23123. return parent::getContents($url);
  23124. }
  23125. if (!$this->io->isInteractive()) {
  23126. return $this->attemptCloneFallback();
  23127. }
  23128. $this->io->writeError('<warning>Failed to download ' . $this->namespace . '/' . $this->repository . ':' . $e->getMessage() . '</warning>');
  23129. $gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, 'Your credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  23130. return parent::getContents($url);
  23131. case 403:
  23132. if (!$this->io->hasAuthentication($this->originUrl) && $gitLabUtil->authorizeOAuth($this->originUrl)) {
  23133. return parent::getContents($url);
  23134. }
  23135. if (!$this->io->isInteractive() && $fetchingRepoData) {
  23136. return $this->attemptCloneFallback();
  23137. }
  23138. throw $e;
  23139. default:
  23140. throw $e;
  23141. }
  23142. }
  23143. }
  23144. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23145. {
  23146. if (!preg_match(self::URL_REGEX, $url, $match)) {
  23147. return false;
  23148. }
  23149. $scheme = !empty($match['scheme']) ? $match['scheme'] : null;
  23150. $guessedDomain = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  23151. $urlParts = explode('/', $match['parts']);
  23152. if (false === self::determineOrigin((array) $config->get('gitlab-domains'), $guessedDomain, $urlParts)) {
  23153. return false;
  23154. }
  23155. if ('https' === $scheme && !extension_loaded('openssl')) {
  23156. $io->writeError('Skipping GitLab driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  23157. return false;
  23158. }
  23159. return true;
  23160. }
  23161. private function getNextPage()
  23162. {
  23163. $headers = $this->remoteFilesystem->getLastHeaders();
  23164. foreach ($headers as $header) {
  23165. if (preg_match('{^link:\s*(.+?)\s*$}i', $header, $match)) {
  23166. $links = explode(',', $match[1]);
  23167. foreach ($links as $link) {
  23168. if (preg_match('{<(.+?)>; *rel="next"}', $link, $match)) {
  23169. return $match[1];
  23170. }
  23171. }
  23172. }
  23173. }
  23174. }
  23175. private static function determineOrigin(array $configuredDomains, $guessedDomain, array &$urlParts)
  23176. {
  23177. if (in_array($guessedDomain, $configuredDomains)) {
  23178. return $guessedDomain;
  23179. }
  23180. while (null !== ($part = array_shift($urlParts))) {
  23181. $guessedDomain .= '/' . $part;
  23182. if (in_array($guessedDomain, $configuredDomains)) {
  23183. return $guessedDomain;
  23184. }
  23185. }
  23186. return false;
  23187. }
  23188. }
  23189. <?php
  23190. namespace Composer\Repository\Vcs;
  23191. use Composer\Config;
  23192. use Composer\IO\IOInterface;
  23193. class HgBitbucketDriver extends BitbucketDriver
  23194. {
  23195. public function getRootIdentifier()
  23196. {
  23197. if ($this->fallbackDriver) {
  23198. return $this->fallbackDriver->getRootIdentifier();
  23199. }
  23200. if (null === $this->rootIdentifier) {
  23201. if (! $this->getRepoData()) {
  23202. return $this->fallbackDriver->getRootIdentifier();
  23203. }
  23204. if ($this->vcsType !== 'hg') {
  23205. throw new \RuntimeException(
  23206. $this->url.' does not appear to be a mercurial repository, use '.
  23207. $this->cloneHttpsUrl.' if this is a git bitbucket repository'
  23208. );
  23209. }
  23210. $mainBranchData = $this->getMainBranchData();
  23211. $this->rootIdentifier = !empty($mainBranchData['name']) ? $mainBranchData['name'] : 'default';
  23212. }
  23213. return $this->rootIdentifier;
  23214. }
  23215. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23216. {
  23217. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+)/?$#', $url)) {
  23218. return false;
  23219. }
  23220. if (!extension_loaded('openssl')) {
  23221. $io->writeError('Skipping Bitbucket hg driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  23222. return false;
  23223. }
  23224. return true;
  23225. }
  23226. protected function setupFallbackDriver($url)
  23227. {
  23228. $this->fallbackDriver = new HgDriver(
  23229. array('url' => $url),
  23230. $this->io,
  23231. $this->config,
  23232. $this->process,
  23233. $this->remoteFilesystem
  23234. );
  23235. $this->fallbackDriver->initialize();
  23236. }
  23237. protected function generateSshUrl()
  23238. {
  23239. return 'ssh://hg@' . $this->originUrl . '/' . $this->owner.'/'.$this->repository;
  23240. }
  23241. }
  23242. <?php
  23243. namespace Composer\Repository\Vcs;
  23244. use Composer\Config;
  23245. use Composer\Util\Hg as HgUtils;
  23246. use Composer\Util\ProcessExecutor;
  23247. use Composer\Util\Filesystem;
  23248. use Composer\IO\IOInterface;
  23249. class HgDriver extends VcsDriver
  23250. {
  23251. protected $tags;
  23252. protected $branches;
  23253. protected $rootIdentifier;
  23254. protected $repoDir;
  23255. protected $infoCache = array();
  23256. public function initialize()
  23257. {
  23258. if (Filesystem::isLocalPath($this->url)) {
  23259. $this->repoDir = $this->url;
  23260. } else {
  23261. $cacheDir = $this->config->get('cache-vcs-dir');
  23262. $this->repoDir = $cacheDir . '/' . preg_replace('{[^a-z0-9]}i', '-', $this->url) . '/';
  23263. $fs = new Filesystem();
  23264. $fs->ensureDirectoryExists($cacheDir);
  23265. if (!is_writable(dirname($this->repoDir))) {
  23266. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$cacheDir.'" directory is not writable by the current user.');
  23267. }
  23268. $this->config->prohibitUrlByConfig($this->url, $this->io);
  23269. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  23270. if (is_dir($this->repoDir) && 0 === $this->process->execute('hg summary', $output, $this->repoDir)) {
  23271. if (0 !== $this->process->execute('hg pull', $output, $this->repoDir)) {
  23272. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  23273. }
  23274. } else {
  23275. $fs->removeDirectory($this->repoDir);
  23276. $command = function ($url) {
  23277. return sprintf('hg clone --noupdate %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($this->repoDir));
  23278. };
  23279. $hgUtils->runCommand($command, $this->url, $this->repoDir);
  23280. }
  23281. }
  23282. $this->getTags();
  23283. $this->getBranches();
  23284. }
  23285. public function getRootIdentifier()
  23286. {
  23287. if (null === $this->rootIdentifier) {
  23288. $this->process->execute(sprintf('hg tip --template "{node}"'), $output, $this->repoDir);
  23289. $output = $this->process->splitLines($output);
  23290. $this->rootIdentifier = $output[0];
  23291. }
  23292. return $this->rootIdentifier;
  23293. }
  23294. public function getUrl()
  23295. {
  23296. return $this->url;
  23297. }
  23298. public function getSource($identifier)
  23299. {
  23300. return array('type' => 'hg', 'url' => $this->getUrl(), 'reference' => $identifier);
  23301. }
  23302. public function getDist($identifier)
  23303. {
  23304. return null;
  23305. }
  23306. public function getFileContent($file, $identifier)
  23307. {
  23308. $resource = sprintf('hg cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  23309. $this->process->execute($resource, $content, $this->repoDir);
  23310. if (!trim($content)) {
  23311. return;
  23312. }
  23313. return $content;
  23314. }
  23315. public function getChangeDate($identifier)
  23316. {
  23317. $this->process->execute(
  23318. sprintf(
  23319. 'hg log --template "{date|rfc3339date}" -r %s',
  23320. ProcessExecutor::escape($identifier)
  23321. ),
  23322. $output,
  23323. $this->repoDir
  23324. );
  23325. return new \DateTime(trim($output), new \DateTimeZone('UTC'));
  23326. }
  23327. public function getTags()
  23328. {
  23329. if (null === $this->tags) {
  23330. $tags = array();
  23331. $this->process->execute('hg tags', $output, $this->repoDir);
  23332. foreach ($this->process->splitLines($output) as $tag) {
  23333. if ($tag && preg_match('(^([^\s]+)\s+\d+:(.*)$)', $tag, $match)) {
  23334. $tags[$match[1]] = $match[2];
  23335. }
  23336. }
  23337. unset($tags['tip']);
  23338. $this->tags = $tags;
  23339. }
  23340. return $this->tags;
  23341. }
  23342. public function getBranches()
  23343. {
  23344. if (null === $this->branches) {
  23345. $branches = array();
  23346. $bookmarks = array();
  23347. $this->process->execute('hg branches', $output, $this->repoDir);
  23348. foreach ($this->process->splitLines($output) as $branch) {
  23349. if ($branch && preg_match('(^([^\s]+)\s+\d+:([a-f0-9]+))', $branch, $match)) {
  23350. $branches[$match[1]] = $match[2];
  23351. }
  23352. }
  23353. $this->process->execute('hg bookmarks', $output, $this->repoDir);
  23354. foreach ($this->process->splitLines($output) as $branch) {
  23355. if ($branch && preg_match('(^(?:[\s*]*)([^\s]+)\s+\d+:(.*)$)', $branch, $match)) {
  23356. $bookmarks[$match[1]] = $match[2];
  23357. }
  23358. }
  23359. $this->branches = array_merge($bookmarks, $branches);
  23360. }
  23361. return $this->branches;
  23362. }
  23363. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23364. {
  23365. if (preg_match('#(^(?:https?|ssh)://(?:[^@]+@)?bitbucket.org|https://(?:.*?)\.kilnhg.com)#i', $url)) {
  23366. return true;
  23367. }
  23368. if (Filesystem::isLocalPath($url)) {
  23369. $url = Filesystem::getPlatformPath($url);
  23370. if (!is_dir($url)) {
  23371. return false;
  23372. }
  23373. $process = new ProcessExecutor($io);
  23374. if ($process->execute('hg summary', $output, $url) === 0) {
  23375. return true;
  23376. }
  23377. }
  23378. if (!$deep) {
  23379. return false;
  23380. }
  23381. $processExecutor = new ProcessExecutor($io);
  23382. $exit = $processExecutor->execute(sprintf('hg identify %s', ProcessExecutor::escape($url)), $ignored);
  23383. return $exit === 0;
  23384. }
  23385. }
  23386. <?php
  23387. namespace Composer\Repository\Vcs;
  23388. use Composer\Config;
  23389. use Composer\IO\IOInterface;
  23390. use Composer\Util\ProcessExecutor;
  23391. use Composer\Util\Perforce;
  23392. class PerforceDriver extends VcsDriver
  23393. {
  23394. protected $depot;
  23395. protected $branch;
  23396. protected $perforce;
  23397. public function initialize()
  23398. {
  23399. $this->depot = $this->repoConfig['depot'];
  23400. $this->branch = '';
  23401. if (!empty($this->repoConfig['branch'])) {
  23402. $this->branch = $this->repoConfig['branch'];
  23403. }
  23404. $this->initPerforce($this->repoConfig);
  23405. $this->perforce->p4Login();
  23406. $this->perforce->checkStream();
  23407. $this->perforce->writeP4ClientSpec();
  23408. $this->perforce->connectClient();
  23409. return true;
  23410. }
  23411. private function initPerforce($repoConfig)
  23412. {
  23413. if (!empty($this->perforce)) {
  23414. return;
  23415. }
  23416. $repoDir = $this->config->get('cache-vcs-dir') . '/' . $this->depot;
  23417. $this->perforce = Perforce::create($repoConfig, $this->getUrl(), $repoDir, $this->process, $this->io);
  23418. }
  23419. public function getFileContent($file, $identifier)
  23420. {
  23421. return $this->perforce->getFileContent($file, $identifier);
  23422. }
  23423. public function getChangeDate($identifier)
  23424. {
  23425. return null;
  23426. }
  23427. public function getRootIdentifier()
  23428. {
  23429. return $this->branch;
  23430. }
  23431. public function getBranches()
  23432. {
  23433. return $this->perforce->getBranches();
  23434. }
  23435. public function getTags()
  23436. {
  23437. return $this->perforce->getTags();
  23438. }
  23439. public function getDist($identifier)
  23440. {
  23441. return null;
  23442. }
  23443. public function getSource($identifier)
  23444. {
  23445. $source = array(
  23446. 'type' => 'perforce',
  23447. 'url' => $this->repoConfig['url'],
  23448. 'reference' => $identifier,
  23449. 'p4user' => $this->perforce->getUser(),
  23450. );
  23451. return $source;
  23452. }
  23453. public function getUrl()
  23454. {
  23455. return $this->url;
  23456. }
  23457. public function hasComposerFile($identifier)
  23458. {
  23459. $composerInfo = $this->perforce->getComposerInformation('//' . $this->depot . '/' . $identifier);
  23460. $composerInfoIdentifier = $identifier;
  23461. return !empty($composerInfo);
  23462. }
  23463. public function getContents($url)
  23464. {
  23465. return false;
  23466. }
  23467. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23468. {
  23469. if ($deep || preg_match('#\b(perforce|p4)\b#i', $url)) {
  23470. return Perforce::checkServerExists($url, new ProcessExecutor($io));
  23471. }
  23472. return false;
  23473. }
  23474. public function cleanup()
  23475. {
  23476. $this->perforce->cleanupClientSpec();
  23477. $this->perforce = null;
  23478. }
  23479. public function getDepot()
  23480. {
  23481. return $this->depot;
  23482. }
  23483. public function getBranch()
  23484. {
  23485. return $this->branch;
  23486. }
  23487. }
  23488. <?php
  23489. namespace Composer\Repository\Vcs;
  23490. use Composer\Cache;
  23491. use Composer\Config;
  23492. use Composer\Json\JsonFile;
  23493. use Composer\Util\ProcessExecutor;
  23494. use Composer\Util\Filesystem;
  23495. use Composer\Util\Svn as SvnUtil;
  23496. use Composer\IO\IOInterface;
  23497. use Composer\Downloader\TransportException;
  23498. class SvnDriver extends VcsDriver
  23499. {
  23500. protected $cache;
  23501. protected $baseUrl;
  23502. protected $tags;
  23503. protected $branches;
  23504. protected $rootIdentifier;
  23505. protected $infoCache = array();
  23506. protected $trunkPath = 'trunk';
  23507. protected $branchesPath = 'branches';
  23508. protected $tagsPath = 'tags';
  23509. protected $packagePath = '';
  23510. protected $cacheCredentials = true;
  23511. private $util;
  23512. public function initialize()
  23513. {
  23514. $this->url = $this->baseUrl = rtrim(self::normalizeUrl($this->url), '/');
  23515. SvnUtil::cleanEnv();
  23516. if (isset($this->repoConfig['trunk-path'])) {
  23517. $this->trunkPath = $this->repoConfig['trunk-path'];
  23518. }
  23519. if (isset($this->repoConfig['branches-path'])) {
  23520. $this->branchesPath = $this->repoConfig['branches-path'];
  23521. }
  23522. if (isset($this->repoConfig['tags-path'])) {
  23523. $this->tagsPath = $this->repoConfig['tags-path'];
  23524. }
  23525. if (array_key_exists('svn-cache-credentials', $this->repoConfig)) {
  23526. $this->cacheCredentials = (bool) $this->repoConfig['svn-cache-credentials'];
  23527. }
  23528. if (isset($this->repoConfig['package-path'])) {
  23529. $this->packagePath = '/' . trim($this->repoConfig['package-path'], '/');
  23530. }
  23531. if (false !== ($pos = strrpos($this->url, '/' . $this->trunkPath))) {
  23532. $this->baseUrl = substr($this->url, 0, $pos);
  23533. }
  23534. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->baseUrl));
  23535. $this->getBranches();
  23536. $this->getTags();
  23537. }
  23538. public function getRootIdentifier()
  23539. {
  23540. return $this->rootIdentifier ?: $this->trunkPath;
  23541. }
  23542. public function getUrl()
  23543. {
  23544. return $this->url;
  23545. }
  23546. public function getSource($identifier)
  23547. {
  23548. return array('type' => 'svn', 'url' => $this->baseUrl, 'reference' => $identifier);
  23549. }
  23550. public function getDist($identifier)
  23551. {
  23552. return null;
  23553. }
  23554. protected function shouldCache($identifier)
  23555. {
  23556. return $this->cache && preg_match('{@\d+$}', $identifier);
  23557. }
  23558. public function getComposerInformation($identifier)
  23559. {
  23560. if (!isset($this->infoCache[$identifier])) {
  23561. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier.'.json')) {
  23562. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  23563. }
  23564. try {
  23565. $composer = $this->getBaseComposerInformation($identifier);
  23566. } catch (TransportException $e) {
  23567. $message = $e->getMessage();
  23568. if (stripos($message, 'path not found') === false && stripos($message, 'svn: warning: W160013') === false) {
  23569. throw $e;
  23570. }
  23571. $composer = '';
  23572. }
  23573. if ($this->shouldCache($identifier)) {
  23574. $this->cache->write($identifier.'.json', json_encode($composer));
  23575. }
  23576. $this->infoCache[$identifier] = $composer;
  23577. }
  23578. return $this->infoCache[$identifier];
  23579. }
  23580. public function getFileContent($file, $identifier)
  23581. {
  23582. $identifier = '/' . trim($identifier, '/') . '/';
  23583. preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  23584. if (!empty($match[2])) {
  23585. $path = $match[1];
  23586. $rev = $match[2];
  23587. } else {
  23588. $path = $identifier;
  23589. $rev = '';
  23590. }
  23591. try {
  23592. $resource = $path.$file;
  23593. $output = $this->execute('svn cat', $this->baseUrl . $resource . $rev);
  23594. if (!trim($output)) {
  23595. return null;
  23596. }
  23597. } catch (\RuntimeException $e) {
  23598. throw new TransportException($e->getMessage());
  23599. }
  23600. return $output;
  23601. }
  23602. public function getChangeDate($identifier)
  23603. {
  23604. $identifier = '/' . trim($identifier, '/') . '/';
  23605. preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  23606. if (!empty($match[2])) {
  23607. $path = $match[1];
  23608. $rev = $match[2];
  23609. } else {
  23610. $path = $identifier;
  23611. $rev = '';
  23612. }
  23613. $output = $this->execute('svn info', $this->baseUrl . $path . $rev);
  23614. foreach ($this->process->splitLines($output) as $line) {
  23615. if ($line && preg_match('{^Last Changed Date: ([^(]+)}', $line, $match)) {
  23616. return new \DateTime($match[1], new \DateTimeZone('UTC'));
  23617. }
  23618. }
  23619. return null;
  23620. }
  23621. public function getTags()
  23622. {
  23623. if (null === $this->tags) {
  23624. $this->tags = array();
  23625. if ($this->tagsPath !== false) {
  23626. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->tagsPath);
  23627. if ($output) {
  23628. foreach ($this->process->splitLines($output) as $line) {
  23629. $line = trim($line);
  23630. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  23631. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  23632. $this->tags[rtrim($match[2], '/')] = $this->buildIdentifier(
  23633. '/' . $this->tagsPath . '/' . $match[2],
  23634. $match[1]
  23635. );
  23636. }
  23637. }
  23638. }
  23639. }
  23640. }
  23641. }
  23642. return $this->tags;
  23643. }
  23644. public function getBranches()
  23645. {
  23646. if (null === $this->branches) {
  23647. $this->branches = array();
  23648. if (false === $this->trunkPath) {
  23649. $trunkParent = $this->baseUrl . '/';
  23650. } else {
  23651. $trunkParent = $this->baseUrl . '/' . $this->trunkPath;
  23652. }
  23653. $output = $this->execute('svn ls --verbose', $trunkParent);
  23654. if ($output) {
  23655. foreach ($this->process->splitLines($output) as $line) {
  23656. $line = trim($line);
  23657. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  23658. if (isset($match[1]) && isset($match[2]) && $match[2] === './') {
  23659. $this->branches['trunk'] = $this->buildIdentifier(
  23660. '/' . $this->trunkPath,
  23661. $match[1]
  23662. );
  23663. $this->rootIdentifier = $this->branches['trunk'];
  23664. break;
  23665. }
  23666. }
  23667. }
  23668. }
  23669. unset($output);
  23670. if ($this->branchesPath !== false) {
  23671. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->branchesPath);
  23672. if ($output) {
  23673. foreach ($this->process->splitLines(trim($output)) as $line) {
  23674. $line = trim($line);
  23675. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  23676. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  23677. $this->branches[rtrim($match[2], '/')] = $this->buildIdentifier(
  23678. '/' . $this->branchesPath . '/' . $match[2],
  23679. $match[1]
  23680. );
  23681. }
  23682. }
  23683. }
  23684. }
  23685. }
  23686. }
  23687. return $this->branches;
  23688. }
  23689. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23690. {
  23691. $url = self::normalizeUrl($url);
  23692. if (preg_match('#(^svn://|^svn\+ssh://|svn\.)#i', $url)) {
  23693. return true;
  23694. }
  23695. if (!$deep && !Filesystem::isLocalPath($url)) {
  23696. return false;
  23697. }
  23698. $processExecutor = new ProcessExecutor($io);
  23699. $exit = $processExecutor->execute(
  23700. "svn info --non-interactive ".ProcessExecutor::escape($url),
  23701. $ignoredOutput
  23702. );
  23703. if ($exit === 0) {
  23704. return true;
  23705. }
  23706. if (false !== stripos($processExecutor->getErrorOutput(), 'authorization failed:')) {
  23707. return true;
  23708. }
  23709. if (false !== stripos($processExecutor->getErrorOutput(), 'Authentication failed')) {
  23710. return true;
  23711. }
  23712. return false;
  23713. }
  23714. protected static function normalizeUrl($url)
  23715. {
  23716. $fs = new Filesystem();
  23717. if ($fs->isAbsolutePath($url)) {
  23718. return 'file://' . strtr($url, '\\', '/');
  23719. }
  23720. return $url;
  23721. }
  23722. protected function execute($command, $url)
  23723. {
  23724. if (null === $this->util) {
  23725. $this->util = new SvnUtil($this->baseUrl, $this->io, $this->config, $this->process);
  23726. $this->util->setCacheCredentials($this->cacheCredentials);
  23727. }
  23728. try {
  23729. return $this->util->execute($command, $url);
  23730. } catch (\RuntimeException $e) {
  23731. if (null === $this->util->binaryVersion()) {
  23732. throw new \RuntimeException('Failed to load '.$this->url.', svn was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput());
  23733. }
  23734. throw new \RuntimeException(
  23735. 'Repository '.$this->url.' could not be processed, '.$e->getMessage()
  23736. );
  23737. }
  23738. }
  23739. protected function buildIdentifier($baseDir, $revision)
  23740. {
  23741. return rtrim($baseDir, '/') . $this->packagePath . '/@' . $revision;
  23742. }
  23743. }
  23744. <?php
  23745. namespace Composer\Repository\Vcs;
  23746. use Composer\Cache;
  23747. use Composer\Downloader\TransportException;
  23748. use Composer\Config;
  23749. use Composer\Factory;
  23750. use Composer\IO\IOInterface;
  23751. use Composer\Json\JsonFile;
  23752. use Composer\Util\ProcessExecutor;
  23753. use Composer\Util\RemoteFilesystem;
  23754. use Composer\Util\Filesystem;
  23755. abstract class VcsDriver implements VcsDriverInterface
  23756. {
  23757. protected $url;
  23758. protected $originUrl;
  23759. protected $repoConfig;
  23760. protected $io;
  23761. protected $config;
  23762. protected $process;
  23763. protected $remoteFilesystem;
  23764. protected $infoCache = array();
  23765. protected $cache;
  23766. final public function __construct(array $repoConfig, IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  23767. {
  23768. if (Filesystem::isLocalPath($repoConfig['url'])) {
  23769. $repoConfig['url'] = Filesystem::getPlatformPath($repoConfig['url']);
  23770. }
  23771. $this->url = $repoConfig['url'];
  23772. $this->originUrl = $repoConfig['url'];
  23773. $this->repoConfig = $repoConfig;
  23774. $this->io = $io;
  23775. $this->config = $config;
  23776. $this->process = $process ?: new ProcessExecutor($io);
  23777. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  23778. }
  23779. protected function shouldCache($identifier)
  23780. {
  23781. return $this->cache && preg_match('{[a-f0-9]{40}}i', $identifier);
  23782. }
  23783. public function getComposerInformation($identifier)
  23784. {
  23785. if (!isset($this->infoCache[$identifier])) {
  23786. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  23787. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  23788. }
  23789. $composer = $this->getBaseComposerInformation($identifier);
  23790. if ($this->shouldCache($identifier)) {
  23791. $this->cache->write($identifier, json_encode($composer));
  23792. }
  23793. $this->infoCache[$identifier] = $composer;
  23794. }
  23795. return $this->infoCache[$identifier];
  23796. }
  23797. protected function getBaseComposerInformation($identifier)
  23798. {
  23799. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  23800. if (!$composerFileContent) {
  23801. return null;
  23802. }
  23803. $composer = JsonFile::parseJson($composerFileContent, $identifier . ':composer.json');
  23804. if (empty($composer['time']) && $changeDate = $this->getChangeDate($identifier)) {
  23805. $composer['time'] = $changeDate->format(DATE_RFC3339);
  23806. }
  23807. return $composer;
  23808. }
  23809. public function hasComposerFile($identifier)
  23810. {
  23811. try {
  23812. return (bool) $this->getComposerInformation($identifier);
  23813. } catch (TransportException $e) {
  23814. }
  23815. return false;
  23816. }
  23817. protected function getScheme()
  23818. {
  23819. if (extension_loaded('openssl')) {
  23820. return 'https';
  23821. }
  23822. return 'http';
  23823. }
  23824. protected function getContents($url)
  23825. {
  23826. $options = isset($this->repoConfig['options']) ? $this->repoConfig['options'] : array();
  23827. return $this->remoteFilesystem->getContents($this->originUrl, $url, false, $options);
  23828. }
  23829. public function cleanup()
  23830. {
  23831. return;
  23832. }
  23833. }
  23834. <?php
  23835. namespace Composer\Repository\Vcs;
  23836. use Composer\Config;
  23837. use Composer\IO\IOInterface;
  23838. interface VcsDriverInterface
  23839. {
  23840. public function initialize();
  23841. public function getComposerInformation($identifier);
  23842. public function getFileContent($file, $identifier);
  23843. public function getChangeDate($identifier);
  23844. public function getRootIdentifier();
  23845. public function getBranches();
  23846. public function getTags();
  23847. public function getDist($identifier);
  23848. public function getSource($identifier);
  23849. public function getUrl();
  23850. public function hasComposerFile($identifier);
  23851. public function cleanup();
  23852. public static function supports(IOInterface $io, Config $config, $url, $deep = false);
  23853. }
  23854. <?php
  23855. namespace Composer\Repository;
  23856. use Composer\Downloader\TransportException;
  23857. use Composer\Repository\Vcs\VcsDriverInterface;
  23858. use Composer\Package\Version\VersionParser;
  23859. use Composer\Package\Loader\ArrayLoader;
  23860. use Composer\Package\Loader\ValidatingArrayLoader;
  23861. use Composer\Package\Loader\InvalidPackageException;
  23862. use Composer\Package\Loader\LoaderInterface;
  23863. use Composer\EventDispatcher\EventDispatcher;
  23864. use Composer\IO\IOInterface;
  23865. use Composer\Config;
  23866. class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  23867. {
  23868. protected $url;
  23869. protected $packageName;
  23870. protected $verbose;
  23871. protected $io;
  23872. protected $config;
  23873. protected $versionParser;
  23874. protected $type;
  23875. protected $loader;
  23876. protected $repoConfig;
  23877. protected $branchErrorOccurred = false;
  23878. private $drivers;
  23879. private $driver;
  23880. private $versionCache;
  23881. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, array $drivers = null, VersionCacheInterface $versionCache = null)
  23882. {
  23883. parent::__construct();
  23884. $this->drivers = $drivers ?: array(
  23885. 'github' => 'Composer\Repository\Vcs\GitHubDriver',
  23886. 'gitlab' => 'Composer\Repository\Vcs\GitLabDriver',
  23887. 'git-bitbucket' => 'Composer\Repository\Vcs\GitBitbucketDriver',
  23888. 'git' => 'Composer\Repository\Vcs\GitDriver',
  23889. 'hg-bitbucket' => 'Composer\Repository\Vcs\HgBitbucketDriver',
  23890. 'hg' => 'Composer\Repository\Vcs\HgDriver',
  23891. 'perforce' => 'Composer\Repository\Vcs\PerforceDriver',
  23892. 'fossil' => 'Composer\Repository\Vcs\FossilDriver',
  23893. 'svn' => 'Composer\Repository\Vcs\SvnDriver',
  23894. );
  23895. $this->url = $repoConfig['url'];
  23896. $this->io = $io;
  23897. $this->type = isset($repoConfig['type']) ? $repoConfig['type'] : 'vcs';
  23898. $this->verbose = $io->isVeryVerbose();
  23899. $this->config = $config;
  23900. $this->repoConfig = $repoConfig;
  23901. $this->versionCache = $versionCache;
  23902. }
  23903. public function getRepoConfig()
  23904. {
  23905. return $this->repoConfig;
  23906. }
  23907. public function setLoader(LoaderInterface $loader)
  23908. {
  23909. $this->loader = $loader;
  23910. }
  23911. public function getDriver()
  23912. {
  23913. if ($this->driver) {
  23914. return $this->driver;
  23915. }
  23916. if (isset($this->drivers[$this->type])) {
  23917. $class = $this->drivers[$this->type];
  23918. $this->driver = new $class($this->repoConfig, $this->io, $this->config);
  23919. $this->driver->initialize();
  23920. return $this->driver;
  23921. }
  23922. foreach ($this->drivers as $driver) {
  23923. if ($driver::supports($this->io, $this->config, $this->url)) {
  23924. $this->driver = new $driver($this->repoConfig, $this->io, $this->config);
  23925. $this->driver->initialize();
  23926. return $this->driver;
  23927. }
  23928. }
  23929. foreach ($this->drivers as $driver) {
  23930. if ($driver::supports($this->io, $this->config, $this->url, true)) {
  23931. $this->driver = new $driver($this->repoConfig, $this->io, $this->config);
  23932. $this->driver->initialize();
  23933. return $this->driver;
  23934. }
  23935. }
  23936. }
  23937. public function hadInvalidBranches()
  23938. {
  23939. return $this->branchErrorOccurred;
  23940. }
  23941. protected function initialize()
  23942. {
  23943. parent::initialize();
  23944. $verbose = $this->verbose;
  23945. $driver = $this->getDriver();
  23946. if (!$driver) {
  23947. throw new \InvalidArgumentException('No driver found to handle VCS repository '.$this->url);
  23948. }
  23949. $this->versionParser = new VersionParser;
  23950. if (!$this->loader) {
  23951. $this->loader = new ArrayLoader($this->versionParser);
  23952. }
  23953. try {
  23954. if ($driver->hasComposerFile($driver->getRootIdentifier())) {
  23955. $data = $driver->getComposerInformation($driver->getRootIdentifier());
  23956. $this->packageName = !empty($data['name']) ? $data['name'] : null;
  23957. }
  23958. } catch (\Exception $e) {
  23959. if ($verbose) {
  23960. $this->io->writeError('<error>Skipped parsing '.$driver->getRootIdentifier().', '.$e->getMessage().'</error>');
  23961. }
  23962. }
  23963. foreach ($driver->getTags() as $tag => $identifier) {
  23964. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $tag . '</comment>)';
  23965. if ($verbose) {
  23966. $this->io->writeError($msg);
  23967. } else {
  23968. $this->io->overwriteError($msg, false);
  23969. }
  23970. $tag = str_replace('release-', '', $tag);
  23971. $cachedPackage = $this->getCachedPackageVersion($tag, $identifier, $verbose);
  23972. if ($cachedPackage) {
  23973. $this->addPackage($cachedPackage);
  23974. continue;
  23975. }
  23976. if (!$parsedTag = $this->validateTag($tag)) {
  23977. if ($verbose) {
  23978. $this->io->writeError('<warning>Skipped tag '.$tag.', invalid tag name</warning>');
  23979. }
  23980. continue;
  23981. }
  23982. try {
  23983. if (!$data = $driver->getComposerInformation($identifier)) {
  23984. if ($verbose) {
  23985. $this->io->writeError('<warning>Skipped tag '.$tag.', no composer file</warning>');
  23986. }
  23987. continue;
  23988. }
  23989. if (isset($data['version'])) {
  23990. $data['version_normalized'] = $this->versionParser->normalize($data['version']);
  23991. } else {
  23992. $data['version'] = $tag;
  23993. $data['version_normalized'] = $parsedTag;
  23994. }
  23995. $data['version'] = preg_replace('{[.-]?dev$}i', '', $data['version']);
  23996. $data['version_normalized'] = preg_replace('{(^dev-|[.-]?dev$)}i', '', $data['version_normalized']);
  23997. if ($data['version_normalized'] !== $parsedTag) {
  23998. if ($verbose) {
  23999. $this->io->writeError('<warning>Skipped tag '.$tag.', tag ('.$parsedTag.') does not match version ('.$data['version_normalized'].') in composer.json</warning>');
  24000. }
  24001. continue;
  24002. }
  24003. $tagPackageName = isset($data['name']) ? $data['name'] : $this->packageName;
  24004. if ($existingPackage = $this->findPackage($tagPackageName, $data['version_normalized'])) {
  24005. if ($verbose) {
  24006. $this->io->writeError('<warning>Skipped tag '.$tag.', it conflicts with an another tag ('.$existingPackage->getPrettyVersion().') as both resolve to '.$data['version_normalized'].' internally</warning>');
  24007. }
  24008. continue;
  24009. }
  24010. if ($verbose) {
  24011. $this->io->writeError('Importing tag '.$tag.' ('.$data['version_normalized'].')');
  24012. }
  24013. $this->addPackage($this->loader->load($this->preProcess($driver, $data, $identifier)));
  24014. } catch (\Exception $e) {
  24015. if ($verbose) {
  24016. $this->io->writeError('<warning>Skipped tag '.$tag.', '.($e instanceof TransportException ? 'no composer file was found' : $e->getMessage()).'</warning>');
  24017. }
  24018. continue;
  24019. }
  24020. }
  24021. if (!$verbose) {
  24022. $this->io->overwriteError('', false);
  24023. }
  24024. $branches = $driver->getBranches();
  24025. foreach ($branches as $branch => $identifier) {
  24026. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $branch . '</comment>)';
  24027. if ($verbose) {
  24028. $this->io->writeError($msg);
  24029. } else {
  24030. $this->io->overwriteError($msg, false);
  24031. }
  24032. if ($branch === 'trunk' && isset($branches['master'])) {
  24033. if ($verbose) {
  24034. $this->io->writeError('<warning>Skipped branch '.$branch.', can not parse both master and trunk branches as they both resolve to 9999999-dev internally</warning>');
  24035. }
  24036. continue;
  24037. }
  24038. if (!$parsedBranch = $this->validateBranch($branch)) {
  24039. if ($verbose) {
  24040. $this->io->writeError('<warning>Skipped branch '.$branch.', invalid name</warning>');
  24041. }
  24042. continue;
  24043. }
  24044. if ('dev-' === substr($parsedBranch, 0, 4) || '9999999-dev' === $parsedBranch) {
  24045. $version = 'dev-' . $branch;
  24046. } else {
  24047. $prefix = substr($branch, 0, 1) === 'v' ? 'v' : '';
  24048. $version = $prefix . preg_replace('{(\.9{7})+}', '.x', $parsedBranch);
  24049. }
  24050. $cachedPackage = $this->getCachedPackageVersion($version, $identifier, $verbose);
  24051. if ($cachedPackage) {
  24052. $this->addPackage($cachedPackage);
  24053. continue;
  24054. }
  24055. try {
  24056. if (!$data = $driver->getComposerInformation($identifier)) {
  24057. if ($verbose) {
  24058. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file</warning>');
  24059. }
  24060. continue;
  24061. }
  24062. $data['version'] = $version;
  24063. $data['version_normalized'] = $parsedBranch;
  24064. if ($verbose) {
  24065. $this->io->writeError('Importing branch '.$branch.' ('.$data['version'].')');
  24066. }
  24067. $packageData = $this->preProcess($driver, $data, $identifier);
  24068. $package = $this->loader->load($packageData);
  24069. if ($this->loader instanceof ValidatingArrayLoader && $this->loader->getWarnings()) {
  24070. throw new InvalidPackageException($this->loader->getErrors(), $this->loader->getWarnings(), $packageData);
  24071. }
  24072. $this->addPackage($package);
  24073. } catch (TransportException $e) {
  24074. if ($verbose) {
  24075. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file was found</warning>');
  24076. }
  24077. continue;
  24078. } catch (\Exception $e) {
  24079. if (!$verbose) {
  24080. $this->io->writeError('');
  24081. }
  24082. $this->branchErrorOccurred = true;
  24083. $this->io->writeError('<error>Skipped branch '.$branch.', '.$e->getMessage().'</error>');
  24084. $this->io->writeError('');
  24085. continue;
  24086. }
  24087. }
  24088. $driver->cleanup();
  24089. if (!$verbose) {
  24090. $this->io->overwriteError('', false);
  24091. }
  24092. if (!$this->getPackages()) {
  24093. throw new InvalidRepositoryException('No valid composer.json was found in any branch or tag of '.$this->url.', could not load a package from it.');
  24094. }
  24095. }
  24096. protected function preProcess(VcsDriverInterface $driver, array $data, $identifier)
  24097. {
  24098. $dataPackageName = isset($data['name']) ? $data['name'] : null;
  24099. $data['name'] = $this->packageName ?: $dataPackageName;
  24100. if (!isset($data['dist'])) {
  24101. $data['dist'] = $driver->getDist($identifier);
  24102. }
  24103. if (!isset($data['source'])) {
  24104. $data['source'] = $driver->getSource($identifier);
  24105. }
  24106. return $data;
  24107. }
  24108. private function validateBranch($branch)
  24109. {
  24110. try {
  24111. return $this->versionParser->normalizeBranch($branch);
  24112. } catch (\Exception $e) {
  24113. }
  24114. return false;
  24115. }
  24116. private function validateTag($version)
  24117. {
  24118. try {
  24119. return $this->versionParser->normalize($version);
  24120. } catch (\Exception $e) {
  24121. }
  24122. return false;
  24123. }
  24124. private function getCachedPackageVersion($version, $identifier, $verbose)
  24125. {
  24126. if (!$this->versionCache) {
  24127. return;
  24128. }
  24129. $cachedPackage = $this->versionCache->getVersionPackage($version, $identifier);
  24130. if ($cachedPackage) {
  24131. $msg = 'Found cached composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $version . '</comment>)';
  24132. if ($verbose) {
  24133. $this->io->writeError($msg);
  24134. } else {
  24135. $this->io->overwriteError($msg, false);
  24136. }
  24137. if ($existingPackage = $this->findPackage($cachedPackage['name'], $cachedPackage['version_normalized'])) {
  24138. if ($verbose) {
  24139. $this->io->writeError('<warning>Skipped cached version '.$version.', it conflicts with an another tag ('.$existingPackage->getPrettyVersion().') as both resolve to '.$cachedPackage['version_normalized'].' internally</warning>');
  24140. }
  24141. $cachedPackage = null;
  24142. }
  24143. }
  24144. if ($cachedPackage) {
  24145. return $this->loader->load($cachedPackage);
  24146. }
  24147. return null;
  24148. }
  24149. }
  24150. <?php
  24151. namespace Composer\Repository;
  24152. interface VersionCacheInterface
  24153. {
  24154. public function getVersionPackage($version, $identifier);
  24155. }
  24156. <?php
  24157. namespace Composer\Repository;
  24158. use Composer\Package\AliasPackage;
  24159. class WritableArrayRepository extends ArrayRepository implements WritableRepositoryInterface
  24160. {
  24161. public function write()
  24162. {
  24163. }
  24164. public function reload()
  24165. {
  24166. }
  24167. public function getCanonicalPackages()
  24168. {
  24169. $packages = $this->getPackages();
  24170. $packagesByName = array();
  24171. foreach ($packages as $package) {
  24172. if (!isset($packagesByName[$package->getName()]) || $packagesByName[$package->getName()] instanceof AliasPackage) {
  24173. $packagesByName[$package->getName()] = $package;
  24174. }
  24175. }
  24176. $canonicalPackages = array();
  24177. foreach ($packagesByName as $package) {
  24178. while ($package instanceof AliasPackage) {
  24179. $package = $package->getAliasOf();
  24180. }
  24181. $canonicalPackages[] = $package;
  24182. }
  24183. return $canonicalPackages;
  24184. }
  24185. }
  24186. <?php
  24187. namespace Composer\Repository;
  24188. use Composer\Package\PackageInterface;
  24189. interface WritableRepositoryInterface extends RepositoryInterface
  24190. {
  24191. public function write();
  24192. public function addPackage(PackageInterface $package);
  24193. public function removePackage(PackageInterface $package);
  24194. public function getCanonicalPackages();
  24195. public function reload();
  24196. }
  24197. <?php
  24198. namespace Composer\Script;
  24199. class CommandEvent extends Event
  24200. {
  24201. }
  24202. <?php
  24203. namespace Composer\Script;
  24204. use Composer\Composer;
  24205. use Composer\IO\IOInterface;
  24206. use Composer\EventDispatcher\Event as BaseEvent;
  24207. class Event extends BaseEvent
  24208. {
  24209. private $composer;
  24210. private $io;
  24211. private $devMode;
  24212. public function __construct($name, Composer $composer, IOInterface $io, $devMode = false, array $args = array(), array $flags = array())
  24213. {
  24214. parent::__construct($name, $args, $flags);
  24215. $this->composer = $composer;
  24216. $this->io = $io;
  24217. $this->devMode = $devMode;
  24218. }
  24219. public function getComposer()
  24220. {
  24221. return $this->composer;
  24222. }
  24223. public function getIO()
  24224. {
  24225. return $this->io;
  24226. }
  24227. public function isDevMode()
  24228. {
  24229. return $this->devMode;
  24230. }
  24231. }
  24232. <?php
  24233. namespace Composer\Script;
  24234. use Composer\Installer\PackageEvent as BasePackageEvent;
  24235. class PackageEvent extends BasePackageEvent
  24236. {
  24237. }
  24238. <?php
  24239. namespace Composer\Script;
  24240. class ScriptEvents
  24241. {
  24242. const PRE_INSTALL_CMD = 'pre-install-cmd';
  24243. const POST_INSTALL_CMD = 'post-install-cmd';
  24244. const PRE_UPDATE_CMD = 'pre-update-cmd';
  24245. const POST_UPDATE_CMD = 'post-update-cmd';
  24246. const PRE_STATUS_CMD = 'pre-status-cmd';
  24247. const POST_STATUS_CMD = 'post-status-cmd';
  24248. const PRE_AUTOLOAD_DUMP = 'pre-autoload-dump';
  24249. const POST_AUTOLOAD_DUMP = 'post-autoload-dump';
  24250. const POST_ROOT_PACKAGE_INSTALL = 'post-root-package-install';
  24251. const POST_CREATE_PROJECT_CMD = 'post-create-project-cmd';
  24252. const PRE_ARCHIVE_CMD = 'pre-archive-cmd';
  24253. const POST_ARCHIVE_CMD = 'post-archive-cmd';
  24254. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  24255. const POST_PACKAGE_INSTALL = 'post-package-install';
  24256. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  24257. const POST_PACKAGE_UPDATE = 'post-package-update';
  24258. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  24259. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  24260. }
  24261. <?php
  24262. namespace Composer\SelfUpdate;
  24263. class Keys
  24264. {
  24265. public static function fingerprint($path)
  24266. {
  24267. $hash = strtoupper(hash('sha256', preg_replace('{\s}', '', file_get_contents($path))));
  24268. return implode(' ', array(
  24269. substr($hash, 0, 8),
  24270. substr($hash, 8, 8),
  24271. substr($hash, 16, 8),
  24272. substr($hash, 24, 8),
  24273. '',
  24274. substr($hash, 32, 8),
  24275. substr($hash, 40, 8),
  24276. substr($hash, 48, 8),
  24277. substr($hash, 56, 8),
  24278. ));
  24279. }
  24280. }
  24281. <?php
  24282. namespace Composer\SelfUpdate;
  24283. use Composer\Util\RemoteFilesystem;
  24284. use Composer\Config;
  24285. use Composer\Json\JsonFile;
  24286. class Versions
  24287. {
  24288. private $rfs;
  24289. private $config;
  24290. private $channel;
  24291. public function __construct(Config $config, RemoteFilesystem $rfs)
  24292. {
  24293. $this->rfs = $rfs;
  24294. $this->config = $config;
  24295. }
  24296. public function getChannel()
  24297. {
  24298. if ($this->channel) {
  24299. return $this->channel;
  24300. }
  24301. $channelFile = $this->config->get('home').'/update-channel';
  24302. if (file_exists($channelFile)) {
  24303. $channel = trim(file_get_contents($channelFile));
  24304. if (in_array($channel, array('stable', 'preview', 'snapshot'), true)) {
  24305. return $this->channel = $channel;
  24306. }
  24307. }
  24308. return $this->channel = 'stable';
  24309. }
  24310. public function setChannel($channel)
  24311. {
  24312. if (!in_array($channel, array('stable', 'preview', 'snapshot'), true)) {
  24313. throw new \InvalidArgumentException('Invalid channel '.$channel.', must be one of: stable, preview, snapshot');
  24314. }
  24315. $channelFile = $this->config->get('home').'/update-channel';
  24316. $this->channel = $channel;
  24317. file_put_contents($channelFile, $channel.PHP_EOL);
  24318. }
  24319. public function getLatest()
  24320. {
  24321. $protocol = extension_loaded('openssl') ? 'https' : 'http';
  24322. $versions = JsonFile::parseJson($this->rfs->getContents('getcomposer.org', $protocol . '://getcomposer.org/versions', false));
  24323. foreach ($versions[$this->getChannel()] as $version) {
  24324. if ($version['min-php'] <= PHP_VERSION_ID) {
  24325. return $version;
  24326. }
  24327. }
  24328. throw new \LogicException('There is no version of Composer available for your PHP version ('.PHP_VERSION.')');
  24329. }
  24330. }
  24331. <?php
  24332. namespace Composer\Util;
  24333. use Composer\Config;
  24334. use Composer\IO\IOInterface;
  24335. class AuthHelper
  24336. {
  24337. protected $io;
  24338. protected $config;
  24339. public function __construct(IOInterface $io, Config $config)
  24340. {
  24341. $this->io = $io;
  24342. $this->config = $config;
  24343. }
  24344. public function storeAuth($originUrl, $storeAuth)
  24345. {
  24346. $store = false;
  24347. $configSource = $this->config->getAuthConfigSource();
  24348. if ($storeAuth === true) {
  24349. $store = $configSource;
  24350. } elseif ($storeAuth === 'prompt') {
  24351. $answer = $this->io->askAndValidate(
  24352. 'Do you want to store credentials for '.$originUrl.' in '.$configSource->getName().' ? [Yn] ',
  24353. function ($value) {
  24354. $input = strtolower(substr(trim($value), 0, 1));
  24355. if (in_array($input, array('y','n'))) {
  24356. return $input;
  24357. }
  24358. throw new \RuntimeException('Please answer (y)es or (n)o');
  24359. },
  24360. null,
  24361. 'y'
  24362. );
  24363. if ($answer === 'y') {
  24364. $store = $configSource;
  24365. }
  24366. }
  24367. if ($store) {
  24368. $store->addConfigSetting(
  24369. 'http-basic.'.$originUrl,
  24370. $this->io->getAuthentication($originUrl)
  24371. );
  24372. }
  24373. }
  24374. }
  24375. <?php
  24376. namespace Composer\Util;
  24377. use Composer\Factory;
  24378. use Composer\IO\IOInterface;
  24379. use Composer\Config;
  24380. use Composer\Downloader\TransportException;
  24381. class Bitbucket
  24382. {
  24383. private $io;
  24384. private $config;
  24385. private $process;
  24386. private $remoteFilesystem;
  24387. private $token = array();
  24388. private $time;
  24389. const OAUTH2_ACCESS_TOKEN_URL = 'https://bitbucket.org/site/oauth2/access_token';
  24390. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null, $time = null)
  24391. {
  24392. $this->io = $io;
  24393. $this->config = $config;
  24394. $this->process = $process ?: new ProcessExecutor($io);
  24395. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  24396. $this->time = $time;
  24397. }
  24398. public function getToken()
  24399. {
  24400. if (!isset($this->token['access_token'])) {
  24401. return '';
  24402. }
  24403. return $this->token['access_token'];
  24404. }
  24405. public function authorizeOAuth($originUrl)
  24406. {
  24407. if ($originUrl !== 'bitbucket.org') {
  24408. return false;
  24409. }
  24410. if (0 === $this->process->execute('git config bitbucket.accesstoken', $output)) {
  24411. $this->io->setAuthentication($originUrl, 'x-token-auth', trim($output));
  24412. return true;
  24413. }
  24414. return false;
  24415. }
  24416. private function requestAccessToken($originUrl)
  24417. {
  24418. try {
  24419. $json = $this->remoteFilesystem->getContents($originUrl, self::OAUTH2_ACCESS_TOKEN_URL, false, array(
  24420. 'retry-auth-failure' => false,
  24421. 'http' => array(
  24422. 'method' => 'POST',
  24423. 'content' => 'grant_type=client_credentials',
  24424. ),
  24425. ));
  24426. $this->token = json_decode($json, true);
  24427. } catch (TransportException $e) {
  24428. if ($e->getCode() === 400) {
  24429. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  24430. $this->io->writeError('This can have two reasons:');
  24431. $this->io->writeError('1. You are authenticating with a bitbucket username/password combination');
  24432. $this->io->writeError('2. You are using an OAuth consumer, but didn\'t configure a (dummy) callback url');
  24433. return false;
  24434. } elseif (in_array($e->getCode(), array(403, 401))) {
  24435. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  24436. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  24437. return false;
  24438. }
  24439. throw $e;
  24440. }
  24441. return true;
  24442. }
  24443. public function authorizeOAuthInteractively($originUrl, $message = null)
  24444. {
  24445. if ($message) {
  24446. $this->io->writeError($message);
  24447. }
  24448. $url = 'https://confluence.atlassian.com/bitbucket/oauth-on-bitbucket-cloud-238027431.html';
  24449. $this->io->writeError(sprintf('Follow the instructions on %s', $url));
  24450. $this->io->writeError(sprintf('to create a consumer. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  24451. $this->io->writeError('Ensure you enter a "Callback URL" (http://example.com is fine) or it will not be possible to create an Access Token (this callback url will not be used by composer)');
  24452. $consumerKey = trim($this->io->askAndHideAnswer('Consumer Key (hidden): '));
  24453. if (!$consumerKey) {
  24454. $this->io->writeError('<warning>No consumer key given, aborting.</warning>');
  24455. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  24456. return false;
  24457. }
  24458. $consumerSecret = trim($this->io->askAndHideAnswer('Consumer Secret (hidden): '));
  24459. if (!$consumerSecret) {
  24460. $this->io->writeError('<warning>No consumer secret given, aborting.</warning>');
  24461. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  24462. return false;
  24463. }
  24464. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  24465. if (!$this->requestAccessToken($originUrl)) {
  24466. return false;
  24467. }
  24468. $this->storeInAuthConfig($originUrl, $consumerKey, $consumerSecret);
  24469. $this->config->getAuthConfigSource()->removeConfigSetting('http-basic.' . $originUrl);
  24470. $this->io->writeError('<info>Consumer stored successfully.</info>');
  24471. return true;
  24472. }
  24473. public function requestToken($originUrl, $consumerKey, $consumerSecret)
  24474. {
  24475. if (!empty($this->token) || $this->getTokenFromConfig($originUrl)) {
  24476. return $this->token['access_token'];
  24477. }
  24478. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  24479. if (!$this->requestAccessToken($originUrl)) {
  24480. return '';
  24481. }
  24482. $this->storeInAuthConfig($originUrl, $consumerKey, $consumerSecret);
  24483. return $this->token['access_token'];
  24484. }
  24485. private function storeInAuthConfig($originUrl, $consumerKey, $consumerSecret)
  24486. {
  24487. $this->config->getConfigSource()->removeConfigSetting('bitbucket-oauth.'.$originUrl);
  24488. $time = null === $this->time ? time() : $this->time;
  24489. $consumer = array(
  24490. "consumer-key" => $consumerKey,
  24491. "consumer-secret" => $consumerSecret,
  24492. "access-token" => $this->token['access_token'],
  24493. "access-token-expiration" => $time + $this->token['expires_in'],
  24494. );
  24495. $this->config->getAuthConfigSource()->addConfigSetting('bitbucket-oauth.'.$originUrl, $consumer);
  24496. }
  24497. private function getTokenFromConfig($originUrl)
  24498. {
  24499. $authConfig = $this->config->get('bitbucket-oauth');
  24500. if (
  24501. !isset($authConfig[$originUrl]['access-token'])
  24502. || !isset($authConfig[$originUrl]['access-token-expiration'])
  24503. || time() > $authConfig[$originUrl]['access-token-expiration']
  24504. ) {
  24505. return false;
  24506. }
  24507. $this->token = array(
  24508. 'access_token' => $authConfig[$originUrl]['access-token'],
  24509. );
  24510. return true;
  24511. }
  24512. }
  24513. <?php
  24514. namespace Composer\Util;
  24515. class ComposerMirror
  24516. {
  24517. public static function processUrl($mirrorUrl, $packageName, $version, $reference, $type)
  24518. {
  24519. if ($reference) {
  24520. $reference = preg_match('{^([a-f0-9]*|%reference%)$}', $reference) ? $reference : md5($reference);
  24521. }
  24522. $version = strpos($version, '/') === false ? $version : md5($version);
  24523. return str_replace(
  24524. array('%package%', '%version%', '%reference%', '%type%'),
  24525. array($packageName, $version, $reference, $type),
  24526. $mirrorUrl
  24527. );
  24528. }
  24529. public static function processGitUrl($mirrorUrl, $packageName, $url, $type)
  24530. {
  24531. if (preg_match('#^(?:(?:https?|git)://github\.com/|git@github\.com:)([^/]+)/(.+?)(?:\.git)?$#', $url, $match)) {
  24532. $url = 'gh-'.$match[1].'/'.$match[2];
  24533. } elseif (preg_match('#^https://bitbucket\.org/([^/]+)/(.+?)(?:\.git)?/?$#', $url, $match)) {
  24534. $url = 'bb-'.$match[1].'/'.$match[2];
  24535. } else {
  24536. $url = preg_replace('{[^a-z0-9_.-]}i', '-', trim($url, '/'));
  24537. }
  24538. return str_replace(
  24539. array('%package%', '%normalizedUrl%', '%type%'),
  24540. array($packageName, $url, $type),
  24541. $mirrorUrl
  24542. );
  24543. }
  24544. public static function processHgUrl($mirrorUrl, $packageName, $url, $type)
  24545. {
  24546. return self::processGitUrl($mirrorUrl, $packageName, $url, $type);
  24547. }
  24548. }
  24549. <?php
  24550. namespace Composer\Util;
  24551. use Composer\Package\Loader\ArrayLoader;
  24552. use Composer\Package\Loader\ValidatingArrayLoader;
  24553. use Composer\Package\Loader\InvalidPackageException;
  24554. use Composer\Json\JsonValidationException;
  24555. use Composer\IO\IOInterface;
  24556. use Composer\Json\JsonFile;
  24557. use Composer\Spdx\SpdxLicenses;
  24558. class ConfigValidator
  24559. {
  24560. private $io;
  24561. public function __construct(IOInterface $io)
  24562. {
  24563. $this->io = $io;
  24564. }
  24565. public function validate($file, $arrayLoaderValidationFlags = ValidatingArrayLoader::CHECK_ALL)
  24566. {
  24567. $errors = array();
  24568. $publishErrors = array();
  24569. $warnings = array();
  24570. $laxValid = false;
  24571. try {
  24572. $json = new JsonFile($file, null, $this->io);
  24573. $manifest = $json->read();
  24574. $json->validateSchema(JsonFile::LAX_SCHEMA);
  24575. $laxValid = true;
  24576. $json->validateSchema();
  24577. } catch (JsonValidationException $e) {
  24578. foreach ($e->getErrors() as $message) {
  24579. if ($laxValid) {
  24580. $publishErrors[] = $message;
  24581. } else {
  24582. $errors[] = $message;
  24583. }
  24584. }
  24585. } catch (\Exception $e) {
  24586. $errors[] = $e->getMessage();
  24587. return array($errors, $publishErrors, $warnings);
  24588. }
  24589. if (empty($manifest['license'])) {
  24590. $warnings[] = 'No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.';
  24591. } else {
  24592. $licenses = (array) $manifest['license'];
  24593. foreach ($licenses as $key => $license) {
  24594. if ('proprietary' === $license) {
  24595. unset($licenses[$key]);
  24596. }
  24597. }
  24598. $licenseValidator = new SpdxLicenses();
  24599. foreach ($licenses as $license) {
  24600. $spdxLicense = $licenseValidator->getLicenseByIdentifier($license);
  24601. if ($spdxLicense && $spdxLicense[3]) {
  24602. if (preg_match('{^[AL]?GPL-[123](\.[01])?\+$}i', $license)) {
  24603. $warnings[] = sprintf(
  24604. 'License "%s" is a deprecated SPDX license identifier, use "'.str_replace('+', '', $license).'-or-later" instead',
  24605. $license
  24606. );
  24607. } elseif (preg_match('{^[AL]?GPL-[123](\.[01])?$}i', $license)) {
  24608. $warnings[] = sprintf(
  24609. 'License "%s" is a deprecated SPDX license identifier, use "'.$license.'-only" or "'.$license.'-or-later" instead',
  24610. $license
  24611. );
  24612. } else {
  24613. $warnings[] = sprintf(
  24614. 'License "%s" is a deprecated SPDX license identifier, see https://spdx.org/licenses/',
  24615. $license
  24616. );
  24617. }
  24618. }
  24619. }
  24620. }
  24621. if (isset($manifest['version'])) {
  24622. $warnings[] = 'The version field is present, it is recommended to leave it out if the package is published on Packagist.';
  24623. }
  24624. if (!empty($manifest['name']) && preg_match('{[A-Z]}', $manifest['name'])) {
  24625. $suggestName = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $manifest['name']);
  24626. $suggestName = strtolower($suggestName);
  24627. $publishErrors[] = sprintf(
  24628. 'Name "%s" does not match the best practice (e.g. lower-cased/with-dashes). We suggest using "%s" instead. As such you will not be able to submit it to Packagist.',
  24629. $manifest['name'],
  24630. $suggestName
  24631. );
  24632. }
  24633. if (!empty($manifest['type']) && $manifest['type'] == 'composer-installer') {
  24634. $warnings[] = "The package type 'composer-installer' is deprecated. Please distribute your custom installers as plugins from now on. See https://getcomposer.org/doc/articles/plugins.md for plugin documentation.";
  24635. }
  24636. if (isset($manifest['require']) && isset($manifest['require-dev'])) {
  24637. $requireOverrides = array_intersect_key($manifest['require'], $manifest['require-dev']);
  24638. if (!empty($requireOverrides)) {
  24639. $plural = (count($requireOverrides) > 1) ? 'are' : 'is';
  24640. $warnings[] = implode(', ', array_keys($requireOverrides)). " {$plural} required both in require and require-dev, this can lead to unexpected behavior";
  24641. }
  24642. }
  24643. $require = isset($manifest['require']) ? $manifest['require'] : array();
  24644. $requireDev = isset($manifest['require-dev']) ? $manifest['require-dev'] : array();
  24645. $packages = array_merge($require, $requireDev);
  24646. foreach ($packages as $package => $version) {
  24647. if (preg_match('/#/', $version) === 1) {
  24648. $warnings[] = sprintf(
  24649. 'The package "%s" is pointing to a commit-ref, this is bad practice and can cause unforeseen issues.',
  24650. $package
  24651. );
  24652. }
  24653. }
  24654. $scriptsDescriptions = isset($manifest['scripts-descriptions']) ? $manifest['scripts-descriptions'] : array();
  24655. $scripts = isset($manifest['scripts']) ? $manifest['scripts'] : array();
  24656. foreach ($scriptsDescriptions as $scriptName => $scriptDescription) {
  24657. if (!array_key_exists($scriptName, $scripts)) {
  24658. $warnings[] = sprintf(
  24659. 'Description for non-existent script "%s" found in "scripts-descriptions"',
  24660. $scriptName
  24661. );
  24662. }
  24663. }
  24664. if (isset($manifest['autoload']['psr-0'][''])) {
  24665. $warnings[] = "Defining autoload.psr-0 with an empty namespace prefix is a bad idea for performance";
  24666. }
  24667. if (isset($manifest['autoload']['psr-4'][''])) {
  24668. $warnings[] = "Defining autoload.psr-4 with an empty namespace prefix is a bad idea for performance";
  24669. }
  24670. try {
  24671. $loader = new ValidatingArrayLoader(new ArrayLoader(), true, null, $arrayLoaderValidationFlags);
  24672. if (!isset($manifest['version'])) {
  24673. $manifest['version'] = '1.0.0';
  24674. }
  24675. if (!isset($manifest['name'])) {
  24676. $manifest['name'] = 'dummy/dummy';
  24677. }
  24678. $loader->load($manifest);
  24679. } catch (InvalidPackageException $e) {
  24680. $errors = array_merge($errors, $e->getErrors());
  24681. }
  24682. $warnings = array_merge($warnings, $loader->getWarnings());
  24683. return array($errors, $publishErrors, $warnings);
  24684. }
  24685. }
  24686. <?php
  24687. namespace Composer\Util;
  24688. use Composer\IO\IOInterface;
  24689. class ErrorHandler
  24690. {
  24691. private static $io;
  24692. public static function handle($level, $message, $file, $line)
  24693. {
  24694. if (!(error_reporting() & $level)) {
  24695. return;
  24696. }
  24697. if (filter_var(ini_get('xdebug.scream'), FILTER_VALIDATE_BOOLEAN)) {
  24698. $message .= "\n\nWarning: You have xdebug.scream enabled, the warning above may be".
  24699. "\na legitimately suppressed error that you were not supposed to see.";
  24700. }
  24701. if ($level !== E_DEPRECATED && $level !== E_USER_DEPRECATED) {
  24702. throw new \ErrorException($message, 0, $level, $file, $line);
  24703. }
  24704. if (self::$io) {
  24705. self::$io->writeError('<warning>Deprecation Notice: '.$message.' in '.$file.':'.$line.'</warning>');
  24706. if (self::$io->isVerbose()) {
  24707. self::$io->writeError('<warning>Stack trace:</warning>');
  24708. self::$io->writeError(array_filter(array_map(function ($a) {
  24709. if (isset($a['line'], $a['file'])) {
  24710. return '<warning> '.$a['file'].':'.$a['line'].'</warning>';
  24711. }
  24712. return null;
  24713. }, array_slice(debug_backtrace(), 2))));
  24714. }
  24715. }
  24716. }
  24717. public static function register(IOInterface $io = null)
  24718. {
  24719. set_error_handler(array(__CLASS__, 'handle'));
  24720. error_reporting(E_ALL | E_STRICT);
  24721. self::$io = $io;
  24722. }
  24723. }
  24724. <?php
  24725. namespace Composer\Util;
  24726. use RecursiveDirectoryIterator;
  24727. use RecursiveIteratorIterator;
  24728. use Symfony\Component\Filesystem\Exception\IOException;
  24729. use Symfony\Component\Finder\Finder;
  24730. class Filesystem
  24731. {
  24732. private $processExecutor;
  24733. public function __construct(ProcessExecutor $executor = null)
  24734. {
  24735. $this->processExecutor = $executor ?: new ProcessExecutor();
  24736. }
  24737. public function remove($file)
  24738. {
  24739. if (is_dir($file)) {
  24740. return $this->removeDirectory($file);
  24741. }
  24742. if (file_exists($file)) {
  24743. return $this->unlink($file);
  24744. }
  24745. return false;
  24746. }
  24747. public function isDirEmpty($dir)
  24748. {
  24749. $finder = Finder::create()
  24750. ->ignoreVCS(false)
  24751. ->ignoreDotFiles(false)
  24752. ->depth(0)
  24753. ->in($dir);
  24754. return count($finder) === 0;
  24755. }
  24756. public function emptyDirectory($dir, $ensureDirectoryExists = true)
  24757. {
  24758. if (file_exists($dir) && is_link($dir)) {
  24759. $this->unlink($dir);
  24760. }
  24761. if ($ensureDirectoryExists) {
  24762. $this->ensureDirectoryExists($dir);
  24763. }
  24764. if (is_dir($dir)) {
  24765. $finder = Finder::create()
  24766. ->ignoreVCS(false)
  24767. ->ignoreDotFiles(false)
  24768. ->depth(0)
  24769. ->in($dir);
  24770. foreach ($finder as $path) {
  24771. $this->remove((string) $path);
  24772. }
  24773. }
  24774. }
  24775. public function removeDirectory($directory)
  24776. {
  24777. if ($this->isSymlinkedDirectory($directory)) {
  24778. return $this->unlinkSymlinkedDirectory($directory);
  24779. }
  24780. if ($this->isJunction($directory)) {
  24781. return $this->removeJunction($directory);
  24782. }
  24783. if (is_link($directory)) {
  24784. return unlink($directory);
  24785. }
  24786. if (!file_exists($directory) || !is_dir($directory)) {
  24787. return true;
  24788. }
  24789. if (preg_match('{^(?:[a-z]:)?[/\\\\]+$}i', $directory)) {
  24790. throw new \RuntimeException('Aborting an attempted deletion of '.$directory.', this was probably not intended, if it is a real use case please report it.');
  24791. }
  24792. if (!function_exists('proc_open')) {
  24793. return $this->removeDirectoryPhp($directory);
  24794. }
  24795. if (Platform::isWindows()) {
  24796. $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape(realpath($directory)));
  24797. } else {
  24798. $cmd = sprintf('rm -rf %s', ProcessExecutor::escape($directory));
  24799. }
  24800. $result = $this->getProcess()->execute($cmd, $output) === 0;
  24801. clearstatcache();
  24802. if ($result && !file_exists($directory)) {
  24803. return true;
  24804. }
  24805. return $this->removeDirectoryPhp($directory);
  24806. }
  24807. public function removeDirectoryPhp($directory)
  24808. {
  24809. try {
  24810. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  24811. } catch (\UnexpectedValueException $e) {
  24812. clearstatcache();
  24813. usleep(100000);
  24814. if (!is_dir($directory)) {
  24815. return true;
  24816. }
  24817. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  24818. }
  24819. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  24820. foreach ($ri as $file) {
  24821. if ($file->isDir()) {
  24822. $this->rmdir($file->getPathname());
  24823. } else {
  24824. $this->unlink($file->getPathname());
  24825. }
  24826. }
  24827. return $this->rmdir($directory);
  24828. }
  24829. public function ensureDirectoryExists($directory)
  24830. {
  24831. if (!is_dir($directory)) {
  24832. if (file_exists($directory)) {
  24833. throw new \RuntimeException(
  24834. $directory.' exists and is not a directory.'
  24835. );
  24836. }
  24837. if (!@mkdir($directory, 0777, true)) {
  24838. throw new \RuntimeException(
  24839. $directory.' does not exist and could not be created.'
  24840. );
  24841. }
  24842. }
  24843. }
  24844. public function unlink($path)
  24845. {
  24846. if (!@$this->unlinkImplementation($path)) {
  24847. if (!Platform::isWindows() || (usleep(350000) && !@$this->unlinkImplementation($path))) {
  24848. $error = error_get_last();
  24849. $message = 'Could not delete '.$path.': ' . @$error['message'];
  24850. if (Platform::isWindows()) {
  24851. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  24852. }
  24853. throw new \RuntimeException($message);
  24854. }
  24855. }
  24856. return true;
  24857. }
  24858. public function rmdir($path)
  24859. {
  24860. if (!@rmdir($path)) {
  24861. if (!Platform::isWindows() || (usleep(350000) && !@rmdir($path))) {
  24862. $error = error_get_last();
  24863. $message = 'Could not delete '.$path.': ' . @$error['message'];
  24864. if (Platform::isWindows()) {
  24865. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  24866. }
  24867. throw new \RuntimeException($message);
  24868. }
  24869. }
  24870. return true;
  24871. }
  24872. public function copyThenRemove($source, $target)
  24873. {
  24874. $this->copy($source, $target);
  24875. if (!is_dir($source)) {
  24876. $this->unlink($source);
  24877. return;
  24878. }
  24879. $this->removeDirectoryPhp($source);
  24880. }
  24881. public function copy($source, $target)
  24882. {
  24883. if (!is_dir($source)) {
  24884. return copy($source, $target);
  24885. }
  24886. $it = new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS);
  24887. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::SELF_FIRST);
  24888. $this->ensureDirectoryExists($target);
  24889. $result = true;
  24890. foreach ($ri as $file) {
  24891. $targetPath = $target . DIRECTORY_SEPARATOR . $ri->getSubPathName();
  24892. if ($file->isDir()) {
  24893. $this->ensureDirectoryExists($targetPath);
  24894. } else {
  24895. $result = $result && copy($file->getPathname(), $targetPath);
  24896. }
  24897. }
  24898. return $result;
  24899. }
  24900. public function rename($source, $target)
  24901. {
  24902. if (true === @rename($source, $target)) {
  24903. return;
  24904. }
  24905. if (!function_exists('proc_open')) {
  24906. return $this->copyThenRemove($source, $target);
  24907. }
  24908. if (Platform::isWindows()) {
  24909. $command = sprintf('xcopy %s %s /E /I /Q /Y', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  24910. $result = $this->processExecutor->execute($command, $output);
  24911. clearstatcache();
  24912. if (0 === $result) {
  24913. $this->remove($source);
  24914. return;
  24915. }
  24916. } else {
  24917. $command = sprintf('mv %s %s', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  24918. $result = $this->processExecutor->execute($command, $output);
  24919. clearstatcache();
  24920. if (0 === $result) {
  24921. return;
  24922. }
  24923. }
  24924. return $this->copyThenRemove($source, $target);
  24925. }
  24926. public function findShortestPath($from, $to, $directories = false)
  24927. {
  24928. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  24929. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  24930. }
  24931. $from = lcfirst($this->normalizePath($from));
  24932. $to = lcfirst($this->normalizePath($to));
  24933. if ($directories) {
  24934. $from = rtrim($from, '/') . '/dummy_file';
  24935. }
  24936. if (dirname($from) === dirname($to)) {
  24937. return './'.basename($to);
  24938. }
  24939. $commonPath = $to;
  24940. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath)) {
  24941. $commonPath = strtr(dirname($commonPath), '\\', '/');
  24942. }
  24943. if (0 !== strpos($from, $commonPath) || '/' === $commonPath) {
  24944. return $to;
  24945. }
  24946. $commonPath = rtrim($commonPath, '/') . '/';
  24947. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/');
  24948. $commonPathCode = str_repeat('../', $sourcePathDepth);
  24949. return ($commonPathCode . substr($to, strlen($commonPath))) ?: './';
  24950. }
  24951. public function findShortestPathCode($from, $to, $directories = false, $staticCode = false)
  24952. {
  24953. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  24954. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  24955. }
  24956. $from = lcfirst($this->normalizePath($from));
  24957. $to = lcfirst($this->normalizePath($to));
  24958. if ($from === $to) {
  24959. return $directories ? '__DIR__' : '__FILE__';
  24960. }
  24961. $commonPath = $to;
  24962. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath) && '.' !== $commonPath) {
  24963. $commonPath = strtr(dirname($commonPath), '\\', '/');
  24964. }
  24965. if (0 !== strpos($from, $commonPath) || '/' === $commonPath || '.' === $commonPath) {
  24966. return var_export($to, true);
  24967. }
  24968. $commonPath = rtrim($commonPath, '/') . '/';
  24969. if (strpos($to, $from.'/') === 0) {
  24970. return '__DIR__ . '.var_export(substr($to, strlen($from)), true);
  24971. }
  24972. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/') + $directories;
  24973. if ($staticCode) {
  24974. $commonPathCode = "__DIR__ . '".str_repeat('/..', $sourcePathDepth)."'";
  24975. } else {
  24976. $commonPathCode = str_repeat('dirname(', $sourcePathDepth).'__DIR__'.str_repeat(')', $sourcePathDepth);
  24977. }
  24978. $relTarget = substr($to, strlen($commonPath));
  24979. return $commonPathCode . (strlen($relTarget) ? '.' . var_export('/' . $relTarget, true) : '');
  24980. }
  24981. public function isAbsolutePath($path)
  24982. {
  24983. return substr($path, 0, 1) === '/' || substr($path, 1, 1) === ':';
  24984. }
  24985. public function size($path)
  24986. {
  24987. if (!file_exists($path)) {
  24988. throw new \RuntimeException("$path does not exist.");
  24989. }
  24990. if (is_dir($path)) {
  24991. return $this->directorySize($path);
  24992. }
  24993. return filesize($path);
  24994. }
  24995. public function normalizePath($path)
  24996. {
  24997. $parts = array();
  24998. $path = strtr($path, '\\', '/');
  24999. $prefix = '';
  25000. $absolute = false;
  25001. if (preg_match('{^( [0-9a-z]{2,}+: (?: // (?: [a-z]: )? )? | [a-z]: )}ix', $path, $match)) {
  25002. $prefix = $match[1];
  25003. $path = substr($path, strlen($prefix));
  25004. }
  25005. if (substr($path, 0, 1) === '/') {
  25006. $absolute = true;
  25007. $path = substr($path, 1);
  25008. }
  25009. $up = false;
  25010. foreach (explode('/', $path) as $chunk) {
  25011. if ('..' === $chunk && ($absolute || $up)) {
  25012. array_pop($parts);
  25013. $up = !(empty($parts) || '..' === end($parts));
  25014. } elseif ('.' !== $chunk && '' !== $chunk) {
  25015. $parts[] = $chunk;
  25016. $up = '..' !== $chunk;
  25017. }
  25018. }
  25019. return $prefix.($absolute ? '/' : '').implode('/', $parts);
  25020. }
  25021. public static function isLocalPath($path)
  25022. {
  25023. return (bool) preg_match('{^(file://(?!//)|/(?!/)|/?[a-z]:[\\\\/]|\.\.[\\\\/]|[a-z0-9_.-]+[\\\\/])}i', $path);
  25024. }
  25025. public static function getPlatformPath($path)
  25026. {
  25027. if (Platform::isWindows()) {
  25028. $path = preg_replace('{^(?:file:///([a-z]):?/)}i', 'file://$1:/', $path);
  25029. }
  25030. return preg_replace('{^file://}i', '', $path);
  25031. }
  25032. protected function directorySize($directory)
  25033. {
  25034. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  25035. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  25036. $size = 0;
  25037. foreach ($ri as $file) {
  25038. if ($file->isFile()) {
  25039. $size += $file->getSize();
  25040. }
  25041. }
  25042. return $size;
  25043. }
  25044. protected function getProcess()
  25045. {
  25046. return $this->processExecutor;
  25047. }
  25048. private function unlinkImplementation($path)
  25049. {
  25050. if (Platform::isWindows() && is_dir($path) && is_link($path)) {
  25051. return rmdir($path);
  25052. }
  25053. return unlink($path);
  25054. }
  25055. public function relativeSymlink($target, $link)
  25056. {
  25057. $cwd = getcwd();
  25058. $relativePath = $this->findShortestPath($link, $target);
  25059. chdir(dirname($link));
  25060. $result = @symlink($relativePath, $link);
  25061. chdir($cwd);
  25062. return $result;
  25063. }
  25064. public function isSymlinkedDirectory($directory)
  25065. {
  25066. if (!is_dir($directory)) {
  25067. return false;
  25068. }
  25069. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  25070. return is_link($resolved);
  25071. }
  25072. private function unlinkSymlinkedDirectory($directory)
  25073. {
  25074. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  25075. return $this->unlink($resolved);
  25076. }
  25077. private function resolveSymlinkedDirectorySymlink($pathname)
  25078. {
  25079. if (!is_dir($pathname)) {
  25080. return $pathname;
  25081. }
  25082. $resolved = rtrim($pathname, '/');
  25083. if (!strlen($resolved)) {
  25084. return $pathname;
  25085. }
  25086. return $resolved;
  25087. }
  25088. public function junction($target, $junction)
  25089. {
  25090. if (!Platform::isWindows()) {
  25091. throw new \LogicException(sprintf('Function %s is not available on non-Windows platform', __CLASS__));
  25092. }
  25093. if (!is_dir($target)) {
  25094. throw new IOException(sprintf('Cannot junction to "%s" as it is not a directory.', $target), 0, null, $target);
  25095. }
  25096. $cmd = sprintf(
  25097. 'mklink /J %s %s',
  25098. ProcessExecutor::escape(str_replace('/', DIRECTORY_SEPARATOR, $junction)),
  25099. ProcessExecutor::escape(realpath($target))
  25100. );
  25101. if ($this->getProcess()->execute($cmd, $output) !== 0) {
  25102. throw new IOException(sprintf('Failed to create junction to "%s" at "%s".', $target, $junction), 0, null, $target);
  25103. }
  25104. clearstatcache(true, $junction);
  25105. }
  25106. public function isJunction($junction)
  25107. {
  25108. if (!Platform::isWindows()) {
  25109. return false;
  25110. }
  25111. if (!is_dir($junction) || is_link($junction)) {
  25112. return false;
  25113. }
  25114. clearstatcache(true, $junction);
  25115. clearstatcache(false);
  25116. $stat = lstat($junction);
  25117. return !($stat['mode'] & 0xC000);
  25118. }
  25119. public function removeJunction($junction)
  25120. {
  25121. if (!Platform::isWindows()) {
  25122. return false;
  25123. }
  25124. $junction = rtrim(str_replace('/', DIRECTORY_SEPARATOR, $junction), DIRECTORY_SEPARATOR);
  25125. if (!$this->isJunction($junction)) {
  25126. throw new IOException(sprintf('%s is not a junction and thus cannot be removed as one', $junction));
  25127. }
  25128. $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape($junction));
  25129. clearstatcache(true, $junction);
  25130. return ($this->getProcess()->execute($cmd, $output) === 0);
  25131. }
  25132. }
  25133. <?php
  25134. namespace Composer\Util;
  25135. use Composer\Config;
  25136. use Composer\IO\IOInterface;
  25137. class Git
  25138. {
  25139. private static $version;
  25140. protected $io;
  25141. protected $config;
  25142. protected $process;
  25143. protected $filesystem;
  25144. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process, Filesystem $fs)
  25145. {
  25146. $this->io = $io;
  25147. $this->config = $config;
  25148. $this->process = $process;
  25149. $this->filesystem = $fs;
  25150. }
  25151. public function runCommand($commandCallable, $url, $cwd, $initialClone = false)
  25152. {
  25153. $this->config->prohibitUrlByConfig($url, $this->io);
  25154. if ($initialClone) {
  25155. $origCwd = $cwd;
  25156. $cwd = null;
  25157. }
  25158. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $url)) {
  25159. throw new \InvalidArgumentException('The source URL ' . $url . ' is invalid, ssh URLs should have a port number after ":".' . "\n" . 'Use ssh://git@example.com:22/path or just git@example.com:path if you do not want to provide a password or custom port.');
  25160. }
  25161. if (!$initialClone) {
  25162. $this->process->execute('git remote -v', $output, $cwd);
  25163. if (preg_match('{^(?:composer|origin)\s+https?://(.+):(.+)@([^/]+)}im', $output, $match)) {
  25164. $this->io->setAuthentication($match[3], rawurldecode($match[1]), rawurldecode($match[2]));
  25165. }
  25166. }
  25167. $protocols = $this->config->get('github-protocols');
  25168. if (!is_array($protocols)) {
  25169. throw new \RuntimeException('Config value "github-protocols" must be an array, got ' . gettype($protocols));
  25170. }
  25171. if (preg_match('{^(?:https?|git)://' . self::getGitHubDomainsRegex($this->config) . '/(.*)}', $url, $match)) {
  25172. $messages = array();
  25173. foreach ($protocols as $protocol) {
  25174. if ('ssh' === $protocol) {
  25175. $protoUrl = "git@" . $match[1] . ":" . $match[2];
  25176. } else {
  25177. $protoUrl = $protocol . "://" . $match[1] . "/" . $match[2];
  25178. }
  25179. if (0 === $this->process->execute(call_user_func($commandCallable, $protoUrl), $ignoredOutput, $cwd)) {
  25180. return;
  25181. }
  25182. $messages[] = '- ' . $protoUrl . "\n" . preg_replace('#^#m', ' ', $this->process->getErrorOutput());
  25183. if ($initialClone) {
  25184. $this->filesystem->removeDirectory($origCwd);
  25185. }
  25186. }
  25187. $this->throwException('Failed to clone ' . $url . ' via ' . implode(', ', $protocols) . ' protocols, aborting.' . "\n\n" . implode("\n", $messages), $url);
  25188. }
  25189. $bypassSshForGitHub = preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url) && !in_array('ssh', $protocols, true);
  25190. $command = call_user_func($commandCallable, $url);
  25191. $auth = null;
  25192. if ($bypassSshForGitHub || 0 !== $this->process->execute($command, $ignoredOutput, $cwd)) {
  25193. if (preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url, $match)) {
  25194. if (!$this->io->hasAuthentication($match[1])) {
  25195. $gitHubUtil = new GitHub($this->io, $this->config, $this->process);
  25196. $message = 'Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos';
  25197. if (!$gitHubUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  25198. $gitHubUtil->authorizeOAuthInteractively($match[1], $message);
  25199. }
  25200. }
  25201. if ($this->io->hasAuthentication($match[1])) {
  25202. $auth = $this->io->getAuthentication($match[1]);
  25203. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  25204. $command = call_user_func($commandCallable, $authUrl);
  25205. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25206. return;
  25207. }
  25208. }
  25209. } elseif (preg_match('{^https://(bitbucket\.org)/(.*)(\.git)?$}U', $url, $match)) {
  25210. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process);
  25211. if (!$this->io->hasAuthentication($match[1])) {
  25212. $message = 'Enter your Bitbucket credentials to access private repos';
  25213. if (!$bitbucketUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  25214. $bitbucketUtil->authorizeOAuthInteractively($match[1], $message);
  25215. $accessToken = $bitbucketUtil->getToken();
  25216. $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
  25217. }
  25218. } else {
  25219. $auth = $this->io->getAuthentication($match[1]);
  25220. if ($auth['username'] !== 'x-token-auth') {
  25221. $accessToken = $bitbucketUtil->requestToken($match[1], $auth['username'], $auth['password']);
  25222. if (! empty($accessToken)) {
  25223. $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
  25224. }
  25225. }
  25226. }
  25227. if ($this->io->hasAuthentication($match[1])) {
  25228. $auth = $this->io->getAuthentication($match[1]);
  25229. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  25230. $command = call_user_func($commandCallable, $authUrl);
  25231. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25232. return;
  25233. }
  25234. } else {
  25235. $sshUrl = 'git@bitbucket.org:' . $match[2] . '.git';
  25236. $this->io->writeError(' No bitbucket authentication configured. Falling back to ssh.');
  25237. $command = call_user_func($commandCallable, $sshUrl);
  25238. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25239. return;
  25240. }
  25241. }
  25242. } elseif ($this->isAuthenticationFailure($url, $match)) {
  25243. if (strpos($match[2], '@')) {
  25244. list($authParts, $match[2]) = explode('@', $match[2], 2);
  25245. }
  25246. $storeAuth = false;
  25247. if ($this->io->hasAuthentication($match[2])) {
  25248. $auth = $this->io->getAuthentication($match[2]);
  25249. } elseif ($this->io->isInteractive()) {
  25250. $defaultUsername = null;
  25251. if (isset($authParts) && $authParts) {
  25252. if (false !== strpos($authParts, ':')) {
  25253. list($defaultUsername, ) = explode(':', $authParts, 2);
  25254. } else {
  25255. $defaultUsername = $authParts;
  25256. }
  25257. }
  25258. $this->io->writeError(' Authentication required (<info>' . parse_url($url, PHP_URL_HOST) . '</info>):');
  25259. $auth = array(
  25260. 'username' => $this->io->ask(' Username: ', $defaultUsername),
  25261. 'password' => $this->io->askAndHideAnswer(' Password: '),
  25262. );
  25263. $storeAuth = $this->config->get('store-auths');
  25264. }
  25265. if ($auth) {
  25266. $authUrl = $match[1] . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[2] . $match[3];
  25267. $command = call_user_func($commandCallable, $authUrl);
  25268. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25269. $this->io->setAuthentication($match[2], $auth['username'], $auth['password']);
  25270. $authHelper = new AuthHelper($this->io, $this->config);
  25271. $authHelper->storeAuth($match[2], $storeAuth);
  25272. return;
  25273. }
  25274. }
  25275. }
  25276. if ($initialClone) {
  25277. $this->filesystem->removeDirectory($origCwd);
  25278. }
  25279. $this->throwException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput(), $url);
  25280. }
  25281. }
  25282. public function syncMirror($url, $dir)
  25283. {
  25284. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  25285. try {
  25286. $commandCallable = function ($url) {
  25287. return sprintf('git remote set-url origin %s && git remote update --prune origin', ProcessExecutor::escape($url));
  25288. };
  25289. $this->runCommand($commandCallable, $url, $dir);
  25290. } catch (\Exception $e) {
  25291. return false;
  25292. }
  25293. return true;
  25294. }
  25295. $this->filesystem->removeDirectory($dir);
  25296. $commandCallable = function ($url) use ($dir) {
  25297. return sprintf('git clone --mirror %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($dir));
  25298. };
  25299. $this->runCommand($commandCallable, $url, $dir, true);
  25300. return true;
  25301. }
  25302. public function fetchRefOrSyncMirror($url, $dir, $ref)
  25303. {
  25304. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  25305. $escapedRef = ProcessExecutor::escape($ref.'^{commit}');
  25306. $exitCode = $this->process->execute(sprintf('git rev-parse --quiet --verify %s', $escapedRef), $output, $dir);
  25307. if ($exitCode === 0) {
  25308. return true;
  25309. }
  25310. }
  25311. $this->syncMirror($url, $dir);
  25312. return false;
  25313. }
  25314. private function isAuthenticationFailure($url, &$match)
  25315. {
  25316. if (!preg_match('{^(https?://)([^/]+)(.*)$}i', $url, $match)) {
  25317. return false;
  25318. }
  25319. $authFailures = array(
  25320. 'fatal: Authentication failed',
  25321. 'remote error: Invalid username or password.',
  25322. 'error: 401 Unauthorized',
  25323. 'fatal: unable to access',
  25324. 'fatal: could not read Username',
  25325. );
  25326. $errorOutput = $this->process->getErrorOutput();
  25327. foreach ($authFailures as $authFailure) {
  25328. if (strpos($errorOutput, $authFailure) !== false) {
  25329. return true;
  25330. }
  25331. }
  25332. return false;
  25333. }
  25334. public static function cleanEnv()
  25335. {
  25336. if (PHP_VERSION_ID < 50400 && ini_get('safe_mode') && false === strpos(ini_get('safe_mode_allowed_env_vars'), 'GIT_ASKPASS')) {
  25337. throw new \RuntimeException('safe_mode is enabled and safe_mode_allowed_env_vars does not contain GIT_ASKPASS, can not set env var. You can disable safe_mode with "-dsafe_mode=0" when running composer');
  25338. }
  25339. if (getenv('GIT_ASKPASS') !== 'echo') {
  25340. putenv('GIT_ASKPASS=echo');
  25341. unset($_SERVER['GIT_ASKPASS']);
  25342. }
  25343. if (getenv('GIT_DIR')) {
  25344. putenv('GIT_DIR');
  25345. unset($_SERVER['GIT_DIR']);
  25346. }
  25347. if (getenv('GIT_WORK_TREE')) {
  25348. putenv('GIT_WORK_TREE');
  25349. unset($_SERVER['GIT_WORK_TREE']);
  25350. }
  25351. if (getenv('LANGUAGE') !== 'C') {
  25352. putenv('LANGUAGE=C');
  25353. }
  25354. putenv("DYLD_LIBRARY_PATH");
  25355. unset($_SERVER['DYLD_LIBRARY_PATH']);
  25356. }
  25357. public static function getGitHubDomainsRegex(Config $config)
  25358. {
  25359. return '(' . implode('|', array_map('preg_quote', $config->get('github-domains'))) . ')';
  25360. }
  25361. public static function sanitizeUrl($message)
  25362. {
  25363. return preg_replace_callback('{://(?P<user>[^@]+?):(?P<password>.+?)@}', function ($m) {
  25364. if (preg_match('{^[a-f0-9]{12,}$}', $m[1])) {
  25365. return '://***:***@';
  25366. }
  25367. return '://' . $m[1] . ':***@';
  25368. }, $message);
  25369. }
  25370. private function throwException($message, $url)
  25371. {
  25372. clearstatcache();
  25373. if (0 !== $this->process->execute('git --version', $ignoredOutput)) {
  25374. throw new \RuntimeException(self::sanitizeUrl('Failed to clone ' . $url . ', git was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput()));
  25375. }
  25376. throw new \RuntimeException(self::sanitizeUrl($message));
  25377. }
  25378. public function getVersion()
  25379. {
  25380. if (isset(self::$version)) {
  25381. return self::$version;
  25382. }
  25383. if (0 !== $this->process->execute('git --version', $output)) {
  25384. return;
  25385. }
  25386. if (preg_match('/^git version (\d+(?:\.\d+)+)/m', $output, $matches)) {
  25387. return self::$version = $matches[1];
  25388. }
  25389. }
  25390. }
  25391. <?php
  25392. namespace Composer\Util;
  25393. use Composer\Factory;
  25394. use Composer\IO\IOInterface;
  25395. use Composer\Config;
  25396. use Composer\Downloader\TransportException;
  25397. class GitHub
  25398. {
  25399. protected $io;
  25400. protected $config;
  25401. protected $process;
  25402. protected $remoteFilesystem;
  25403. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  25404. {
  25405. $this->io = $io;
  25406. $this->config = $config;
  25407. $this->process = $process ?: new ProcessExecutor($io);
  25408. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  25409. }
  25410. public function authorizeOAuth($originUrl)
  25411. {
  25412. if (!in_array($originUrl, $this->config->get('github-domains'))) {
  25413. return false;
  25414. }
  25415. if (0 === $this->process->execute('git config github.accesstoken', $output)) {
  25416. $this->io->setAuthentication($originUrl, trim($output), 'x-oauth-basic');
  25417. return true;
  25418. }
  25419. return false;
  25420. }
  25421. public function authorizeOAuthInteractively($originUrl, $message = null)
  25422. {
  25423. if ($message) {
  25424. $this->io->writeError($message);
  25425. }
  25426. $note = 'Composer';
  25427. if ($this->config->get('github-expose-hostname') === true && 0 === $this->process->execute('hostname', $output)) {
  25428. $note .= ' on ' . trim($output);
  25429. }
  25430. $note .= ' ' . date('Y-m-d Hi');
  25431. $url = 'https://'.$originUrl.'/settings/tokens/new?scopes=repo&description=' . str_replace('%20', '+', rawurlencode($note));
  25432. $this->io->writeError(sprintf('Head to %s', $url));
  25433. $this->io->writeError(sprintf('to retrieve a token. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  25434. $token = trim($this->io->askAndHideAnswer('Token (hidden): '));
  25435. if (!$token) {
  25436. $this->io->writeError('<warning>No token given, aborting.</warning>');
  25437. $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
  25438. return false;
  25439. }
  25440. $this->io->setAuthentication($originUrl, $token, 'x-oauth-basic');
  25441. try {
  25442. $apiUrl = ('github.com' === $originUrl) ? 'api.github.com/' : $originUrl . '/api/v3/';
  25443. $this->remoteFilesystem->getContents($originUrl, 'https://'. $apiUrl, false, array(
  25444. 'retry-auth-failure' => false,
  25445. ));
  25446. } catch (TransportException $e) {
  25447. if (in_array($e->getCode(), array(403, 401))) {
  25448. $this->io->writeError('<error>Invalid token provided.</error>');
  25449. $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
  25450. return false;
  25451. }
  25452. throw $e;
  25453. }
  25454. $this->config->getConfigSource()->removeConfigSetting('github-oauth.'.$originUrl);
  25455. $this->config->getAuthConfigSource()->addConfigSetting('github-oauth.'.$originUrl, $token);
  25456. $this->io->writeError('<info>Token stored successfully.</info>');
  25457. return true;
  25458. }
  25459. public function getRateLimit(array $headers)
  25460. {
  25461. $rateLimit = array(
  25462. 'limit' => '?',
  25463. 'reset' => '?',
  25464. );
  25465. foreach ($headers as $header) {
  25466. $header = trim($header);
  25467. if (false === strpos($header, 'X-RateLimit-')) {
  25468. continue;
  25469. }
  25470. list($type, $value) = explode(':', $header, 2);
  25471. switch ($type) {
  25472. case 'X-RateLimit-Limit':
  25473. $rateLimit['limit'] = (int) trim($value);
  25474. break;
  25475. case 'X-RateLimit-Reset':
  25476. $rateLimit['reset'] = date('Y-m-d H:i:s', (int) trim($value));
  25477. break;
  25478. }
  25479. }
  25480. return $rateLimit;
  25481. }
  25482. public function isRateLimited(array $headers)
  25483. {
  25484. foreach ($headers as $header) {
  25485. if (preg_match('{^X-RateLimit-Remaining: *0$}i', trim($header))) {
  25486. return true;
  25487. }
  25488. }
  25489. return false;
  25490. }
  25491. }
  25492. <?php
  25493. namespace Composer\Util;
  25494. use Composer\IO\IOInterface;
  25495. use Composer\Config;
  25496. use Composer\Factory;
  25497. use Composer\Downloader\TransportException;
  25498. use Composer\Json\JsonFile;
  25499. class GitLab
  25500. {
  25501. protected $io;
  25502. protected $config;
  25503. protected $process;
  25504. protected $remoteFilesystem;
  25505. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  25506. {
  25507. $this->io = $io;
  25508. $this->config = $config;
  25509. $this->process = $process ?: new ProcessExecutor($io);
  25510. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  25511. }
  25512. public function authorizeOAuth($originUrl)
  25513. {
  25514. if (!in_array($originUrl, $this->config->get('gitlab-domains'), true)) {
  25515. return false;
  25516. }
  25517. if (0 === $this->process->execute('git config gitlab.accesstoken', $output)) {
  25518. $this->io->setAuthentication($originUrl, trim($output), 'oauth2');
  25519. return true;
  25520. }
  25521. $authTokens = $this->config->get('gitlab-token');
  25522. if (isset($authTokens[$originUrl])) {
  25523. $this->io->setAuthentication($originUrl, $authTokens[$originUrl], 'private-token');
  25524. return true;
  25525. }
  25526. return false;
  25527. }
  25528. public function authorizeOAuthInteractively($scheme, $originUrl, $message = null)
  25529. {
  25530. if ($message) {
  25531. $this->io->writeError($message);
  25532. }
  25533. $this->io->writeError(sprintf('A token will be created and stored in "%s", your password will never be stored', $this->config->getAuthConfigSource()->getName()));
  25534. $this->io->writeError('To revoke access to this token you can visit '.$originUrl.'/profile/applications');
  25535. $attemptCounter = 0;
  25536. while ($attemptCounter++ < 5) {
  25537. try {
  25538. $response = $this->createToken($scheme, $originUrl);
  25539. } catch (TransportException $e) {
  25540. if (in_array($e->getCode(), array(403, 401))) {
  25541. if (401 === $e->getCode()) {
  25542. $this->io->writeError('Bad credentials.');
  25543. } else {
  25544. $this->io->writeError('Maximum number of login attempts exceeded. Please try again later.');
  25545. }
  25546. $this->io->writeError('You can also manually create a personal token at '.$scheme.'://'.$originUrl.'/profile/personal_access_tokens');
  25547. $this->io->writeError('Add it using "composer config --global --auth gitlab-token.'.$originUrl.' <token>"');
  25548. continue;
  25549. }
  25550. throw $e;
  25551. }
  25552. $this->io->setAuthentication($originUrl, $response['access_token'], 'oauth2');
  25553. $this->config->getAuthConfigSource()->addConfigSetting('gitlab-oauth.'.$originUrl, $response['access_token']);
  25554. return true;
  25555. }
  25556. throw new \RuntimeException('Invalid GitLab credentials 5 times in a row, aborting.');
  25557. }
  25558. private function createToken($scheme, $originUrl)
  25559. {
  25560. $username = $this->io->ask('Username: ');
  25561. $password = $this->io->askAndHideAnswer('Password: ');
  25562. $headers = array('Content-Type: application/x-www-form-urlencoded');
  25563. $apiUrl = $originUrl;
  25564. $data = http_build_query(array(
  25565. 'username' => $username,
  25566. 'password' => $password,
  25567. 'grant_type' => 'password',
  25568. ), null, '&');
  25569. $options = array(
  25570. 'retry-auth-failure' => false,
  25571. 'http' => array(
  25572. 'method' => 'POST',
  25573. 'header' => $headers,
  25574. 'content' => $data,
  25575. ),
  25576. );
  25577. $json = $this->remoteFilesystem->getContents($originUrl, $scheme.'://'.$apiUrl.'/oauth/token', false, $options);
  25578. $this->io->writeError('Token successfully created');
  25579. return JsonFile::parseJson($json);
  25580. }
  25581. }
  25582. <?php
  25583. namespace Composer\Util;
  25584. use Composer\Config;
  25585. use Composer\IO\IOInterface;
  25586. class Hg
  25587. {
  25588. private $io;
  25589. private $config;
  25590. private $process;
  25591. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process)
  25592. {
  25593. $this->io = $io;
  25594. $this->config = $config;
  25595. $this->process = $process;
  25596. }
  25597. public function runCommand($commandCallable, $url, $cwd)
  25598. {
  25599. $this->config->prohibitUrlByConfig($url, $this->io);
  25600. $command = call_user_func($commandCallable, $url);
  25601. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25602. return;
  25603. }
  25604. if (preg_match('{^(https?)://((.+)(?:\:(.+))?@)?([^/]+)(/.*)?}mi', $url, $match) && $this->io->hasAuthentication($match[5])) {
  25605. $auth = $this->io->getAuthentication($match[5]);
  25606. $authenticatedUrl = $match[1] . '://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[5] . (!empty($match[6]) ? $match[6] : null);
  25607. $command = call_user_func($commandCallable, $authenticatedUrl);
  25608. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25609. return;
  25610. }
  25611. $error = $this->process->getErrorOutput();
  25612. } else {
  25613. $error = 'The given URL (' . $url . ') does not match the required format (http(s)://(username:password@)example.com/path-to-repository)';
  25614. }
  25615. $this->throwException('Failed to clone ' . $url . ', ' . "\n\n" . $error, $url);
  25616. }
  25617. public static function sanitizeUrl($message)
  25618. {
  25619. return preg_replace_callback('{://(?P<user>[^@]+?):(?P<password>.+?)@}', function ($m) {
  25620. if (preg_match('{^[a-f0-9]{12,}$}', $m[1])) {
  25621. return '://***:***@';
  25622. }
  25623. return '://' . $m[1] . ':***@';
  25624. }, $message);
  25625. }
  25626. private function throwException($message, $url)
  25627. {
  25628. if (0 !== $this->process->execute('hg --version', $ignoredOutput)) {
  25629. throw new \RuntimeException(self::sanitizeUrl('Failed to clone ' . $url . ', hg was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput()));
  25630. }
  25631. throw new \RuntimeException(self::sanitizeUrl($message));
  25632. }
  25633. }
  25634. <?php
  25635. namespace Composer\Util;
  25636. use Composer\XdebugHandler\XdebugHandler;
  25637. class IniHelper
  25638. {
  25639. public static function getAll()
  25640. {
  25641. return XdebugHandler::getAllIniFiles();
  25642. }
  25643. public static function getMessage()
  25644. {
  25645. $paths = self::getAll();
  25646. if (empty($paths[0])) {
  25647. array_shift($paths);
  25648. }
  25649. $ini = array_shift($paths);
  25650. if (empty($ini)) {
  25651. return 'A php.ini file does not exist. You will have to create one.';
  25652. }
  25653. if (!empty($paths)) {
  25654. return 'Your command-line PHP is using multiple ini files. Run `php --ini` to show them.';
  25655. }
  25656. return 'The php.ini used by your command-line PHP is: '.$ini;
  25657. }
  25658. }
  25659. <?php
  25660. namespace Composer\Util;
  25661. class NoProxyPattern
  25662. {
  25663. protected $rules = array();
  25664. public function __construct($pattern)
  25665. {
  25666. $this->rules = preg_split("/[\s,]+/", $pattern);
  25667. }
  25668. public function test($url)
  25669. {
  25670. $host = parse_url($url, PHP_URL_HOST);
  25671. $port = parse_url($url, PHP_URL_PORT);
  25672. if (empty($port)) {
  25673. switch (parse_url($url, PHP_URL_SCHEME)) {
  25674. case 'http':
  25675. $port = 80;
  25676. break;
  25677. case 'https':
  25678. $port = 443;
  25679. break;
  25680. }
  25681. }
  25682. foreach ($this->rules as $rule) {
  25683. if ($rule == '*') {
  25684. return true;
  25685. }
  25686. $match = false;
  25687. list($ruleHost) = explode(':', $rule);
  25688. list($base) = explode('/', $ruleHost);
  25689. if (filter_var($base, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
  25690. if (!isset($ip)) {
  25691. $ip = gethostbyname($host);
  25692. }
  25693. if (strpos($ruleHost, '/') === false) {
  25694. $match = $ip === $ruleHost;
  25695. } else {
  25696. if ($ip === $host) {
  25697. $match = false;
  25698. } else {
  25699. $match = self::inCIDRBlock($ruleHost, $ip);
  25700. }
  25701. }
  25702. } else {
  25703. $haystack = '.' . trim($host, '.') . '.';
  25704. $needle = '.'. trim($ruleHost, '.') .'.';
  25705. $match = stripos(strrev($haystack), strrev($needle)) === 0;
  25706. }
  25707. if ($match && strpos($rule, ':') !== false) {
  25708. list(, $rulePort) = explode(':', $rule);
  25709. if (!empty($rulePort) && $port != $rulePort) {
  25710. $match = false;
  25711. }
  25712. }
  25713. if ($match) {
  25714. return true;
  25715. }
  25716. }
  25717. return false;
  25718. }
  25719. private static function inCIDRBlock($cidr, $ip)
  25720. {
  25721. list($base, $bits) = explode('/', $cidr);
  25722. list($a, $b, $c, $d) = explode('.', $base);
  25723. $i = ($a << 24) + ($b << 16) + ($c << 8) + $d;
  25724. $mask = $bits == 0 ? 0 : (~0 << (32 - $bits));
  25725. $low = $i & $mask;
  25726. $high = $i | (~$mask & 0xFFFFFFFF);
  25727. list($a, $b, $c, $d) = explode('.', $ip);
  25728. $check = ($a << 24) + ($b << 16) + ($c << 8) + $d;
  25729. return $check >= $low && $check <= $high;
  25730. }
  25731. }
  25732. <?php
  25733. namespace Composer\Util;
  25734. use Composer\IO\IOInterface;
  25735. use Symfony\Component\Process\Process;
  25736. class Perforce
  25737. {
  25738. protected $path;
  25739. protected $p4Depot;
  25740. protected $p4Client;
  25741. protected $p4User;
  25742. protected $p4Password;
  25743. protected $p4Port;
  25744. protected $p4Stream;
  25745. protected $p4ClientSpec;
  25746. protected $p4DepotType;
  25747. protected $p4Branch;
  25748. protected $process;
  25749. protected $uniquePerforceClientName;
  25750. protected $windowsFlag;
  25751. protected $commandResult;
  25752. protected $io;
  25753. protected $filesystem;
  25754. public function __construct($repoConfig, $port, $path, ProcessExecutor $process, $isWindows, IOInterface $io)
  25755. {
  25756. $this->windowsFlag = $isWindows;
  25757. $this->p4Port = $port;
  25758. $this->initializePath($path);
  25759. $this->process = $process;
  25760. $this->initialize($repoConfig);
  25761. $this->io = $io;
  25762. }
  25763. public static function create($repoConfig, $port, $path, ProcessExecutor $process, IOInterface $io)
  25764. {
  25765. return new Perforce($repoConfig, $port, $path, $process, Platform::isWindows(), $io);
  25766. }
  25767. public static function checkServerExists($url, ProcessExecutor $processExecutor)
  25768. {
  25769. $output = null;
  25770. return 0 === $processExecutor->execute('p4 -p ' . ProcessExecutor::escape($url) . ' info -s', $output);
  25771. }
  25772. public function initialize($repoConfig)
  25773. {
  25774. $this->uniquePerforceClientName = $this->generateUniquePerforceClientName();
  25775. if (!$repoConfig) {
  25776. return;
  25777. }
  25778. if (isset($repoConfig['unique_perforce_client_name'])) {
  25779. $this->uniquePerforceClientName = $repoConfig['unique_perforce_client_name'];
  25780. }
  25781. if (isset($repoConfig['depot'])) {
  25782. $this->p4Depot = $repoConfig['depot'];
  25783. }
  25784. if (isset($repoConfig['branch'])) {
  25785. $this->p4Branch = $repoConfig['branch'];
  25786. }
  25787. if (isset($repoConfig['p4user'])) {
  25788. $this->p4User = $repoConfig['p4user'];
  25789. } else {
  25790. $this->p4User = $this->getP4variable('P4USER');
  25791. }
  25792. if (isset($repoConfig['p4password'])) {
  25793. $this->p4Password = $repoConfig['p4password'];
  25794. }
  25795. }
  25796. public function initializeDepotAndBranch($depot, $branch)
  25797. {
  25798. if (isset($depot)) {
  25799. $this->p4Depot = $depot;
  25800. }
  25801. if (isset($branch)) {
  25802. $this->p4Branch = $branch;
  25803. }
  25804. }
  25805. public function generateUniquePerforceClientName()
  25806. {
  25807. return gethostname() . "_" . time();
  25808. }
  25809. public function cleanupClientSpec()
  25810. {
  25811. $client = $this->getClient();
  25812. $task = 'client -d ' . ProcessExecutor::escape($client);
  25813. $useP4Client = false;
  25814. $command = $this->generateP4Command($task, $useP4Client);
  25815. $this->executeCommand($command);
  25816. $clientSpec = $this->getP4ClientSpec();
  25817. $fileSystem = $this->getFilesystem();
  25818. $fileSystem->remove($clientSpec);
  25819. }
  25820. protected function executeCommand($command)
  25821. {
  25822. $this->commandResult = '';
  25823. return $this->process->execute($command, $this->commandResult);
  25824. }
  25825. public function getClient()
  25826. {
  25827. if (!isset($this->p4Client)) {
  25828. $cleanStreamName = str_replace(array('//', '/', '@'), array('', '_', ''), $this->getStream());
  25829. $this->p4Client = 'composer_perforce_' . $this->uniquePerforceClientName . '_' . $cleanStreamName;
  25830. }
  25831. return $this->p4Client;
  25832. }
  25833. protected function getPath()
  25834. {
  25835. return $this->path;
  25836. }
  25837. public function initializePath($path)
  25838. {
  25839. $this->path = $path;
  25840. $fs = $this->getFilesystem();
  25841. $fs->ensureDirectoryExists($path);
  25842. }
  25843. protected function getPort()
  25844. {
  25845. return $this->p4Port;
  25846. }
  25847. public function setStream($stream)
  25848. {
  25849. $this->p4Stream = $stream;
  25850. $index = strrpos($stream, '/');
  25851. if ($index > 2) {
  25852. $this->p4DepotType = 'stream';
  25853. }
  25854. }
  25855. public function isStream()
  25856. {
  25857. return (strcmp($this->p4DepotType, 'stream') === 0);
  25858. }
  25859. public function getStream()
  25860. {
  25861. if (!isset($this->p4Stream)) {
  25862. if ($this->isStream()) {
  25863. $this->p4Stream = '//' . $this->p4Depot . '/' . $this->p4Branch;
  25864. } else {
  25865. $this->p4Stream = '//' . $this->p4Depot;
  25866. }
  25867. }
  25868. return $this->p4Stream;
  25869. }
  25870. public function getStreamWithoutLabel($stream)
  25871. {
  25872. $index = strpos($stream, '@');
  25873. if ($index === false) {
  25874. return $stream;
  25875. }
  25876. return substr($stream, 0, $index);
  25877. }
  25878. public function getP4ClientSpec()
  25879. {
  25880. return $this->path . '/' . $this->getClient() . '.p4.spec';
  25881. }
  25882. public function getUser()
  25883. {
  25884. return $this->p4User;
  25885. }
  25886. public function setUser($user)
  25887. {
  25888. $this->p4User = $user;
  25889. }
  25890. public function queryP4User()
  25891. {
  25892. $this->getUser();
  25893. if (strlen($this->p4User) > 0) {
  25894. return;
  25895. }
  25896. $this->p4User = $this->getP4variable('P4USER');
  25897. if (strlen($this->p4User) > 0) {
  25898. return;
  25899. }
  25900. $this->p4User = $this->io->ask('Enter P4 User:');
  25901. if ($this->windowsFlag) {
  25902. $command = 'p4 set P4USER=' . $this->p4User;
  25903. } else {
  25904. $command = 'export P4USER=' . $this->p4User;
  25905. }
  25906. $this->executeCommand($command);
  25907. }
  25908. protected function getP4variable($name)
  25909. {
  25910. if ($this->windowsFlag) {
  25911. $command = 'p4 set';
  25912. $this->executeCommand($command);
  25913. $result = trim($this->commandResult);
  25914. $resArray = explode(PHP_EOL, $result);
  25915. foreach ($resArray as $line) {
  25916. $fields = explode('=', $line);
  25917. if (strcmp($name, $fields[0]) == 0) {
  25918. $index = strpos($fields[1], ' ');
  25919. if ($index === false) {
  25920. $value = $fields[1];
  25921. } else {
  25922. $value = substr($fields[1], 0, $index);
  25923. }
  25924. $value = trim($value);
  25925. return $value;
  25926. }
  25927. }
  25928. return null;
  25929. }
  25930. $command = 'echo $' . $name;
  25931. $this->executeCommand($command);
  25932. $result = trim($this->commandResult);
  25933. return $result;
  25934. }
  25935. public function queryP4Password()
  25936. {
  25937. if (isset($this->p4Password)) {
  25938. return $this->p4Password;
  25939. }
  25940. $password = $this->getP4variable('P4PASSWD');
  25941. if (strlen($password) <= 0) {
  25942. $password = $this->io->askAndHideAnswer('Enter password for Perforce user ' . $this->getUser() . ': ');
  25943. }
  25944. $this->p4Password = $password;
  25945. return $password;
  25946. }
  25947. public function generateP4Command($command, $useClient = true)
  25948. {
  25949. $p4Command = 'p4 ';
  25950. $p4Command = $p4Command . '-u ' . $this->getUser() . ' ';
  25951. if ($useClient) {
  25952. $p4Command = $p4Command . '-c ' . $this->getClient() . ' ';
  25953. }
  25954. $p4Command = $p4Command . '-p ' . $this->getPort() . ' ' . $command;
  25955. return $p4Command;
  25956. }
  25957. public function isLoggedIn()
  25958. {
  25959. $command = $this->generateP4Command('login -s', false);
  25960. $exitCode = $this->executeCommand($command);
  25961. if ($exitCode) {
  25962. $errorOutput = $this->process->getErrorOutput();
  25963. $index = strpos($errorOutput, $this->getUser());
  25964. if ($index === false) {
  25965. $index = strpos($errorOutput, 'p4');
  25966. if ($index === false) {
  25967. return false;
  25968. }
  25969. throw new \Exception('p4 command not found in path: ' . $errorOutput);
  25970. }
  25971. throw new \Exception('Invalid user name: ' . $this->getUser());
  25972. }
  25973. return true;
  25974. }
  25975. public function connectClient()
  25976. {
  25977. $p4CreateClientCommand = $this->generateP4Command(
  25978. 'client -i < ' . str_replace(" ", "\\ ", $this->getP4ClientSpec())
  25979. );
  25980. $this->executeCommand($p4CreateClientCommand);
  25981. }
  25982. public function syncCodeBase($sourceReference)
  25983. {
  25984. $prevDir = getcwd();
  25985. chdir($this->path);
  25986. $p4SyncCommand = $this->generateP4Command('sync -f ');
  25987. if (null !== $sourceReference) {
  25988. $p4SyncCommand = $p4SyncCommand . '@' . $sourceReference;
  25989. }
  25990. $this->executeCommand($p4SyncCommand);
  25991. chdir($prevDir);
  25992. }
  25993. public function writeClientSpecToFile($spec)
  25994. {
  25995. fwrite($spec, 'Client: ' . $this->getClient() . PHP_EOL . PHP_EOL);
  25996. fwrite($spec, 'Update: ' . date('Y/m/d H:i:s') . PHP_EOL . PHP_EOL);
  25997. fwrite($spec, 'Access: ' . date('Y/m/d H:i:s') . PHP_EOL);
  25998. fwrite($spec, 'Owner: ' . $this->getUser() . PHP_EOL . PHP_EOL);
  25999. fwrite($spec, 'Description:' . PHP_EOL);
  26000. fwrite($spec, ' Created by ' . $this->getUser() . ' from composer.' . PHP_EOL . PHP_EOL);
  26001. fwrite($spec, 'Root: ' . $this->getPath() . PHP_EOL . PHP_EOL);
  26002. fwrite($spec, 'Options: noallwrite noclobber nocompress unlocked modtime rmdir' . PHP_EOL . PHP_EOL);
  26003. fwrite($spec, 'SubmitOptions: revertunchanged' . PHP_EOL . PHP_EOL);
  26004. fwrite($spec, 'LineEnd: local' . PHP_EOL . PHP_EOL);
  26005. if ($this->isStream()) {
  26006. fwrite($spec, 'Stream:' . PHP_EOL);
  26007. fwrite($spec, ' ' . $this->getStreamWithoutLabel($this->p4Stream) . PHP_EOL);
  26008. } else {
  26009. fwrite(
  26010. $spec,
  26011. 'View: ' . $this->getStream() . '/... //' . $this->getClient() . '/... ' . PHP_EOL
  26012. );
  26013. }
  26014. }
  26015. public function writeP4ClientSpec()
  26016. {
  26017. $clientSpec = $this->getP4ClientSpec();
  26018. $spec = fopen($clientSpec, 'w');
  26019. try {
  26020. $this->writeClientSpecToFile($spec);
  26021. } catch (\Exception $e) {
  26022. fclose($spec);
  26023. throw $e;
  26024. }
  26025. fclose($spec);
  26026. }
  26027. protected function read($pipe, $name)
  26028. {
  26029. if (feof($pipe)) {
  26030. return;
  26031. }
  26032. $line = fgets($pipe);
  26033. while ($line !== false) {
  26034. $line = fgets($pipe);
  26035. }
  26036. return;
  26037. }
  26038. public function windowsLogin($password)
  26039. {
  26040. $command = $this->generateP4Command(' login -a');
  26041. $process = new Process($command, null, null, $password);
  26042. return $process->run();
  26043. }
  26044. public function p4Login()
  26045. {
  26046. $this->queryP4User();
  26047. if (!$this->isLoggedIn()) {
  26048. $password = $this->queryP4Password();
  26049. if ($this->windowsFlag) {
  26050. $this->windowsLogin($password);
  26051. } else {
  26052. $command = 'echo ' . ProcessExecutor::escape($password) . ' | ' . $this->generateP4Command(' login -a', false);
  26053. $exitCode = $this->executeCommand($command);
  26054. $result = trim($this->commandResult);
  26055. if ($exitCode) {
  26056. throw new \Exception("Error logging in:" . $this->process->getErrorOutput());
  26057. }
  26058. }
  26059. }
  26060. }
  26061. public function getComposerInformation($identifier)
  26062. {
  26063. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  26064. if (!$composerFileContent) {
  26065. return;
  26066. }
  26067. return json_decode($composerFileContent, true);
  26068. }
  26069. public function getFileContent($file, $identifier)
  26070. {
  26071. $path = $this->getFilePath($file, $identifier);
  26072. $command = $this->generateP4Command(' print ' . ProcessExecutor::escape($path));
  26073. $this->executeCommand($command);
  26074. $result = $this->commandResult;
  26075. if (!trim($result)) {
  26076. return null;
  26077. }
  26078. return $result;
  26079. }
  26080. public function getFilePath($file, $identifier)
  26081. {
  26082. $index = strpos($identifier, '@');
  26083. if ($index === false) {
  26084. $path = $identifier. '/' . $file;
  26085. return $path;
  26086. }
  26087. $path = substr($identifier, 0, $index) . '/' . $file . substr($identifier, $index);
  26088. $command = $this->generateP4Command(' files ' . ProcessExecutor::escape($path), false);
  26089. $this->executeCommand($command);
  26090. $result = $this->commandResult;
  26091. $index2 = strpos($result, 'no such file(s).');
  26092. if ($index2 === false) {
  26093. $index3 = strpos($result, 'change');
  26094. if ($index3 !== false) {
  26095. $phrase = trim(substr($result, $index3));
  26096. $fields = explode(' ', $phrase);
  26097. return substr($identifier, 0, $index) . '/' . $file . '@' . $fields[1];
  26098. }
  26099. }
  26100. return null;
  26101. }
  26102. public function getBranches()
  26103. {
  26104. $possibleBranches = array();
  26105. if (!$this->isStream()) {
  26106. $possibleBranches[$this->p4Branch] = $this->getStream();
  26107. } else {
  26108. $command = $this->generateP4Command('streams '.ProcessExecutor::escape('//' . $this->p4Depot . '/...'));
  26109. $this->executeCommand($command);
  26110. $result = $this->commandResult;
  26111. $resArray = explode(PHP_EOL, $result);
  26112. foreach ($resArray as $line) {
  26113. $resBits = explode(' ', $line);
  26114. if (count($resBits) > 4) {
  26115. $branch = preg_replace('/[^A-Za-z0-9 ]/', '', $resBits[4]);
  26116. $possibleBranches[$branch] = $resBits[1];
  26117. }
  26118. }
  26119. }
  26120. $command = $this->generateP4Command('changes '. ProcessExecutor::escape($this->getStream() . '/...'), false);
  26121. $this->executeCommand($command);
  26122. $result = $this->commandResult;
  26123. $resArray = explode(PHP_EOL, $result);
  26124. $lastCommit = $resArray[0];
  26125. $lastCommitArr = explode(' ', $lastCommit);
  26126. $lastCommitNum = $lastCommitArr[1];
  26127. $branches = array('master' => $possibleBranches[$this->p4Branch] . '@'. $lastCommitNum);
  26128. return $branches;
  26129. }
  26130. public function getTags()
  26131. {
  26132. $command = $this->generateP4Command('labels');
  26133. $this->executeCommand($command);
  26134. $result = $this->commandResult;
  26135. $resArray = explode(PHP_EOL, $result);
  26136. $tags = array();
  26137. foreach ($resArray as $line) {
  26138. $index = strpos($line, 'Label');
  26139. if (!($index === false)) {
  26140. $fields = explode(' ', $line);
  26141. $tags[$fields[1]] = $this->getStream() . '@' . $fields[1];
  26142. }
  26143. }
  26144. return $tags;
  26145. }
  26146. public function checkStream()
  26147. {
  26148. $command = $this->generateP4Command('depots', false);
  26149. $this->executeCommand($command);
  26150. $result = $this->commandResult;
  26151. $resArray = explode(PHP_EOL, $result);
  26152. foreach ($resArray as $line) {
  26153. $index = strpos($line, 'Depot');
  26154. if (!($index === false)) {
  26155. $fields = explode(' ', $line);
  26156. if (strcmp($this->p4Depot, $fields[1]) === 0) {
  26157. $this->p4DepotType = $fields[3];
  26158. return $this->isStream();
  26159. }
  26160. }
  26161. }
  26162. return false;
  26163. }
  26164. protected function getChangeList($reference)
  26165. {
  26166. $index = strpos($reference, '@');
  26167. if ($index === false) {
  26168. return null;
  26169. }
  26170. $label = substr($reference, $index);
  26171. $command = $this->generateP4Command(' changes -m1 ' . ProcessExecutor::escape($label));
  26172. $this->executeCommand($command);
  26173. $changes = $this->commandResult;
  26174. if (strpos($changes, 'Change') !== 0) {
  26175. return null;
  26176. }
  26177. $fields = explode(' ', $changes);
  26178. return $fields[1];
  26179. }
  26180. public function getCommitLogs($fromReference, $toReference)
  26181. {
  26182. $fromChangeList = $this->getChangeList($fromReference);
  26183. if ($fromChangeList === null) {
  26184. return null;
  26185. }
  26186. $toChangeList = $this->getChangeList($toReference);
  26187. if ($toChangeList === null) {
  26188. return null;
  26189. }
  26190. $index = strpos($fromReference, '@');
  26191. $main = substr($fromReference, 0, $index) . '/...';
  26192. $command = $this->generateP4Command('filelog ' . ProcessExecutor::escape($main . '@' . $fromChangeList. ',' . $toChangeList));
  26193. $this->executeCommand($command);
  26194. return $this->commandResult;
  26195. }
  26196. public function getFilesystem()
  26197. {
  26198. if (empty($this->filesystem)) {
  26199. $this->filesystem = new Filesystem($this->process);
  26200. }
  26201. return $this->filesystem;
  26202. }
  26203. public function setFilesystem(Filesystem $fs)
  26204. {
  26205. $this->filesystem = $fs;
  26206. }
  26207. }
  26208. <?php
  26209. namespace Composer\Util;
  26210. class Platform
  26211. {
  26212. public static function expandPath($path)
  26213. {
  26214. if (preg_match('#^~[\\/]#', $path)) {
  26215. return self::getUserDirectory() . substr($path, 1);
  26216. }
  26217. return preg_replace_callback('#^(\$|(?P<percent>%))(?P<var>\w++)(?(percent)%)(?P<path>.*)#', function ($matches) {
  26218. if (Platform::isWindows() && $matches['var'] == 'HOME') {
  26219. return (getenv('HOME') ?: getenv('USERPROFILE')) . $matches['path'];
  26220. }
  26221. return getenv($matches['var']) . $matches['path'];
  26222. }, $path);
  26223. }
  26224. public static function getUserDirectory()
  26225. {
  26226. if (false !== ($home = getenv('HOME'))) {
  26227. return $home;
  26228. }
  26229. if (self::isWindows() && false !== ($home = getenv('USERPROFILE'))) {
  26230. return $home;
  26231. }
  26232. if (function_exists('posix_getuid') && function_exists('posix_getpwuid')) {
  26233. $info = posix_getpwuid(posix_getuid());
  26234. return $info['dir'];
  26235. }
  26236. throw new \RuntimeException('Could not determine user directory');
  26237. }
  26238. public static function isWindows()
  26239. {
  26240. return defined('PHP_WINDOWS_VERSION_BUILD');
  26241. }
  26242. public static function strlen($str)
  26243. {
  26244. static $useMbString = null;
  26245. if (null === $useMbString) {
  26246. $useMbString = function_exists('mb_strlen') && ini_get('mbstring.func_overload');
  26247. }
  26248. if ($useMbString) {
  26249. return mb_strlen($str, '8bit');
  26250. }
  26251. return strlen($str);
  26252. }
  26253. }
  26254. <?php
  26255. namespace Composer\Util;
  26256. use Composer\IO\IOInterface;
  26257. use Symfony\Component\Process\Process;
  26258. use Symfony\Component\Process\ProcessUtils;
  26259. class ProcessExecutor
  26260. {
  26261. protected static $timeout = 300;
  26262. protected $captureOutput;
  26263. protected $errorOutput;
  26264. protected $io;
  26265. public function __construct(IOInterface $io = null)
  26266. {
  26267. $this->io = $io;
  26268. }
  26269. public function execute($command, &$output = null, $cwd = null)
  26270. {
  26271. if ($this->io && $this->io->isDebug()) {
  26272. $safeCommand = preg_replace_callback('{://(?P<user>[^:/\s]+):(?P<password>[^@\s/]+)@}i', function ($m) {
  26273. if (preg_match('{^[a-f0-9]{12,}$}', $m['user'])) {
  26274. return '://***:***@';
  26275. }
  26276. return '://'.$m['user'].':***@';
  26277. }, $command);
  26278. $this->io->writeError('Executing command ('.($cwd ?: 'CWD').'): '.$safeCommand);
  26279. }
  26280. if (null === $cwd && Platform::isWindows() && false !== strpos($command, 'git') && getcwd()) {
  26281. $cwd = realpath(getcwd());
  26282. }
  26283. $this->captureOutput = count(func_get_args()) > 1;
  26284. $this->errorOutput = null;
  26285. $process = new Process($command, $cwd, null, null, static::getTimeout());
  26286. $callback = is_callable($output) ? $output : array($this, 'outputHandler');
  26287. $process->run($callback);
  26288. if ($this->captureOutput && !is_callable($output)) {
  26289. $output = $process->getOutput();
  26290. }
  26291. $this->errorOutput = $process->getErrorOutput();
  26292. return $process->getExitCode();
  26293. }
  26294. public function splitLines($output)
  26295. {
  26296. $output = trim($output);
  26297. return ((string) $output === '') ? array() : preg_split('{\r?\n}', $output);
  26298. }
  26299. public function getErrorOutput()
  26300. {
  26301. return $this->errorOutput;
  26302. }
  26303. public function outputHandler($type, $buffer)
  26304. {
  26305. if ($this->captureOutput) {
  26306. return;
  26307. }
  26308. if (null === $this->io) {
  26309. echo $buffer;
  26310. return;
  26311. }
  26312. if (Process::ERR === $type) {
  26313. $this->io->writeError($buffer, false);
  26314. } else {
  26315. $this->io->write($buffer, false);
  26316. }
  26317. }
  26318. public static function getTimeout()
  26319. {
  26320. return static::$timeout;
  26321. }
  26322. public static function setTimeout($timeout)
  26323. {
  26324. static::$timeout = $timeout;
  26325. }
  26326. public static function escape($argument)
  26327. {
  26328. return self::escapeArgument($argument);
  26329. }
  26330. private static function escapeArgument($argument)
  26331. {
  26332. if ('\\' === DIRECTORY_SEPARATOR) {
  26333. if ('' === $argument) {
  26334. return escapeshellarg($argument);
  26335. }
  26336. $escapedArgument = '';
  26337. $quote = false;
  26338. foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
  26339. if ('"' === $part) {
  26340. $escapedArgument .= '\\"';
  26341. } elseif (self::isSurroundedBy($part, '%')) {
  26342. $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%';
  26343. } else {
  26344. if ('\\' === substr($part, -1)) {
  26345. $part .= '\\';
  26346. }
  26347. $quote = true;
  26348. $escapedArgument .= $part;
  26349. }
  26350. }
  26351. if ($quote) {
  26352. $escapedArgument = '"'.$escapedArgument.'"';
  26353. }
  26354. return $escapedArgument;
  26355. }
  26356. return "'".str_replace("'", "'\\''", $argument)."'";
  26357. }
  26358. private static function isSurroundedBy($arg, $char)
  26359. {
  26360. return 2 < strlen($arg) && $char === $arg[0] && $char === $arg[strlen($arg) - 1];
  26361. }
  26362. }
  26363. <?php
  26364. namespace Composer\Util;
  26365. use Composer\Config;
  26366. use Composer\IO\IOInterface;
  26367. use Composer\Downloader\TransportException;
  26368. use Composer\CaBundle\CaBundle;
  26369. use Psr\Log\LoggerInterface;
  26370. class RemoteFilesystem
  26371. {
  26372. private $io;
  26373. private $config;
  26374. private $scheme;
  26375. private $bytesMax;
  26376. private $originUrl;
  26377. private $fileUrl;
  26378. private $fileName;
  26379. private $retry;
  26380. private $progress;
  26381. private $lastProgress;
  26382. private $options = array();
  26383. private $peerCertificateMap = array();
  26384. private $disableTls = false;
  26385. private $retryAuthFailure;
  26386. private $lastHeaders;
  26387. private $storeAuth;
  26388. private $degradedMode = false;
  26389. private $redirects;
  26390. private $maxRedirects = 20;
  26391. public function __construct(IOInterface $io, Config $config = null, array $options = array(), $disableTls = false)
  26392. {
  26393. $this->io = $io;
  26394. if ($disableTls === false) {
  26395. $this->options = $this->getTlsDefaults($options);
  26396. } else {
  26397. $this->disableTls = true;
  26398. }
  26399. $this->options = array_replace_recursive($this->options, $options);
  26400. $this->config = $config;
  26401. }
  26402. public function copy($originUrl, $fileUrl, $fileName, $progress = true, $options = array())
  26403. {
  26404. return $this->get($originUrl, $fileUrl, $options, $fileName, $progress);
  26405. }
  26406. public function getContents($originUrl, $fileUrl, $progress = true, $options = array())
  26407. {
  26408. return $this->get($originUrl, $fileUrl, $options, null, $progress);
  26409. }
  26410. public function getOptions()
  26411. {
  26412. return $this->options;
  26413. }
  26414. public function setOptions(array $options)
  26415. {
  26416. $this->options = array_replace_recursive($this->options, $options);
  26417. }
  26418. public function isTlsDisabled()
  26419. {
  26420. return $this->disableTls === true;
  26421. }
  26422. public function getLastHeaders()
  26423. {
  26424. return $this->lastHeaders;
  26425. }
  26426. public function findHeaderValue(array $headers, $name)
  26427. {
  26428. $value = null;
  26429. foreach ($headers as $header) {
  26430. if (preg_match('{^'.$name.':\s*(.+?)\s*$}i', $header, $match)) {
  26431. $value = $match[1];
  26432. } elseif (preg_match('{^HTTP/}i', $header)) {
  26433. $value = null;
  26434. }
  26435. }
  26436. return $value;
  26437. }
  26438. public function findStatusCode(array $headers)
  26439. {
  26440. $value = null;
  26441. foreach ($headers as $header) {
  26442. if (preg_match('{^HTTP/\S+ (\d+)}i', $header, $match)) {
  26443. $value = (int) $match[1];
  26444. }
  26445. }
  26446. return $value;
  26447. }
  26448. public function findStatusMessage(array $headers)
  26449. {
  26450. $value = null;
  26451. foreach ($headers as $header) {
  26452. if (preg_match('{^HTTP/\S+ \d+}i', $header)) {
  26453. $value = $header;
  26454. }
  26455. }
  26456. return $value;
  26457. }
  26458. protected function get($originUrl, $fileUrl, $additionalOptions = array(), $fileName = null, $progress = true)
  26459. {
  26460. if (strpos($originUrl, '.github.com') === (strlen($originUrl) - 11)) {
  26461. $originUrl = 'github.com';
  26462. }
  26463. if (
  26464. $this->config
  26465. && is_array($this->config->get('gitlab-domains'))
  26466. && false === strpos($originUrl, '/')
  26467. && !in_array($originUrl, $this->config->get('gitlab-domains'))
  26468. ) {
  26469. foreach ($this->config->get('gitlab-domains') as $gitlabDomain) {
  26470. if (0 === strpos($gitlabDomain, $originUrl)) {
  26471. $originUrl = $gitlabDomain;
  26472. break;
  26473. }
  26474. }
  26475. unset($gitlabDomain);
  26476. }
  26477. $this->scheme = parse_url($fileUrl, PHP_URL_SCHEME);
  26478. $this->bytesMax = 0;
  26479. $this->originUrl = $originUrl;
  26480. $this->fileUrl = $fileUrl;
  26481. $this->fileName = $fileName;
  26482. $this->progress = $progress;
  26483. $this->lastProgress = null;
  26484. $this->retryAuthFailure = true;
  26485. $this->lastHeaders = array();
  26486. $this->redirects = 1;
  26487. if (preg_match('{^https?://([^:/]+):([^@/]+)@([^/]+)}i', $fileUrl, $match)) {
  26488. $this->io->setAuthentication($originUrl, rawurldecode($match[1]), rawurldecode($match[2]));
  26489. }
  26490. $tempAdditionalOptions = $additionalOptions;
  26491. if (isset($tempAdditionalOptions['retry-auth-failure'])) {
  26492. $this->retryAuthFailure = (bool) $tempAdditionalOptions['retry-auth-failure'];
  26493. unset($tempAdditionalOptions['retry-auth-failure']);
  26494. }
  26495. $isRedirect = false;
  26496. if (isset($tempAdditionalOptions['redirects'])) {
  26497. $this->redirects = $tempAdditionalOptions['redirects'];
  26498. $isRedirect = true;
  26499. unset($tempAdditionalOptions['redirects']);
  26500. }
  26501. $options = $this->getOptionsForUrl($originUrl, $tempAdditionalOptions);
  26502. unset($tempAdditionalOptions);
  26503. $origFileUrl = $fileUrl;
  26504. if (isset($options['github-token'])) {
  26505. if (preg_match('{^https?://([a-z0-9-]+\.)*github\.com/}', $fileUrl)) {
  26506. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['github-token'];
  26507. }
  26508. unset($options['github-token']);
  26509. }
  26510. if (isset($options['gitlab-token'])) {
  26511. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['gitlab-token'];
  26512. unset($options['gitlab-token']);
  26513. }
  26514. if (isset($options['http'])) {
  26515. $options['http']['ignore_errors'] = true;
  26516. }
  26517. if ($this->degradedMode && substr($fileUrl, 0, 26) === 'http://repo.packagist.org/') {
  26518. $fileUrl = 'http://' . gethostbyname('repo.packagist.org') . substr($fileUrl, 20);
  26519. $degradedPackagist = true;
  26520. }
  26521. $ctx = StreamContextFactory::getContext($fileUrl, $options, array('notification' => array($this, 'callbackGet')));
  26522. $actualContextOptions = stream_context_get_options($ctx);
  26523. $usingProxy = !empty($actualContextOptions['http']['proxy']) ? ' using proxy ' . $actualContextOptions['http']['proxy'] : '';
  26524. $this->io->writeError((substr($origFileUrl, 0, 4) === 'http' ? 'Downloading ' : 'Reading ') . $origFileUrl . $usingProxy, true, IOInterface::DEBUG);
  26525. unset($origFileUrl, $actualContextOptions);
  26526. if ((!preg_match('{^http://(repo\.)?packagist\.org/p/}', $fileUrl) || (false === strpos($fileUrl, '$') && false === strpos($fileUrl, '%24'))) && empty($degradedPackagist) && $this->config) {
  26527. $this->config->prohibitUrlByConfig($fileUrl, $this->io);
  26528. }
  26529. if ($this->progress && !$isRedirect) {
  26530. $this->io->writeError("Downloading (<comment>connecting...</comment>)", false);
  26531. }
  26532. $errorMessage = '';
  26533. $errorCode = 0;
  26534. $result = false;
  26535. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  26536. if ($errorMessage) {
  26537. $errorMessage .= "\n";
  26538. }
  26539. $errorMessage .= preg_replace('{^file_get_contents\(.*?\): }', '', $msg);
  26540. });
  26541. try {
  26542. $result = $this->getRemoteContents($originUrl, $fileUrl, $ctx, $http_response_header);
  26543. if (!empty($http_response_header[0])) {
  26544. $statusCode = $this->findStatusCode($http_response_header);
  26545. if (in_array($statusCode, array(401, 403)) && $this->retryAuthFailure) {
  26546. $warning = null;
  26547. if ($this->findHeaderValue($http_response_header, 'content-type') === 'application/json') {
  26548. $data = json_decode($result, true);
  26549. if (!empty($data['warning'])) {
  26550. $warning = $data['warning'];
  26551. }
  26552. }
  26553. $this->promptAuthAndRetry($statusCode, $this->findStatusMessage($http_response_header), $warning, $http_response_header);
  26554. }
  26555. }
  26556. $contentLength = !empty($http_response_header[0]) ? $this->findHeaderValue($http_response_header, 'content-length') : null;
  26557. if ($contentLength && Platform::strlen($result) < $contentLength) {
  26558. $e = new TransportException('Content-Length mismatch, received '.Platform::strlen($result).' bytes out of the expected '.$contentLength);
  26559. $e->setHeaders($http_response_header);
  26560. $e->setStatusCode($this->findStatusCode($http_response_header));
  26561. $e->setResponse($result);
  26562. $this->io->writeError('Content-Length mismatch, received '.Platform::strlen($result).' out of '.$contentLength.' bytes: (' . base64_encode($result).')', true, IOInterface::DEBUG);
  26563. throw $e;
  26564. }
  26565. if (PHP_VERSION_ID < 50600 && !empty($options['ssl']['peer_fingerprint'])) {
  26566. $params = stream_context_get_params($ctx);
  26567. $expectedPeerFingerprint = $options['ssl']['peer_fingerprint'];
  26568. $peerFingerprint = TlsHelper::getCertificateFingerprint($params['options']['ssl']['peer_certificate']);
  26569. if ($expectedPeerFingerprint !== $peerFingerprint) {
  26570. throw new TransportException('Peer fingerprint did not match');
  26571. }
  26572. }
  26573. } catch (\Exception $e) {
  26574. if ($e instanceof TransportException && !empty($http_response_header[0])) {
  26575. $e->setHeaders($http_response_header);
  26576. $e->setStatusCode($this->findStatusCode($http_response_header));
  26577. }
  26578. if ($e instanceof TransportException && $result !== false) {
  26579. $e->setResponse($result);
  26580. }
  26581. $result = false;
  26582. }
  26583. if ($errorMessage && !filter_var(ini_get('allow_url_fopen'), FILTER_VALIDATE_BOOLEAN)) {
  26584. $errorMessage = 'allow_url_fopen must be enabled in php.ini ('.$errorMessage.')';
  26585. }
  26586. restore_error_handler();
  26587. if (isset($e) && !$this->retry) {
  26588. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  26589. $this->degradedMode = true;
  26590. $this->io->writeError('');
  26591. $this->io->writeError(array(
  26592. '<error>'.$e->getMessage().'</error>',
  26593. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  26594. ));
  26595. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  26596. }
  26597. throw $e;
  26598. }
  26599. $statusCode = null;
  26600. $contentType = null;
  26601. $locationHeader = null;
  26602. if (!empty($http_response_header[0])) {
  26603. $statusCode = $this->findStatusCode($http_response_header);
  26604. $contentType = $this->findHeaderValue($http_response_header, 'content-type');
  26605. $locationHeader = $this->findHeaderValue($http_response_header, 'location');
  26606. }
  26607. if ($originUrl === 'bitbucket.org'
  26608. && !$this->isPublicBitBucketDownload($fileUrl)
  26609. && substr($fileUrl, -4) === '.zip'
  26610. && (!$locationHeader || substr($locationHeader, -4) !== '.zip')
  26611. && $contentType && preg_match('{^text/html\b}i', $contentType)
  26612. ) {
  26613. $result = false;
  26614. if ($this->retryAuthFailure) {
  26615. $this->promptAuthAndRetry(401);
  26616. }
  26617. }
  26618. if ($statusCode === 404
  26619. && $this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)
  26620. && false !== strpos($fileUrl, 'archive.zip')
  26621. ) {
  26622. $result = false;
  26623. if ($this->retryAuthFailure) {
  26624. $this->promptAuthAndRetry(401);
  26625. }
  26626. }
  26627. $hasFollowedRedirect = false;
  26628. if ($statusCode >= 300 && $statusCode <= 399 && $statusCode !== 304 && $this->redirects < $this->maxRedirects) {
  26629. $hasFollowedRedirect = true;
  26630. $result = $this->handleRedirect($http_response_header, $additionalOptions, $result);
  26631. }
  26632. if ($statusCode && $statusCode >= 400 && $statusCode <= 599) {
  26633. if (!$this->retry) {
  26634. if ($this->progress && !$this->retry && !$isRedirect) {
  26635. $this->io->overwriteError("Downloading (<error>failed</error>)", false);
  26636. }
  26637. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded ('.$http_response_header[0].')', $statusCode);
  26638. $e->setHeaders($http_response_header);
  26639. $e->setResponse($result);
  26640. $e->setStatusCode($statusCode);
  26641. throw $e;
  26642. }
  26643. $result = false;
  26644. }
  26645. if ($this->progress && !$this->retry && !$isRedirect) {
  26646. $this->io->overwriteError("Downloading (".($result === false ? '<error>failed</error>' : '<comment>100%</comment>').")", false);
  26647. }
  26648. if ($result && extension_loaded('zlib') && substr($fileUrl, 0, 4) === 'http' && !$hasFollowedRedirect) {
  26649. $contentEncoding = $this->findHeaderValue($http_response_header, 'content-encoding');
  26650. $decode = $contentEncoding && 'gzip' === strtolower($contentEncoding);
  26651. if ($decode) {
  26652. try {
  26653. if (PHP_VERSION_ID >= 50400) {
  26654. $result = zlib_decode($result);
  26655. } else {
  26656. $result = file_get_contents('compress.zlib://data:application/octet-stream;base64,'.base64_encode($result));
  26657. }
  26658. if (!$result) {
  26659. throw new TransportException('Failed to decode zlib stream');
  26660. }
  26661. } catch (\Exception $e) {
  26662. if ($this->degradedMode) {
  26663. throw $e;
  26664. }
  26665. $this->degradedMode = true;
  26666. $this->io->writeError(array(
  26667. '',
  26668. '<error>Failed to decode response: '.$e->getMessage().'</error>',
  26669. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  26670. ));
  26671. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  26672. }
  26673. }
  26674. }
  26675. if (false !== $result && null !== $fileName && !$isRedirect) {
  26676. if ('' === $result) {
  26677. throw new TransportException('"'.$this->fileUrl.'" appears broken, and returned an empty 200 response');
  26678. }
  26679. $errorMessage = '';
  26680. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  26681. if ($errorMessage) {
  26682. $errorMessage .= "\n";
  26683. }
  26684. $errorMessage .= preg_replace('{^file_put_contents\(.*?\): }', '', $msg);
  26685. });
  26686. $result = (bool) file_put_contents($fileName, $result);
  26687. restore_error_handler();
  26688. if (false === $result) {
  26689. throw new TransportException('The "'.$this->fileUrl.'" file could not be written to '.$fileName.': '.$errorMessage);
  26690. }
  26691. }
  26692. if (false === $result && false !== strpos($errorMessage, 'Peer certificate') && PHP_VERSION_ID < 50600) {
  26693. if (CaBundle::isOpensslParseSafe()) {
  26694. $certDetails = $this->getCertificateCnAndFp($this->fileUrl, $options);
  26695. if ($certDetails) {
  26696. $this->peerCertificateMap[$this->getUrlAuthority($this->fileUrl)] = $certDetails;
  26697. $this->retry = true;
  26698. }
  26699. } else {
  26700. $this->io->writeError('');
  26701. $this->io->writeError(sprintf(
  26702. '<error>Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.</error>',
  26703. PHP_VERSION
  26704. ));
  26705. }
  26706. }
  26707. if ($this->retry) {
  26708. $this->retry = false;
  26709. $result = $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  26710. if ($this->storeAuth && $this->config) {
  26711. $authHelper = new AuthHelper($this->io, $this->config);
  26712. $authHelper->storeAuth($this->originUrl, $this->storeAuth);
  26713. $this->storeAuth = false;
  26714. }
  26715. return $result;
  26716. }
  26717. if (false === $result) {
  26718. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded: '.$errorMessage, $errorCode);
  26719. if (!empty($http_response_header[0])) {
  26720. $e->setHeaders($http_response_header);
  26721. }
  26722. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  26723. $this->degradedMode = true;
  26724. $this->io->writeError('');
  26725. $this->io->writeError(array(
  26726. '<error>'.$e->getMessage().'</error>',
  26727. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  26728. ));
  26729. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  26730. }
  26731. throw $e;
  26732. }
  26733. if (!empty($http_response_header[0])) {
  26734. $this->lastHeaders = $http_response_header;
  26735. }
  26736. return $result;
  26737. }
  26738. protected function getRemoteContents($originUrl, $fileUrl, $context, array &$responseHeaders = null)
  26739. {
  26740. try {
  26741. $e = null;
  26742. $result = file_get_contents($fileUrl, false, $context);
  26743. } catch (\Throwable $e) {
  26744. } catch (\Exception $e) {
  26745. }
  26746. $responseHeaders = isset($http_response_header) ? $http_response_header : array();
  26747. if (null !== $e) {
  26748. throw $e;
  26749. }
  26750. return $result;
  26751. }
  26752. protected function callbackGet($notificationCode, $severity, $message, $messageCode, $bytesTransferred, $bytesMax)
  26753. {
  26754. switch ($notificationCode) {
  26755. case STREAM_NOTIFY_FAILURE:
  26756. if (400 === $messageCode) {
  26757. throw new TransportException("The '" . $this->fileUrl . "' URL could not be accessed: " . $message, $messageCode);
  26758. }
  26759. break;
  26760. case STREAM_NOTIFY_FILE_SIZE_IS:
  26761. $this->bytesMax = $bytesMax;
  26762. break;
  26763. case STREAM_NOTIFY_PROGRESS:
  26764. if ($this->bytesMax > 0 && $this->progress) {
  26765. $progression = min(100, round($bytesTransferred / $this->bytesMax * 100));
  26766. if ((0 === $progression % 5) && 100 !== $progression && $progression !== $this->lastProgress) {
  26767. $this->lastProgress = $progression;
  26768. $this->io->overwriteError("Downloading (<comment>$progression%</comment>)", false);
  26769. }
  26770. }
  26771. break;
  26772. default:
  26773. break;
  26774. }
  26775. }
  26776. protected function promptAuthAndRetry($httpStatus, $reason = null, $warning = null, $headers = array())
  26777. {
  26778. if ($this->config && in_array($this->originUrl, $this->config->get('github-domains'), true)) {
  26779. $gitHubUtil = new GitHub($this->io, $this->config, null);
  26780. $message = "\n";
  26781. $rateLimited = $gitHubUtil->isRateLimited($headers);
  26782. if ($rateLimited) {
  26783. $rateLimit = $gitHubUtil->getRateLimit($headers);
  26784. if ($this->io->hasAuthentication($this->originUrl)) {
  26785. $message = 'Review your configured GitHub OAuth token or enter a new one to go over the API rate limit.';
  26786. } else {
  26787. $message = 'Create a GitHub OAuth token to go over the API rate limit.';
  26788. }
  26789. $message = sprintf(
  26790. 'GitHub API limit (%d calls/hr) is exhausted, could not fetch '.$this->fileUrl.'. '.$message.' You can also wait until %s for the rate limit to reset.',
  26791. $rateLimit['limit'],
  26792. $rateLimit['reset']
  26793. )."\n";
  26794. } else {
  26795. $message .= 'Could not fetch '.$this->fileUrl.', please ';
  26796. if ($this->io->hasAuthentication($this->originUrl)) {
  26797. $message .= 'review your configured GitHub OAuth token or enter a new one to access private repos';
  26798. } else {
  26799. $message .= 'create a GitHub OAuth token to access private repos';
  26800. }
  26801. }
  26802. if (!$gitHubUtil->authorizeOAuth($this->originUrl)
  26803. && (!$this->io->isInteractive() || !$gitHubUtil->authorizeOAuthInteractively($this->originUrl, $message))
  26804. ) {
  26805. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  26806. }
  26807. } elseif ($this->config && in_array($this->originUrl, $this->config->get('gitlab-domains'), true)) {
  26808. $message = "\n".'Could not fetch '.$this->fileUrl.', enter your ' . $this->originUrl . ' credentials ' .($httpStatus === 401 ? 'to access private repos' : 'to go over the API rate limit');
  26809. $gitLabUtil = new GitLab($this->io, $this->config, null);
  26810. if ($this->io->hasAuthentication($this->originUrl) && ($auth = $this->io->getAuthentication($this->originUrl)) && $auth['password'] === 'private-token') {
  26811. throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
  26812. }
  26813. if (!$gitLabUtil->authorizeOAuth($this->originUrl)
  26814. && (!$this->io->isInteractive() || !$gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, $message))
  26815. ) {
  26816. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  26817. }
  26818. } elseif ($this->config && $this->originUrl === 'bitbucket.org') {
  26819. $askForOAuthToken = true;
  26820. if ($this->io->hasAuthentication($this->originUrl)) {
  26821. $auth = $this->io->getAuthentication($this->originUrl);
  26822. if ($auth['username'] !== 'x-token-auth') {
  26823. $bitbucketUtil = new Bitbucket($this->io, $this->config);
  26824. $accessToken = $bitbucketUtil->requestToken($this->originUrl, $auth['username'], $auth['password']);
  26825. if (!empty($accessToken)) {
  26826. $this->io->setAuthentication($this->originUrl, 'x-token-auth', $accessToken);
  26827. $askForOAuthToken = false;
  26828. }
  26829. } else {
  26830. throw new TransportException('Could not authenticate against ' . $this->originUrl, 401);
  26831. }
  26832. }
  26833. if ($askForOAuthToken) {
  26834. $message = "\n".'Could not fetch ' . $this->fileUrl . ', please create a bitbucket OAuth token to ' . (($httpStatus === 401 || $httpStatus === 403) ? 'access private repos' : 'go over the API rate limit');
  26835. $bitBucketUtil = new Bitbucket($this->io, $this->config);
  26836. if (! $bitBucketUtil->authorizeOAuth($this->originUrl)
  26837. && (! $this->io->isInteractive() || !$bitBucketUtil->authorizeOAuthInteractively($this->originUrl, $message))
  26838. ) {
  26839. throw new TransportException('Could not authenticate against ' . $this->originUrl, 401);
  26840. }
  26841. }
  26842. } else {
  26843. if ($httpStatus === 404) {
  26844. return;
  26845. }
  26846. if (!$this->io->isInteractive()) {
  26847. if ($httpStatus === 401) {
  26848. $message = "The '" . $this->fileUrl . "' URL required authentication.\nYou must be using the interactive console to authenticate";
  26849. }
  26850. if ($httpStatus === 403) {
  26851. $message = "The '" . $this->fileUrl . "' URL could not be accessed: " . $reason;
  26852. }
  26853. throw new TransportException($message, $httpStatus);
  26854. }
  26855. if ($this->io->hasAuthentication($this->originUrl)) {
  26856. throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
  26857. }
  26858. $this->io->overwriteError('');
  26859. if ($warning) {
  26860. $this->io->writeError(' <warning>'.$warning.'</warning>');
  26861. }
  26862. $this->io->writeError(' Authentication required (<info>'.parse_url($this->fileUrl, PHP_URL_HOST).'</info>):');
  26863. $username = $this->io->ask(' Username: ');
  26864. $password = $this->io->askAndHideAnswer(' Password: ');
  26865. $this->io->setAuthentication($this->originUrl, $username, $password);
  26866. $this->storeAuth = $this->config->get('store-auths');
  26867. }
  26868. $this->retry = true;
  26869. throw new TransportException('RETRY');
  26870. }
  26871. protected function getOptionsForUrl($originUrl, $additionalOptions)
  26872. {
  26873. $tlsOptions = array();
  26874. if ($this->disableTls === false && PHP_VERSION_ID < 50600 && !stream_is_local($this->fileUrl)) {
  26875. $host = parse_url($this->fileUrl, PHP_URL_HOST);
  26876. if (PHP_VERSION_ID < 50304) {
  26877. if ($host === 'github.com' || $host === 'api.github.com') {
  26878. $host = '*.github.com';
  26879. }
  26880. }
  26881. $tlsOptions['ssl']['CN_match'] = $host;
  26882. $tlsOptions['ssl']['SNI_server_name'] = $host;
  26883. $urlAuthority = $this->getUrlAuthority($this->fileUrl);
  26884. if (isset($this->peerCertificateMap[$urlAuthority])) {
  26885. $certMap = $this->peerCertificateMap[$urlAuthority];
  26886. $this->io->writeError('', true, IOInterface::DEBUG);
  26887. $this->io->writeError(sprintf(
  26888. 'Using <info>%s</info> as CN for subjectAltName enabled host <info>%s</info>',
  26889. $certMap['cn'],
  26890. $urlAuthority
  26891. ), true, IOInterface::DEBUG);
  26892. $tlsOptions['ssl']['CN_match'] = $certMap['cn'];
  26893. $tlsOptions['ssl']['peer_fingerprint'] = $certMap['fp'];
  26894. } elseif (!CaBundle::isOpensslParseSafe() && $host === 'repo.packagist.org') {
  26895. $tlsOptions['ssl']['CN_match'] = 'packagist.org';
  26896. }
  26897. }
  26898. $headers = array();
  26899. if (extension_loaded('zlib')) {
  26900. $headers[] = 'Accept-Encoding: gzip';
  26901. }
  26902. $options = array_replace_recursive($this->options, $tlsOptions, $additionalOptions);
  26903. if (!$this->degradedMode) {
  26904. $options['http']['protocol_version'] = 1.1;
  26905. $headers[] = 'Connection: close';
  26906. }
  26907. if ($this->io->hasAuthentication($originUrl)) {
  26908. $auth = $this->io->getAuthentication($originUrl);
  26909. if ('github.com' === $originUrl && 'x-oauth-basic' === $auth['password']) {
  26910. $options['github-token'] = $auth['username'];
  26911. } elseif ($this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)) {
  26912. if ($auth['password'] === 'oauth2') {
  26913. $headers[] = 'Authorization: Bearer '.$auth['username'];
  26914. } elseif ($auth['password'] === 'private-token') {
  26915. $headers[] = 'PRIVATE-TOKEN: '.$auth['username'];
  26916. }
  26917. } elseif ('bitbucket.org' === $originUrl
  26918. && $this->fileUrl !== Bitbucket::OAUTH2_ACCESS_TOKEN_URL && 'x-token-auth' === $auth['username']
  26919. ) {
  26920. if (!$this->isPublicBitBucketDownload($this->fileUrl)) {
  26921. $headers[] = 'Authorization: Bearer ' . $auth['password'];
  26922. }
  26923. } else {
  26924. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  26925. $headers[] = 'Authorization: Basic '.$authStr;
  26926. }
  26927. }
  26928. $options['http']['follow_location'] = 0;
  26929. if (isset($options['http']['header']) && !is_array($options['http']['header'])) {
  26930. $options['http']['header'] = explode("\r\n", trim($options['http']['header'], "\r\n"));
  26931. }
  26932. foreach ($headers as $header) {
  26933. $options['http']['header'][] = $header;
  26934. }
  26935. return $options;
  26936. }
  26937. private function handleRedirect(array $http_response_header, array $additionalOptions, $result)
  26938. {
  26939. if ($locationHeader = $this->findHeaderValue($http_response_header, 'location')) {
  26940. if (parse_url($locationHeader, PHP_URL_SCHEME)) {
  26941. $targetUrl = $locationHeader;
  26942. } elseif (parse_url($locationHeader, PHP_URL_HOST)) {
  26943. $targetUrl = $this->scheme.':'.$locationHeader;
  26944. } elseif ('/' === $locationHeader[0]) {
  26945. $urlHost = parse_url($this->fileUrl, PHP_URL_HOST);
  26946. $targetUrl = preg_replace('{^(.+(?://|@)'.preg_quote($urlHost).'(?::\d+)?)(?:[/\?].*)?$}', '\1'.$locationHeader, $this->fileUrl);
  26947. } else {
  26948. $targetUrl = preg_replace('{^(.+/)[^/?]*(?:\?.*)?$}', '\1'.$locationHeader, $this->fileUrl);
  26949. }
  26950. }
  26951. if (!empty($targetUrl)) {
  26952. $this->redirects++;
  26953. $this->io->writeError('', true, IOInterface::DEBUG);
  26954. $this->io->writeError(sprintf('Following redirect (%u) %s', $this->redirects, $targetUrl), true, IOInterface::DEBUG);
  26955. $additionalOptions['redirects'] = $this->redirects;
  26956. return $this->get(parse_url($targetUrl, PHP_URL_HOST), $targetUrl, $additionalOptions, $this->fileName, $this->progress);
  26957. }
  26958. if (!$this->retry) {
  26959. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded, got redirect without Location ('.$http_response_header[0].')');
  26960. $e->setHeaders($http_response_header);
  26961. $e->setResponse($result);
  26962. throw $e;
  26963. }
  26964. return false;
  26965. }
  26966. private function getTlsDefaults(array $options)
  26967. {
  26968. $ciphers = implode(':', array(
  26969. 'ECDHE-RSA-AES128-GCM-SHA256',
  26970. 'ECDHE-ECDSA-AES128-GCM-SHA256',
  26971. 'ECDHE-RSA-AES256-GCM-SHA384',
  26972. 'ECDHE-ECDSA-AES256-GCM-SHA384',
  26973. 'DHE-RSA-AES128-GCM-SHA256',
  26974. 'DHE-DSS-AES128-GCM-SHA256',
  26975. 'kEDH+AESGCM',
  26976. 'ECDHE-RSA-AES128-SHA256',
  26977. 'ECDHE-ECDSA-AES128-SHA256',
  26978. 'ECDHE-RSA-AES128-SHA',
  26979. 'ECDHE-ECDSA-AES128-SHA',
  26980. 'ECDHE-RSA-AES256-SHA384',
  26981. 'ECDHE-ECDSA-AES256-SHA384',
  26982. 'ECDHE-RSA-AES256-SHA',
  26983. 'ECDHE-ECDSA-AES256-SHA',
  26984. 'DHE-RSA-AES128-SHA256',
  26985. 'DHE-RSA-AES128-SHA',
  26986. 'DHE-DSS-AES128-SHA256',
  26987. 'DHE-RSA-AES256-SHA256',
  26988. 'DHE-DSS-AES256-SHA',
  26989. 'DHE-RSA-AES256-SHA',
  26990. 'AES128-GCM-SHA256',
  26991. 'AES256-GCM-SHA384',
  26992. 'AES128-SHA256',
  26993. 'AES256-SHA256',
  26994. 'AES128-SHA',
  26995. 'AES256-SHA',
  26996. 'AES',
  26997. 'CAMELLIA',
  26998. 'DES-CBC3-SHA',
  26999. '!aNULL',
  27000. '!eNULL',
  27001. '!EXPORT',
  27002. '!DES',
  27003. '!RC4',
  27004. '!MD5',
  27005. '!PSK',
  27006. '!aECDH',
  27007. '!EDH-DSS-DES-CBC3-SHA',
  27008. '!EDH-RSA-DES-CBC3-SHA',
  27009. '!KRB5-DES-CBC3-SHA',
  27010. ));
  27011. $defaults = array(
  27012. 'ssl' => array(
  27013. 'ciphers' => $ciphers,
  27014. 'verify_peer' => true,
  27015. 'verify_depth' => 7,
  27016. 'SNI_enabled' => true,
  27017. 'capture_peer_cert' => true,
  27018. ),
  27019. );
  27020. if (isset($options['ssl'])) {
  27021. $defaults['ssl'] = array_replace_recursive($defaults['ssl'], $options['ssl']);
  27022. }
  27023. $caBundleLogger = $this->io instanceof LoggerInterface ? $this->io : null;
  27024. if (!isset($defaults['ssl']['cafile']) && !isset($defaults['ssl']['capath'])) {
  27025. $result = CaBundle::getSystemCaRootBundlePath($caBundleLogger);
  27026. if (is_dir($result)) {
  27027. $defaults['ssl']['capath'] = $result;
  27028. } else {
  27029. $defaults['ssl']['cafile'] = $result;
  27030. }
  27031. }
  27032. if (isset($defaults['ssl']['cafile']) && (!is_readable($defaults['ssl']['cafile']) || !CaBundle::validateCaFile($defaults['ssl']['cafile'], $caBundleLogger))) {
  27033. throw new TransportException('The configured cafile was not valid or could not be read.');
  27034. }
  27035. if (isset($defaults['ssl']['capath']) && (!is_dir($defaults['ssl']['capath']) || !is_readable($defaults['ssl']['capath']))) {
  27036. throw new TransportException('The configured capath was not valid or could not be read.');
  27037. }
  27038. if (PHP_VERSION_ID >= 50413) {
  27039. $defaults['ssl']['disable_compression'] = true;
  27040. }
  27041. return $defaults;
  27042. }
  27043. private function getCertificateCnAndFp($url, $options)
  27044. {
  27045. if (PHP_VERSION_ID >= 50600) {
  27046. throw new \BadMethodCallException(sprintf(
  27047. '%s must not be used on PHP >= 5.6',
  27048. __METHOD__
  27049. ));
  27050. }
  27051. $context = StreamContextFactory::getContext($url, $options, array('options' => array(
  27052. 'ssl' => array(
  27053. 'capture_peer_cert' => true,
  27054. 'verify_peer' => false,
  27055. ), ),
  27056. ));
  27057. if (false === $handle = @fopen($url, 'rb', false, $context)) {
  27058. return;
  27059. }
  27060. fclose($handle);
  27061. $handle = null;
  27062. $params = stream_context_get_params($context);
  27063. if (!empty($params['options']['ssl']['peer_certificate'])) {
  27064. $peerCertificate = $params['options']['ssl']['peer_certificate'];
  27065. if (TlsHelper::checkCertificateHost($peerCertificate, parse_url($url, PHP_URL_HOST), $commonName)) {
  27066. return array(
  27067. 'cn' => $commonName,
  27068. 'fp' => TlsHelper::getCertificateFingerprint($peerCertificate),
  27069. );
  27070. }
  27071. }
  27072. }
  27073. private function getUrlAuthority($url)
  27074. {
  27075. $defaultPorts = array(
  27076. 'ftp' => 21,
  27077. 'http' => 80,
  27078. 'https' => 443,
  27079. 'ssh2.sftp' => 22,
  27080. 'ssh2.scp' => 22,
  27081. );
  27082. $scheme = parse_url($url, PHP_URL_SCHEME);
  27083. if (!isset($defaultPorts[$scheme])) {
  27084. throw new \InvalidArgumentException(sprintf(
  27085. 'Could not get default port for unknown scheme: %s',
  27086. $scheme
  27087. ));
  27088. }
  27089. $defaultPort = $defaultPorts[$scheme];
  27090. $port = parse_url($url, PHP_URL_PORT) ?: $defaultPort;
  27091. return parse_url($url, PHP_URL_HOST).':'.$port;
  27092. }
  27093. private function isPublicBitBucketDownload($urlToBitBucketFile)
  27094. {
  27095. $domain = parse_url($urlToBitBucketFile, PHP_URL_HOST);
  27096. if (strpos($domain, 'bitbucket.org') === false) {
  27097. return true;
  27098. }
  27099. $path = parse_url($urlToBitBucketFile, PHP_URL_PATH);
  27100. $pathParts = explode('/', $path);
  27101. return count($pathParts) >= 4 && $pathParts[3] == 'downloads';
  27102. }
  27103. }
  27104. <?php
  27105. namespace Composer\Util;
  27106. class Silencer
  27107. {
  27108. private static $stack = array();
  27109. public static function suppress($mask = null)
  27110. {
  27111. if (!isset($mask)) {
  27112. $mask = E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE | E_DEPRECATED | E_USER_DEPRECATED | E_STRICT;
  27113. }
  27114. $old = error_reporting();
  27115. self::$stack[] = $old;
  27116. error_reporting($old & ~$mask);
  27117. return $old;
  27118. }
  27119. public static function restore()
  27120. {
  27121. if (!empty(self::$stack)) {
  27122. error_reporting(array_pop(self::$stack));
  27123. }
  27124. }
  27125. public static function call($callable )
  27126. {
  27127. try {
  27128. self::suppress();
  27129. $result = call_user_func_array($callable, array_slice(func_get_args(), 1));
  27130. self::restore();
  27131. return $result;
  27132. } catch (\Exception $e) {
  27133. self::restore();
  27134. throw $e;
  27135. }
  27136. }
  27137. }
  27138. <?php
  27139. namespace Composer\Util;
  27140. use Composer\Spdx\SpdxLicenses;
  27141. trigger_error('The ' . __NAMESPACE__ . '\SpdxLicense class is deprecated, use Composer\Spdx\SpdxLicenses instead.', E_USER_DEPRECATED);
  27142. class SpdxLicense extends SpdxLicenses
  27143. {
  27144. }
  27145. <?php
  27146. namespace Composer\Util;
  27147. use Composer\Composer;
  27148. final class StreamContextFactory
  27149. {
  27150. public static function getContext($url, array $defaultOptions = array(), array $defaultParams = array())
  27151. {
  27152. $options = array('http' => array(
  27153. 'follow_location' => 1,
  27154. 'max_redirects' => 20,
  27155. ));
  27156. if (PHP_SAPI === 'cli' && (!empty($_SERVER['HTTP_PROXY']) || !empty($_SERVER['http_proxy']))) {
  27157. $proxy = parse_url(!empty($_SERVER['http_proxy']) ? $_SERVER['http_proxy'] : $_SERVER['HTTP_PROXY']);
  27158. }
  27159. if (!empty($_SERVER['CGI_HTTP_PROXY'])) {
  27160. $proxy = parse_url($_SERVER['CGI_HTTP_PROXY']);
  27161. }
  27162. if (preg_match('{^https://}i', $url) && (!empty($_SERVER['HTTPS_PROXY']) || !empty($_SERVER['https_proxy']))) {
  27163. $proxy = parse_url(!empty($_SERVER['https_proxy']) ? $_SERVER['https_proxy'] : $_SERVER['HTTPS_PROXY']);
  27164. }
  27165. if (!empty($_SERVER['NO_PROXY']) || !empty($_SERVER['no_proxy']) && parse_url($url, PHP_URL_HOST)) {
  27166. $pattern = new NoProxyPattern(!empty($_SERVER['no_proxy']) ? $_SERVER['no_proxy'] : $_SERVER['NO_PROXY']);
  27167. if ($pattern->test($url)) {
  27168. unset($proxy);
  27169. }
  27170. }
  27171. if (!empty($proxy)) {
  27172. $proxyURL = isset($proxy['scheme']) ? $proxy['scheme'] . '://' : '';
  27173. $proxyURL .= isset($proxy['host']) ? $proxy['host'] : '';
  27174. if (isset($proxy['port'])) {
  27175. $proxyURL .= ":" . $proxy['port'];
  27176. } elseif ('http://' == substr($proxyURL, 0, 7)) {
  27177. $proxyURL .= ":80";
  27178. } elseif ('https://' == substr($proxyURL, 0, 8)) {
  27179. $proxyURL .= ":443";
  27180. }
  27181. $proxyURL = str_replace(array('http://', 'https://'), array('tcp://', 'ssl://'), $proxyURL);
  27182. if (0 === strpos($proxyURL, 'ssl:') && !extension_loaded('openssl')) {
  27183. throw new \RuntimeException('You must enable the openssl extension to use a proxy over https');
  27184. }
  27185. $options['http']['proxy'] = $proxyURL;
  27186. switch (parse_url($url, PHP_URL_SCHEME)) {
  27187. case 'http':
  27188. $reqFullUriEnv = getenv('HTTP_PROXY_REQUEST_FULLURI');
  27189. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  27190. $options['http']['request_fulluri'] = true;
  27191. }
  27192. break;
  27193. case 'https':
  27194. $reqFullUriEnv = getenv('HTTPS_PROXY_REQUEST_FULLURI');
  27195. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  27196. $options['http']['request_fulluri'] = true;
  27197. }
  27198. break;
  27199. }
  27200. if ('https' === parse_url($url, PHP_URL_SCHEME)) {
  27201. $options['ssl']['SNI_enabled'] = true;
  27202. if (PHP_VERSION_ID < 50600) {
  27203. $options['ssl']['SNI_server_name'] = parse_url($url, PHP_URL_HOST);
  27204. }
  27205. }
  27206. if (isset($proxy['user'])) {
  27207. $auth = rawurldecode($proxy['user']);
  27208. if (isset($proxy['pass'])) {
  27209. $auth .= ':' . rawurldecode($proxy['pass']);
  27210. }
  27211. $auth = base64_encode($auth);
  27212. if (isset($defaultOptions['http']['header'])) {
  27213. if (is_string($defaultOptions['http']['header'])) {
  27214. $defaultOptions['http']['header'] = array($defaultOptions['http']['header']);
  27215. }
  27216. $defaultOptions['http']['header'][] = "Proxy-Authorization: Basic {$auth}";
  27217. } else {
  27218. $options['http']['header'] = array("Proxy-Authorization: Basic {$auth}");
  27219. }
  27220. }
  27221. }
  27222. $options = array_replace_recursive($options, $defaultOptions);
  27223. if (isset($options['http']['header'])) {
  27224. $options['http']['header'] = self::fixHttpHeaderField($options['http']['header']);
  27225. }
  27226. if (defined('HHVM_VERSION')) {
  27227. $phpVersion = 'HHVM ' . HHVM_VERSION;
  27228. } else {
  27229. $phpVersion = 'PHP ' . PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
  27230. }
  27231. if (!isset($options['http']['header']) || false === stripos(implode('', $options['http']['header']), 'user-agent')) {
  27232. $options['http']['header'][] = sprintf(
  27233. 'User-Agent: Composer/%s (%s; %s; %s%s)',
  27234. Composer::VERSION === '@package_version@' ? 'source' : Composer::VERSION,
  27235. function_exists('php_uname') ? php_uname('s') : 'Unknown',
  27236. function_exists('php_uname') ? php_uname('r') : 'Unknown',
  27237. $phpVersion,
  27238. getenv('CI') ? '; CI' : ''
  27239. );
  27240. }
  27241. return stream_context_create($options, $defaultParams);
  27242. }
  27243. private static function fixHttpHeaderField($header)
  27244. {
  27245. if (!is_array($header)) {
  27246. $header = explode("\r\n", $header);
  27247. }
  27248. uasort($header, function ($el) {
  27249. return stripos($el, 'content-type') === 0 ? 1 : -1;
  27250. });
  27251. return $header;
  27252. }
  27253. }
  27254. <?php
  27255. namespace Composer\Util;
  27256. use Composer\Config;
  27257. use Composer\IO\IOInterface;
  27258. class Svn
  27259. {
  27260. const MAX_QTY_AUTH_TRIES = 5;
  27261. protected $credentials;
  27262. protected $hasAuth;
  27263. protected $io;
  27264. protected $url;
  27265. protected $cacheCredentials = true;
  27266. protected $process;
  27267. protected $qtyAuthTries = 0;
  27268. protected $config;
  27269. private static $version;
  27270. public function __construct($url, IOInterface $io, Config $config, ProcessExecutor $process = null)
  27271. {
  27272. $this->url = $url;
  27273. $this->io = $io;
  27274. $this->config = $config;
  27275. $this->process = $process ?: new ProcessExecutor($io);
  27276. }
  27277. public static function cleanEnv()
  27278. {
  27279. putenv("DYLD_LIBRARY_PATH");
  27280. unset($_SERVER['DYLD_LIBRARY_PATH']);
  27281. }
  27282. public function execute($command, $url, $cwd = null, $path = null, $verbose = false)
  27283. {
  27284. $this->config->prohibitUrlByConfig($url, $this->io);
  27285. return $this->executeWithAuthRetry($command, $cwd, $url, $path, $verbose);
  27286. }
  27287. public function executeLocal($command, $path, $cwd = null, $verbose = false)
  27288. {
  27289. return $this->executeWithAuthRetry($command, $cwd, '', $path, $verbose);
  27290. }
  27291. private function executeWithAuthRetry($svnCommand, $cwd, $url, $path, $verbose)
  27292. {
  27293. $command = $this->getCommand($svnCommand, $url, $path);
  27294. $output = null;
  27295. $io = $this->io;
  27296. $handler = function ($type, $buffer) use (&$output, $io, $verbose) {
  27297. if ($type !== 'out') {
  27298. return;
  27299. }
  27300. if ('Redirecting to URL ' === substr($buffer, 0, 19)) {
  27301. return;
  27302. }
  27303. $output .= $buffer;
  27304. if ($verbose) {
  27305. $io->writeError($buffer, false);
  27306. }
  27307. };
  27308. $status = $this->process->execute($command, $handler, $cwd);
  27309. if (0 === $status) {
  27310. return $output;
  27311. }
  27312. $errorOutput = $this->process->getErrorOutput();
  27313. $fullOutput = implode("\n", array($output, $errorOutput));
  27314. if (false === stripos($fullOutput, 'Could not authenticate to server:')
  27315. && false === stripos($fullOutput, 'authorization failed')
  27316. && false === stripos($fullOutput, 'svn: E170001:')
  27317. && false === stripos($fullOutput, 'svn: E215004:')) {
  27318. throw new \RuntimeException($fullOutput);
  27319. }
  27320. if (!$this->hasAuth()) {
  27321. $this->doAuthDance();
  27322. }
  27323. if ($this->qtyAuthTries++ < self::MAX_QTY_AUTH_TRIES) {
  27324. return $this->executeWithAuthRetry($svnCommand, $cwd, $url, $path, $verbose);
  27325. }
  27326. throw new \RuntimeException(
  27327. 'wrong credentials provided ('.$fullOutput.')'
  27328. );
  27329. }
  27330. public function setCacheCredentials($cacheCredentials)
  27331. {
  27332. $this->cacheCredentials = $cacheCredentials;
  27333. }
  27334. protected function doAuthDance()
  27335. {
  27336. if (!$this->io->isInteractive()) {
  27337. throw new \RuntimeException(
  27338. 'can not ask for authentication in non interactive mode'
  27339. );
  27340. }
  27341. $this->io->writeError("The Subversion server ({$this->url}) requested credentials:");
  27342. $this->hasAuth = true;
  27343. $this->credentials['username'] = $this->io->ask("Username: ");
  27344. $this->credentials['password'] = $this->io->askAndHideAnswer("Password: ");
  27345. $this->cacheCredentials = $this->io->askConfirmation("Should Subversion cache these credentials? (yes/no) ", true);
  27346. return $this;
  27347. }
  27348. protected function getCommand($cmd, $url, $path = null)
  27349. {
  27350. $cmd = sprintf(
  27351. '%s %s%s %s',
  27352. $cmd,
  27353. '--non-interactive ',
  27354. $this->getCredentialString(),
  27355. ProcessExecutor::escape($url)
  27356. );
  27357. if ($path) {
  27358. $cmd .= ' ' . ProcessExecutor::escape($path);
  27359. }
  27360. return $cmd;
  27361. }
  27362. protected function getCredentialString()
  27363. {
  27364. if (!$this->hasAuth()) {
  27365. return '';
  27366. }
  27367. return sprintf(
  27368. ' %s--username %s --password %s ',
  27369. $this->getAuthCache(),
  27370. ProcessExecutor::escape($this->getUsername()),
  27371. ProcessExecutor::escape($this->getPassword())
  27372. );
  27373. }
  27374. protected function getPassword()
  27375. {
  27376. if ($this->credentials === null) {
  27377. throw new \LogicException("No svn auth detected.");
  27378. }
  27379. return isset($this->credentials['password']) ? $this->credentials['password'] : '';
  27380. }
  27381. protected function getUsername()
  27382. {
  27383. if ($this->credentials === null) {
  27384. throw new \LogicException("No svn auth detected.");
  27385. }
  27386. return $this->credentials['username'];
  27387. }
  27388. protected function hasAuth()
  27389. {
  27390. if (null !== $this->hasAuth) {
  27391. return $this->hasAuth;
  27392. }
  27393. if (false === $this->createAuthFromConfig()) {
  27394. $this->createAuthFromUrl();
  27395. }
  27396. return $this->hasAuth;
  27397. }
  27398. protected function getAuthCache()
  27399. {
  27400. return $this->cacheCredentials ? '' : '--no-auth-cache ';
  27401. }
  27402. private function createAuthFromConfig()
  27403. {
  27404. if (!$this->config->has('http-basic')) {
  27405. return $this->hasAuth = false;
  27406. }
  27407. $authConfig = $this->config->get('http-basic');
  27408. $host = parse_url($this->url, PHP_URL_HOST);
  27409. if (isset($authConfig[$host])) {
  27410. $this->credentials['username'] = $authConfig[$host]['username'];
  27411. $this->credentials['password'] = $authConfig[$host]['password'];
  27412. return $this->hasAuth = true;
  27413. }
  27414. return $this->hasAuth = false;
  27415. }
  27416. private function createAuthFromUrl()
  27417. {
  27418. $uri = parse_url($this->url);
  27419. if (empty($uri['user'])) {
  27420. return $this->hasAuth = false;
  27421. }
  27422. $this->credentials['username'] = $uri['user'];
  27423. if (!empty($uri['pass'])) {
  27424. $this->credentials['password'] = $uri['pass'];
  27425. }
  27426. return $this->hasAuth = true;
  27427. }
  27428. public function binaryVersion()
  27429. {
  27430. if (!self::$version) {
  27431. if (0 === $this->process->execute('svn --version', $output)) {
  27432. if (preg_match('{(\d+(?:\.\d+)+)}', $output, $match)) {
  27433. self::$version = $match[1];
  27434. }
  27435. }
  27436. }
  27437. return self::$version;
  27438. }
  27439. }
  27440. <?php
  27441. namespace Composer\Util;
  27442. use Composer\CaBundle\CaBundle;
  27443. final class TlsHelper
  27444. {
  27445. private static $useOpensslParse;
  27446. public static function checkCertificateHost($certificate, $hostname, &$cn = null)
  27447. {
  27448. $names = self::getCertificateNames($certificate);
  27449. if (empty($names)) {
  27450. return false;
  27451. }
  27452. $combinedNames = array_merge($names['san'], array($names['cn']));
  27453. $hostname = strtolower($hostname);
  27454. foreach ($combinedNames as $certName) {
  27455. $matcher = self::certNameMatcher($certName);
  27456. if ($matcher && $matcher($hostname)) {
  27457. $cn = $names['cn'];
  27458. return true;
  27459. }
  27460. }
  27461. return false;
  27462. }
  27463. public static function getCertificateNames($certificate)
  27464. {
  27465. if (is_array($certificate)) {
  27466. $info = $certificate;
  27467. } elseif (CaBundle::isOpensslParseSafe()) {
  27468. $info = openssl_x509_parse($certificate, false);
  27469. }
  27470. if (!isset($info['subject']['commonName'])) {
  27471. return null;
  27472. }
  27473. $commonName = strtolower($info['subject']['commonName']);
  27474. $subjectAltNames = array();
  27475. if (isset($info['extensions']['subjectAltName'])) {
  27476. $subjectAltNames = preg_split('{\s*,\s*}', $info['extensions']['subjectAltName']);
  27477. $subjectAltNames = array_filter(array_map(function ($name) {
  27478. if (0 === strpos($name, 'DNS:')) {
  27479. return strtolower(ltrim(substr($name, 4)));
  27480. }
  27481. return null;
  27482. }, $subjectAltNames));
  27483. $subjectAltNames = array_values($subjectAltNames);
  27484. }
  27485. return array(
  27486. 'cn' => $commonName,
  27487. 'san' => $subjectAltNames,
  27488. );
  27489. }
  27490. public static function getCertificateFingerprint($certificate)
  27491. {
  27492. $pubkeydetails = openssl_pkey_get_details(openssl_get_publickey($certificate));
  27493. $pubkeypem = $pubkeydetails['key'];
  27494. $start = '-----BEGIN PUBLIC KEY-----';
  27495. $end = '-----END PUBLIC KEY-----';
  27496. $pemtrim = substr($pubkeypem, strpos($pubkeypem, $start) + strlen($start), (strlen($pubkeypem) - strpos($pubkeypem, $end)) * (-1));
  27497. $der = base64_decode($pemtrim);
  27498. return sha1($der);
  27499. }
  27500. public static function isOpensslParseSafe()
  27501. {
  27502. return CaBundle::isOpensslParseSafe();
  27503. }
  27504. private static function certNameMatcher($certName)
  27505. {
  27506. $wildcards = substr_count($certName, '*');
  27507. if (0 === $wildcards) {
  27508. return function ($hostname) use ($certName) {
  27509. return $hostname === $certName;
  27510. };
  27511. }
  27512. if (1 === $wildcards) {
  27513. $components = explode('.', $certName);
  27514. if (3 > count($components)) {
  27515. return;
  27516. }
  27517. $firstComponent = $components[0];
  27518. if ('*' !== $firstComponent[strlen($firstComponent) - 1]) {
  27519. return;
  27520. }
  27521. $wildcardRegex = preg_quote($certName);
  27522. $wildcardRegex = str_replace('\\*', '[a-z0-9-]+', $wildcardRegex);
  27523. $wildcardRegex = "{^{$wildcardRegex}$}";
  27524. return function ($hostname) use ($wildcardRegex) {
  27525. return 1 === preg_match($wildcardRegex, $hostname);
  27526. };
  27527. }
  27528. }
  27529. }
  27530. <?php
  27531. namespace Composer\Util;
  27532. use Composer\Config;
  27533. class Url
  27534. {
  27535. public static function updateDistReference(Config $config, $url, $ref)
  27536. {
  27537. $host = parse_url($url, PHP_URL_HOST);
  27538. if ($host === 'api.github.com' || $host === 'github.com' || $host === 'www.github.com') {
  27539. if (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/(zip|tar)ball/(.+)$}i', $url, $match)) {
  27540. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  27541. } elseif (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/archive/.+\.(zip|tar)(?:\.gz)?$}i', $url, $match)) {
  27542. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  27543. } elseif (preg_match('{^https?://api\.github\.com/repos/([^/]+)/([^/]+)/(zip|tar)ball(?:/.+)?$}i', $url, $match)) {
  27544. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  27545. }
  27546. } elseif ($host === 'bitbucket.org' || $host === 'www.bitbucket.org') {
  27547. if (preg_match('{^https?://(?:www\.)?bitbucket\.org/([^/]+)/([^/]+)/get/(.+)\.(zip|tar\.gz|tar\.bz2)$}i', $url, $match)) {
  27548. $url = 'https://bitbucket.org/' . $match[1] . '/'. $match[2] . '/get/' . $ref . '.' . $match[4];
  27549. }
  27550. } elseif ($host === 'gitlab.com' || $host === 'www.gitlab.com') {
  27551. if (preg_match('{^https?://(?:www\.)?gitlab\.com/api/v[34]/projects/([^/]+)/repository/archive\.(zip|tar\.gz|tar\.bz2|tar)\?sha=.+$}i', $url, $match)) {
  27552. $url = 'https://gitlab.com/api/v4/projects/' . $match[1] . '/repository/archive.' . $match[2] . '?sha=' . $ref;
  27553. }
  27554. } elseif (in_array($host, $config->get('github-domains'), true)) {
  27555. $url = preg_replace('{(/repos/[^/]+/[^/]+/(zip|tar)ball)(?:/.+)?$}i', '$1/'.$ref, $url);
  27556. } elseif (in_array($host, $config->get('gitlab-domains'), true)) {
  27557. $url = preg_replace('{(/api/v[34]/projects/[^/]+/repository/archive\.(?:zip|tar\.gz|tar\.bz2|tar)\?sha=).+$}i', '${1}'.$ref, $url);
  27558. }
  27559. return $url;
  27560. }
  27561. }
  27562. <?php
  27563. namespace Composer;
  27564. use Symfony\Component\Console\Output\OutputInterface;
  27565. trigger_error('The ' . __NAMESPACE__ . '\XdebugHandler class is deprecated, use Composer\XdebugHandler\XdebugHandler instead,', E_USER_DEPRECATED);
  27566. class XdebugHandler extends XdebugHandler\XdebugHandler
  27567. {
  27568. const ENV_ALLOW = 'COMPOSER_ALLOW_XDEBUG';
  27569. const ENV_VERSION = 'COMPOSER_XDEBUG_VERSION';
  27570. public function __construct(OutputInterface $output)
  27571. {
  27572. parent::__construct('composer', '--ansi');
  27573. }
  27574. }
  27575. <?php
  27576. function includeIfExists($file)
  27577. {
  27578. return file_exists($file) ? include $file : false;
  27579. }
  27580. if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) {
  27581. echo 'You must set up the project dependencies using `composer install`'.PHP_EOL.
  27582. 'See https://getcomposer.org/download/ for instructions on installing Composer'.PHP_EOL;
  27583. exit(1);
  27584. }
  27585. return $loader;
  27586. <?php
  27587. /*
  27588. * This file is part of Composer.
  27589. *
  27590. * (c) Nils Adermann <naderman@naderman.de>
  27591. * Jordi Boggiano <j.boggiano@seld.be>
  27592. *
  27593. * For the full copyright and license information, please view the LICENSE
  27594. * file that was distributed with this source code.
  27595. */
  27596. namespace Composer\Autoload;
  27597. /**
  27598. * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
  27599. *
  27600. * $loader = new \Composer\Autoload\ClassLoader();
  27601. *
  27602. * // register classes with namespaces
  27603. * $loader->add('Symfony\Component', __DIR__.'/component');
  27604. * $loader->add('Symfony', __DIR__.'/framework');
  27605. *
  27606. * // activate the autoloader
  27607. * $loader->register();
  27608. *
  27609. * // to enable searching the include path (eg. for PEAR packages)
  27610. * $loader->setUseIncludePath(true);
  27611. *
  27612. * In this example, if you try to use a class in the Symfony\Component
  27613. * namespace or one of its children (Symfony\Component\Console for instance),
  27614. * the autoloader will first look for the class under the component/
  27615. * directory, and it will then fallback to the framework/ directory if not
  27616. * found before giving up.
  27617. *
  27618. * This class is loosely based on the Symfony UniversalClassLoader.
  27619. *
  27620. * @author Fabien Potencier <fabien@symfony.com>
  27621. * @author Jordi Boggiano <j.boggiano@seld.be>
  27622. * @see http://www.php-fig.org/psr/psr-0/
  27623. * @see http://www.php-fig.org/psr/psr-4/
  27624. */
  27625. class ClassLoader
  27626. {
  27627. // PSR-4
  27628. private $prefixLengthsPsr4 = array();
  27629. private $prefixDirsPsr4 = array();
  27630. private $fallbackDirsPsr4 = array();
  27631. // PSR-0
  27632. private $prefixesPsr0 = array();
  27633. private $fallbackDirsPsr0 = array();
  27634. private $useIncludePath = false;
  27635. private $classMap = array();
  27636. private $classMapAuthoritative = false;
  27637. private $missingClasses = array();
  27638. private $apcuPrefix;
  27639. public function getPrefixes()
  27640. {
  27641. if (!empty($this->prefixesPsr0)) {
  27642. return call_user_func_array('array_merge', $this->prefixesPsr0);
  27643. }
  27644. return array();
  27645. }
  27646. public function getPrefixesPsr4()
  27647. {
  27648. return $this->prefixDirsPsr4;
  27649. }
  27650. public function getFallbackDirs()
  27651. {
  27652. return $this->fallbackDirsPsr0;
  27653. }
  27654. public function getFallbackDirsPsr4()
  27655. {
  27656. return $this->fallbackDirsPsr4;
  27657. }
  27658. public function getClassMap()
  27659. {
  27660. return $this->classMap;
  27661. }
  27662. /**
  27663. * @param array $classMap Class to filename map
  27664. */
  27665. public function addClassMap(array $classMap)
  27666. {
  27667. if ($this->classMap) {
  27668. $this->classMap = array_merge($this->classMap, $classMap);
  27669. } else {
  27670. $this->classMap = $classMap;
  27671. }
  27672. }
  27673. /**
  27674. * Registers a set of PSR-0 directories for a given prefix, either
  27675. * appending or prepending to the ones previously set for this prefix.
  27676. *
  27677. * @param string $prefix The prefix
  27678. * @param array|string $paths The PSR-0 root directories
  27679. * @param bool $prepend Whether to prepend the directories
  27680. */
  27681. public function add($prefix, $paths, $prepend = false)
  27682. {
  27683. if (!$prefix) {
  27684. if ($prepend) {
  27685. $this->fallbackDirsPsr0 = array_merge(
  27686. (array) $paths,
  27687. $this->fallbackDirsPsr0
  27688. );
  27689. } else {
  27690. $this->fallbackDirsPsr0 = array_merge(
  27691. $this->fallbackDirsPsr0,
  27692. (array) $paths
  27693. );
  27694. }
  27695. return;
  27696. }
  27697. $first = $prefix[0];
  27698. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  27699. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  27700. return;
  27701. }
  27702. if ($prepend) {
  27703. $this->prefixesPsr0[$first][$prefix] = array_merge(
  27704. (array) $paths,
  27705. $this->prefixesPsr0[$first][$prefix]
  27706. );
  27707. } else {
  27708. $this->prefixesPsr0[$first][$prefix] = array_merge(
  27709. $this->prefixesPsr0[$first][$prefix],
  27710. (array) $paths
  27711. );
  27712. }
  27713. }
  27714. /**
  27715. * Registers a set of PSR-4 directories for a given namespace, either
  27716. * appending or prepending to the ones previously set for this namespace.
  27717. *
  27718. * @param string $prefix The prefix/namespace, with trailing '\\'
  27719. * @param array|string $paths The PSR-4 base directories
  27720. * @param bool $prepend Whether to prepend the directories
  27721. *
  27722. * @throws \InvalidArgumentException
  27723. */
  27724. public function addPsr4($prefix, $paths, $prepend = false)
  27725. {
  27726. if (!$prefix) {
  27727. // Register directories for the root namespace.
  27728. if ($prepend) {
  27729. $this->fallbackDirsPsr4 = array_merge(
  27730. (array) $paths,
  27731. $this->fallbackDirsPsr4
  27732. );
  27733. } else {
  27734. $this->fallbackDirsPsr4 = array_merge(
  27735. $this->fallbackDirsPsr4,
  27736. (array) $paths
  27737. );
  27738. }
  27739. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  27740. // Register directories for a new namespace.
  27741. $length = strlen($prefix);
  27742. if ('\\' !== $prefix[$length - 1]) {
  27743. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  27744. }
  27745. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  27746. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  27747. } elseif ($prepend) {
  27748. // Prepend directories for an already registered namespace.
  27749. $this->prefixDirsPsr4[$prefix] = array_merge(
  27750. (array) $paths,
  27751. $this->prefixDirsPsr4[$prefix]
  27752. );
  27753. } else {
  27754. // Append directories for an already registered namespace.
  27755. $this->prefixDirsPsr4[$prefix] = array_merge(
  27756. $this->prefixDirsPsr4[$prefix],
  27757. (array) $paths
  27758. );
  27759. }
  27760. }
  27761. /**
  27762. * Registers a set of PSR-0 directories for a given prefix,
  27763. * replacing any others previously set for this prefix.
  27764. *
  27765. * @param string $prefix The prefix
  27766. * @param array|string $paths The PSR-0 base directories
  27767. */
  27768. public function set($prefix, $paths)
  27769. {
  27770. if (!$prefix) {
  27771. $this->fallbackDirsPsr0 = (array) $paths;
  27772. } else {
  27773. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  27774. }
  27775. }
  27776. /**
  27777. * Registers a set of PSR-4 directories for a given namespace,
  27778. * replacing any others previously set for this namespace.
  27779. *
  27780. * @param string $prefix The prefix/namespace, with trailing '\\'
  27781. * @param array|string $paths The PSR-4 base directories
  27782. *
  27783. * @throws \InvalidArgumentException
  27784. */
  27785. public function setPsr4($prefix, $paths)
  27786. {
  27787. if (!$prefix) {
  27788. $this->fallbackDirsPsr4 = (array) $paths;
  27789. } else {
  27790. $length = strlen($prefix);
  27791. if ('\\' !== $prefix[$length - 1]) {
  27792. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  27793. }
  27794. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  27795. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  27796. }
  27797. }
  27798. /**
  27799. * Turns on searching the include path for class files.
  27800. *
  27801. * @param bool $useIncludePath
  27802. */
  27803. public function setUseIncludePath($useIncludePath)
  27804. {
  27805. $this->useIncludePath = $useIncludePath;
  27806. }
  27807. /**
  27808. * Can be used to check if the autoloader uses the include path to check
  27809. * for classes.
  27810. *
  27811. * @return bool
  27812. */
  27813. public function getUseIncludePath()
  27814. {
  27815. return $this->useIncludePath;
  27816. }
  27817. /**
  27818. * Turns off searching the prefix and fallback directories for classes
  27819. * that have not been registered with the class map.
  27820. *
  27821. * @param bool $classMapAuthoritative
  27822. */
  27823. public function setClassMapAuthoritative($classMapAuthoritative)
  27824. {
  27825. $this->classMapAuthoritative = $classMapAuthoritative;
  27826. }
  27827. /**
  27828. * Should class lookup fail if not found in the current class map?
  27829. *
  27830. * @return bool
  27831. */
  27832. public function isClassMapAuthoritative()
  27833. {
  27834. return $this->classMapAuthoritative;
  27835. }
  27836. /**
  27837. * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
  27838. *
  27839. * @param string|null $apcuPrefix
  27840. */
  27841. public function setApcuPrefix($apcuPrefix)
  27842. {
  27843. $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
  27844. }
  27845. /**
  27846. * The APCu prefix in use, or null if APCu caching is not enabled.
  27847. *
  27848. * @return string|null
  27849. */
  27850. public function getApcuPrefix()
  27851. {
  27852. return $this->apcuPrefix;
  27853. }
  27854. /**
  27855. * Registers this instance as an autoloader.
  27856. *
  27857. * @param bool $prepend Whether to prepend the autoloader or not
  27858. */
  27859. public function register($prepend = false)
  27860. {
  27861. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  27862. }
  27863. /**
  27864. * Unregisters this instance as an autoloader.
  27865. */
  27866. public function unregister()
  27867. {
  27868. spl_autoload_unregister(array($this, 'loadClass'));
  27869. }
  27870. /**
  27871. * Loads the given class or interface.
  27872. *
  27873. * @param string $class The name of the class
  27874. * @return bool|null True if loaded, null otherwise
  27875. */
  27876. public function loadClass($class)
  27877. {
  27878. if ($file = $this->findFile($class)) {
  27879. includeFile($file);
  27880. return true;
  27881. }
  27882. }
  27883. /**
  27884. * Finds the path to the file where the class is defined.
  27885. *
  27886. * @param string $class The name of the class
  27887. *
  27888. * @return string|false The path if found, false otherwise
  27889. */
  27890. public function findFile($class)
  27891. {
  27892. // class map lookup
  27893. if (isset($this->classMap[$class])) {
  27894. return $this->classMap[$class];
  27895. }
  27896. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  27897. return false;
  27898. }
  27899. if (null !== $this->apcuPrefix) {
  27900. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  27901. if ($hit) {
  27902. return $file;
  27903. }
  27904. }
  27905. $file = $this->findFileWithExtension($class, '.php');
  27906. // Search for Hack files if we are running on HHVM
  27907. if (false === $file && defined('HHVM_VERSION')) {
  27908. $file = $this->findFileWithExtension($class, '.hh');
  27909. }
  27910. if (null !== $this->apcuPrefix) {
  27911. apcu_add($this->apcuPrefix.$class, $file);
  27912. }
  27913. if (false === $file) {
  27914. // Remember that this class does not exist.
  27915. $this->missingClasses[$class] = true;
  27916. }
  27917. return $file;
  27918. }
  27919. private function findFileWithExtension($class, $ext)
  27920. {
  27921. // PSR-4 lookup
  27922. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  27923. $first = $class[0];
  27924. if (isset($this->prefixLengthsPsr4[$first])) {
  27925. $subPath = $class;
  27926. while (false !== $lastPos = strrpos($subPath, '\\')) {
  27927. $subPath = substr($subPath, 0, $lastPos);
  27928. $search = $subPath . '\\';
  27929. if (isset($this->prefixDirsPsr4[$search])) {
  27930. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  27931. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  27932. if (file_exists($file = $dir . $pathEnd)) {
  27933. return $file;
  27934. }
  27935. }
  27936. }
  27937. }
  27938. }
  27939. // PSR-4 fallback dirs
  27940. foreach ($this->fallbackDirsPsr4 as $dir) {
  27941. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  27942. return $file;
  27943. }
  27944. }
  27945. // PSR-0 lookup
  27946. if (false !== $pos = strrpos($class, '\\')) {
  27947. // namespaced class name
  27948. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  27949. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  27950. } else {
  27951. // PEAR-like class name
  27952. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  27953. }
  27954. if (isset($this->prefixesPsr0[$first])) {
  27955. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  27956. if (0 === strpos($class, $prefix)) {
  27957. foreach ($dirs as $dir) {
  27958. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  27959. return $file;
  27960. }
  27961. }
  27962. }
  27963. }
  27964. }
  27965. // PSR-0 fallback dirs
  27966. foreach ($this->fallbackDirsPsr0 as $dir) {
  27967. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  27968. return $file;
  27969. }
  27970. }
  27971. // PSR-0 include paths.
  27972. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  27973. return $file;
  27974. }
  27975. return false;
  27976. }
  27977. }
  27978. /**
  27979. * Scope isolated include.
  27980. *
  27981. * Prevents access to $this/self from included files.
  27982. */
  27983. function includeFile($file)
  27984. {
  27985. include $file;
  27986. }
  27987. {
  27988. "$schema": "http://json-schema.org/draft-04/schema#",
  27989. "description": "A representation of packages metadata.",
  27990. "type": "object",
  27991. "oneOf": [
  27992. { "required": [ "packages" ] },
  27993. { "required": [ "providers" ] },
  27994. { "required": [ "provider-includes", "providers-url" ] }
  27995. ],
  27996. "properties": {
  27997. "packages": {
  27998. "type": ["object", "array"],
  27999. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  28000. "additionalProperties": { "$ref": "#/definitions/versions" }
  28001. },
  28002. "providers-url": {
  28003. "type": "string",
  28004. "description": "Endpoint to retrieve provider data from, e.g. '/p/%package%$%hash%.json'."
  28005. },
  28006. "provider-includes": {
  28007. "type": "object",
  28008. "description": "A hashmap of provider listings.",
  28009. "additionalProperties": { "$ref": "#/definitions/provider" }
  28010. },
  28011. "providers": {
  28012. "type": "object",
  28013. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  28014. "additionalProperties": { "$ref": "#/definitions/provider" }
  28015. },
  28016. "notify-batch": {
  28017. "type": "string",
  28018. "description": "Endpoint to call after multiple packages have been installed, e.g. '/downloads/'."
  28019. },
  28020. "search": {
  28021. "type": "string",
  28022. "description": "Endpoint that provides search capabilities, e.g. '/search.json?q=%query%&type=%type%'."
  28023. },
  28024. "warning": {
  28025. "type": "string",
  28026. "description": "A message that will be output by Composer as a warning when this source is consulted."
  28027. }
  28028. },
  28029. "definitions": {
  28030. "versions": {
  28031. "type": "object",
  28032. "description": "A hashmap of versions and their metadata.",
  28033. "additionalProperties": { "$ref": "#/definitions/version" }
  28034. },
  28035. "version": {
  28036. "type": "object",
  28037. "oneOf": [
  28038. { "$ref": "#/definitions/package" },
  28039. { "$ref": "#/definitions/metapackage" }
  28040. ]
  28041. },
  28042. "package-base": {
  28043. "properties": {
  28044. "name": { "type": "string" },
  28045. "type": { "type": "string" },
  28046. "version": { "type": "string" },
  28047. "version_normalized": {
  28048. "type": "string",
  28049. "description": "Normalized version, optional but can save computational time on client side."
  28050. },
  28051. "autoload": { "type": "object" },
  28052. "require": { "type": "object" },
  28053. "replace": { "type": "object" },
  28054. "conflict": { "type": "object" },
  28055. "provide": { "type": "object" },
  28056. "time": { "type": "string" }
  28057. },
  28058. "additionalProperties": true
  28059. },
  28060. "package": {
  28061. "allOf": [
  28062. { "$ref": "#/definitions/package-base" },
  28063. {
  28064. "properties": {
  28065. "dist": { "type": "object" },
  28066. "source": { "type": "object" }
  28067. }
  28068. },
  28069. { "oneOf": [
  28070. { "required": [ "name", "version", "source" ] },
  28071. { "required": [ "name", "version", "dist" ] }
  28072. ] }
  28073. ]
  28074. },
  28075. "metapackage": {
  28076. "allOf": [
  28077. { "$ref": "#/definitions/package-base" },
  28078. {
  28079. "properties": {
  28080. "type": { "type": "string", "enum": [ "metapackage" ] }
  28081. },
  28082. "required": [ "name", "version", "type" ]
  28083. }
  28084. ]
  28085. },
  28086. "provider": {
  28087. "type": "object",
  28088. "properties": {
  28089. "sha256": {
  28090. "type": "string",
  28091. "description": "Hash value that can be used to validate the resource."
  28092. }
  28093. }
  28094. }
  28095. }
  28096. }
  28097. {
  28098. "$schema": "http://json-schema.org/draft-04/schema#",
  28099. "name": "Package",
  28100. "type": "object",
  28101. "additionalProperties": false,
  28102. "required": [ "name", "description" ],
  28103. "properties": {
  28104. "name": {
  28105. "type": "string",
  28106. "description": "Package name, including 'vendor-name/' prefix."
  28107. },
  28108. "type": {
  28109. "description": "Package type, either 'library' for common packages, 'composer-plugin' for plugins, 'metapackage' for empty packages, or a custom type ([a-z0-9-]+) defined by whatever project this package applies to.",
  28110. "type": "string"
  28111. },
  28112. "target-dir": {
  28113. "description": "DEPRECATED: Forces the package to be installed into the given subdirectory path. This is used for autoloading PSR-0 packages that do not contain their full path. Use forward slashes for cross-platform compatibility.",
  28114. "type": "string"
  28115. },
  28116. "description": {
  28117. "type": "string",
  28118. "description": "Short package description."
  28119. },
  28120. "keywords": {
  28121. "type": "array",
  28122. "items": {
  28123. "type": "string",
  28124. "description": "A tag/keyword that this package relates to."
  28125. }
  28126. },
  28127. "homepage": {
  28128. "type": "string",
  28129. "description": "Homepage URL for the project.",
  28130. "format": "uri"
  28131. },
  28132. "readme": {
  28133. "type": "string",
  28134. "description": "Relative path to the readme document."
  28135. },
  28136. "version": {
  28137. "type": "string",
  28138. "description": "Package version, see https://getcomposer.org/doc/04-schema.md#version for more info on valid schemes."
  28139. },
  28140. "time": {
  28141. "type": "string",
  28142. "description": "Package release date, in 'YYYY-MM-DD', 'YYYY-MM-DD HH:MM:SS' or 'YYYY-MM-DDTHH:MM:SSZ' format."
  28143. },
  28144. "license": {
  28145. "type": ["string", "array"],
  28146. "description": "License name. Or an array of license names."
  28147. },
  28148. "authors": {
  28149. "$ref": "#/definitions/authors"
  28150. },
  28151. "require": {
  28152. "type": "object",
  28153. "description": "This is a hash of package name (keys) and version constraints (values) that are required to run this package.",
  28154. "additionalProperties": {
  28155. "type": "string"
  28156. }
  28157. },
  28158. "replace": {
  28159. "type": "object",
  28160. "description": "This is a hash of package name (keys) and version constraints (values) that can be replaced by this package.",
  28161. "additionalProperties": {
  28162. "type": "string"
  28163. }
  28164. },
  28165. "conflict": {
  28166. "type": "object",
  28167. "description": "This is a hash of package name (keys) and version constraints (values) that conflict with this package.",
  28168. "additionalProperties": {
  28169. "type": "string"
  28170. }
  28171. },
  28172. "provide": {
  28173. "type": "object",
  28174. "description": "This is a hash of package name (keys) and version constraints (values) that this package provides in addition to this package's name.",
  28175. "additionalProperties": {
  28176. "type": "string"
  28177. }
  28178. },
  28179. "require-dev": {
  28180. "type": "object",
  28181. "description": "This is a hash of package name (keys) and version constraints (values) that this package requires for developing it (testing tools and such).",
  28182. "additionalProperties": {
  28183. "type": "string"
  28184. }
  28185. },
  28186. "suggest": {
  28187. "type": "object",
  28188. "description": "This is a hash of package name (keys) and descriptions (values) that this package suggests work well with it (this will be suggested to the user during installation).",
  28189. "additionalProperties": {
  28190. "type": "string"
  28191. }
  28192. },
  28193. "config": {
  28194. "type": "object",
  28195. "description": "Composer options.",
  28196. "properties": {
  28197. "process-timeout": {
  28198. "type": "integer",
  28199. "description": "The timeout in seconds for process executions, defaults to 300 (5mins)."
  28200. },
  28201. "use-include-path": {
  28202. "type": "boolean",
  28203. "description": "If true, the Composer autoloader will also look for classes in the PHP include path."
  28204. },
  28205. "preferred-install": {
  28206. "type": ["string", "object"],
  28207. "description": "The install method Composer will prefer to use, defaults to auto and can be any of source, dist, auto, or a hash of {\"pattern\": \"preference\"}."
  28208. },
  28209. "notify-on-install": {
  28210. "type": "boolean",
  28211. "description": "Composer allows repositories to define a notification URL, so that they get notified whenever a package from that repository is installed. This option allows you to disable that behaviour, defaults to true."
  28212. },
  28213. "github-protocols": {
  28214. "type": "array",
  28215. "description": "A list of protocols to use for github.com clones, in priority order, defaults to [\"git\", \"https\", \"http\"].",
  28216. "items": {
  28217. "type": "string"
  28218. }
  28219. },
  28220. "github-oauth": {
  28221. "type": "object",
  28222. "description": "A hash of domain name => github API oauth tokens, typically {\"github.com\":\"<token>\"}.",
  28223. "additionalProperties": {
  28224. "type": "string"
  28225. }
  28226. },
  28227. "gitlab-oauth": {
  28228. "type": "object",
  28229. "description": "A hash of domain name => gitlab API oauth tokens, typically {\"gitlab.com\":\"<token>\"}.",
  28230. "additionalProperties": {
  28231. "type": "string"
  28232. }
  28233. },
  28234. "gitlab-token": {
  28235. "type": "object",
  28236. "description": "A hash of domain name => gitlab private tokens, typically {\"gitlab.com\":\"<token>\"}.",
  28237. "additionalProperties": true
  28238. },
  28239. "disable-tls": {
  28240. "type": "boolean",
  28241. "description": "Defaults to `false`. If set to true all HTTPS URLs will be tried with HTTP instead and no network level encryption is performed. Enabling this is a security risk and is NOT recommended. The better way is to enable the php_openssl extension in php.ini."
  28242. },
  28243. "secure-http": {
  28244. "type": "boolean",
  28245. "description": "Defaults to `true`. If set to true only HTTPS URLs are allowed to be downloaded via Composer. If you really absolutely need HTTP access to something then you can disable it, but using \"Let's Encrypt\" to get a free SSL certificate is generally a better alternative."
  28246. },
  28247. "cafile": {
  28248. "type": "string",
  28249. "description": "A way to set the path to the openssl CA file. In PHP 5.6+ you should rather set this via openssl.cafile in php.ini, although PHP 5.6+ should be able to detect your system CA file automatically."
  28250. },
  28251. "capath": {
  28252. "type": "string",
  28253. "description": "If cafile is not specified or if the certificate is not found there, the directory pointed to by capath is searched for a suitable certificate. capath must be a correctly hashed certificate directory."
  28254. },
  28255. "http-basic": {
  28256. "type": "object",
  28257. "description": "A hash of domain name => {\"username\": \"...\", \"password\": \"...\"}.",
  28258. "additionalProperties": {
  28259. "type": "object",
  28260. "required": ["username", "password"],
  28261. "properties": {
  28262. "username": {
  28263. "type": "string",
  28264. "description": "The username used for HTTP Basic authentication"
  28265. },
  28266. "password": {
  28267. "type": "string",
  28268. "description": "The password used for HTTP Basic authentication"
  28269. }
  28270. }
  28271. }
  28272. },
  28273. "store-auths": {
  28274. "type": ["string", "boolean"],
  28275. "description": "What to do after prompting for authentication, one of: true (store), false (do not store) or \"prompt\" (ask every time), defaults to prompt."
  28276. },
  28277. "platform": {
  28278. "type": "object",
  28279. "description": "This is a hash of package name (keys) and version (values) that will be used to mock the platform packages on this machine.",
  28280. "additionalProperties": {
  28281. "type": "string"
  28282. }
  28283. },
  28284. "vendor-dir": {
  28285. "type": "string",
  28286. "description": "The location where all packages are installed, defaults to \"vendor\"."
  28287. },
  28288. "bin-dir": {
  28289. "type": "string",
  28290. "description": "The location where all binaries are linked, defaults to \"vendor/bin\"."
  28291. },
  28292. "data-dir": {
  28293. "type": "string",
  28294. "description": "The location where old phar files are stored, defaults to \"$home\" except on XDG Base Directory compliant unixes."
  28295. },
  28296. "cache-dir": {
  28297. "type": "string",
  28298. "description": "The location where all caches are located, defaults to \"~/.composer/cache\" on *nix and \"%LOCALAPPDATA%\\Composer\" on windows."
  28299. },
  28300. "cache-files-dir": {
  28301. "type": "string",
  28302. "description": "The location where files (zip downloads) are cached, defaults to \"{$cache-dir}/files\"."
  28303. },
  28304. "cache-repo-dir": {
  28305. "type": "string",
  28306. "description": "The location where repo (git/hg repo clones) are cached, defaults to \"{$cache-dir}/repo\"."
  28307. },
  28308. "cache-vcs-dir": {
  28309. "type": "string",
  28310. "description": "The location where vcs infos (git clones, github api calls, etc. when reading vcs repos) are cached, defaults to \"{$cache-dir}/vcs\"."
  28311. },
  28312. "cache-ttl": {
  28313. "type": "integer",
  28314. "description": "The default cache time-to-live, defaults to 15552000 (6 months)."
  28315. },
  28316. "cache-files-ttl": {
  28317. "type": "integer",
  28318. "description": "The cache time-to-live for files, defaults to the value of cache-ttl."
  28319. },
  28320. "cache-files-maxsize": {
  28321. "type": ["string", "integer"],
  28322. "description": "The cache max size for the files cache, defaults to \"300MiB\"."
  28323. },
  28324. "bin-compat": {
  28325. "enum": ["auto", "full"],
  28326. "description": "The compatibility of the binaries, defaults to \"auto\" (automatically guessed) and can be \"full\" (compatible with both Windows and Unix-based systems)."
  28327. },
  28328. "discard-changes": {
  28329. "type": ["string", "boolean"],
  28330. "description": "The default style of handling dirty updates, defaults to false and can be any of true, false or \"stash\"."
  28331. },
  28332. "autoloader-suffix": {
  28333. "type": "string",
  28334. "description": "Optional string to be used as a suffix for the generated Composer autoloader. When null a random one will be generated."
  28335. },
  28336. "optimize-autoloader": {
  28337. "type": "boolean",
  28338. "description": "Always optimize when dumping the autoloader."
  28339. },
  28340. "prepend-autoloader": {
  28341. "type": "boolean",
  28342. "description": "If false, the composer autoloader will not be prepended to existing autoloaders, defaults to true."
  28343. },
  28344. "classmap-authoritative": {
  28345. "type": "boolean",
  28346. "description": "If true, the composer autoloader will not scan the filesystem for classes that are not found in the class map, defaults to false."
  28347. },
  28348. "apcu-autoloader": {
  28349. "type": "boolean",
  28350. "description": "If true, the Composer autoloader will check for APCu and use it to cache found/not-found classes when the extension is enabled, defaults to false."
  28351. },
  28352. "github-domains": {
  28353. "type": "array",
  28354. "description": "A list of domains to use in github mode. This is used for GitHub Enterprise setups, defaults to [\"github.com\"].",
  28355. "items": {
  28356. "type": "string"
  28357. }
  28358. },
  28359. "github-expose-hostname": {
  28360. "type": "boolean",
  28361. "description": "Defaults to true. If set to false, the OAuth tokens created to access the github API will have a date instead of the machine hostname."
  28362. },
  28363. "gitlab-domains": {
  28364. "type": "array",
  28365. "description": "A list of domains to use in gitlab mode. This is used for custom GitLab setups, defaults to [\"gitlab.com\"].",
  28366. "items": {
  28367. "type": "string"
  28368. }
  28369. },
  28370. "archive-format": {
  28371. "type": "string",
  28372. "description": "The default archiving format when not provided on cli, defaults to \"tar\"."
  28373. },
  28374. "archive-dir": {
  28375. "type": "string",
  28376. "description": "The default archive path when not provided on cli, defaults to \".\"."
  28377. },
  28378. "htaccess-protect": {
  28379. "type": "boolean",
  28380. "description": "Defaults to true. If set to false, Composer will not create .htaccess files in the composer home, cache, and data directories."
  28381. },
  28382. "sort-packages": {
  28383. "type": "boolean",
  28384. "description": "Defaults to false. If set to true, Composer will sort packages when adding/updating a new dependency."
  28385. }
  28386. }
  28387. },
  28388. "extra": {
  28389. "type": ["object", "array"],
  28390. "description": "Arbitrary extra data that can be used by plugins, for example, package of type composer-plugin may have a 'class' key defining an installer class name.",
  28391. "additionalProperties": true
  28392. },
  28393. "autoload": {
  28394. "$ref": "#/definitions/autoload"
  28395. },
  28396. "autoload-dev": {
  28397. "type": "object",
  28398. "description": "Description of additional autoload rules for development purpose (eg. a test suite).",
  28399. "properties": {
  28400. "psr-0": {
  28401. "type": "object",
  28402. "description": "This is a hash of namespaces (keys) and the directories they can be found into (values, can be arrays of paths) by the autoloader.",
  28403. "additionalProperties": {
  28404. "type": ["string", "array"],
  28405. "items": {
  28406. "type": "string"
  28407. }
  28408. }
  28409. },
  28410. "psr-4": {
  28411. "type": "object",
  28412. "description": "This is a hash of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader.",
  28413. "additionalProperties": {
  28414. "type": ["string", "array"],
  28415. "items": {
  28416. "type": "string"
  28417. }
  28418. }
  28419. },
  28420. "classmap": {
  28421. "type": "array",
  28422. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  28423. },
  28424. "files": {
  28425. "type": "array",
  28426. "description": "This is an array of files that are always required on every request."
  28427. }
  28428. }
  28429. },
  28430. "archive": {
  28431. "type": ["object"],
  28432. "description": "Options for creating package archives for distribution.",
  28433. "properties": {
  28434. "exclude": {
  28435. "type": "array",
  28436. "description": "A list of patterns for paths to exclude or include if prefixed with an exclamation mark."
  28437. }
  28438. }
  28439. },
  28440. "repositories": {
  28441. "type": ["object", "array"],
  28442. "description": "A set of additional repositories where packages can be found.",
  28443. "additionalProperties": {
  28444. "oneOf": [
  28445. { "$ref": "#/definitions/repository" },
  28446. { "type": "boolean", "enum": [false] }
  28447. ]
  28448. },
  28449. "items": {
  28450. "oneOf": [
  28451. { "$ref": "#/definitions/repository" },
  28452. {
  28453. "type": "object",
  28454. "additionalProperties": { "type": "boolean", "enum": [false] },
  28455. "minProperties": 1,
  28456. "maxProperties": 1
  28457. }
  28458. ]
  28459. }
  28460. },
  28461. "minimum-stability": {
  28462. "type": ["string"],
  28463. "description": "The minimum stability the packages must have to be install-able. Possible values are: dev, alpha, beta, RC, stable.",
  28464. "pattern": "^dev|alpha|beta|rc|RC|stable$"
  28465. },
  28466. "prefer-stable": {
  28467. "type": ["boolean"],
  28468. "description": "If set to true, stable packages will be preferred to dev packages when possible, even if the minimum-stability allows unstable packages."
  28469. },
  28470. "bin": {
  28471. "type": ["string", "array"],
  28472. "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
  28473. "items": {
  28474. "type": "string"
  28475. }
  28476. },
  28477. "include-path": {
  28478. "type": ["array"],
  28479. "description": "DEPRECATED: A list of directories which should get added to PHP's include path. This is only present to support legacy projects, and all new code should preferably use autoloading.",
  28480. "items": {
  28481. "type": "string"
  28482. }
  28483. },
  28484. "scripts": {
  28485. "type": ["object"],
  28486. "description": "Script listeners that will be executed before/after some events.",
  28487. "properties": {
  28488. "pre-install-cmd": {
  28489. "type": ["array", "string"],
  28490. "description": "Occurs before the install command is executed, contains one or more Class::method callables or shell commands."
  28491. },
  28492. "post-install-cmd": {
  28493. "type": ["array", "string"],
  28494. "description": "Occurs after the install command is executed, contains one or more Class::method callables or shell commands."
  28495. },
  28496. "pre-update-cmd": {
  28497. "type": ["array", "string"],
  28498. "description": "Occurs before the update command is executed, contains one or more Class::method callables or shell commands."
  28499. },
  28500. "post-update-cmd": {
  28501. "type": ["array", "string"],
  28502. "description": "Occurs after the update command is executed, contains one or more Class::method callables or shell commands."
  28503. },
  28504. "pre-status-cmd": {
  28505. "type": ["array", "string"],
  28506. "description": "Occurs before the status command is executed, contains one or more Class::method callables or shell commands."
  28507. },
  28508. "post-status-cmd": {
  28509. "type": ["array", "string"],
  28510. "description": "Occurs after the status command is executed, contains one or more Class::method callables or shell commands."
  28511. },
  28512. "pre-package-install": {
  28513. "type": ["array", "string"],
  28514. "description": "Occurs before a package is installed, contains one or more Class::method callables or shell commands."
  28515. },
  28516. "post-package-install": {
  28517. "type": ["array", "string"],
  28518. "description": "Occurs after a package is installed, contains one or more Class::method callables or shell commands."
  28519. },
  28520. "pre-package-update": {
  28521. "type": ["array", "string"],
  28522. "description": "Occurs before a package is updated, contains one or more Class::method callables or shell commands."
  28523. },
  28524. "post-package-update": {
  28525. "type": ["array", "string"],
  28526. "description": "Occurs after a package is updated, contains one or more Class::method callables or shell commands."
  28527. },
  28528. "pre-package-uninstall": {
  28529. "type": ["array", "string"],
  28530. "description": "Occurs before a package has been uninstalled, contains one or more Class::method callables or shell commands."
  28531. },
  28532. "post-package-uninstall": {
  28533. "type": ["array", "string"],
  28534. "description": "Occurs after a package has been uninstalled, contains one or more Class::method callables or shell commands."
  28535. },
  28536. "pre-autoload-dump": {
  28537. "type": ["array", "string"],
  28538. "description": "Occurs before the autoloader is dumped, contains one or more Class::method callables or shell commands."
  28539. },
  28540. "post-autoload-dump": {
  28541. "type": ["array", "string"],
  28542. "description": "Occurs after the autoloader is dumped, contains one or more Class::method callables or shell commands."
  28543. },
  28544. "post-root-package-install": {
  28545. "type": ["array", "string"],
  28546. "description": "Occurs after the root-package is installed, contains one or more Class::method callables or shell commands."
  28547. },
  28548. "post-create-project-cmd": {
  28549. "type": ["array", "string"],
  28550. "description": "Occurs after the create-project command is executed, contains one or more Class::method callables or shell commands."
  28551. }
  28552. }
  28553. },
  28554. "scripts-descriptions": {
  28555. "type": ["object"],
  28556. "description": "Descriptions for custom commands, shown in console help.",
  28557. "additionalProperties": {
  28558. "type": "string"
  28559. }
  28560. },
  28561. "support": {
  28562. "type": "object",
  28563. "properties": {
  28564. "email": {
  28565. "type": "string",
  28566. "description": "Email address for support.",
  28567. "format": "email"
  28568. },
  28569. "issues": {
  28570. "type": "string",
  28571. "description": "URL to the issue tracker.",
  28572. "format": "uri"
  28573. },
  28574. "forum": {
  28575. "type": "string",
  28576. "description": "URL to the forum.",
  28577. "format": "uri"
  28578. },
  28579. "wiki": {
  28580. "type": "string",
  28581. "description": "URL to the wiki.",
  28582. "format": "uri"
  28583. },
  28584. "irc": {
  28585. "type": "string",
  28586. "description": "IRC channel for support, as irc://server/channel.",
  28587. "format": "uri"
  28588. },
  28589. "source": {
  28590. "type": "string",
  28591. "description": "URL to browse or download the sources.",
  28592. "format": "uri"
  28593. },
  28594. "docs": {
  28595. "type": "string",
  28596. "description": "URL to the documentation.",
  28597. "format": "uri"
  28598. },
  28599. "rss": {
  28600. "type": "string",
  28601. "description": "URL to the RSS feed.",
  28602. "format": "uri"
  28603. }
  28604. }
  28605. },
  28606. "non-feature-branches": {
  28607. "type": ["array"],
  28608. "description": "A set of string or regex patterns for non-numeric branch names that will not be handled as feature branches.",
  28609. "items": {
  28610. "type": "string"
  28611. }
  28612. },
  28613. "abandoned": {
  28614. "type": ["boolean", "string"],
  28615. "description": "Indicates whether this package has been abandoned, it can be boolean or a package name/URL pointing to a recommended alternative. Defaults to false."
  28616. },
  28617. "_comment": {
  28618. "type": ["array", "string"],
  28619. "description": "A key to store comments in"
  28620. }
  28621. },
  28622. "definitions": {
  28623. "authors": {
  28624. "type": "array",
  28625. "description": "List of authors that contributed to the package. This is typically the main maintainers, not the full list.",
  28626. "items": {
  28627. "type": "object",
  28628. "additionalProperties": false,
  28629. "required": [ "name"],
  28630. "properties": {
  28631. "name": {
  28632. "type": "string",
  28633. "description": "Full name of the author."
  28634. },
  28635. "email": {
  28636. "type": "string",
  28637. "description": "Email address of the author.",
  28638. "format": "email"
  28639. },
  28640. "homepage": {
  28641. "type": "string",
  28642. "description": "Homepage URL for the author.",
  28643. "format": "uri"
  28644. },
  28645. "role": {
  28646. "type": "string",
  28647. "description": "Author's role in the project."
  28648. }
  28649. }
  28650. }
  28651. },
  28652. "autoload": {
  28653. "type": "object",
  28654. "description": "Description of how the package can be autoloaded.",
  28655. "properties": {
  28656. "psr-0": {
  28657. "type": "object",
  28658. "description": "This is a hash of namespaces (keys) and the directories they can be found in (values, can be arrays of paths) by the autoloader.",
  28659. "additionalProperties": {
  28660. "type": ["string", "array"],
  28661. "items": {
  28662. "type": "string"
  28663. }
  28664. }
  28665. },
  28666. "psr-4": {
  28667. "type": "object",
  28668. "description": "This is a hash of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader.",
  28669. "additionalProperties": {
  28670. "type": ["string", "array"],
  28671. "items": {
  28672. "type": "string"
  28673. }
  28674. }
  28675. },
  28676. "classmap": {
  28677. "type": "array",
  28678. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  28679. },
  28680. "files": {
  28681. "type": "array",
  28682. "description": "This is an array of files that are always required on every request."
  28683. },
  28684. "exclude-from-classmap": {
  28685. "type": "array",
  28686. "description": "This is an array of patterns to exclude from autoload classmap generation. (e.g. \"exclude-from-classmap\": [\"/test/\", \"/tests/\", \"/Tests/\"]"
  28687. }
  28688. }
  28689. },
  28690. "repository": {
  28691. "type": "object",
  28692. "oneOf": [
  28693. { "$ref": "#/definitions/composer-repository" },
  28694. { "$ref": "#/definitions/vcs-repository" },
  28695. { "$ref": "#/definitions/path-repository" },
  28696. { "$ref": "#/definitions/artifact-repository" },
  28697. { "$ref": "#/definitions/pear-repository" },
  28698. { "$ref": "#/definitions/package-repository" }
  28699. ]
  28700. },
  28701. "composer-repository": {
  28702. "type": "object",
  28703. "required": ["type", "url"],
  28704. "properties": {
  28705. "type": { "type": "string", "enum": ["composer"] },
  28706. "url": { "type": "string" },
  28707. "options": {
  28708. "type": "object",
  28709. "additionalProperties": true
  28710. },
  28711. "allow_ssl_downgrade": { "type": "boolean" },
  28712. "force-lazy-providers": { "type": "boolean" }
  28713. }
  28714. },
  28715. "vcs-repository": {
  28716. "type": "object",
  28717. "required": ["type", "url"],
  28718. "properties": {
  28719. "type": { "type": "string", "enum": ["vcs", "github", "git", "gitlab", "git-bitbucket", "hg", "hg-bitbucket", "fossil", "perforce", "svn"] },
  28720. "url": { "type": "string" },
  28721. "no-api": { "type": "boolean" },
  28722. "secure-http": { "type": "boolean" },
  28723. "svn-cache-credentials": { "type": "boolean" },
  28724. "trunk-path": { "type": ["string", "boolean"] },
  28725. "branches-path": { "type": ["string", "boolean"] },
  28726. "tags-path": { "type": ["string", "boolean"] },
  28727. "package-path": { "type": "string" },
  28728. "depot": { "type": "string" },
  28729. "branch": { "type": "string" },
  28730. "unique_perforce_client_name": { "type": "string" },
  28731. "p4user": { "type": "string" },
  28732. "p4password": { "type": "string" }
  28733. }
  28734. },
  28735. "path-repository": {
  28736. "type": "object",
  28737. "required": ["type", "url"],
  28738. "properties": {
  28739. "type": { "type": "string", "enum": ["path"] },
  28740. "url": { "type": "string" },
  28741. "options": {
  28742. "type": "object",
  28743. "properties": {
  28744. "symlink": { "type": ["boolean", "null"] }
  28745. },
  28746. "additionalProperties": true
  28747. }
  28748. }
  28749. },
  28750. "artifact-repository": {
  28751. "type": "object",
  28752. "required": ["type", "url"],
  28753. "properties": {
  28754. "type": { "type": "string", "enum": ["artifact"] },
  28755. "url": { "type": "string" }
  28756. }
  28757. },
  28758. "pear-repository": {
  28759. "type": "object",
  28760. "required": ["type", "url"],
  28761. "properties": {
  28762. "type": { "type": "string", "enum": ["pear"] },
  28763. "url": { "type": "string" },
  28764. "vendor-alias": { "type": "string" }
  28765. }
  28766. },
  28767. "package-repository": {
  28768. "type": "object",
  28769. "required": ["type", "package"],
  28770. "properties": {
  28771. "type": { "type": "string", "enum": ["package"] },
  28772. "package": {
  28773. "oneOf": [
  28774. { "$ref": "#/definitions/inline-package" },
  28775. {
  28776. "type": "array",
  28777. "items": { "$ref": "#/definitions/inline-package" }
  28778. }
  28779. ]
  28780. }
  28781. }
  28782. },
  28783. "inline-package": {
  28784. "type": "object",
  28785. "required": ["name", "version"],
  28786. "properties": {
  28787. "name": {
  28788. "type": "string",
  28789. "description": "Package name, including 'vendor-name/' prefix."
  28790. },
  28791. "type": {
  28792. "type": "string"
  28793. },
  28794. "target-dir": {
  28795. "description": "DEPRECATED: Forces the package to be installed into the given subdirectory path. This is used for autoloading PSR-0 packages that do not contain their full path. Use forward slashes for cross-platform compatibility.",
  28796. "type": "string"
  28797. },
  28798. "description": {
  28799. "type": "string"
  28800. },
  28801. "keywords": {
  28802. "type": "array",
  28803. "items": {
  28804. "type": "string"
  28805. }
  28806. },
  28807. "homepage": {
  28808. "type": "string",
  28809. "format": "uri"
  28810. },
  28811. "version": {
  28812. "type": "string"
  28813. },
  28814. "time": {
  28815. "type": "string"
  28816. },
  28817. "license": {
  28818. "type": [
  28819. "string",
  28820. "array"
  28821. ]
  28822. },
  28823. "authors": {
  28824. "$ref": "#/definitions/authors"
  28825. },
  28826. "require": {
  28827. "type": "object",
  28828. "additionalProperties": {
  28829. "type": "string"
  28830. }
  28831. },
  28832. "replace": {
  28833. "type": "object",
  28834. "additionalProperties": {
  28835. "type": "string"
  28836. }
  28837. },
  28838. "conflict": {
  28839. "type": "object",
  28840. "additionalProperties": {
  28841. "type": "string"
  28842. }
  28843. },
  28844. "provide": {
  28845. "type": "object",
  28846. "additionalProperties": {
  28847. "type": "string"
  28848. }
  28849. },
  28850. "require-dev": {
  28851. "type": "object",
  28852. "additionalProperties": {
  28853. "type": "string"
  28854. }
  28855. },
  28856. "suggest": {
  28857. "type": "object",
  28858. "additionalProperties": {
  28859. "type": "string"
  28860. }
  28861. },
  28862. "extra": {
  28863. "type": ["object", "array"],
  28864. "additionalProperties": true
  28865. },
  28866. "autoload": {
  28867. "$ref": "#/definitions/autoload"
  28868. },
  28869. "archive": {
  28870. "type": ["object"],
  28871. "properties": {
  28872. "exclude": {
  28873. "type": "array"
  28874. }
  28875. }
  28876. },
  28877. "bin": {
  28878. "type": ["string", "array"],
  28879. "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
  28880. "items": {
  28881. "type": "string"
  28882. }
  28883. },
  28884. "include-path": {
  28885. "type": ["array"],
  28886. "description": "DEPRECATED: A list of directories which should get added to PHP's include path. This is only present to support legacy projects, and all new code should preferably use autoloading.",
  28887. "items": {
  28888. "type": "string"
  28889. }
  28890. },
  28891. "source": {
  28892. "type": "object",
  28893. "required": ["type", "url", "reference"],
  28894. "properties": {
  28895. "type": {
  28896. "type": "string"
  28897. },
  28898. "url": {
  28899. "type": "string"
  28900. },
  28901. "reference": {
  28902. "type": "string"
  28903. },
  28904. "mirrors": {
  28905. "type": "array"
  28906. }
  28907. }
  28908. },
  28909. "dist": {
  28910. "type": "object",
  28911. "required": ["type", "url"],
  28912. "properties": {
  28913. "type": {
  28914. "type": "string"
  28915. },
  28916. "url": {
  28917. "type": "string"
  28918. },
  28919. "reference": {
  28920. "type": "string"
  28921. },
  28922. "shasum": {
  28923. "type": "string"
  28924. },
  28925. "mirrors": {
  28926. "type": "array"
  28927. }
  28928. }
  28929. }
  28930. },
  28931. "additionalProperties": true
  28932. }
  28933. }
  28934. }
  28935. {
  28936. "389-exception": [
  28937. "389 Directory Server Exception"
  28938. ],
  28939. "Autoconf-exception-2.0": [
  28940. "Autoconf exception 2.0"
  28941. ],
  28942. "Autoconf-exception-3.0": [
  28943. "Autoconf exception 3.0"
  28944. ],
  28945. "Bison-exception-2.2": [
  28946. "Bison exception 2.2"
  28947. ],
  28948. "Bootloader-exception": [
  28949. "Bootloader Distribution Exception"
  28950. ],
  28951. "Classpath-exception-2.0": [
  28952. "Classpath exception 2.0"
  28953. ],
  28954. "CLISP-exception-2.0": [
  28955. "CLISP exception 2.0"
  28956. ],
  28957. "DigiRule-FOSS-exception": [
  28958. "DigiRule FOSS License Exception"
  28959. ],
  28960. "eCos-exception-2.0": [
  28961. "eCos exception 2.0"
  28962. ],
  28963. "Fawkes-Runtime-exception": [
  28964. "Fawkes Runtime Exception"
  28965. ],
  28966. "FLTK-exception": [
  28967. "FLTK exception"
  28968. ],
  28969. "Font-exception-2.0": [
  28970. "Font exception 2.0"
  28971. ],
  28972. "freertos-exception-2.0": [
  28973. "FreeRTOS Exception 2.0"
  28974. ],
  28975. "GCC-exception-2.0": [
  28976. "GCC Runtime Library exception 2.0"
  28977. ],
  28978. "GCC-exception-3.1": [
  28979. "GCC Runtime Library exception 3.1"
  28980. ],
  28981. "gnu-javamail-exception": [
  28982. "GNU JavaMail exception"
  28983. ],
  28984. "i2p-gpl-java-exception": [
  28985. "i2p GPL+Java Exception"
  28986. ],
  28987. "Libtool-exception": [
  28988. "Libtool Exception"
  28989. ],
  28990. "Linux-syscall-note": [
  28991. "Linux Syscall Note"
  28992. ],
  28993. "LLVM-exception": [
  28994. "LLVM Exception"
  28995. ],
  28996. "LZMA-exception": [
  28997. "LZMA exception"
  28998. ],
  28999. "mif-exception": [
  29000. "Macros and Inline Functions Exception"
  29001. ],
  29002. "Nokia-Qt-exception-1.1": [
  29003. "Nokia Qt LGPL exception 1.1"
  29004. ],
  29005. "OCCT-exception-1.0": [
  29006. "Open CASCADE Exception 1.0"
  29007. ],
  29008. "OpenJDK-assembly-exception-1.0": [
  29009. "OpenJDK Assembly exception 1.0"
  29010. ],
  29011. "openvpn-openssl-exception": [
  29012. "OpenVPN OpenSSL Exception"
  29013. ],
  29014. "Qwt-exception-1.0": [
  29015. "Qwt exception 1.0"
  29016. ],
  29017. "u-boot-exception-2.0": [
  29018. "U-Boot exception 2.0"
  29019. ],
  29020. "WxWindows-exception-3.1": [
  29021. "WxWindows Library Exception 3.1"
  29022. ]
  29023. }{
  29024. "0BSD": [
  29025. "BSD Zero Clause License",
  29026. false,
  29027. false
  29028. ],
  29029. "AAL": [
  29030. "Attribution Assurance License",
  29031. true,
  29032. false
  29033. ],
  29034. "Abstyles": [
  29035. "Abstyles License",
  29036. false,
  29037. false
  29038. ],
  29039. "Adobe-2006": [
  29040. "Adobe Systems Incorporated Source Code License Agreement",
  29041. false,
  29042. false
  29043. ],
  29044. "Adobe-Glyph": [
  29045. "Adobe Glyph List License",
  29046. false,
  29047. false
  29048. ],
  29049. "ADSL": [
  29050. "Amazon Digital Services License",
  29051. false,
  29052. false
  29053. ],
  29054. "AFL-1.1": [
  29055. "Academic Free License v1.1",
  29056. true,
  29057. false
  29058. ],
  29059. "AFL-1.2": [
  29060. "Academic Free License v1.2",
  29061. true,
  29062. false
  29063. ],
  29064. "AFL-2.0": [
  29065. "Academic Free License v2.0",
  29066. true,
  29067. false
  29068. ],
  29069. "AFL-2.1": [
  29070. "Academic Free License v2.1",
  29071. true,
  29072. false
  29073. ],
  29074. "AFL-3.0": [
  29075. "Academic Free License v3.0",
  29076. true,
  29077. false
  29078. ],
  29079. "Afmparse": [
  29080. "Afmparse License",
  29081. false,
  29082. false
  29083. ],
  29084. "AGPL-1.0": [
  29085. "Affero General Public License v1.0",
  29086. false,
  29087. true
  29088. ],
  29089. "AGPL-1.0-only": [
  29090. "Affero General Public License v1.0 only",
  29091. false,
  29092. false
  29093. ],
  29094. "AGPL-1.0-or-later": [
  29095. "Affero General Public License v1.0 or later",
  29096. false,
  29097. false
  29098. ],
  29099. "AGPL-3.0": [
  29100. "GNU Affero General Public License v3.0",
  29101. true,
  29102. true
  29103. ],
  29104. "AGPL-3.0-only": [
  29105. "GNU Affero General Public License v3.0 only",
  29106. true,
  29107. false
  29108. ],
  29109. "AGPL-3.0-or-later": [
  29110. "GNU Affero General Public License v3.0 or later",
  29111. true,
  29112. false
  29113. ],
  29114. "Aladdin": [
  29115. "Aladdin Free Public License",
  29116. false,
  29117. false
  29118. ],
  29119. "AMDPLPA": [
  29120. "AMD's plpa_map.c License",
  29121. false,
  29122. false
  29123. ],
  29124. "AML": [
  29125. "Apple MIT License",
  29126. false,
  29127. false
  29128. ],
  29129. "AMPAS": [
  29130. "Academy of Motion Picture Arts and Sciences BSD",
  29131. false,
  29132. false
  29133. ],
  29134. "ANTLR-PD": [
  29135. "ANTLR Software Rights Notice",
  29136. false,
  29137. false
  29138. ],
  29139. "Apache-1.0": [
  29140. "Apache License 1.0",
  29141. false,
  29142. false
  29143. ],
  29144. "Apache-1.1": [
  29145. "Apache License 1.1",
  29146. true,
  29147. false
  29148. ],
  29149. "Apache-2.0": [
  29150. "Apache License 2.0",
  29151. true,
  29152. false
  29153. ],
  29154. "APAFML": [
  29155. "Adobe Postscript AFM License",
  29156. false,
  29157. false
  29158. ],
  29159. "APL-1.0": [
  29160. "Adaptive Public License 1.0",
  29161. true,
  29162. false
  29163. ],
  29164. "APSL-1.0": [
  29165. "Apple Public Source License 1.0",
  29166. true,
  29167. false
  29168. ],
  29169. "APSL-1.1": [
  29170. "Apple Public Source License 1.1",
  29171. true,
  29172. false
  29173. ],
  29174. "APSL-1.2": [
  29175. "Apple Public Source License 1.2",
  29176. true,
  29177. false
  29178. ],
  29179. "APSL-2.0": [
  29180. "Apple Public Source License 2.0",
  29181. true,
  29182. false
  29183. ],
  29184. "Artistic-1.0": [
  29185. "Artistic License 1.0",
  29186. true,
  29187. false
  29188. ],
  29189. "Artistic-1.0-cl8": [
  29190. "Artistic License 1.0 w/clause 8",
  29191. true,
  29192. false
  29193. ],
  29194. "Artistic-1.0-Perl": [
  29195. "Artistic License 1.0 (Perl)",
  29196. true,
  29197. false
  29198. ],
  29199. "Artistic-2.0": [
  29200. "Artistic License 2.0",
  29201. true,
  29202. false
  29203. ],
  29204. "Bahyph": [
  29205. "Bahyph License",
  29206. false,
  29207. false
  29208. ],
  29209. "Barr": [
  29210. "Barr License",
  29211. false,
  29212. false
  29213. ],
  29214. "Beerware": [
  29215. "Beerware License",
  29216. false,
  29217. false
  29218. ],
  29219. "BitTorrent-1.0": [
  29220. "BitTorrent Open Source License v1.0",
  29221. false,
  29222. false
  29223. ],
  29224. "BitTorrent-1.1": [
  29225. "BitTorrent Open Source License v1.1",
  29226. false,
  29227. false
  29228. ],
  29229. "Borceux": [
  29230. "Borceux license",
  29231. false,
  29232. false
  29233. ],
  29234. "BSD-1-Clause": [
  29235. "BSD 1-Clause License",
  29236. false,
  29237. false
  29238. ],
  29239. "BSD-2-Clause": [
  29240. "BSD 2-Clause \"Simplified\" License",
  29241. true,
  29242. false
  29243. ],
  29244. "BSD-2-Clause-FreeBSD": [
  29245. "BSD 2-Clause FreeBSD License",
  29246. false,
  29247. false
  29248. ],
  29249. "BSD-2-Clause-NetBSD": [
  29250. "BSD 2-Clause NetBSD License",
  29251. false,
  29252. false
  29253. ],
  29254. "BSD-2-Clause-Patent": [
  29255. "BSD-2-Clause Plus Patent License",
  29256. true,
  29257. false
  29258. ],
  29259. "BSD-3-Clause": [
  29260. "BSD 3-Clause \"New\" or \"Revised\" License",
  29261. true,
  29262. false
  29263. ],
  29264. "BSD-3-Clause-Attribution": [
  29265. "BSD with attribution",
  29266. false,
  29267. false
  29268. ],
  29269. "BSD-3-Clause-Clear": [
  29270. "BSD 3-Clause Clear License",
  29271. false,
  29272. false
  29273. ],
  29274. "BSD-3-Clause-LBNL": [
  29275. "Lawrence Berkeley National Labs BSD variant license",
  29276. false,
  29277. false
  29278. ],
  29279. "BSD-3-Clause-No-Nuclear-License": [
  29280. "BSD 3-Clause No Nuclear License",
  29281. false,
  29282. false
  29283. ],
  29284. "BSD-3-Clause-No-Nuclear-License-2014": [
  29285. "BSD 3-Clause No Nuclear License 2014",
  29286. false,
  29287. false
  29288. ],
  29289. "BSD-3-Clause-No-Nuclear-Warranty": [
  29290. "BSD 3-Clause No Nuclear Warranty",
  29291. false,
  29292. false
  29293. ],
  29294. "BSD-4-Clause": [
  29295. "BSD 4-Clause \"Original\" or \"Old\" License",
  29296. false,
  29297. false
  29298. ],
  29299. "BSD-4-Clause-UC": [
  29300. "BSD-4-Clause (University of California-Specific)",
  29301. false,
  29302. false
  29303. ],
  29304. "BSD-Protection": [
  29305. "BSD Protection License",
  29306. false,
  29307. false
  29308. ],
  29309. "BSD-Source-Code": [
  29310. "BSD Source Code Attribution",
  29311. false,
  29312. false
  29313. ],
  29314. "BSL-1.0": [
  29315. "Boost Software License 1.0",
  29316. true,
  29317. false
  29318. ],
  29319. "bzip2-1.0.5": [
  29320. "bzip2 and libbzip2 License v1.0.5",
  29321. false,
  29322. false
  29323. ],
  29324. "bzip2-1.0.6": [
  29325. "bzip2 and libbzip2 License v1.0.6",
  29326. false,
  29327. false
  29328. ],
  29329. "Caldera": [
  29330. "Caldera License",
  29331. false,
  29332. false
  29333. ],
  29334. "CATOSL-1.1": [
  29335. "Computer Associates Trusted Open Source License 1.1",
  29336. true,
  29337. false
  29338. ],
  29339. "CC-BY-1.0": [
  29340. "Creative Commons Attribution 1.0 Generic",
  29341. false,
  29342. false
  29343. ],
  29344. "CC-BY-2.0": [
  29345. "Creative Commons Attribution 2.0 Generic",
  29346. false,
  29347. false
  29348. ],
  29349. "CC-BY-2.5": [
  29350. "Creative Commons Attribution 2.5 Generic",
  29351. false,
  29352. false
  29353. ],
  29354. "CC-BY-3.0": [
  29355. "Creative Commons Attribution 3.0 Unported",
  29356. false,
  29357. false
  29358. ],
  29359. "CC-BY-4.0": [
  29360. "Creative Commons Attribution 4.0 International",
  29361. false,
  29362. false
  29363. ],
  29364. "CC-BY-NC-1.0": [
  29365. "Creative Commons Attribution Non Commercial 1.0 Generic",
  29366. false,
  29367. false
  29368. ],
  29369. "CC-BY-NC-2.0": [
  29370. "Creative Commons Attribution Non Commercial 2.0 Generic",
  29371. false,
  29372. false
  29373. ],
  29374. "CC-BY-NC-2.5": [
  29375. "Creative Commons Attribution Non Commercial 2.5 Generic",
  29376. false,
  29377. false
  29378. ],
  29379. "CC-BY-NC-3.0": [
  29380. "Creative Commons Attribution Non Commercial 3.0 Unported",
  29381. false,
  29382. false
  29383. ],
  29384. "CC-BY-NC-4.0": [
  29385. "Creative Commons Attribution Non Commercial 4.0 International",
  29386. false,
  29387. false
  29388. ],
  29389. "CC-BY-NC-ND-1.0": [
  29390. "Creative Commons Attribution Non Commercial No Derivatives 1.0 Generic",
  29391. false,
  29392. false
  29393. ],
  29394. "CC-BY-NC-ND-2.0": [
  29395. "Creative Commons Attribution Non Commercial No Derivatives 2.0 Generic",
  29396. false,
  29397. false
  29398. ],
  29399. "CC-BY-NC-ND-2.5": [
  29400. "Creative Commons Attribution Non Commercial No Derivatives 2.5 Generic",
  29401. false,
  29402. false
  29403. ],
  29404. "CC-BY-NC-ND-3.0": [
  29405. "Creative Commons Attribution Non Commercial No Derivatives 3.0 Unported",
  29406. false,
  29407. false
  29408. ],
  29409. "CC-BY-NC-ND-4.0": [
  29410. "Creative Commons Attribution Non Commercial No Derivatives 4.0 International",
  29411. false,
  29412. false
  29413. ],
  29414. "CC-BY-NC-SA-1.0": [
  29415. "Creative Commons Attribution Non Commercial Share Alike 1.0 Generic",
  29416. false,
  29417. false
  29418. ],
  29419. "CC-BY-NC-SA-2.0": [
  29420. "Creative Commons Attribution Non Commercial Share Alike 2.0 Generic",
  29421. false,
  29422. false
  29423. ],
  29424. "CC-BY-NC-SA-2.5": [
  29425. "Creative Commons Attribution Non Commercial Share Alike 2.5 Generic",
  29426. false,
  29427. false
  29428. ],
  29429. "CC-BY-NC-SA-3.0": [
  29430. "Creative Commons Attribution Non Commercial Share Alike 3.0 Unported",
  29431. false,
  29432. false
  29433. ],
  29434. "CC-BY-NC-SA-4.0": [
  29435. "Creative Commons Attribution Non Commercial Share Alike 4.0 International",
  29436. false,
  29437. false
  29438. ],
  29439. "CC-BY-ND-1.0": [
  29440. "Creative Commons Attribution No Derivatives 1.0 Generic",
  29441. false,
  29442. false
  29443. ],
  29444. "CC-BY-ND-2.0": [
  29445. "Creative Commons Attribution No Derivatives 2.0 Generic",
  29446. false,
  29447. false
  29448. ],
  29449. "CC-BY-ND-2.5": [
  29450. "Creative Commons Attribution No Derivatives 2.5 Generic",
  29451. false,
  29452. false
  29453. ],
  29454. "CC-BY-ND-3.0": [
  29455. "Creative Commons Attribution No Derivatives 3.0 Unported",
  29456. false,
  29457. false
  29458. ],
  29459. "CC-BY-ND-4.0": [
  29460. "Creative Commons Attribution No Derivatives 4.0 International",
  29461. false,
  29462. false
  29463. ],
  29464. "CC-BY-SA-1.0": [
  29465. "Creative Commons Attribution Share Alike 1.0 Generic",
  29466. false,
  29467. false
  29468. ],
  29469. "CC-BY-SA-2.0": [
  29470. "Creative Commons Attribution Share Alike 2.0 Generic",
  29471. false,
  29472. false
  29473. ],
  29474. "CC-BY-SA-2.5": [
  29475. "Creative Commons Attribution Share Alike 2.5 Generic",
  29476. false,
  29477. false
  29478. ],
  29479. "CC-BY-SA-3.0": [
  29480. "Creative Commons Attribution Share Alike 3.0 Unported",
  29481. false,
  29482. false
  29483. ],
  29484. "CC-BY-SA-4.0": [
  29485. "Creative Commons Attribution Share Alike 4.0 International",
  29486. false,
  29487. false
  29488. ],
  29489. "CC0-1.0": [
  29490. "Creative Commons Zero v1.0 Universal",
  29491. false,
  29492. false
  29493. ],
  29494. "CDDL-1.0": [
  29495. "Common Development and Distribution License 1.0",
  29496. true,
  29497. false
  29498. ],
  29499. "CDDL-1.1": [
  29500. "Common Development and Distribution License 1.1",
  29501. false,
  29502. false
  29503. ],
  29504. "CDLA-Permissive-1.0": [
  29505. "Community Data License Agreement Permissive 1.0",
  29506. false,
  29507. false
  29508. ],
  29509. "CDLA-Sharing-1.0": [
  29510. "Community Data License Agreement Sharing 1.0",
  29511. false,
  29512. false
  29513. ],
  29514. "CECILL-1.0": [
  29515. "CeCILL Free Software License Agreement v1.0",
  29516. false,
  29517. false
  29518. ],
  29519. "CECILL-1.1": [
  29520. "CeCILL Free Software License Agreement v1.1",
  29521. false,
  29522. false
  29523. ],
  29524. "CECILL-2.0": [
  29525. "CeCILL Free Software License Agreement v2.0",
  29526. false,
  29527. false
  29528. ],
  29529. "CECILL-2.1": [
  29530. "CeCILL Free Software License Agreement v2.1",
  29531. true,
  29532. false
  29533. ],
  29534. "CECILL-B": [
  29535. "CeCILL-B Free Software License Agreement",
  29536. false,
  29537. false
  29538. ],
  29539. "CECILL-C": [
  29540. "CeCILL-C Free Software License Agreement",
  29541. false,
  29542. false
  29543. ],
  29544. "ClArtistic": [
  29545. "Clarified Artistic License",
  29546. false,
  29547. false
  29548. ],
  29549. "CNRI-Jython": [
  29550. "CNRI Jython License",
  29551. false,
  29552. false
  29553. ],
  29554. "CNRI-Python": [
  29555. "CNRI Python License",
  29556. true,
  29557. false
  29558. ],
  29559. "CNRI-Python-GPL-Compatible": [
  29560. "CNRI Python Open Source GPL Compatible License Agreement",
  29561. false,
  29562. false
  29563. ],
  29564. "Condor-1.1": [
  29565. "Condor Public License v1.1",
  29566. false,
  29567. false
  29568. ],
  29569. "CPAL-1.0": [
  29570. "Common Public Attribution License 1.0",
  29571. true,
  29572. false
  29573. ],
  29574. "CPL-1.0": [
  29575. "Common Public License 1.0",
  29576. true,
  29577. false
  29578. ],
  29579. "CPOL-1.02": [
  29580. "Code Project Open License 1.02",
  29581. false,
  29582. false
  29583. ],
  29584. "Crossword": [
  29585. "Crossword License",
  29586. false,
  29587. false
  29588. ],
  29589. "CrystalStacker": [
  29590. "CrystalStacker License",
  29591. false,
  29592. false
  29593. ],
  29594. "CUA-OPL-1.0": [
  29595. "CUA Office Public License v1.0",
  29596. true,
  29597. false
  29598. ],
  29599. "Cube": [
  29600. "Cube License",
  29601. false,
  29602. false
  29603. ],
  29604. "curl": [
  29605. "curl License",
  29606. false,
  29607. false
  29608. ],
  29609. "D-FSL-1.0": [
  29610. "Deutsche Freie Software Lizenz",
  29611. false,
  29612. false
  29613. ],
  29614. "diffmark": [
  29615. "diffmark license",
  29616. false,
  29617. false
  29618. ],
  29619. "DOC": [
  29620. "DOC License",
  29621. false,
  29622. false
  29623. ],
  29624. "Dotseqn": [
  29625. "Dotseqn License",
  29626. false,
  29627. false
  29628. ],
  29629. "DSDP": [
  29630. "DSDP License",
  29631. false,
  29632. false
  29633. ],
  29634. "dvipdfm": [
  29635. "dvipdfm License",
  29636. false,
  29637. false
  29638. ],
  29639. "ECL-1.0": [
  29640. "Educational Community License v1.0",
  29641. true,
  29642. false
  29643. ],
  29644. "ECL-2.0": [
  29645. "Educational Community License v2.0",
  29646. true,
  29647. false
  29648. ],
  29649. "eCos-2.0": [
  29650. "eCos license version 2.0",
  29651. false,
  29652. true
  29653. ],
  29654. "EFL-1.0": [
  29655. "Eiffel Forum License v1.0",
  29656. true,
  29657. false
  29658. ],
  29659. "EFL-2.0": [
  29660. "Eiffel Forum License v2.0",
  29661. true,
  29662. false
  29663. ],
  29664. "eGenix": [
  29665. "eGenix.com Public License 1.1.0",
  29666. false,
  29667. false
  29668. ],
  29669. "Entessa": [
  29670. "Entessa Public License v1.0",
  29671. true,
  29672. false
  29673. ],
  29674. "EPL-1.0": [
  29675. "Eclipse Public License 1.0",
  29676. true,
  29677. false
  29678. ],
  29679. "EPL-2.0": [
  29680. "Eclipse Public License 2.0",
  29681. true,
  29682. false
  29683. ],
  29684. "ErlPL-1.1": [
  29685. "Erlang Public License v1.1",
  29686. false,
  29687. false
  29688. ],
  29689. "EUDatagrid": [
  29690. "EU DataGrid Software License",
  29691. true,
  29692. false
  29693. ],
  29694. "EUPL-1.0": [
  29695. "European Union Public License 1.0",
  29696. false,
  29697. false
  29698. ],
  29699. "EUPL-1.1": [
  29700. "European Union Public License 1.1",
  29701. true,
  29702. false
  29703. ],
  29704. "EUPL-1.2": [
  29705. "European Union Public License 1.2",
  29706. true,
  29707. false
  29708. ],
  29709. "Eurosym": [
  29710. "Eurosym License",
  29711. false,
  29712. false
  29713. ],
  29714. "Fair": [
  29715. "Fair License",
  29716. true,
  29717. false
  29718. ],
  29719. "Frameworx-1.0": [
  29720. "Frameworx Open License 1.0",
  29721. true,
  29722. false
  29723. ],
  29724. "FreeImage": [
  29725. "FreeImage Public License v1.0",
  29726. false,
  29727. false
  29728. ],
  29729. "FSFAP": [
  29730. "FSF All Permissive License",
  29731. false,
  29732. false
  29733. ],
  29734. "FSFUL": [
  29735. "FSF Unlimited License",
  29736. false,
  29737. false
  29738. ],
  29739. "FSFULLR": [
  29740. "FSF Unlimited License (with License Retention)",
  29741. false,
  29742. false
  29743. ],
  29744. "FTL": [
  29745. "Freetype Project License",
  29746. false,
  29747. false
  29748. ],
  29749. "GFDL-1.1": [
  29750. "GNU Free Documentation License v1.1",
  29751. false,
  29752. true
  29753. ],
  29754. "GFDL-1.1-only": [
  29755. "GNU Free Documentation License v1.1 only",
  29756. false,
  29757. false
  29758. ],
  29759. "GFDL-1.1-or-later": [
  29760. "GNU Free Documentation License v1.1 or later",
  29761. false,
  29762. false
  29763. ],
  29764. "GFDL-1.2": [
  29765. "GNU Free Documentation License v1.2",
  29766. false,
  29767. true
  29768. ],
  29769. "GFDL-1.2-only": [
  29770. "GNU Free Documentation License v1.2 only",
  29771. false,
  29772. false
  29773. ],
  29774. "GFDL-1.2-or-later": [
  29775. "GNU Free Documentation License v1.2 or later",
  29776. false,
  29777. false
  29778. ],
  29779. "GFDL-1.3": [
  29780. "GNU Free Documentation License v1.3",
  29781. false,
  29782. true
  29783. ],
  29784. "GFDL-1.3-only": [
  29785. "GNU Free Documentation License v1.3 only",
  29786. false,
  29787. false
  29788. ],
  29789. "GFDL-1.3-or-later": [
  29790. "GNU Free Documentation License v1.3 or later",
  29791. false,
  29792. false
  29793. ],
  29794. "Giftware": [
  29795. "Giftware License",
  29796. false,
  29797. false
  29798. ],
  29799. "GL2PS": [
  29800. "GL2PS License",
  29801. false,
  29802. false
  29803. ],
  29804. "Glide": [
  29805. "3dfx Glide License",
  29806. false,
  29807. false
  29808. ],
  29809. "Glulxe": [
  29810. "Glulxe License",
  29811. false,
  29812. false
  29813. ],
  29814. "gnuplot": [
  29815. "gnuplot License",
  29816. false,
  29817. false
  29818. ],
  29819. "GPL-1.0": [
  29820. "GNU General Public License v1.0 only",
  29821. false,
  29822. true
  29823. ],
  29824. "GPL-1.0+": [
  29825. "GNU General Public License v1.0 or later",
  29826. false,
  29827. true
  29828. ],
  29829. "GPL-1.0-only": [
  29830. "GNU General Public License v1.0 only",
  29831. false,
  29832. false
  29833. ],
  29834. "GPL-1.0-or-later": [
  29835. "GNU General Public License v1.0 or later",
  29836. false,
  29837. false
  29838. ],
  29839. "GPL-2.0": [
  29840. "GNU General Public License v2.0 only",
  29841. true,
  29842. true
  29843. ],
  29844. "GPL-2.0+": [
  29845. "GNU General Public License v2.0 or later",
  29846. true,
  29847. true
  29848. ],
  29849. "GPL-2.0-only": [
  29850. "GNU General Public License v2.0 only",
  29851. true,
  29852. false
  29853. ],
  29854. "GPL-2.0-or-later": [
  29855. "GNU General Public License v2.0 or later",
  29856. true,
  29857. false
  29858. ],
  29859. "GPL-2.0-with-autoconf-exception": [
  29860. "GNU General Public License v2.0 w/Autoconf exception",
  29861. false,
  29862. true
  29863. ],
  29864. "GPL-2.0-with-bison-exception": [
  29865. "GNU General Public License v2.0 w/Bison exception",
  29866. false,
  29867. true
  29868. ],
  29869. "GPL-2.0-with-classpath-exception": [
  29870. "GNU General Public License v2.0 w/Classpath exception",
  29871. false,
  29872. true
  29873. ],
  29874. "GPL-2.0-with-font-exception": [
  29875. "GNU General Public License v2.0 w/Font exception",
  29876. false,
  29877. true
  29878. ],
  29879. "GPL-2.0-with-GCC-exception": [
  29880. "GNU General Public License v2.0 w/GCC Runtime Library exception",
  29881. false,
  29882. true
  29883. ],
  29884. "GPL-3.0": [
  29885. "GNU General Public License v3.0 only",
  29886. true,
  29887. true
  29888. ],
  29889. "GPL-3.0+": [
  29890. "GNU General Public License v3.0 or later",
  29891. true,
  29892. true
  29893. ],
  29894. "GPL-3.0-only": [
  29895. "GNU General Public License v3.0 only",
  29896. true,
  29897. false
  29898. ],
  29899. "GPL-3.0-or-later": [
  29900. "GNU General Public License v3.0 or later",
  29901. true,
  29902. false
  29903. ],
  29904. "GPL-3.0-with-autoconf-exception": [
  29905. "GNU General Public License v3.0 w/Autoconf exception",
  29906. false,
  29907. true
  29908. ],
  29909. "GPL-3.0-with-GCC-exception": [
  29910. "GNU General Public License v3.0 w/GCC Runtime Library exception",
  29911. true,
  29912. true
  29913. ],
  29914. "gSOAP-1.3b": [
  29915. "gSOAP Public License v1.3b",
  29916. false,
  29917. false
  29918. ],
  29919. "HaskellReport": [
  29920. "Haskell Language Report License",
  29921. false,
  29922. false
  29923. ],
  29924. "HPND": [
  29925. "Historical Permission Notice and Disclaimer",
  29926. true,
  29927. false
  29928. ],
  29929. "IBM-pibs": [
  29930. "IBM PowerPC Initialization and Boot Software",
  29931. false,
  29932. false
  29933. ],
  29934. "ICU": [
  29935. "ICU License",
  29936. false,
  29937. false
  29938. ],
  29939. "IJG": [
  29940. "Independent JPEG Group License",
  29941. false,
  29942. false
  29943. ],
  29944. "ImageMagick": [
  29945. "ImageMagick License",
  29946. false,
  29947. false
  29948. ],
  29949. "iMatix": [
  29950. "iMatix Standard Function Library Agreement",
  29951. false,
  29952. false
  29953. ],
  29954. "Imlib2": [
  29955. "Imlib2 License",
  29956. false,
  29957. false
  29958. ],
  29959. "Info-ZIP": [
  29960. "Info-ZIP License",
  29961. false,
  29962. false
  29963. ],
  29964. "Intel": [
  29965. "Intel Open Source License",
  29966. true,
  29967. false
  29968. ],
  29969. "Intel-ACPI": [
  29970. "Intel ACPI Software License Agreement",
  29971. false,
  29972. false
  29973. ],
  29974. "Interbase-1.0": [
  29975. "Interbase Public License v1.0",
  29976. false,
  29977. false
  29978. ],
  29979. "IPA": [
  29980. "IPA Font License",
  29981. true,
  29982. false
  29983. ],
  29984. "IPL-1.0": [
  29985. "IBM Public License v1.0",
  29986. true,
  29987. false
  29988. ],
  29989. "ISC": [
  29990. "ISC License",
  29991. true,
  29992. false
  29993. ],
  29994. "JasPer-2.0": [
  29995. "JasPer License",
  29996. false,
  29997. false
  29998. ],
  29999. "JSON": [
  30000. "JSON License",
  30001. false,
  30002. false
  30003. ],
  30004. "LAL-1.2": [
  30005. "Licence Art Libre 1.2",
  30006. false,
  30007. false
  30008. ],
  30009. "LAL-1.3": [
  30010. "Licence Art Libre 1.3",
  30011. false,
  30012. false
  30013. ],
  30014. "Latex2e": [
  30015. "Latex2e License",
  30016. false,
  30017. false
  30018. ],
  30019. "Leptonica": [
  30020. "Leptonica License",
  30021. false,
  30022. false
  30023. ],
  30024. "LGPL-2.0": [
  30025. "GNU Library General Public License v2 only",
  30026. true,
  30027. true
  30028. ],
  30029. "LGPL-2.0+": [
  30030. "GNU Library General Public License v2 or later",
  30031. true,
  30032. true
  30033. ],
  30034. "LGPL-2.0-only": [
  30035. "GNU Library General Public License v2 only",
  30036. true,
  30037. false
  30038. ],
  30039. "LGPL-2.0-or-later": [
  30040. "GNU Library General Public License v2 or later",
  30041. true,
  30042. false
  30043. ],
  30044. "LGPL-2.1": [
  30045. "GNU Lesser General Public License v2.1 only",
  30046. true,
  30047. true
  30048. ],
  30049. "LGPL-2.1+": [
  30050. "GNU Library General Public License v2.1 or later",
  30051. true,
  30052. true
  30053. ],
  30054. "LGPL-2.1-only": [
  30055. "GNU Lesser General Public License v2.1 only",
  30056. true,
  30057. false
  30058. ],
  30059. "LGPL-2.1-or-later": [
  30060. "GNU Lesser General Public License v2.1 or later",
  30061. true,
  30062. false
  30063. ],
  30064. "LGPL-3.0": [
  30065. "GNU Lesser General Public License v3.0 only",
  30066. true,
  30067. true
  30068. ],
  30069. "LGPL-3.0+": [
  30070. "GNU Lesser General Public License v3.0 or later",
  30071. true,
  30072. true
  30073. ],
  30074. "LGPL-3.0-only": [
  30075. "GNU Lesser General Public License v3.0 only",
  30076. true,
  30077. false
  30078. ],
  30079. "LGPL-3.0-or-later": [
  30080. "GNU Lesser General Public License v3.0 or later",
  30081. true,
  30082. false
  30083. ],
  30084. "LGPLLR": [
  30085. "Lesser General Public License For Linguistic Resources",
  30086. false,
  30087. false
  30088. ],
  30089. "Libpng": [
  30090. "libpng License",
  30091. false,
  30092. false
  30093. ],
  30094. "libtiff": [
  30095. "libtiff License",
  30096. false,
  30097. false
  30098. ],
  30099. "LiLiQ-P-1.1": [
  30100. "Licence Libre du Qu\u00e9bec \u2013 Permissive version 1.1",
  30101. true,
  30102. false
  30103. ],
  30104. "LiLiQ-R-1.1": [
  30105. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 version 1.1",
  30106. true,
  30107. false
  30108. ],
  30109. "LiLiQ-Rplus-1.1": [
  30110. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 forte version 1.1",
  30111. true,
  30112. false
  30113. ],
  30114. "Linux-OpenIB": [
  30115. "Linux Kernel Variant of OpenIB.org license",
  30116. false,
  30117. false
  30118. ],
  30119. "LPL-1.0": [
  30120. "Lucent Public License Version 1.0",
  30121. true,
  30122. false
  30123. ],
  30124. "LPL-1.02": [
  30125. "Lucent Public License v1.02",
  30126. true,
  30127. false
  30128. ],
  30129. "LPPL-1.0": [
  30130. "LaTeX Project Public License v1.0",
  30131. false,
  30132. false
  30133. ],
  30134. "LPPL-1.1": [
  30135. "LaTeX Project Public License v1.1",
  30136. false,
  30137. false
  30138. ],
  30139. "LPPL-1.2": [
  30140. "LaTeX Project Public License v1.2",
  30141. false,
  30142. false
  30143. ],
  30144. "LPPL-1.3a": [
  30145. "LaTeX Project Public License v1.3a",
  30146. false,
  30147. false
  30148. ],
  30149. "LPPL-1.3c": [
  30150. "LaTeX Project Public License v1.3c",
  30151. true,
  30152. false
  30153. ],
  30154. "MakeIndex": [
  30155. "MakeIndex License",
  30156. false,
  30157. false
  30158. ],
  30159. "MirOS": [
  30160. "MirOS License",
  30161. true,
  30162. false
  30163. ],
  30164. "MIT": [
  30165. "MIT License",
  30166. true,
  30167. false
  30168. ],
  30169. "MIT-0": [
  30170. "MIT No Attribution",
  30171. true,
  30172. false
  30173. ],
  30174. "MIT-advertising": [
  30175. "Enlightenment License (e16)",
  30176. false,
  30177. false
  30178. ],
  30179. "MIT-CMU": [
  30180. "CMU License",
  30181. false,
  30182. false
  30183. ],
  30184. "MIT-enna": [
  30185. "enna License",
  30186. false,
  30187. false
  30188. ],
  30189. "MIT-feh": [
  30190. "feh License",
  30191. false,
  30192. false
  30193. ],
  30194. "MITNFA": [
  30195. "MIT +no-false-attribs license",
  30196. false,
  30197. false
  30198. ],
  30199. "Motosoto": [
  30200. "Motosoto License",
  30201. true,
  30202. false
  30203. ],
  30204. "mpich2": [
  30205. "mpich2 License",
  30206. false,
  30207. false
  30208. ],
  30209. "MPL-1.0": [
  30210. "Mozilla Public License 1.0",
  30211. true,
  30212. false
  30213. ],
  30214. "MPL-1.1": [
  30215. "Mozilla Public License 1.1",
  30216. true,
  30217. false
  30218. ],
  30219. "MPL-2.0": [
  30220. "Mozilla Public License 2.0",
  30221. true,
  30222. false
  30223. ],
  30224. "MPL-2.0-no-copyleft-exception": [
  30225. "Mozilla Public License 2.0 (no copyleft exception)",
  30226. true,
  30227. false
  30228. ],
  30229. "MS-PL": [
  30230. "Microsoft Public License",
  30231. true,
  30232. false
  30233. ],
  30234. "MS-RL": [
  30235. "Microsoft Reciprocal License",
  30236. true,
  30237. false
  30238. ],
  30239. "MTLL": [
  30240. "Matrix Template Library License",
  30241. false,
  30242. false
  30243. ],
  30244. "Multics": [
  30245. "Multics License",
  30246. true,
  30247. false
  30248. ],
  30249. "Mup": [
  30250. "Mup License",
  30251. false,
  30252. false
  30253. ],
  30254. "NASA-1.3": [
  30255. "NASA Open Source Agreement 1.3",
  30256. true,
  30257. false
  30258. ],
  30259. "Naumen": [
  30260. "Naumen Public License",
  30261. true,
  30262. false
  30263. ],
  30264. "NBPL-1.0": [
  30265. "Net Boolean Public License v1",
  30266. false,
  30267. false
  30268. ],
  30269. "NCSA": [
  30270. "University of Illinois/NCSA Open Source License",
  30271. true,
  30272. false
  30273. ],
  30274. "Net-SNMP": [
  30275. "Net-SNMP License",
  30276. false,
  30277. false
  30278. ],
  30279. "NetCDF": [
  30280. "NetCDF license",
  30281. false,
  30282. false
  30283. ],
  30284. "Newsletr": [
  30285. "Newsletr License",
  30286. false,
  30287. false
  30288. ],
  30289. "NGPL": [
  30290. "Nethack General Public License",
  30291. true,
  30292. false
  30293. ],
  30294. "NLOD-1.0": [
  30295. "Norwegian Licence for Open Government Data",
  30296. false,
  30297. false
  30298. ],
  30299. "NLPL": [
  30300. "No Limit Public License",
  30301. false,
  30302. false
  30303. ],
  30304. "Nokia": [
  30305. "Nokia Open Source License",
  30306. true,
  30307. false
  30308. ],
  30309. "NOSL": [
  30310. "Netizen Open Source License",
  30311. false,
  30312. false
  30313. ],
  30314. "Noweb": [
  30315. "Noweb License",
  30316. false,
  30317. false
  30318. ],
  30319. "NPL-1.0": [
  30320. "Netscape Public License v1.0",
  30321. false,
  30322. false
  30323. ],
  30324. "NPL-1.1": [
  30325. "Netscape Public License v1.1",
  30326. false,
  30327. false
  30328. ],
  30329. "NPOSL-3.0": [
  30330. "Non-Profit Open Software License 3.0",
  30331. true,
  30332. false
  30333. ],
  30334. "NRL": [
  30335. "NRL License",
  30336. false,
  30337. false
  30338. ],
  30339. "NTP": [
  30340. "NTP License",
  30341. true,
  30342. false
  30343. ],
  30344. "Nunit": [
  30345. "Nunit License",
  30346. false,
  30347. true
  30348. ],
  30349. "OCCT-PL": [
  30350. "Open CASCADE Technology Public License",
  30351. false,
  30352. false
  30353. ],
  30354. "OCLC-2.0": [
  30355. "OCLC Research Public License 2.0",
  30356. true,
  30357. false
  30358. ],
  30359. "ODbL-1.0": [
  30360. "ODC Open Database License v1.0",
  30361. false,
  30362. false
  30363. ],
  30364. "OFL-1.0": [
  30365. "SIL Open Font License 1.0",
  30366. false,
  30367. false
  30368. ],
  30369. "OFL-1.1": [
  30370. "SIL Open Font License 1.1",
  30371. true,
  30372. false
  30373. ],
  30374. "OGTSL": [
  30375. "Open Group Test Suite License",
  30376. true,
  30377. false
  30378. ],
  30379. "OLDAP-1.1": [
  30380. "Open LDAP Public License v1.1",
  30381. false,
  30382. false
  30383. ],
  30384. "OLDAP-1.2": [
  30385. "Open LDAP Public License v1.2",
  30386. false,
  30387. false
  30388. ],
  30389. "OLDAP-1.3": [
  30390. "Open LDAP Public License v1.3",
  30391. false,
  30392. false
  30393. ],
  30394. "OLDAP-1.4": [
  30395. "Open LDAP Public License v1.4",
  30396. false,
  30397. false
  30398. ],
  30399. "OLDAP-2.0": [
  30400. "Open LDAP Public License v2.0 (or possibly 2.0A and 2.0B)",
  30401. false,
  30402. false
  30403. ],
  30404. "OLDAP-2.0.1": [
  30405. "Open LDAP Public License v2.0.1",
  30406. false,
  30407. false
  30408. ],
  30409. "OLDAP-2.1": [
  30410. "Open LDAP Public License v2.1",
  30411. false,
  30412. false
  30413. ],
  30414. "OLDAP-2.2": [
  30415. "Open LDAP Public License v2.2",
  30416. false,
  30417. false
  30418. ],
  30419. "OLDAP-2.2.1": [
  30420. "Open LDAP Public License v2.2.1",
  30421. false,
  30422. false
  30423. ],
  30424. "OLDAP-2.2.2": [
  30425. "Open LDAP Public License 2.2.2",
  30426. false,
  30427. false
  30428. ],
  30429. "OLDAP-2.3": [
  30430. "Open LDAP Public License v2.3",
  30431. false,
  30432. false
  30433. ],
  30434. "OLDAP-2.4": [
  30435. "Open LDAP Public License v2.4",
  30436. false,
  30437. false
  30438. ],
  30439. "OLDAP-2.5": [
  30440. "Open LDAP Public License v2.5",
  30441. false,
  30442. false
  30443. ],
  30444. "OLDAP-2.6": [
  30445. "Open LDAP Public License v2.6",
  30446. false,
  30447. false
  30448. ],
  30449. "OLDAP-2.7": [
  30450. "Open LDAP Public License v2.7",
  30451. false,
  30452. false
  30453. ],
  30454. "OLDAP-2.8": [
  30455. "Open LDAP Public License v2.8",
  30456. false,
  30457. false
  30458. ],
  30459. "OML": [
  30460. "Open Market License",
  30461. false,
  30462. false
  30463. ],
  30464. "OpenSSL": [
  30465. "OpenSSL License",
  30466. false,
  30467. false
  30468. ],
  30469. "OPL-1.0": [
  30470. "Open Public License v1.0",
  30471. false,
  30472. false
  30473. ],
  30474. "OSET-PL-2.1": [
  30475. "OSET Public License version 2.1",
  30476. true,
  30477. false
  30478. ],
  30479. "OSL-1.0": [
  30480. "Open Software License 1.0",
  30481. true,
  30482. false
  30483. ],
  30484. "OSL-1.1": [
  30485. "Open Software License 1.1",
  30486. false,
  30487. false
  30488. ],
  30489. "OSL-2.0": [
  30490. "Open Software License 2.0",
  30491. true,
  30492. false
  30493. ],
  30494. "OSL-2.1": [
  30495. "Open Software License 2.1",
  30496. true,
  30497. false
  30498. ],
  30499. "OSL-3.0": [
  30500. "Open Software License 3.0",
  30501. true,
  30502. false
  30503. ],
  30504. "PDDL-1.0": [
  30505. "ODC Public Domain Dedication & License 1.0",
  30506. false,
  30507. false
  30508. ],
  30509. "PHP-3.0": [
  30510. "PHP License v3.0",
  30511. true,
  30512. false
  30513. ],
  30514. "PHP-3.01": [
  30515. "PHP License v3.01",
  30516. false,
  30517. false
  30518. ],
  30519. "Plexus": [
  30520. "Plexus Classworlds License",
  30521. false,
  30522. false
  30523. ],
  30524. "PostgreSQL": [
  30525. "PostgreSQL License",
  30526. true,
  30527. false
  30528. ],
  30529. "psfrag": [
  30530. "psfrag License",
  30531. false,
  30532. false
  30533. ],
  30534. "psutils": [
  30535. "psutils License",
  30536. false,
  30537. false
  30538. ],
  30539. "Python-2.0": [
  30540. "Python License 2.0",
  30541. true,
  30542. false
  30543. ],
  30544. "Qhull": [
  30545. "Qhull License",
  30546. false,
  30547. false
  30548. ],
  30549. "QPL-1.0": [
  30550. "Q Public License 1.0",
  30551. true,
  30552. false
  30553. ],
  30554. "Rdisc": [
  30555. "Rdisc License",
  30556. false,
  30557. false
  30558. ],
  30559. "RHeCos-1.1": [
  30560. "Red Hat eCos Public License v1.1",
  30561. false,
  30562. false
  30563. ],
  30564. "RPL-1.1": [
  30565. "Reciprocal Public License 1.1",
  30566. true,
  30567. false
  30568. ],
  30569. "RPL-1.5": [
  30570. "Reciprocal Public License 1.5",
  30571. true,
  30572. false
  30573. ],
  30574. "RPSL-1.0": [
  30575. "RealNetworks Public Source License v1.0",
  30576. true,
  30577. false
  30578. ],
  30579. "RSA-MD": [
  30580. "RSA Message-Digest License",
  30581. false,
  30582. false
  30583. ],
  30584. "RSCPL": [
  30585. "Ricoh Source Code Public License",
  30586. true,
  30587. false
  30588. ],
  30589. "Ruby": [
  30590. "Ruby License",
  30591. false,
  30592. false
  30593. ],
  30594. "SAX-PD": [
  30595. "Sax Public Domain Notice",
  30596. false,
  30597. false
  30598. ],
  30599. "Saxpath": [
  30600. "Saxpath License",
  30601. false,
  30602. false
  30603. ],
  30604. "SCEA": [
  30605. "SCEA Shared Source License",
  30606. false,
  30607. false
  30608. ],
  30609. "Sendmail": [
  30610. "Sendmail License",
  30611. false,
  30612. false
  30613. ],
  30614. "SGI-B-1.0": [
  30615. "SGI Free Software License B v1.0",
  30616. false,
  30617. false
  30618. ],
  30619. "SGI-B-1.1": [
  30620. "SGI Free Software License B v1.1",
  30621. false,
  30622. false
  30623. ],
  30624. "SGI-B-2.0": [
  30625. "SGI Free Software License B v2.0",
  30626. false,
  30627. false
  30628. ],
  30629. "SimPL-2.0": [
  30630. "Simple Public License 2.0",
  30631. true,
  30632. false
  30633. ],
  30634. "SISSL": [
  30635. "Sun Industry Standards Source License v1.1",
  30636. true,
  30637. false
  30638. ],
  30639. "SISSL-1.2": [
  30640. "Sun Industry Standards Source License v1.2",
  30641. false,
  30642. false
  30643. ],
  30644. "Sleepycat": [
  30645. "Sleepycat License",
  30646. true,
  30647. false
  30648. ],
  30649. "SMLNJ": [
  30650. "Standard ML of New Jersey License",
  30651. false,
  30652. false
  30653. ],
  30654. "SMPPL": [
  30655. "Secure Messaging Protocol Public License",
  30656. false,
  30657. false
  30658. ],
  30659. "SNIA": [
  30660. "SNIA Public License 1.1",
  30661. false,
  30662. false
  30663. ],
  30664. "Spencer-86": [
  30665. "Spencer License 86",
  30666. false,
  30667. false
  30668. ],
  30669. "Spencer-94": [
  30670. "Spencer License 94",
  30671. false,
  30672. false
  30673. ],
  30674. "Spencer-99": [
  30675. "Spencer License 99",
  30676. false,
  30677. false
  30678. ],
  30679. "SPL-1.0": [
  30680. "Sun Public License v1.0",
  30681. true,
  30682. false
  30683. ],
  30684. "StandardML-NJ": [
  30685. "Standard ML of New Jersey License",
  30686. false,
  30687. true
  30688. ],
  30689. "SugarCRM-1.1.3": [
  30690. "SugarCRM Public License v1.1.3",
  30691. false,
  30692. false
  30693. ],
  30694. "SWL": [
  30695. "Scheme Widget Library (SWL) Software License Agreement",
  30696. false,
  30697. false
  30698. ],
  30699. "TCL": [
  30700. "TCL/TK License",
  30701. false,
  30702. false
  30703. ],
  30704. "TCP-wrappers": [
  30705. "TCP Wrappers License",
  30706. false,
  30707. false
  30708. ],
  30709. "TMate": [
  30710. "TMate Open Source License",
  30711. false,
  30712. false
  30713. ],
  30714. "TORQUE-1.1": [
  30715. "TORQUE v2.5+ Software License v1.1",
  30716. false,
  30717. false
  30718. ],
  30719. "TOSL": [
  30720. "Trusster Open Source License",
  30721. false,
  30722. false
  30723. ],
  30724. "Unicode-DFS-2015": [
  30725. "Unicode License Agreement - Data Files and Software (2015)",
  30726. false,
  30727. false
  30728. ],
  30729. "Unicode-DFS-2016": [
  30730. "Unicode License Agreement - Data Files and Software (2016)",
  30731. false,
  30732. false
  30733. ],
  30734. "Unicode-TOU": [
  30735. "Unicode Terms of Use",
  30736. false,
  30737. false
  30738. ],
  30739. "Unlicense": [
  30740. "The Unlicense",
  30741. false,
  30742. false
  30743. ],
  30744. "UPL-1.0": [
  30745. "Universal Permissive License v1.0",
  30746. true,
  30747. false
  30748. ],
  30749. "Vim": [
  30750. "Vim License",
  30751. false,
  30752. false
  30753. ],
  30754. "VOSTROM": [
  30755. "VOSTROM Public License for Open Source",
  30756. false,
  30757. false
  30758. ],
  30759. "VSL-1.0": [
  30760. "Vovida Software License v1.0",
  30761. true,
  30762. false
  30763. ],
  30764. "W3C": [
  30765. "W3C Software Notice and License (2002-12-31)",
  30766. true,
  30767. false
  30768. ],
  30769. "W3C-19980720": [
  30770. "W3C Software Notice and License (1998-07-20)",
  30771. false,
  30772. false
  30773. ],
  30774. "W3C-20150513": [
  30775. "W3C Software Notice and Document License (2015-05-13)",
  30776. false,
  30777. false
  30778. ],
  30779. "Watcom-1.0": [
  30780. "Sybase Open Watcom Public License 1.0",
  30781. true,
  30782. false
  30783. ],
  30784. "Wsuipa": [
  30785. "Wsuipa License",
  30786. false,
  30787. false
  30788. ],
  30789. "WTFPL": [
  30790. "Do What The F*ck You Want To Public License",
  30791. false,
  30792. false
  30793. ],
  30794. "wxWindows": [
  30795. "wxWindows Library License",
  30796. false,
  30797. true
  30798. ],
  30799. "X11": [
  30800. "X11 License",
  30801. false,
  30802. false
  30803. ],
  30804. "Xerox": [
  30805. "Xerox License",
  30806. false,
  30807. false
  30808. ],
  30809. "XFree86-1.1": [
  30810. "XFree86 License 1.1",
  30811. false,
  30812. false
  30813. ],
  30814. "xinetd": [
  30815. "xinetd License",
  30816. false,
  30817. false
  30818. ],
  30819. "Xnet": [
  30820. "X.Net License",
  30821. true,
  30822. false
  30823. ],
  30824. "xpp": [
  30825. "XPP License",
  30826. false,
  30827. false
  30828. ],
  30829. "XSkat": [
  30830. "XSkat License",
  30831. false,
  30832. false
  30833. ],
  30834. "YPL-1.0": [
  30835. "Yahoo! Public License v1.0",
  30836. false,
  30837. false
  30838. ],
  30839. "YPL-1.1": [
  30840. "Yahoo! Public License v1.1",
  30841. false,
  30842. false
  30843. ],
  30844. "Zed": [
  30845. "Zed License",
  30846. false,
  30847. false
  30848. ],
  30849. "Zend-2.0": [
  30850. "Zend License v2.0",
  30851. false,
  30852. false
  30853. ],
  30854. "Zimbra-1.3": [
  30855. "Zimbra Public License v1.3",
  30856. false,
  30857. false
  30858. ],
  30859. "Zimbra-1.4": [
  30860. "Zimbra Public License v1.4",
  30861. false,
  30862. false
  30863. ],
  30864. "Zlib": [
  30865. "zlib License",
  30866. true,
  30867. false
  30868. ],
  30869. "zlib-acknowledgement": [
  30870. "zlib/libpng License with Acknowledgement",
  30871. false,
  30872. false
  30873. ],
  30874. "ZPL-1.1": [
  30875. "Zope Public License 1.1",
  30876. false,
  30877. false
  30878. ],
  30879. "ZPL-2.0": [
  30880. "Zope Public License 2.0",
  30881. true,
  30882. false
  30883. ],
  30884. "ZPL-2.1": [
  30885. "Zope Public License 2.1",
  30886. false,
  30887. false
  30888. ]
  30889. }MZ�ÿÿ¸@躴 Í!¸LÍ!This program cannot be run in DOS mode.
  30890. $Æ,Í;§Bž;§Bž;§Bž2ßמ:§Bž2ßÁž-§Bž2ßÆž9§Bž2ßÑž?§Bža9ž8§Bž;§Cž§Bž2ßÈž:§Bž2ßÖž:§Bž2ßÓž:§BžRich;§BžPEL¬MoOà 
  30891. 8 @`?œ@��"P@ Pp!8!@ Ø.text 
  30892.  `.rdataÎ
  30893. @@.data�0@À.rsrc @@@.relocÌP"@Bj$¸æ@èxjöÿ @ƒeЋð�EÐPVÿ @‹EЃàûPVÿ @�MÔÿX @ƒeü�EÔPÿ5H @ÿL @YYÿ5\ @�EÔPÿ5` @ÿD @YY‹ÈÿP @ƒMüÿ�MÔÿT @3ÀèHÃ; 0@uóÃé¬h€@裡l3@Ç$40@ÿ5h3@£40@h$0@h(0@h 0@ÿ  @ƒÄ£00@…À}jè¹YÃjh"@è3Û‰]üd¡‹p‰]ä¿€3@SVWÿ0 @;Ãt;Æu3öF‰uäëhèÿ4 @ëÚ3öF¡|3@;Æu
  30894. jè\Yë;¡|3@…Àu,‰5|3@hð @hä @è§YY…ÀtÇEüþÿÿÿ¸ÿé݉5<0@¡|3@;Æuhà @hØ @èlYYÇ|3@9]äuSWÿ8 @9Œ3@thŒ3@èƒY…Àt
  30895. SjSÿŒ3@¡$0@‹ ¼ @‰ÿ5$0@ÿ5(0@ÿ5 0@èþÿÿƒÄ £80@9,0@u7PÿÀ @‹Eì‹‹ ‰MàPQèŽYYËeè‹Eà£80@3Û9,0@uPÿh @9<0@uÿœ @ÇEüþÿÿÿ¡80@èûøMZf9@t3ÀëM¡<@�€@�8PEué·H�ù t�ù uÕƒ¸„vÌ3É9ˆøëƒxtv¼3É9ˆè•Á‹Áj£,0@ÿp @jÿÿl @YY£„3@£ˆ3@ÿÌ @‹ t3@‰ÿˆ @‹ p3@‰¡¨ @‹£x3@èV謃=0@u hµ@ÿ¬ @Yègƒ=0@ÿu jÿÿ° @Y3ÀÃè{éŸýÿÿ‹ÿU‹ì�ì(£H1@‰ D1@‰@1@‰<1@‰581@‰=41@fŒ`1@fŒ T1@fŒ01@fŒ,1@fŒ%(1@fŒ-$1@œ�X1@‹E£L1@‹E£P1@�E£\1@‹…àüÿÿǘ0@¡P1@£L0@Ç@0@ ÀÇD0@¡0@‰…Øüÿÿ¡0@‰…Üüÿÿÿ @£�0@jè?Yjÿ @h!@ÿ$ @ƒ=�0@ujèYh Àÿ( @Pÿ, @ÉËÿU‹ì‹E‹�8csmàu*ƒxu$‹@= “t=!“t="“t=@™uèÐ3À]ÂhH@ÿ @3ÀÃÿ%¤ @jh("@èbÿ5ˆ3@‹5Œ @ÿÖY‰Eäƒøÿu ÿuÿÄ @Yëgjè’Yƒeüÿ5ˆ3@ÿÖ‰Eäÿ5„3@ÿÖYY‰Eà�EàP�EäPÿu‹5l @ÿÖYPèU‰EÜÿuäÿÖ£ˆ3@ÿuàÿփģ„3@ÇEüþÿÿÿè ‹EÜèÃjèYËÿU‹ìÿuèNÿÿÿ÷ØÀ÷ØYH]ËÿV¸ü!@¾ü!@W‹ø;Æs‹…ÀtÿЃÇ;þrñ_^ËÿV¸"@¾"@W‹ø;Æs‹…ÀtÿЃÇ;þrñ_^Ãÿ%È @ÌÌÌÌ‹ÿU‹ì‹M¸MZf9t3À]ËA<Á�8PEuï3Ò¹ f9H”‹Â]ÃÌÌÌÌÌÌÌÌÌÌÌ‹ÿU‹ì‹E‹H<È·ASV·q3ÒW�D…öv‹} ‹H ;ùr ‹XÙ;ûr
  30896. BƒÀ(;Örè3À_^[]ÃÌÌÌÌÌÌÌÌÌÌÌÌ‹ÿU‹ìjþhH"@he@d¡PƒìSVW¡0@1Eø3ÅP�Eðd£‰eèÇEüh@è*ÿÿÿƒÄ…ÀtU‹E-@Ph@èPÿÿÿƒÄ…Àt;‹@$Áè÷ЃàÇEüþÿÿÿ‹Mðd‰ Y_^[‹å]ËEì‹‹3Ò=À”‹ÂËeèÇEüþÿÿÿ3À‹Mðd‰ Y_^[‹å]ÃÌÿ%¸ @ÿ%´ @ÌÌhe@dÿ5‹D$‰l$�l$+àSVW¡0@1Eü3ÅP‰eèÿuø‹EüÇEüþÿÿÿ‰Eø�Eðd£Ã‹Mðd‰ Y__^[‹å]QËÿU‹ìÿuÿuÿu ÿuh‡@h0@èçƒÄ]ËÿVhh3öVèÙƒÄ …Àt VVVVVèƒÄ^Ã3ÀËÿU‹ìƒì¡0@ƒeøƒeüSW¿Næ@»»ÿÿ;Çt …Ãt ÷У0@ë`V�EøPÿ< @‹uü3uøÿ @3ðÿ @3ðÿ @3ð�EðPÿ @‹Eô3Eð3ð;÷u¾Oæ@»ë …óu‹ÆÁà ð‰50@÷Ö‰50@^_[ÉÃÿ%t @ÿ%x @ÿ%| @ÿ%€ @ÿ%„ @ÿ%� @ÿ%” @ÿ%˜ @ÿ%Ð @Pdÿ5�D$ +d$ SVW‰(‹è¡0@3ÅP‰EðÿuüÇEüÿÿÿÿ�Eôd£Ã‹Môd‰ Y__^[‹å]QËMð3Íè¯÷ÿÿéÝÿÿÿ�MÔÿ%T @‹T$�B ‹JÌ3Èè�÷ÿÿ‹Jü3Èè†÷ÿÿ¸l"@ésÿÿÿ¸#Ê#Ü#ˆ)r)b)H)4))ú(æ(Ò(´(¬(–(ž)ú#à$%Ê%&d&®&¤$('Ä'Ö'è'þ'(((6(¦'H(Z(t(†('''–'‚'l'^'R'F'>'>(0'¶'¸)–@W@Š@¬MoOl€!€@0@˜0@bad allocationH0@ð!@RSDSÑŒ³´�J¨!öÌëLZc:\users\seld\documents\visual studio 2010\Projects\hiddeninp\Release\hiddeninp.pdbeæþÿÿÿÐÿÿÿþÿÿÿ@@þÿÿÿÌÿÿÿþÿÿÿ:@þÿÿÿØÿÿÿþÿÿÿË@ß@ÿÿÿÿÝ@"“d"@à"ì# $#ô&D H#(h ¸#Ê#Ü#ˆ)r)b)H)4))ú(æ(Ò(´(¬(–(ž)ú#à$%Ê%&d&®&¤$('Ä'Ö'è'þ'(((6(¦'H(Z(t(†('''–'‚'l'^'R'F'>'>(0'¶'¸)•GetConsoleMode·SetConsoleMode;GetStdHandleKERNEL32.dll??$?6DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z‘?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@AJ?cin@std@@3V?$basic_istream@DU?$char_traits@D@std@@@1@AÂ??$getline@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z_??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ{??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ³?endl@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@1@AAV21@@ZMSVCP90.dll_amsg_exitŸ__getmainargs,_cexit|_exitf_XcptFilterÌexit __initenv_initterm_initterm_e<_configthreadlocaleã__setusermatherr _adjust_fdivË__p__commodeÏ__p__fmodej_encode_pointerà__set_app_typeK_crt_debugger_hookC?terminate@@YAXXZMSVCR90.dllæ_unlock–__dllonexitv_lock_onexit`_decode_pointers_except_handler4_common _invoke_watson?_controlfp_s½InterlockedExchange!SleepºInterlockedCompareExchange-TerminateProcess©GetCurrentProcess>UnhandledExceptionFilterSetUnhandledExceptionFilterÑIsDebuggerPresentTQueryPerformanceCounterfGetTickCount­GetCurrentThreadIdªGetCurrentProcessIdOGetSystemTimeAsFileTimes__CxxFrameHandler3Næ@»±¿Dÿÿÿÿÿÿÿÿþÿÿÿ$!@ €8€P€h€ € � @(äÈCVä(4VS_VERSION_INFO½ïþ†StringFileInfob040904b0ÊQFileDescriptionReads from stdin without leaking info to the terminal and outputs back to stdout6 FileVersion1, 0, 0, 08 InternalNamehiddeninputPLegalCopyrightJordi Boggiano - 2012HOriginalFilenamehiddeninput.exe: ProductNameHidden Input: ProductVersion1, 0, 0, 0DVarFileInfo$Translation °<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  30897. <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
  30898. <security>
  30899. <requestedPrivileges>
  30900. <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
  30901. </requestedPrivileges>
  30902. </security>
  30903. </trustInfo>
  30904. <dependency>
  30905. <dependentAssembly>
  30906. <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
  30907. </dependentAssembly>
  30908. </dependency>
  30909. </assembly>PAPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDING@00!0/080F0L0T0^0d0n0{0‰0—0¡0¨0®0³0¸0½0Â0È0Ð0ä0ÿ01#1-1@1J1O1T1v1{1„1‰1–1§1­1´1È1Í1Ó1Û1á1ç1ô1ú12"2*23292A2M2_2j2p2¹2¿2Ç2Î2Ó2Ù2ß2ç2í2ô2û2 333%303N3T3Z3`3f3l3s3z3�3ˆ3�3–3�3¥3­3µ3Á3Ê3Ï3Õ3ß3è3ó3ÿ34444%4;4B4‹4‘4š4¡4¬4²4Æ4Û4æ4þ45!5^5c5„5‰5¨5H6M6_6}6‘6—677 7*7w7|7Á7ä7ñ7ý78 88=8E8P8V8\8b8h8n8t8z8€8œ8â89 $Ü0è0ì01 1t1x12 2@2\2`2h2t20 0<?php
  30910. namespace Symfony\Component\Console;
  30911. use Symfony\Component\Console\Descriptor\TextDescriptor;
  30912. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  30913. use Symfony\Component\Console\Exception\ExceptionInterface;
  30914. use Symfony\Component\Console\Formatter\OutputFormatter;
  30915. use Symfony\Component\Console\Helper\DebugFormatterHelper;
  30916. use Symfony\Component\Console\Helper\Helper;
  30917. use Symfony\Component\Console\Helper\ProcessHelper;
  30918. use Symfony\Component\Console\Helper\QuestionHelper;
  30919. use Symfony\Component\Console\Input\InputInterface;
  30920. use Symfony\Component\Console\Input\ArgvInput;
  30921. use Symfony\Component\Console\Input\ArrayInput;
  30922. use Symfony\Component\Console\Input\InputDefinition;
  30923. use Symfony\Component\Console\Input\InputOption;
  30924. use Symfony\Component\Console\Input\InputArgument;
  30925. use Symfony\Component\Console\Input\InputAwareInterface;
  30926. use Symfony\Component\Console\Output\BufferedOutput;
  30927. use Symfony\Component\Console\Output\OutputInterface;
  30928. use Symfony\Component\Console\Output\ConsoleOutput;
  30929. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  30930. use Symfony\Component\Console\Command\Command;
  30931. use Symfony\Component\Console\Command\HelpCommand;
  30932. use Symfony\Component\Console\Command\ListCommand;
  30933. use Symfony\Component\Console\Helper\HelperSet;
  30934. use Symfony\Component\Console\Helper\FormatterHelper;
  30935. use Symfony\Component\Console\Helper\DialogHelper;
  30936. use Symfony\Component\Console\Helper\ProgressHelper;
  30937. use Symfony\Component\Console\Helper\TableHelper;
  30938. use Symfony\Component\Console\Event\ConsoleCommandEvent;
  30939. use Symfony\Component\Console\Event\ConsoleExceptionEvent;
  30940. use Symfony\Component\Console\Event\ConsoleTerminateEvent;
  30941. use Symfony\Component\Console\Exception\CommandNotFoundException;
  30942. use Symfony\Component\Console\Exception\LogicException;
  30943. use Symfony\Component\Debug\Exception\FatalThrowableError;
  30944. use Symfony\Component\EventDispatcher\EventDispatcherInterface;
  30945. class Application
  30946. {
  30947. private $commands = array();
  30948. private $wantHelps = false;
  30949. private $runningCommand;
  30950. private $name;
  30951. private $version;
  30952. private $catchExceptions = true;
  30953. private $autoExit = true;
  30954. private $definition;
  30955. private $helperSet;
  30956. private $dispatcher;
  30957. private $terminalDimensions;
  30958. private $defaultCommand;
  30959. private $initialized;
  30960. public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
  30961. {
  30962. $this->name = $name;
  30963. $this->version = $version;
  30964. $this->defaultCommand = 'list';
  30965. }
  30966. public function setDispatcher(EventDispatcherInterface $dispatcher)
  30967. {
  30968. $this->dispatcher = $dispatcher;
  30969. }
  30970. public function run(InputInterface $input = null, OutputInterface $output = null)
  30971. {
  30972. if (null === $input) {
  30973. $input = new ArgvInput();
  30974. }
  30975. if (null === $output) {
  30976. $output = new ConsoleOutput();
  30977. }
  30978. $this->configureIO($input, $output);
  30979. try {
  30980. $e = null;
  30981. $exitCode = $this->doRun($input, $output);
  30982. } catch (\Exception $e) {
  30983. }
  30984. if (null !== $e) {
  30985. if (!$this->catchExceptions) {
  30986. throw $e;
  30987. }
  30988. if ($output instanceof ConsoleOutputInterface) {
  30989. $this->renderException($e, $output->getErrorOutput());
  30990. } else {
  30991. $this->renderException($e, $output);
  30992. }
  30993. $exitCode = $e->getCode();
  30994. if (is_numeric($exitCode)) {
  30995. $exitCode = (int) $exitCode;
  30996. if (0 === $exitCode) {
  30997. $exitCode = 1;
  30998. }
  30999. } else {
  31000. $exitCode = 1;
  31001. }
  31002. }
  31003. if ($this->autoExit) {
  31004. if ($exitCode > 255) {
  31005. $exitCode = 255;
  31006. }
  31007. exit($exitCode);
  31008. }
  31009. return $exitCode;
  31010. }
  31011. public function doRun(InputInterface $input, OutputInterface $output)
  31012. {
  31013. if (true === $input->hasParameterOption(array('--version', '-V'))) {
  31014. $output->writeln($this->getLongVersion());
  31015. return 0;
  31016. }
  31017. $name = $this->getCommandName($input);
  31018. if (true === $input->hasParameterOption(array('--help', '-h'))) {
  31019. if (!$name) {
  31020. $name = 'help';
  31021. $input = new ArrayInput(array('command' => 'help'));
  31022. } else {
  31023. $this->wantHelps = true;
  31024. }
  31025. }
  31026. if (!$name) {
  31027. $name = $this->defaultCommand;
  31028. $definition = $this->getDefinition();
  31029. $definition->setArguments(array_merge(
  31030. $definition->getArguments(),
  31031. array(
  31032. 'command' => new InputArgument('command', InputArgument::OPTIONAL, $definition->getArgument('command')->getDescription(), $name),
  31033. )
  31034. ));
  31035. }
  31036. $this->runningCommand = null;
  31037. $command = $this->find($name);
  31038. $this->runningCommand = $command;
  31039. $exitCode = $this->doRunCommand($command, $input, $output);
  31040. $this->runningCommand = null;
  31041. return $exitCode;
  31042. }
  31043. public function setHelperSet(HelperSet $helperSet)
  31044. {
  31045. $this->helperSet = $helperSet;
  31046. }
  31047. public function getHelperSet()
  31048. {
  31049. if (!$this->helperSet) {
  31050. $this->helperSet = $this->getDefaultHelperSet();
  31051. }
  31052. return $this->helperSet;
  31053. }
  31054. public function setDefinition(InputDefinition $definition)
  31055. {
  31056. $this->definition = $definition;
  31057. }
  31058. public function getDefinition()
  31059. {
  31060. if (!$this->definition) {
  31061. $this->definition = $this->getDefaultInputDefinition();
  31062. }
  31063. return $this->definition;
  31064. }
  31065. public function getHelp()
  31066. {
  31067. return $this->getLongVersion();
  31068. }
  31069. public function setCatchExceptions($boolean)
  31070. {
  31071. $this->catchExceptions = (bool) $boolean;
  31072. }
  31073. public function setAutoExit($boolean)
  31074. {
  31075. $this->autoExit = (bool) $boolean;
  31076. }
  31077. public function getName()
  31078. {
  31079. return $this->name;
  31080. }
  31081. public function setName($name)
  31082. {
  31083. $this->name = $name;
  31084. }
  31085. public function getVersion()
  31086. {
  31087. return $this->version;
  31088. }
  31089. public function setVersion($version)
  31090. {
  31091. $this->version = $version;
  31092. }
  31093. public function getLongVersion()
  31094. {
  31095. if ('UNKNOWN' !== $this->getName()) {
  31096. if ('UNKNOWN' !== $this->getVersion()) {
  31097. return sprintf('<info>%s</info> version <comment>%s</comment>', $this->getName(), $this->getVersion());
  31098. }
  31099. return sprintf('<info>%s</info>', $this->getName());
  31100. }
  31101. return '<info>Console Tool</info>';
  31102. }
  31103. public function register($name)
  31104. {
  31105. return $this->add(new Command($name));
  31106. }
  31107. public function addCommands(array $commands)
  31108. {
  31109. foreach ($commands as $command) {
  31110. $this->add($command);
  31111. }
  31112. }
  31113. public function add(Command $command)
  31114. {
  31115. $this->init();
  31116. $command->setApplication($this);
  31117. if (!$command->isEnabled()) {
  31118. $command->setApplication(null);
  31119. return;
  31120. }
  31121. if (null === $command->getDefinition()) {
  31122. throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', get_class($command)));
  31123. }
  31124. $this->commands[$command->getName()] = $command;
  31125. foreach ($command->getAliases() as $alias) {
  31126. $this->commands[$alias] = $command;
  31127. }
  31128. return $command;
  31129. }
  31130. public function get($name)
  31131. {
  31132. $this->init();
  31133. if (!isset($this->commands[$name])) {
  31134. throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
  31135. }
  31136. $command = $this->commands[$name];
  31137. if ($this->wantHelps) {
  31138. $this->wantHelps = false;
  31139. $helpCommand = $this->get('help');
  31140. $helpCommand->setCommand($command);
  31141. return $helpCommand;
  31142. }
  31143. return $command;
  31144. }
  31145. public function has($name)
  31146. {
  31147. $this->init();
  31148. return isset($this->commands[$name]);
  31149. }
  31150. public function getNamespaces()
  31151. {
  31152. $namespaces = array();
  31153. foreach ($this->all() as $command) {
  31154. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName()));
  31155. foreach ($command->getAliases() as $alias) {
  31156. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($alias));
  31157. }
  31158. }
  31159. return array_values(array_unique(array_filter($namespaces)));
  31160. }
  31161. public function findNamespace($namespace)
  31162. {
  31163. $allNamespaces = $this->getNamespaces();
  31164. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $namespace);
  31165. $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces);
  31166. if (empty($namespaces)) {
  31167. $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);
  31168. if ($alternatives = $this->findAlternatives($namespace, $allNamespaces)) {
  31169. if (1 == count($alternatives)) {
  31170. $message .= "\n\nDid you mean this?\n ";
  31171. } else {
  31172. $message .= "\n\nDid you mean one of these?\n ";
  31173. }
  31174. $message .= implode("\n ", $alternatives);
  31175. }
  31176. throw new CommandNotFoundException($message, $alternatives);
  31177. }
  31178. $exact = in_array($namespace, $namespaces, true);
  31179. if (count($namespaces) > 1 && !$exact) {
  31180. throw new CommandNotFoundException(sprintf('The namespace "%s" is ambiguous (%s).', $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces));
  31181. }
  31182. return $exact ? $namespace : reset($namespaces);
  31183. }
  31184. public function find($name)
  31185. {
  31186. $this->init();
  31187. $aliases = array();
  31188. $allCommands = array_keys($this->commands);
  31189. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $name);
  31190. $commands = preg_grep('{^'.$expr.'}', $allCommands);
  31191. if (empty($commands) || count(preg_grep('{^'.$expr.'$}', $commands)) < 1) {
  31192. if (false !== $pos = strrpos($name, ':')) {
  31193. $this->findNamespace(substr($name, 0, $pos));
  31194. }
  31195. $message = sprintf('Command "%s" is not defined.', $name);
  31196. if ($alternatives = $this->findAlternatives($name, $allCommands)) {
  31197. if (1 == count($alternatives)) {
  31198. $message .= "\n\nDid you mean this?\n ";
  31199. } else {
  31200. $message .= "\n\nDid you mean one of these?\n ";
  31201. }
  31202. $message .= implode("\n ", $alternatives);
  31203. }
  31204. throw new CommandNotFoundException($message, $alternatives);
  31205. }
  31206. if (count($commands) > 1) {
  31207. $commandList = $this->commands;
  31208. $commands = array_filter($commands, function ($nameOrAlias) use ($commandList, $commands, &$aliases) {
  31209. $commandName = $commandList[$nameOrAlias]->getName();
  31210. $aliases[$nameOrAlias] = $commandName;
  31211. return $commandName === $nameOrAlias || !in_array($commandName, $commands);
  31212. });
  31213. }
  31214. $exact = in_array($name, $commands, true) || isset($aliases[$name]);
  31215. if (!$exact && count($commands) > 1) {
  31216. $suggestions = $this->getAbbreviationSuggestions(array_values($commands));
  31217. throw new CommandNotFoundException(sprintf('Command "%s" is ambiguous (%s).', $name, $suggestions), array_values($commands));
  31218. }
  31219. return $this->get($exact ? $name : reset($commands));
  31220. }
  31221. public function all($namespace = null)
  31222. {
  31223. $this->init();
  31224. if (null === $namespace) {
  31225. return $this->commands;
  31226. }
  31227. $commands = array();
  31228. foreach ($this->commands as $name => $command) {
  31229. if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1)) {
  31230. $commands[$name] = $command;
  31231. }
  31232. }
  31233. return $commands;
  31234. }
  31235. public static function getAbbreviations($names)
  31236. {
  31237. $abbrevs = array();
  31238. foreach ($names as $name) {
  31239. for ($len = strlen($name); $len > 0; --$len) {
  31240. $abbrev = substr($name, 0, $len);
  31241. $abbrevs[$abbrev][] = $name;
  31242. }
  31243. }
  31244. return $abbrevs;
  31245. }
  31246. public function asText($namespace = null, $raw = false)
  31247. {
  31248. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  31249. $descriptor = new TextDescriptor();
  31250. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, !$raw);
  31251. $descriptor->describe($output, $this, array('namespace' => $namespace, 'raw_output' => true));
  31252. return $output->fetch();
  31253. }
  31254. public function asXml($namespace = null, $asDom = false)
  31255. {
  31256. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  31257. $descriptor = new XmlDescriptor();
  31258. if ($asDom) {
  31259. return $descriptor->getApplicationDocument($this, $namespace);
  31260. }
  31261. $output = new BufferedOutput();
  31262. $descriptor->describe($output, $this, array('namespace' => $namespace));
  31263. return $output->fetch();
  31264. }
  31265. public function renderException($e, $output)
  31266. {
  31267. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  31268. do {
  31269. $title = sprintf(' [%s] ', get_class($e));
  31270. $len = Helper::strlen($title);
  31271. $width = $this->getTerminalWidth() ? $this->getTerminalWidth() - 1 : PHP_INT_MAX;
  31272. if (defined('HHVM_VERSION') && $width > 1 << 31) {
  31273. $width = 1 << 31;
  31274. }
  31275. $lines = array();
  31276. foreach (preg_split('/\r?\n/', trim($e->getMessage())) as $line) {
  31277. foreach ($this->splitStringByWidth($line, $width - 4) as $line) {
  31278. $lineLength = Helper::strlen($line) + 4;
  31279. $lines[] = array($line, $lineLength);
  31280. $len = max($lineLength, $len);
  31281. }
  31282. }
  31283. $messages = array();
  31284. $messages[] = $emptyLine = sprintf('<error>%s</error>', str_repeat(' ', $len));
  31285. $messages[] = sprintf('<error>%s%s</error>', $title, str_repeat(' ', max(0, $len - Helper::strlen($title))));
  31286. foreach ($lines as $line) {
  31287. $messages[] = sprintf('<error> %s %s</error>', OutputFormatter::escape($line[0]), str_repeat(' ', $len - $line[1]));
  31288. }
  31289. $messages[] = $emptyLine;
  31290. $messages[] = '';
  31291. $output->writeln($messages, OutputInterface::VERBOSITY_QUIET);
  31292. if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
  31293. $output->writeln('<comment>Exception trace:</comment>', OutputInterface::VERBOSITY_QUIET);
  31294. $trace = $e->getTrace();
  31295. array_unshift($trace, array(
  31296. 'function' => '',
  31297. 'file' => null !== $e->getFile() ? $e->getFile() : 'n/a',
  31298. 'line' => null !== $e->getLine() ? $e->getLine() : 'n/a',
  31299. 'args' => array(),
  31300. ));
  31301. for ($i = 0, $count = count($trace); $i < $count; ++$i) {
  31302. $class = isset($trace[$i]['class']) ? $trace[$i]['class'] : '';
  31303. $type = isset($trace[$i]['type']) ? $trace[$i]['type'] : '';
  31304. $function = $trace[$i]['function'];
  31305. $file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a';
  31306. $line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a';
  31307. $output->writeln(sprintf(' %s%s%s() at <info>%s:%s</info>', $class, $type, $function, $file, $line), OutputInterface::VERBOSITY_QUIET);
  31308. }
  31309. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  31310. }
  31311. } while ($e = $e->getPrevious());
  31312. if (null !== $this->runningCommand) {
  31313. $output->writeln(sprintf('<info>%s</info>', sprintf($this->runningCommand->getSynopsis(), $this->getName())), OutputInterface::VERBOSITY_QUIET);
  31314. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  31315. }
  31316. }
  31317. protected function getTerminalWidth()
  31318. {
  31319. $dimensions = $this->getTerminalDimensions();
  31320. return $dimensions[0];
  31321. }
  31322. protected function getTerminalHeight()
  31323. {
  31324. $dimensions = $this->getTerminalDimensions();
  31325. return $dimensions[1];
  31326. }
  31327. public function getTerminalDimensions()
  31328. {
  31329. if ($this->terminalDimensions) {
  31330. return $this->terminalDimensions;
  31331. }
  31332. if ('\\' === DIRECTORY_SEPARATOR) {
  31333. if (preg_match('/^(\d+)x\d+ \(\d+x(\d+)\)$/', trim(getenv('ANSICON')), $matches)) {
  31334. return array((int) $matches[1], (int) $matches[2]);
  31335. }
  31336. if (preg_match('/^(\d+)x(\d+)$/', $this->getConsoleMode(), $matches)) {
  31337. return array((int) $matches[1], (int) $matches[2]);
  31338. }
  31339. }
  31340. if ($sttyString = $this->getSttyColumns()) {
  31341. if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) {
  31342. return array((int) $matches[2], (int) $matches[1]);
  31343. }
  31344. if (preg_match('/;.(\d+).rows;.(\d+).columns/i', $sttyString, $matches)) {
  31345. return array((int) $matches[2], (int) $matches[1]);
  31346. }
  31347. }
  31348. return array(null, null);
  31349. }
  31350. public function setTerminalDimensions($width, $height)
  31351. {
  31352. $this->terminalDimensions = array($width, $height);
  31353. return $this;
  31354. }
  31355. protected function configureIO(InputInterface $input, OutputInterface $output)
  31356. {
  31357. if (true === $input->hasParameterOption(array('--ansi'))) {
  31358. $output->setDecorated(true);
  31359. } elseif (true === $input->hasParameterOption(array('--no-ansi'))) {
  31360. $output->setDecorated(false);
  31361. }
  31362. if (true === $input->hasParameterOption(array('--no-interaction', '-n'))) {
  31363. $input->setInteractive(false);
  31364. } elseif (function_exists('posix_isatty') && $this->getHelperSet()->has('question')) {
  31365. $inputStream = $this->getHelperSet()->get('question')->getInputStream();
  31366. if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) {
  31367. $input->setInteractive(false);
  31368. }
  31369. }
  31370. if (true === $input->hasParameterOption(array('--quiet', '-q'))) {
  31371. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  31372. $input->setInteractive(false);
  31373. } else {
  31374. if ($input->hasParameterOption('-vvv') || $input->hasParameterOption('--verbose=3') || 3 === $input->getParameterOption('--verbose')) {
  31375. $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
  31376. } elseif ($input->hasParameterOption('-vv') || $input->hasParameterOption('--verbose=2') || 2 === $input->getParameterOption('--verbose')) {
  31377. $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
  31378. } elseif ($input->hasParameterOption('-v') || $input->hasParameterOption('--verbose=1') || $input->hasParameterOption('--verbose') || $input->getParameterOption('--verbose')) {
  31379. $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
  31380. }
  31381. }
  31382. }
  31383. protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
  31384. {
  31385. foreach ($command->getHelperSet() as $helper) {
  31386. if ($helper instanceof InputAwareInterface) {
  31387. $helper->setInput($input);
  31388. }
  31389. }
  31390. if (null === $this->dispatcher) {
  31391. return $command->run($input, $output);
  31392. }
  31393. try {
  31394. $command->mergeApplicationDefinition();
  31395. $input->bind($command->getDefinition());
  31396. } catch (ExceptionInterface $e) {
  31397. }
  31398. $event = new ConsoleCommandEvent($command, $input, $output);
  31399. $e = null;
  31400. try {
  31401. $this->dispatcher->dispatch(ConsoleEvents::COMMAND, $event);
  31402. if ($event->commandShouldRun()) {
  31403. $exitCode = $command->run($input, $output);
  31404. } else {
  31405. $exitCode = ConsoleCommandEvent::RETURN_CODE_DISABLED;
  31406. }
  31407. } catch (\Exception $e) {
  31408. } catch (\Throwable $e) {
  31409. }
  31410. if (null !== $e) {
  31411. $x = $e instanceof \Exception ? $e : new FatalThrowableError($e);
  31412. $event = new ConsoleExceptionEvent($command, $input, $output, $x, $x->getCode());
  31413. $this->dispatcher->dispatch(ConsoleEvents::EXCEPTION, $event);
  31414. if ($x !== $event->getException()) {
  31415. $e = $event->getException();
  31416. }
  31417. $exitCode = $e->getCode();
  31418. }
  31419. $event = new ConsoleTerminateEvent($command, $input, $output, $exitCode);
  31420. $this->dispatcher->dispatch(ConsoleEvents::TERMINATE, $event);
  31421. if (null !== $e) {
  31422. throw $e;
  31423. }
  31424. return $event->getExitCode();
  31425. }
  31426. protected function getCommandName(InputInterface $input)
  31427. {
  31428. return $input->getFirstArgument();
  31429. }
  31430. protected function getDefaultInputDefinition()
  31431. {
  31432. return new InputDefinition(array(
  31433. new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),
  31434. new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message'),
  31435. new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'),
  31436. new InputOption('--verbose', '-v|vv|vvv', InputOption::VALUE_NONE, 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'),
  31437. new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version'),
  31438. new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output'),
  31439. new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output'),
  31440. new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'),
  31441. ));
  31442. }
  31443. protected function getDefaultCommands()
  31444. {
  31445. return array(new HelpCommand(), new ListCommand());
  31446. }
  31447. protected function getDefaultHelperSet()
  31448. {
  31449. return new HelperSet(array(
  31450. new FormatterHelper(),
  31451. new DialogHelper(false),
  31452. new ProgressHelper(false),
  31453. new TableHelper(false),
  31454. new DebugFormatterHelper(),
  31455. new ProcessHelper(),
  31456. new QuestionHelper(),
  31457. ));
  31458. }
  31459. private function getSttyColumns()
  31460. {
  31461. if (!function_exists('proc_open')) {
  31462. return;
  31463. }
  31464. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  31465. $process = proc_open('stty -a | grep columns', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  31466. if (is_resource($process)) {
  31467. $info = stream_get_contents($pipes[1]);
  31468. fclose($pipes[1]);
  31469. fclose($pipes[2]);
  31470. proc_close($process);
  31471. return $info;
  31472. }
  31473. }
  31474. private function getConsoleMode()
  31475. {
  31476. if (!function_exists('proc_open')) {
  31477. return;
  31478. }
  31479. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  31480. $process = proc_open('mode CON', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  31481. if (is_resource($process)) {
  31482. $info = stream_get_contents($pipes[1]);
  31483. fclose($pipes[1]);
  31484. fclose($pipes[2]);
  31485. proc_close($process);
  31486. if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
  31487. return $matches[2].'x'.$matches[1];
  31488. }
  31489. }
  31490. }
  31491. private function getAbbreviationSuggestions($abbrevs)
  31492. {
  31493. return sprintf('%s, %s%s', $abbrevs[0], $abbrevs[1], count($abbrevs) > 2 ? sprintf(' and %d more', count($abbrevs) - 2) : '');
  31494. }
  31495. public function extractNamespace($name, $limit = null)
  31496. {
  31497. $parts = explode(':', $name);
  31498. array_pop($parts);
  31499. return implode(':', null === $limit ? $parts : array_slice($parts, 0, $limit));
  31500. }
  31501. private function findAlternatives($name, $collection)
  31502. {
  31503. $threshold = 1e3;
  31504. $alternatives = array();
  31505. $collectionParts = array();
  31506. foreach ($collection as $item) {
  31507. $collectionParts[$item] = explode(':', $item);
  31508. }
  31509. foreach (explode(':', $name) as $i => $subname) {
  31510. foreach ($collectionParts as $collectionName => $parts) {
  31511. $exists = isset($alternatives[$collectionName]);
  31512. if (!isset($parts[$i]) && $exists) {
  31513. $alternatives[$collectionName] += $threshold;
  31514. continue;
  31515. } elseif (!isset($parts[$i])) {
  31516. continue;
  31517. }
  31518. $lev = levenshtein($subname, $parts[$i]);
  31519. if ($lev <= strlen($subname) / 3 || '' !== $subname && false !== strpos($parts[$i], $subname)) {
  31520. $alternatives[$collectionName] = $exists ? $alternatives[$collectionName] + $lev : $lev;
  31521. } elseif ($exists) {
  31522. $alternatives[$collectionName] += $threshold;
  31523. }
  31524. }
  31525. }
  31526. foreach ($collection as $item) {
  31527. $lev = levenshtein($name, $item);
  31528. if ($lev <= strlen($name) / 3 || false !== strpos($item, $name)) {
  31529. $alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev;
  31530. }
  31531. }
  31532. $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; });
  31533. asort($alternatives);
  31534. return array_keys($alternatives);
  31535. }
  31536. public function setDefaultCommand($commandName)
  31537. {
  31538. $this->defaultCommand = $commandName;
  31539. }
  31540. private function splitStringByWidth($string, $width)
  31541. {
  31542. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  31543. return str_split($string, $width);
  31544. }
  31545. $utf8String = mb_convert_encoding($string, 'utf8', $encoding);
  31546. $lines = array();
  31547. $line = '';
  31548. foreach (preg_split('//u', $utf8String) as $char) {
  31549. if (mb_strwidth($line.$char, 'utf8') <= $width) {
  31550. $line .= $char;
  31551. continue;
  31552. }
  31553. $lines[] = str_pad($line, $width);
  31554. $line = $char;
  31555. }
  31556. $lines[] = count($lines) ? str_pad($line, $width) : $line;
  31557. mb_convert_variables($encoding, 'utf8', $lines);
  31558. return $lines;
  31559. }
  31560. private function extractAllNamespaces($name)
  31561. {
  31562. $parts = explode(':', $name, -1);
  31563. $namespaces = array();
  31564. foreach ($parts as $part) {
  31565. if (count($namespaces)) {
  31566. $namespaces[] = end($namespaces).':'.$part;
  31567. } else {
  31568. $namespaces[] = $part;
  31569. }
  31570. }
  31571. return $namespaces;
  31572. }
  31573. private function init()
  31574. {
  31575. if ($this->initialized) {
  31576. return;
  31577. }
  31578. $this->initialized = true;
  31579. foreach ($this->getDefaultCommands() as $command) {
  31580. $this->add($command);
  31581. }
  31582. }
  31583. }
  31584. <?php
  31585. namespace Symfony\Component\Console\Command;
  31586. use Symfony\Component\Console\Descriptor\TextDescriptor;
  31587. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  31588. use Symfony\Component\Console\Exception\ExceptionInterface;
  31589. use Symfony\Component\Console\Input\InputDefinition;
  31590. use Symfony\Component\Console\Input\InputOption;
  31591. use Symfony\Component\Console\Input\InputArgument;
  31592. use Symfony\Component\Console\Input\InputInterface;
  31593. use Symfony\Component\Console\Output\BufferedOutput;
  31594. use Symfony\Component\Console\Output\OutputInterface;
  31595. use Symfony\Component\Console\Application;
  31596. use Symfony\Component\Console\Helper\HelperSet;
  31597. use Symfony\Component\Console\Exception\InvalidArgumentException;
  31598. use Symfony\Component\Console\Exception\LogicException;
  31599. class Command
  31600. {
  31601. private $application;
  31602. private $name;
  31603. private $processTitle;
  31604. private $aliases = array();
  31605. private $definition;
  31606. private $help;
  31607. private $description;
  31608. private $ignoreValidationErrors = false;
  31609. private $applicationDefinitionMerged = false;
  31610. private $applicationDefinitionMergedWithArgs = false;
  31611. private $code;
  31612. private $synopsis = array();
  31613. private $usages = array();
  31614. private $helperSet;
  31615. public function __construct($name = null)
  31616. {
  31617. $this->definition = new InputDefinition();
  31618. if (null !== $name) {
  31619. $this->setName($name);
  31620. }
  31621. $this->configure();
  31622. if (!$this->name) {
  31623. throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', get_class($this)));
  31624. }
  31625. }
  31626. public function ignoreValidationErrors()
  31627. {
  31628. $this->ignoreValidationErrors = true;
  31629. }
  31630. public function setApplication(Application $application = null)
  31631. {
  31632. $this->application = $application;
  31633. if ($application) {
  31634. $this->setHelperSet($application->getHelperSet());
  31635. } else {
  31636. $this->helperSet = null;
  31637. }
  31638. }
  31639. public function setHelperSet(HelperSet $helperSet)
  31640. {
  31641. $this->helperSet = $helperSet;
  31642. }
  31643. public function getHelperSet()
  31644. {
  31645. return $this->helperSet;
  31646. }
  31647. public function getApplication()
  31648. {
  31649. return $this->application;
  31650. }
  31651. public function isEnabled()
  31652. {
  31653. return true;
  31654. }
  31655. protected function configure()
  31656. {
  31657. }
  31658. protected function execute(InputInterface $input, OutputInterface $output)
  31659. {
  31660. throw new LogicException('You must override the execute() method in the concrete command class.');
  31661. }
  31662. protected function interact(InputInterface $input, OutputInterface $output)
  31663. {
  31664. }
  31665. protected function initialize(InputInterface $input, OutputInterface $output)
  31666. {
  31667. }
  31668. public function run(InputInterface $input, OutputInterface $output)
  31669. {
  31670. $this->getSynopsis(true);
  31671. $this->getSynopsis(false);
  31672. $this->mergeApplicationDefinition();
  31673. try {
  31674. $input->bind($this->definition);
  31675. } catch (ExceptionInterface $e) {
  31676. if (!$this->ignoreValidationErrors) {
  31677. throw $e;
  31678. }
  31679. }
  31680. $this->initialize($input, $output);
  31681. if (null !== $this->processTitle) {
  31682. if (function_exists('cli_set_process_title')) {
  31683. if (!@cli_set_process_title($this->processTitle)) {
  31684. if ('Darwin' === PHP_OS) {
  31685. $output->writeln('<comment>Running "cli_set_process_title" as an unprivileged user is not supported on MacOS.</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
  31686. } else {
  31687. cli_set_process_title($this->processTitle);
  31688. }
  31689. }
  31690. } elseif (function_exists('setproctitle')) {
  31691. setproctitle($this->processTitle);
  31692. } elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {
  31693. $output->writeln('<comment>Install the proctitle PECL to be able to change the process title.</comment>');
  31694. }
  31695. }
  31696. if ($input->isInteractive()) {
  31697. $this->interact($input, $output);
  31698. }
  31699. if ($input->hasArgument('command') && null === $input->getArgument('command')) {
  31700. $input->setArgument('command', $this->getName());
  31701. }
  31702. $input->validate();
  31703. if ($this->code) {
  31704. $statusCode = call_user_func($this->code, $input, $output);
  31705. } else {
  31706. $statusCode = $this->execute($input, $output);
  31707. }
  31708. return is_numeric($statusCode) ? (int) $statusCode : 0;
  31709. }
  31710. public function setCode($code)
  31711. {
  31712. if (!is_callable($code)) {
  31713. throw new InvalidArgumentException('Invalid callable provided to Command::setCode.');
  31714. }
  31715. if (PHP_VERSION_ID >= 50400 && $code instanceof \Closure) {
  31716. $r = new \ReflectionFunction($code);
  31717. if (null === $r->getClosureThis()) {
  31718. if (PHP_VERSION_ID < 70000) {
  31719. $code = @\Closure::bind($code, $this);
  31720. } else {
  31721. $code = \Closure::bind($code, $this);
  31722. }
  31723. }
  31724. }
  31725. $this->code = $code;
  31726. return $this;
  31727. }
  31728. public function mergeApplicationDefinition($mergeArgs = true)
  31729. {
  31730. if (null === $this->application || (true === $this->applicationDefinitionMerged && ($this->applicationDefinitionMergedWithArgs || !$mergeArgs))) {
  31731. return;
  31732. }
  31733. $this->definition->addOptions($this->application->getDefinition()->getOptions());
  31734. if ($mergeArgs) {
  31735. $currentArguments = $this->definition->getArguments();
  31736. $this->definition->setArguments($this->application->getDefinition()->getArguments());
  31737. $this->definition->addArguments($currentArguments);
  31738. }
  31739. $this->applicationDefinitionMerged = true;
  31740. if ($mergeArgs) {
  31741. $this->applicationDefinitionMergedWithArgs = true;
  31742. }
  31743. }
  31744. public function setDefinition($definition)
  31745. {
  31746. if ($definition instanceof InputDefinition) {
  31747. $this->definition = $definition;
  31748. } else {
  31749. $this->definition->setDefinition($definition);
  31750. }
  31751. $this->applicationDefinitionMerged = false;
  31752. return $this;
  31753. }
  31754. public function getDefinition()
  31755. {
  31756. return $this->definition;
  31757. }
  31758. public function getNativeDefinition()
  31759. {
  31760. return $this->getDefinition();
  31761. }
  31762. public function addArgument($name, $mode = null, $description = '', $default = null)
  31763. {
  31764. $this->definition->addArgument(new InputArgument($name, $mode, $description, $default));
  31765. return $this;
  31766. }
  31767. public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null)
  31768. {
  31769. $this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
  31770. return $this;
  31771. }
  31772. public function setName($name)
  31773. {
  31774. $this->validateName($name);
  31775. $this->name = $name;
  31776. return $this;
  31777. }
  31778. public function setProcessTitle($title)
  31779. {
  31780. $this->processTitle = $title;
  31781. return $this;
  31782. }
  31783. public function getName()
  31784. {
  31785. return $this->name;
  31786. }
  31787. public function setDescription($description)
  31788. {
  31789. $this->description = $description;
  31790. return $this;
  31791. }
  31792. public function getDescription()
  31793. {
  31794. return $this->description;
  31795. }
  31796. public function setHelp($help)
  31797. {
  31798. $this->help = $help;
  31799. return $this;
  31800. }
  31801. public function getHelp()
  31802. {
  31803. return $this->help;
  31804. }
  31805. public function getProcessedHelp()
  31806. {
  31807. $name = $this->name;
  31808. $placeholders = array(
  31809. '%command.name%',
  31810. '%command.full_name%',
  31811. );
  31812. $replacements = array(
  31813. $name,
  31814. $_SERVER['PHP_SELF'].' '.$name,
  31815. );
  31816. return str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription());
  31817. }
  31818. public function setAliases($aliases)
  31819. {
  31820. if (!is_array($aliases) && !$aliases instanceof \Traversable) {
  31821. throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable');
  31822. }
  31823. foreach ($aliases as $alias) {
  31824. $this->validateName($alias);
  31825. }
  31826. $this->aliases = $aliases;
  31827. return $this;
  31828. }
  31829. public function getAliases()
  31830. {
  31831. return $this->aliases;
  31832. }
  31833. public function getSynopsis($short = false)
  31834. {
  31835. $key = $short ? 'short' : 'long';
  31836. if (!isset($this->synopsis[$key])) {
  31837. $this->synopsis[$key] = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis($short)));
  31838. }
  31839. return $this->synopsis[$key];
  31840. }
  31841. public function addUsage($usage)
  31842. {
  31843. if (0 !== strpos($usage, $this->name)) {
  31844. $usage = sprintf('%s %s', $this->name, $usage);
  31845. }
  31846. $this->usages[] = $usage;
  31847. return $this;
  31848. }
  31849. public function getUsages()
  31850. {
  31851. return $this->usages;
  31852. }
  31853. public function getHelper($name)
  31854. {
  31855. if (null === $this->helperSet) {
  31856. throw new LogicException(sprintf('Cannot retrieve helper "%s" because there is no HelperSet defined. Did you forget to add your command to the application or to set the application on the command using the setApplication() method? You can also set the HelperSet directly using the setHelperSet() method.', $name));
  31857. }
  31858. return $this->helperSet->get($name);
  31859. }
  31860. public function asText()
  31861. {
  31862. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  31863. $descriptor = new TextDescriptor();
  31864. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  31865. $descriptor->describe($output, $this, array('raw_output' => true));
  31866. return $output->fetch();
  31867. }
  31868. public function asXml($asDom = false)
  31869. {
  31870. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  31871. $descriptor = new XmlDescriptor();
  31872. if ($asDom) {
  31873. return $descriptor->getCommandDocument($this);
  31874. }
  31875. $output = new BufferedOutput();
  31876. $descriptor->describe($output, $this);
  31877. return $output->fetch();
  31878. }
  31879. private function validateName($name)
  31880. {
  31881. if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) {
  31882. throw new InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));
  31883. }
  31884. }
  31885. }
  31886. <?php
  31887. namespace Symfony\Component\Console\Command;
  31888. use Symfony\Component\Console\Helper\DescriptorHelper;
  31889. use Symfony\Component\Console\Input\InputArgument;
  31890. use Symfony\Component\Console\Input\InputOption;
  31891. use Symfony\Component\Console\Input\InputInterface;
  31892. use Symfony\Component\Console\Output\OutputInterface;
  31893. class HelpCommand extends Command
  31894. {
  31895. private $command;
  31896. protected function configure()
  31897. {
  31898. $this->ignoreValidationErrors();
  31899. $this
  31900. ->setName('help')
  31901. ->setDefinition(array(
  31902. new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'),
  31903. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output help as XML'),
  31904. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  31905. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
  31906. ))
  31907. ->setDescription('Displays help for a command')
  31908. ->setHelp(<<<'EOF'
  31909. The <info>%command.name%</info> command displays help for a given command:
  31910. <info>php %command.full_name% list</info>
  31911. You can also output the help in other formats by using the <comment>--format</comment> option:
  31912. <info>php %command.full_name% --format=xml list</info>
  31913. To display the list of available commands, please use the <info>list</info> command.
  31914. EOF
  31915. )
  31916. ;
  31917. }
  31918. public function setCommand(Command $command)
  31919. {
  31920. $this->command = $command;
  31921. }
  31922. protected function execute(InputInterface $input, OutputInterface $output)
  31923. {
  31924. if (null === $this->command) {
  31925. $this->command = $this->getApplication()->find($input->getArgument('command_name'));
  31926. }
  31927. if ($input->getOption('xml')) {
  31928. @trigger_error('The --xml option was deprecated in version 2.7 and will be removed in version 3.0. Use the --format option instead.', E_USER_DEPRECATED);
  31929. $input->setOption('format', 'xml');
  31930. }
  31931. $helper = new DescriptorHelper();
  31932. $helper->describe($output, $this->command, array(
  31933. 'format' => $input->getOption('format'),
  31934. 'raw_text' => $input->getOption('raw'),
  31935. ));
  31936. $this->command = null;
  31937. }
  31938. }
  31939. <?php
  31940. namespace Symfony\Component\Console\Command;
  31941. use Symfony\Component\Console\Helper\DescriptorHelper;
  31942. use Symfony\Component\Console\Input\InputArgument;
  31943. use Symfony\Component\Console\Input\InputOption;
  31944. use Symfony\Component\Console\Input\InputInterface;
  31945. use Symfony\Component\Console\Output\OutputInterface;
  31946. use Symfony\Component\Console\Input\InputDefinition;
  31947. class ListCommand extends Command
  31948. {
  31949. protected function configure()
  31950. {
  31951. $this
  31952. ->setName('list')
  31953. ->setDefinition($this->createDefinition())
  31954. ->setDescription('Lists commands')
  31955. ->setHelp(<<<'EOF'
  31956. The <info>%command.name%</info> command lists all commands:
  31957. <info>php %command.full_name%</info>
  31958. You can also display the commands for a specific namespace:
  31959. <info>php %command.full_name% test</info>
  31960. You can also output the information in other formats by using the <comment>--format</comment> option:
  31961. <info>php %command.full_name% --format=xml</info>
  31962. It's also possible to get raw list of commands (useful for embedding command runner):
  31963. <info>php %command.full_name% --raw</info>
  31964. EOF
  31965. )
  31966. ;
  31967. }
  31968. public function getNativeDefinition()
  31969. {
  31970. return $this->createDefinition();
  31971. }
  31972. protected function execute(InputInterface $input, OutputInterface $output)
  31973. {
  31974. if ($input->getOption('xml')) {
  31975. @trigger_error('The --xml option was deprecated in version 2.7 and will be removed in version 3.0. Use the --format option instead.', E_USER_DEPRECATED);
  31976. $input->setOption('format', 'xml');
  31977. }
  31978. $helper = new DescriptorHelper();
  31979. $helper->describe($output, $this->getApplication(), array(
  31980. 'format' => $input->getOption('format'),
  31981. 'raw_text' => $input->getOption('raw'),
  31982. 'namespace' => $input->getArgument('namespace'),
  31983. ));
  31984. }
  31985. private function createDefinition()
  31986. {
  31987. return new InputDefinition(array(
  31988. new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
  31989. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output list as XML'),
  31990. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'),
  31991. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  31992. ));
  31993. }
  31994. }
  31995. <?php
  31996. namespace Symfony\Component\Console;
  31997. final class ConsoleEvents
  31998. {
  31999. const COMMAND = 'console.command';
  32000. const TERMINATE = 'console.terminate';
  32001. const EXCEPTION = 'console.exception';
  32002. }
  32003. <?php
  32004. namespace Symfony\Component\Console\Descriptor;
  32005. use Symfony\Component\Console\Application;
  32006. use Symfony\Component\Console\Command\Command;
  32007. use Symfony\Component\Console\Exception\CommandNotFoundException;
  32008. class ApplicationDescription
  32009. {
  32010. const GLOBAL_NAMESPACE = '_global';
  32011. private $application;
  32012. private $namespace;
  32013. private $namespaces;
  32014. private $commands;
  32015. private $aliases;
  32016. public function __construct(Application $application, $namespace = null)
  32017. {
  32018. $this->application = $application;
  32019. $this->namespace = $namespace;
  32020. }
  32021. public function getNamespaces()
  32022. {
  32023. if (null === $this->namespaces) {
  32024. $this->inspectApplication();
  32025. }
  32026. return $this->namespaces;
  32027. }
  32028. public function getCommands()
  32029. {
  32030. if (null === $this->commands) {
  32031. $this->inspectApplication();
  32032. }
  32033. return $this->commands;
  32034. }
  32035. public function getCommand($name)
  32036. {
  32037. if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) {
  32038. throw new CommandNotFoundException(sprintf('Command %s does not exist.', $name));
  32039. }
  32040. return isset($this->commands[$name]) ? $this->commands[$name] : $this->aliases[$name];
  32041. }
  32042. private function inspectApplication()
  32043. {
  32044. $this->commands = array();
  32045. $this->namespaces = array();
  32046. $all = $this->application->all($this->namespace ? $this->application->findNamespace($this->namespace) : null);
  32047. foreach ($this->sortCommands($all) as $namespace => $commands) {
  32048. $names = array();
  32049. foreach ($commands as $name => $command) {
  32050. if (!$command->getName()) {
  32051. continue;
  32052. }
  32053. if ($command->getName() === $name) {
  32054. $this->commands[$name] = $command;
  32055. } else {
  32056. $this->aliases[$name] = $command;
  32057. }
  32058. $names[] = $name;
  32059. }
  32060. $this->namespaces[$namespace] = array('id' => $namespace, 'commands' => $names);
  32061. }
  32062. }
  32063. private function sortCommands(array $commands)
  32064. {
  32065. $namespacedCommands = array();
  32066. $globalCommands = array();
  32067. foreach ($commands as $name => $command) {
  32068. $key = $this->application->extractNamespace($name, 1);
  32069. if (!$key) {
  32070. $globalCommands['_global'][$name] = $command;
  32071. } else {
  32072. $namespacedCommands[$key][$name] = $command;
  32073. }
  32074. }
  32075. ksort($namespacedCommands);
  32076. $namespacedCommands = array_merge($globalCommands, $namespacedCommands);
  32077. foreach ($namespacedCommands as &$commandsSet) {
  32078. ksort($commandsSet);
  32079. }
  32080. unset($commandsSet);
  32081. return $namespacedCommands;
  32082. }
  32083. }
  32084. <?php
  32085. namespace Symfony\Component\Console\Descriptor;
  32086. use Symfony\Component\Console\Application;
  32087. use Symfony\Component\Console\Command\Command;
  32088. use Symfony\Component\Console\Input\InputArgument;
  32089. use Symfony\Component\Console\Input\InputDefinition;
  32090. use Symfony\Component\Console\Input\InputOption;
  32091. use Symfony\Component\Console\Output\OutputInterface;
  32092. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32093. abstract class Descriptor implements DescriptorInterface
  32094. {
  32095. private $output;
  32096. public function describe(OutputInterface $output, $object, array $options = array())
  32097. {
  32098. $this->output = $output;
  32099. switch (true) {
  32100. case $object instanceof InputArgument:
  32101. $this->describeInputArgument($object, $options);
  32102. break;
  32103. case $object instanceof InputOption:
  32104. $this->describeInputOption($object, $options);
  32105. break;
  32106. case $object instanceof InputDefinition:
  32107. $this->describeInputDefinition($object, $options);
  32108. break;
  32109. case $object instanceof Command:
  32110. $this->describeCommand($object, $options);
  32111. break;
  32112. case $object instanceof Application:
  32113. $this->describeApplication($object, $options);
  32114. break;
  32115. default:
  32116. throw new InvalidArgumentException(sprintf('Object of type "%s" is not describable.', get_class($object)));
  32117. }
  32118. }
  32119. protected function write($content, $decorated = false)
  32120. {
  32121. $this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
  32122. }
  32123. abstract protected function describeInputArgument(InputArgument $argument, array $options = array());
  32124. abstract protected function describeInputOption(InputOption $option, array $options = array());
  32125. abstract protected function describeInputDefinition(InputDefinition $definition, array $options = array());
  32126. abstract protected function describeCommand(Command $command, array $options = array());
  32127. abstract protected function describeApplication(Application $application, array $options = array());
  32128. }
  32129. <?php
  32130. namespace Symfony\Component\Console\Descriptor;
  32131. use Symfony\Component\Console\Output\OutputInterface;
  32132. interface DescriptorInterface
  32133. {
  32134. public function describe(OutputInterface $output, $object, array $options = array());
  32135. }
  32136. <?php
  32137. namespace Symfony\Component\Console\Descriptor;
  32138. use Symfony\Component\Console\Application;
  32139. use Symfony\Component\Console\Command\Command;
  32140. use Symfony\Component\Console\Input\InputArgument;
  32141. use Symfony\Component\Console\Input\InputDefinition;
  32142. use Symfony\Component\Console\Input\InputOption;
  32143. class JsonDescriptor extends Descriptor
  32144. {
  32145. protected function describeInputArgument(InputArgument $argument, array $options = array())
  32146. {
  32147. $this->writeData($this->getInputArgumentData($argument), $options);
  32148. }
  32149. protected function describeInputOption(InputOption $option, array $options = array())
  32150. {
  32151. $this->writeData($this->getInputOptionData($option), $options);
  32152. }
  32153. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  32154. {
  32155. $this->writeData($this->getInputDefinitionData($definition), $options);
  32156. }
  32157. protected function describeCommand(Command $command, array $options = array())
  32158. {
  32159. $this->writeData($this->getCommandData($command), $options);
  32160. }
  32161. protected function describeApplication(Application $application, array $options = array())
  32162. {
  32163. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  32164. $description = new ApplicationDescription($application, $describedNamespace);
  32165. $commands = array();
  32166. foreach ($description->getCommands() as $command) {
  32167. $commands[] = $this->getCommandData($command);
  32168. }
  32169. $data = $describedNamespace
  32170. ? array('commands' => $commands, 'namespace' => $describedNamespace)
  32171. : array('commands' => $commands, 'namespaces' => array_values($description->getNamespaces()));
  32172. $this->writeData($data, $options);
  32173. }
  32174. private function writeData(array $data, array $options)
  32175. {
  32176. $this->write(json_encode($data, isset($options['json_encoding']) ? $options['json_encoding'] : 0));
  32177. }
  32178. private function getInputArgumentData(InputArgument $argument)
  32179. {
  32180. return array(
  32181. 'name' => $argument->getName(),
  32182. 'is_required' => $argument->isRequired(),
  32183. 'is_array' => $argument->isArray(),
  32184. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()),
  32185. 'default' => INF === $argument->getDefault() ? 'INF' : $argument->getDefault(),
  32186. );
  32187. }
  32188. private function getInputOptionData(InputOption $option)
  32189. {
  32190. return array(
  32191. 'name' => '--'.$option->getName(),
  32192. 'shortcut' => $option->getShortcut() ? '-'.str_replace('|', '|-', $option->getShortcut()) : '',
  32193. 'accept_value' => $option->acceptValue(),
  32194. 'is_value_required' => $option->isValueRequired(),
  32195. 'is_multiple' => $option->isArray(),
  32196. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
  32197. 'default' => INF === $option->getDefault() ? 'INF' : $option->getDefault(),
  32198. );
  32199. }
  32200. private function getInputDefinitionData(InputDefinition $definition)
  32201. {
  32202. $inputArguments = array();
  32203. foreach ($definition->getArguments() as $name => $argument) {
  32204. $inputArguments[$name] = $this->getInputArgumentData($argument);
  32205. }
  32206. $inputOptions = array();
  32207. foreach ($definition->getOptions() as $name => $option) {
  32208. $inputOptions[$name] = $this->getInputOptionData($option);
  32209. }
  32210. return array('arguments' => $inputArguments, 'options' => $inputOptions);
  32211. }
  32212. private function getCommandData(Command $command)
  32213. {
  32214. $command->getSynopsis();
  32215. $command->mergeApplicationDefinition(false);
  32216. return array(
  32217. 'name' => $command->getName(),
  32218. 'usage' => array_merge(array($command->getSynopsis()), $command->getUsages(), $command->getAliases()),
  32219. 'description' => $command->getDescription(),
  32220. 'help' => $command->getProcessedHelp(),
  32221. 'definition' => $this->getInputDefinitionData($command->getNativeDefinition()),
  32222. );
  32223. }
  32224. }
  32225. <?php
  32226. namespace Symfony\Component\Console\Descriptor;
  32227. use Symfony\Component\Console\Application;
  32228. use Symfony\Component\Console\Command\Command;
  32229. use Symfony\Component\Console\Helper\Helper;
  32230. use Symfony\Component\Console\Input\InputArgument;
  32231. use Symfony\Component\Console\Input\InputDefinition;
  32232. use Symfony\Component\Console\Input\InputOption;
  32233. class MarkdownDescriptor extends Descriptor
  32234. {
  32235. protected function describeInputArgument(InputArgument $argument, array $options = array())
  32236. {
  32237. $this->write(
  32238. '**'.$argument->getName().':**'."\n\n"
  32239. .'* Name: '.($argument->getName() ?: '<none>')."\n"
  32240. .'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n"
  32241. .'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n"
  32242. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $argument->getDescription() ?: '<none>')."\n"
  32243. .'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`'
  32244. );
  32245. }
  32246. protected function describeInputOption(InputOption $option, array $options = array())
  32247. {
  32248. $this->write(
  32249. '**'.$option->getName().':**'."\n\n"
  32250. .'* Name: `--'.$option->getName().'`'."\n"
  32251. .'* Shortcut: '.($option->getShortcut() ? '`-'.str_replace('|', '|-', $option->getShortcut()).'`' : '<none>')."\n"
  32252. .'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n"
  32253. .'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n"
  32254. .'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n"
  32255. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $option->getDescription() ?: '<none>')."\n"
  32256. .'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`'
  32257. );
  32258. }
  32259. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  32260. {
  32261. if ($showArguments = count($definition->getArguments()) > 0) {
  32262. $this->write('### Arguments:');
  32263. foreach ($definition->getArguments() as $argument) {
  32264. $this->write("\n\n");
  32265. $this->write($this->describeInputArgument($argument));
  32266. }
  32267. }
  32268. if (count($definition->getOptions()) > 0) {
  32269. if ($showArguments) {
  32270. $this->write("\n\n");
  32271. }
  32272. $this->write('### Options:');
  32273. foreach ($definition->getOptions() as $option) {
  32274. $this->write("\n\n");
  32275. $this->write($this->describeInputOption($option));
  32276. }
  32277. }
  32278. }
  32279. protected function describeCommand(Command $command, array $options = array())
  32280. {
  32281. $command->getSynopsis();
  32282. $command->mergeApplicationDefinition(false);
  32283. $this->write(
  32284. $command->getName()."\n"
  32285. .str_repeat('-', Helper::strlen($command->getName()))."\n\n"
  32286. .'* Description: '.($command->getDescription() ?: '<none>')."\n"
  32287. .'* Usage:'."\n\n"
  32288. .array_reduce(array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
  32289. return $carry.' * `'.$usage.'`'."\n";
  32290. })
  32291. );
  32292. if ($help = $command->getProcessedHelp()) {
  32293. $this->write("\n");
  32294. $this->write($help);
  32295. }
  32296. if ($command->getNativeDefinition()) {
  32297. $this->write("\n\n");
  32298. $this->describeInputDefinition($command->getNativeDefinition());
  32299. }
  32300. }
  32301. protected function describeApplication(Application $application, array $options = array())
  32302. {
  32303. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  32304. $description = new ApplicationDescription($application, $describedNamespace);
  32305. $this->write($application->getName()."\n".str_repeat('=', Helper::strlen($application->getName())));
  32306. foreach ($description->getNamespaces() as $namespace) {
  32307. if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  32308. $this->write("\n\n");
  32309. $this->write('**'.$namespace['id'].':**');
  32310. }
  32311. $this->write("\n\n");
  32312. $this->write(implode("\n", array_map(function ($commandName) {
  32313. return '* '.$commandName;
  32314. }, $namespace['commands'])));
  32315. }
  32316. foreach ($description->getCommands() as $command) {
  32317. $this->write("\n\n");
  32318. $this->write($this->describeCommand($command));
  32319. }
  32320. }
  32321. }
  32322. <?php
  32323. namespace Symfony\Component\Console\Descriptor;
  32324. use Symfony\Component\Console\Application;
  32325. use Symfony\Component\Console\Command\Command;
  32326. use Symfony\Component\Console\Formatter\OutputFormatter;
  32327. use Symfony\Component\Console\Helper\Helper;
  32328. use Symfony\Component\Console\Input\InputArgument;
  32329. use Symfony\Component\Console\Input\InputDefinition;
  32330. use Symfony\Component\Console\Input\InputOption;
  32331. class TextDescriptor extends Descriptor
  32332. {
  32333. protected function describeInputArgument(InputArgument $argument, array $options = array())
  32334. {
  32335. if (null !== $argument->getDefault() && (!is_array($argument->getDefault()) || count($argument->getDefault()))) {
  32336. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($argument->getDefault()));
  32337. } else {
  32338. $default = '';
  32339. }
  32340. $totalWidth = isset($options['total_width']) ? $options['total_width'] : Helper::strlen($argument->getName());
  32341. $spacingWidth = $totalWidth - strlen($argument->getName());
  32342. $this->writeText(sprintf(' <info>%s</info> %s%s%s',
  32343. $argument->getName(),
  32344. str_repeat(' ', $spacingWidth),
  32345. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $argument->getDescription()),
  32346. $default
  32347. ), $options);
  32348. }
  32349. protected function describeInputOption(InputOption $option, array $options = array())
  32350. {
  32351. if ($option->acceptValue() && null !== $option->getDefault() && (!is_array($option->getDefault()) || count($option->getDefault()))) {
  32352. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($option->getDefault()));
  32353. } else {
  32354. $default = '';
  32355. }
  32356. $value = '';
  32357. if ($option->acceptValue()) {
  32358. $value = '='.strtoupper($option->getName());
  32359. if ($option->isValueOptional()) {
  32360. $value = '['.$value.']';
  32361. }
  32362. }
  32363. $totalWidth = isset($options['total_width']) ? $options['total_width'] : $this->calculateTotalWidthForOptions(array($option));
  32364. $synopsis = sprintf('%s%s',
  32365. $option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : ' ',
  32366. sprintf('--%s%s', $option->getName(), $value)
  32367. );
  32368. $spacingWidth = $totalWidth - Helper::strlen($synopsis);
  32369. $this->writeText(sprintf(' <info>%s</info> %s%s%s%s',
  32370. $synopsis,
  32371. str_repeat(' ', $spacingWidth),
  32372. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $option->getDescription()),
  32373. $default,
  32374. $option->isArray() ? '<comment> (multiple values allowed)</comment>' : ''
  32375. ), $options);
  32376. }
  32377. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  32378. {
  32379. $totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions());
  32380. foreach ($definition->getArguments() as $argument) {
  32381. $totalWidth = max($totalWidth, Helper::strlen($argument->getName()));
  32382. }
  32383. if ($definition->getArguments()) {
  32384. $this->writeText('<comment>Arguments:</comment>', $options);
  32385. $this->writeText("\n");
  32386. foreach ($definition->getArguments() as $argument) {
  32387. $this->describeInputArgument($argument, array_merge($options, array('total_width' => $totalWidth)));
  32388. $this->writeText("\n");
  32389. }
  32390. }
  32391. if ($definition->getArguments() && $definition->getOptions()) {
  32392. $this->writeText("\n");
  32393. }
  32394. if ($definition->getOptions()) {
  32395. $laterOptions = array();
  32396. $this->writeText('<comment>Options:</comment>', $options);
  32397. foreach ($definition->getOptions() as $option) {
  32398. if (strlen($option->getShortcut()) > 1) {
  32399. $laterOptions[] = $option;
  32400. continue;
  32401. }
  32402. $this->writeText("\n");
  32403. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  32404. }
  32405. foreach ($laterOptions as $option) {
  32406. $this->writeText("\n");
  32407. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  32408. }
  32409. }
  32410. }
  32411. protected function describeCommand(Command $command, array $options = array())
  32412. {
  32413. $command->getSynopsis(true);
  32414. $command->getSynopsis(false);
  32415. $command->mergeApplicationDefinition(false);
  32416. $this->writeText('<comment>Usage:</comment>', $options);
  32417. foreach (array_merge(array($command->getSynopsis(true)), $command->getAliases(), $command->getUsages()) as $usage) {
  32418. $this->writeText("\n");
  32419. $this->writeText(' '.OutputFormatter::escape($usage), $options);
  32420. }
  32421. $this->writeText("\n");
  32422. $definition = $command->getNativeDefinition();
  32423. if ($definition->getOptions() || $definition->getArguments()) {
  32424. $this->writeText("\n");
  32425. $this->describeInputDefinition($definition, $options);
  32426. $this->writeText("\n");
  32427. }
  32428. if ($help = $command->getProcessedHelp()) {
  32429. $this->writeText("\n");
  32430. $this->writeText('<comment>Help:</comment>', $options);
  32431. $this->writeText("\n");
  32432. $this->writeText(' '.str_replace("\n", "\n ", $help), $options);
  32433. $this->writeText("\n");
  32434. }
  32435. }
  32436. protected function describeApplication(Application $application, array $options = array())
  32437. {
  32438. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  32439. $description = new ApplicationDescription($application, $describedNamespace);
  32440. if (isset($options['raw_text']) && $options['raw_text']) {
  32441. $width = $this->getColumnWidth($description->getCommands());
  32442. foreach ($description->getCommands() as $command) {
  32443. $this->writeText(sprintf("%-{$width}s %s", $command->getName(), $command->getDescription()), $options);
  32444. $this->writeText("\n");
  32445. }
  32446. } else {
  32447. if ('' != $help = $application->getHelp()) {
  32448. $this->writeText("$help\n\n", $options);
  32449. }
  32450. $this->writeText("<comment>Usage:</comment>\n", $options);
  32451. $this->writeText(" command [options] [arguments]\n\n", $options);
  32452. $this->describeInputDefinition(new InputDefinition($application->getDefinition()->getOptions()), $options);
  32453. $this->writeText("\n");
  32454. $this->writeText("\n");
  32455. $width = $this->getColumnWidth($description->getCommands());
  32456. if ($describedNamespace) {
  32457. $this->writeText(sprintf('<comment>Available commands for the "%s" namespace:</comment>', $describedNamespace), $options);
  32458. } else {
  32459. $this->writeText('<comment>Available commands:</comment>', $options);
  32460. }
  32461. foreach ($description->getNamespaces() as $namespace) {
  32462. if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  32463. $this->writeText("\n");
  32464. $this->writeText(' <comment>'.$namespace['id'].'</comment>', $options);
  32465. }
  32466. foreach ($namespace['commands'] as $name) {
  32467. $this->writeText("\n");
  32468. $spacingWidth = $width - Helper::strlen($name);
  32469. $this->writeText(sprintf(' <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $description->getCommand($name)->getDescription()), $options);
  32470. }
  32471. }
  32472. $this->writeText("\n");
  32473. }
  32474. }
  32475. private function writeText($content, array $options = array())
  32476. {
  32477. $this->write(
  32478. isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content,
  32479. isset($options['raw_output']) ? !$options['raw_output'] : true
  32480. );
  32481. }
  32482. private function formatDefaultValue($default)
  32483. {
  32484. if (INF === $default) {
  32485. return 'INF';
  32486. }
  32487. if (is_string($default)) {
  32488. $default = OutputFormatter::escape($default);
  32489. } elseif (is_array($default)) {
  32490. foreach ($default as $key => $value) {
  32491. if (is_string($value)) {
  32492. $default[$key] = OutputFormatter::escape($value);
  32493. }
  32494. }
  32495. }
  32496. if (\PHP_VERSION_ID < 50400) {
  32497. return str_replace(array('\/', '\\\\'), array('/', '\\'), json_encode($default));
  32498. }
  32499. return str_replace('\\\\', '\\', json_encode($default, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
  32500. }
  32501. private function getColumnWidth(array $commands)
  32502. {
  32503. $widths = array();
  32504. foreach ($commands as $command) {
  32505. $widths[] = Helper::strlen($command->getName());
  32506. foreach ($command->getAliases() as $alias) {
  32507. $widths[] = Helper::strlen($alias);
  32508. }
  32509. }
  32510. return max($widths) + 2;
  32511. }
  32512. private function calculateTotalWidthForOptions(array $options)
  32513. {
  32514. $totalWidth = 0;
  32515. foreach ($options as $option) {
  32516. $nameLength = 1 + max(strlen($option->getShortcut()), 1) + 4 + Helper::strlen($option->getName());
  32517. if ($option->acceptValue()) {
  32518. $valueLength = 1 + Helper::strlen($option->getName());
  32519. $valueLength += $option->isValueOptional() ? 2 : 0;
  32520. $nameLength += $valueLength;
  32521. }
  32522. $totalWidth = max($totalWidth, $nameLength);
  32523. }
  32524. return $totalWidth;
  32525. }
  32526. }
  32527. <?php
  32528. namespace Symfony\Component\Console\Descriptor;
  32529. use Symfony\Component\Console\Application;
  32530. use Symfony\Component\Console\Command\Command;
  32531. use Symfony\Component\Console\Input\InputArgument;
  32532. use Symfony\Component\Console\Input\InputDefinition;
  32533. use Symfony\Component\Console\Input\InputOption;
  32534. class XmlDescriptor extends Descriptor
  32535. {
  32536. public function getInputDefinitionDocument(InputDefinition $definition)
  32537. {
  32538. $dom = new \DOMDocument('1.0', 'UTF-8');
  32539. $dom->appendChild($definitionXML = $dom->createElement('definition'));
  32540. $definitionXML->appendChild($argumentsXML = $dom->createElement('arguments'));
  32541. foreach ($definition->getArguments() as $argument) {
  32542. $this->appendDocument($argumentsXML, $this->getInputArgumentDocument($argument));
  32543. }
  32544. $definitionXML->appendChild($optionsXML = $dom->createElement('options'));
  32545. foreach ($definition->getOptions() as $option) {
  32546. $this->appendDocument($optionsXML, $this->getInputOptionDocument($option));
  32547. }
  32548. return $dom;
  32549. }
  32550. public function getCommandDocument(Command $command)
  32551. {
  32552. $dom = new \DOMDocument('1.0', 'UTF-8');
  32553. $dom->appendChild($commandXML = $dom->createElement('command'));
  32554. $command->getSynopsis();
  32555. $command->mergeApplicationDefinition(false);
  32556. $commandXML->setAttribute('id', $command->getName());
  32557. $commandXML->setAttribute('name', $command->getName());
  32558. $commandXML->appendChild($usagesXML = $dom->createElement('usages'));
  32559. foreach (array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()) as $usage) {
  32560. $usagesXML->appendChild($dom->createElement('usage', $usage));
  32561. }
  32562. $commandXML->appendChild($descriptionXML = $dom->createElement('description'));
  32563. $descriptionXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getDescription())));
  32564. $commandXML->appendChild($helpXML = $dom->createElement('help'));
  32565. $helpXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getProcessedHelp())));
  32566. $definitionXML = $this->getInputDefinitionDocument($command->getNativeDefinition());
  32567. $this->appendDocument($commandXML, $definitionXML->getElementsByTagName('definition')->item(0));
  32568. return $dom;
  32569. }
  32570. public function getApplicationDocument(Application $application, $namespace = null)
  32571. {
  32572. $dom = new \DOMDocument('1.0', 'UTF-8');
  32573. $dom->appendChild($rootXml = $dom->createElement('symfony'));
  32574. if ('UNKNOWN' !== $application->getName()) {
  32575. $rootXml->setAttribute('name', $application->getName());
  32576. if ('UNKNOWN' !== $application->getVersion()) {
  32577. $rootXml->setAttribute('version', $application->getVersion());
  32578. }
  32579. }
  32580. $rootXml->appendChild($commandsXML = $dom->createElement('commands'));
  32581. $description = new ApplicationDescription($application, $namespace);
  32582. if ($namespace) {
  32583. $commandsXML->setAttribute('namespace', $namespace);
  32584. }
  32585. foreach ($description->getCommands() as $command) {
  32586. $this->appendDocument($commandsXML, $this->getCommandDocument($command));
  32587. }
  32588. if (!$namespace) {
  32589. $rootXml->appendChild($namespacesXML = $dom->createElement('namespaces'));
  32590. foreach ($description->getNamespaces() as $namespaceDescription) {
  32591. $namespacesXML->appendChild($namespaceArrayXML = $dom->createElement('namespace'));
  32592. $namespaceArrayXML->setAttribute('id', $namespaceDescription['id']);
  32593. foreach ($namespaceDescription['commands'] as $name) {
  32594. $namespaceArrayXML->appendChild($commandXML = $dom->createElement('command'));
  32595. $commandXML->appendChild($dom->createTextNode($name));
  32596. }
  32597. }
  32598. }
  32599. return $dom;
  32600. }
  32601. protected function describeInputArgument(InputArgument $argument, array $options = array())
  32602. {
  32603. $this->writeDocument($this->getInputArgumentDocument($argument));
  32604. }
  32605. protected function describeInputOption(InputOption $option, array $options = array())
  32606. {
  32607. $this->writeDocument($this->getInputOptionDocument($option));
  32608. }
  32609. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  32610. {
  32611. $this->writeDocument($this->getInputDefinitionDocument($definition));
  32612. }
  32613. protected function describeCommand(Command $command, array $options = array())
  32614. {
  32615. $this->writeDocument($this->getCommandDocument($command));
  32616. }
  32617. protected function describeApplication(Application $application, array $options = array())
  32618. {
  32619. $this->writeDocument($this->getApplicationDocument($application, isset($options['namespace']) ? $options['namespace'] : null));
  32620. }
  32621. private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent)
  32622. {
  32623. foreach ($importedParent->childNodes as $childNode) {
  32624. $parentNode->appendChild($parentNode->ownerDocument->importNode($childNode, true));
  32625. }
  32626. }
  32627. private function writeDocument(\DOMDocument $dom)
  32628. {
  32629. $dom->formatOutput = true;
  32630. $this->write($dom->saveXML());
  32631. }
  32632. private function getInputArgumentDocument(InputArgument $argument)
  32633. {
  32634. $dom = new \DOMDocument('1.0', 'UTF-8');
  32635. $dom->appendChild($objectXML = $dom->createElement('argument'));
  32636. $objectXML->setAttribute('name', $argument->getName());
  32637. $objectXML->setAttribute('is_required', $argument->isRequired() ? 1 : 0);
  32638. $objectXML->setAttribute('is_array', $argument->isArray() ? 1 : 0);
  32639. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  32640. $descriptionXML->appendChild($dom->createTextNode($argument->getDescription()));
  32641. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  32642. $defaults = is_array($argument->getDefault()) ? $argument->getDefault() : (is_bool($argument->getDefault()) ? array(var_export($argument->getDefault(), true)) : ($argument->getDefault() ? array($argument->getDefault()) : array()));
  32643. foreach ($defaults as $default) {
  32644. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  32645. $defaultXML->appendChild($dom->createTextNode($default));
  32646. }
  32647. return $dom;
  32648. }
  32649. private function getInputOptionDocument(InputOption $option)
  32650. {
  32651. $dom = new \DOMDocument('1.0', 'UTF-8');
  32652. $dom->appendChild($objectXML = $dom->createElement('option'));
  32653. $objectXML->setAttribute('name', '--'.$option->getName());
  32654. $pos = strpos($option->getShortcut(), '|');
  32655. if (false !== $pos) {
  32656. $objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos));
  32657. $objectXML->setAttribute('shortcuts', '-'.str_replace('|', '|-', $option->getShortcut()));
  32658. } else {
  32659. $objectXML->setAttribute('shortcut', $option->getShortcut() ? '-'.$option->getShortcut() : '');
  32660. }
  32661. $objectXML->setAttribute('accept_value', $option->acceptValue() ? 1 : 0);
  32662. $objectXML->setAttribute('is_value_required', $option->isValueRequired() ? 1 : 0);
  32663. $objectXML->setAttribute('is_multiple', $option->isArray() ? 1 : 0);
  32664. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  32665. $descriptionXML->appendChild($dom->createTextNode($option->getDescription()));
  32666. if ($option->acceptValue()) {
  32667. $defaults = is_array($option->getDefault()) ? $option->getDefault() : (is_bool($option->getDefault()) ? array(var_export($option->getDefault(), true)) : ($option->getDefault() ? array($option->getDefault()) : array()));
  32668. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  32669. if (!empty($defaults)) {
  32670. foreach ($defaults as $default) {
  32671. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  32672. $defaultXML->appendChild($dom->createTextNode($default));
  32673. }
  32674. }
  32675. }
  32676. return $dom;
  32677. }
  32678. }
  32679. <?php
  32680. namespace Symfony\Component\Console\Event;
  32681. class ConsoleCommandEvent extends ConsoleEvent
  32682. {
  32683. const RETURN_CODE_DISABLED = 113;
  32684. private $commandShouldRun = true;
  32685. public function disableCommand()
  32686. {
  32687. return $this->commandShouldRun = false;
  32688. }
  32689. public function enableCommand()
  32690. {
  32691. return $this->commandShouldRun = true;
  32692. }
  32693. public function commandShouldRun()
  32694. {
  32695. return $this->commandShouldRun;
  32696. }
  32697. }
  32698. <?php
  32699. namespace Symfony\Component\Console\Event;
  32700. use Symfony\Component\Console\Command\Command;
  32701. use Symfony\Component\Console\Input\InputInterface;
  32702. use Symfony\Component\Console\Output\OutputInterface;
  32703. use Symfony\Component\EventDispatcher\Event;
  32704. class ConsoleEvent extends Event
  32705. {
  32706. protected $command;
  32707. private $input;
  32708. private $output;
  32709. public function __construct(Command $command, InputInterface $input, OutputInterface $output)
  32710. {
  32711. $this->command = $command;
  32712. $this->input = $input;
  32713. $this->output = $output;
  32714. }
  32715. public function getCommand()
  32716. {
  32717. return $this->command;
  32718. }
  32719. public function getInput()
  32720. {
  32721. return $this->input;
  32722. }
  32723. public function getOutput()
  32724. {
  32725. return $this->output;
  32726. }
  32727. }
  32728. <?php
  32729. namespace Symfony\Component\Console\Event;
  32730. use Symfony\Component\Console\Command\Command;
  32731. use Symfony\Component\Console\Input\InputInterface;
  32732. use Symfony\Component\Console\Output\OutputInterface;
  32733. class ConsoleExceptionEvent extends ConsoleEvent
  32734. {
  32735. private $exception;
  32736. private $exitCode;
  32737. public function __construct(Command $command, InputInterface $input, OutputInterface $output, \Exception $exception, $exitCode)
  32738. {
  32739. parent::__construct($command, $input, $output);
  32740. $this->setException($exception);
  32741. $this->exitCode = (int) $exitCode;
  32742. }
  32743. public function getException()
  32744. {
  32745. return $this->exception;
  32746. }
  32747. public function setException(\Exception $exception)
  32748. {
  32749. $this->exception = $exception;
  32750. }
  32751. public function getExitCode()
  32752. {
  32753. return $this->exitCode;
  32754. }
  32755. }
  32756. <?php
  32757. namespace Symfony\Component\Console\Event;
  32758. use Symfony\Component\Console\Command\Command;
  32759. use Symfony\Component\Console\Input\InputInterface;
  32760. use Symfony\Component\Console\Output\OutputInterface;
  32761. class ConsoleTerminateEvent extends ConsoleEvent
  32762. {
  32763. private $exitCode;
  32764. public function __construct(Command $command, InputInterface $input, OutputInterface $output, $exitCode)
  32765. {
  32766. parent::__construct($command, $input, $output);
  32767. $this->setExitCode($exitCode);
  32768. }
  32769. public function setExitCode($exitCode)
  32770. {
  32771. $this->exitCode = (int) $exitCode;
  32772. }
  32773. public function getExitCode()
  32774. {
  32775. return $this->exitCode;
  32776. }
  32777. }
  32778. <?php
  32779. namespace Symfony\Component\Console\Exception;
  32780. class CommandNotFoundException extends \InvalidArgumentException implements ExceptionInterface
  32781. {
  32782. private $alternatives;
  32783. public function __construct($message, array $alternatives = array(), $code = 0, \Exception $previous = null)
  32784. {
  32785. parent::__construct($message, $code, $previous);
  32786. $this->alternatives = $alternatives;
  32787. }
  32788. public function getAlternatives()
  32789. {
  32790. return $this->alternatives;
  32791. }
  32792. }
  32793. <?php
  32794. namespace Symfony\Component\Console\Exception;
  32795. interface ExceptionInterface
  32796. {
  32797. }
  32798. <?php
  32799. namespace Symfony\Component\Console\Exception;
  32800. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  32801. {
  32802. }
  32803. <?php
  32804. namespace Symfony\Component\Console\Exception;
  32805. class InvalidOptionException extends \InvalidArgumentException implements ExceptionInterface
  32806. {
  32807. }
  32808. <?php
  32809. namespace Symfony\Component\Console\Exception;
  32810. class LogicException extends \LogicException implements ExceptionInterface
  32811. {
  32812. }
  32813. <?php
  32814. namespace Symfony\Component\Console\Exception;
  32815. class RuntimeException extends \RuntimeException implements ExceptionInterface
  32816. {
  32817. }
  32818. <?php
  32819. namespace Symfony\Component\Console\Formatter;
  32820. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32821. class OutputFormatter implements OutputFormatterInterface
  32822. {
  32823. private $decorated;
  32824. private $styles = array();
  32825. private $styleStack;
  32826. public static function escape($text)
  32827. {
  32828. $text = preg_replace('/([^\\\\]?)</', '$1\\<', $text);
  32829. return self::escapeTrailingBackslash($text);
  32830. }
  32831. public static function escapeTrailingBackslash($text)
  32832. {
  32833. if ('\\' === substr($text, -1)) {
  32834. $len = strlen($text);
  32835. $text = rtrim($text, '\\');
  32836. $text = str_replace("\0", '', $text);
  32837. $text .= str_repeat("\0", $len - strlen($text));
  32838. }
  32839. return $text;
  32840. }
  32841. public function __construct($decorated = false, array $styles = array())
  32842. {
  32843. $this->decorated = (bool) $decorated;
  32844. $this->setStyle('error', new OutputFormatterStyle('white', 'red'));
  32845. $this->setStyle('info', new OutputFormatterStyle('green'));
  32846. $this->setStyle('comment', new OutputFormatterStyle('yellow'));
  32847. $this->setStyle('question', new OutputFormatterStyle('black', 'cyan'));
  32848. foreach ($styles as $name => $style) {
  32849. $this->setStyle($name, $style);
  32850. }
  32851. $this->styleStack = new OutputFormatterStyleStack();
  32852. }
  32853. public function setDecorated($decorated)
  32854. {
  32855. $this->decorated = (bool) $decorated;
  32856. }
  32857. public function isDecorated()
  32858. {
  32859. return $this->decorated;
  32860. }
  32861. public function setStyle($name, OutputFormatterStyleInterface $style)
  32862. {
  32863. $this->styles[strtolower($name)] = $style;
  32864. }
  32865. public function hasStyle($name)
  32866. {
  32867. return isset($this->styles[strtolower($name)]);
  32868. }
  32869. public function getStyle($name)
  32870. {
  32871. if (!$this->hasStyle($name)) {
  32872. throw new InvalidArgumentException(sprintf('Undefined style: %s', $name));
  32873. }
  32874. return $this->styles[strtolower($name)];
  32875. }
  32876. public function format($message)
  32877. {
  32878. $message = (string) $message;
  32879. $offset = 0;
  32880. $output = '';
  32881. $tagRegex = '[a-z][a-z0-9_=;-]*+';
  32882. preg_match_all("#<(($tagRegex) | /($tagRegex)?)>#ix", $message, $matches, PREG_OFFSET_CAPTURE);
  32883. foreach ($matches[0] as $i => $match) {
  32884. $pos = $match[1];
  32885. $text = $match[0];
  32886. if (0 != $pos && '\\' == $message[$pos - 1]) {
  32887. continue;
  32888. }
  32889. $output .= $this->applyCurrentStyle(substr($message, $offset, $pos - $offset));
  32890. $offset = $pos + strlen($text);
  32891. if ($open = '/' != $text[1]) {
  32892. $tag = $matches[1][$i][0];
  32893. } else {
  32894. $tag = isset($matches[3][$i][0]) ? $matches[3][$i][0] : '';
  32895. }
  32896. if (!$open && !$tag) {
  32897. $this->styleStack->pop();
  32898. } elseif (false === $style = $this->createStyleFromString(strtolower($tag))) {
  32899. $output .= $this->applyCurrentStyle($text);
  32900. } elseif ($open) {
  32901. $this->styleStack->push($style);
  32902. } else {
  32903. $this->styleStack->pop($style);
  32904. }
  32905. }
  32906. $output .= $this->applyCurrentStyle(substr($message, $offset));
  32907. if (false !== strpos($output, "\0")) {
  32908. return strtr($output, array("\0" => '\\', '\\<' => '<'));
  32909. }
  32910. return str_replace('\\<', '<', $output);
  32911. }
  32912. public function getStyleStack()
  32913. {
  32914. return $this->styleStack;
  32915. }
  32916. private function createStyleFromString($string)
  32917. {
  32918. if (isset($this->styles[$string])) {
  32919. return $this->styles[$string];
  32920. }
  32921. if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', strtolower($string), $matches, PREG_SET_ORDER)) {
  32922. return false;
  32923. }
  32924. $style = new OutputFormatterStyle();
  32925. foreach ($matches as $match) {
  32926. array_shift($match);
  32927. if ('fg' == $match[0]) {
  32928. $style->setForeground($match[1]);
  32929. } elseif ('bg' == $match[0]) {
  32930. $style->setBackground($match[1]);
  32931. } else {
  32932. try {
  32933. $style->setOption($match[1]);
  32934. } catch (\InvalidArgumentException $e) {
  32935. return false;
  32936. }
  32937. }
  32938. }
  32939. return $style;
  32940. }
  32941. private function applyCurrentStyle($text)
  32942. {
  32943. return $this->isDecorated() && strlen($text) > 0 ? $this->styleStack->getCurrent()->apply($text) : $text;
  32944. }
  32945. }
  32946. <?php
  32947. namespace Symfony\Component\Console\Formatter;
  32948. interface OutputFormatterInterface
  32949. {
  32950. public function setDecorated($decorated);
  32951. public function isDecorated();
  32952. public function setStyle($name, OutputFormatterStyleInterface $style);
  32953. public function hasStyle($name);
  32954. public function getStyle($name);
  32955. public function format($message);
  32956. }
  32957. <?php
  32958. namespace Symfony\Component\Console\Formatter;
  32959. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32960. class OutputFormatterStyle implements OutputFormatterStyleInterface
  32961. {
  32962. private static $availableForegroundColors = array(
  32963. 'black' => array('set' => 30, 'unset' => 39),
  32964. 'red' => array('set' => 31, 'unset' => 39),
  32965. 'green' => array('set' => 32, 'unset' => 39),
  32966. 'yellow' => array('set' => 33, 'unset' => 39),
  32967. 'blue' => array('set' => 34, 'unset' => 39),
  32968. 'magenta' => array('set' => 35, 'unset' => 39),
  32969. 'cyan' => array('set' => 36, 'unset' => 39),
  32970. 'white' => array('set' => 37, 'unset' => 39),
  32971. 'default' => array('set' => 39, 'unset' => 39),
  32972. );
  32973. private static $availableBackgroundColors = array(
  32974. 'black' => array('set' => 40, 'unset' => 49),
  32975. 'red' => array('set' => 41, 'unset' => 49),
  32976. 'green' => array('set' => 42, 'unset' => 49),
  32977. 'yellow' => array('set' => 43, 'unset' => 49),
  32978. 'blue' => array('set' => 44, 'unset' => 49),
  32979. 'magenta' => array('set' => 45, 'unset' => 49),
  32980. 'cyan' => array('set' => 46, 'unset' => 49),
  32981. 'white' => array('set' => 47, 'unset' => 49),
  32982. 'default' => array('set' => 49, 'unset' => 49),
  32983. );
  32984. private static $availableOptions = array(
  32985. 'bold' => array('set' => 1, 'unset' => 22),
  32986. 'underscore' => array('set' => 4, 'unset' => 24),
  32987. 'blink' => array('set' => 5, 'unset' => 25),
  32988. 'reverse' => array('set' => 7, 'unset' => 27),
  32989. 'conceal' => array('set' => 8, 'unset' => 28),
  32990. );
  32991. private $foreground;
  32992. private $background;
  32993. private $options = array();
  32994. public function __construct($foreground = null, $background = null, array $options = array())
  32995. {
  32996. if (null !== $foreground) {
  32997. $this->setForeground($foreground);
  32998. }
  32999. if (null !== $background) {
  33000. $this->setBackground($background);
  33001. }
  33002. if (count($options)) {
  33003. $this->setOptions($options);
  33004. }
  33005. }
  33006. public function setForeground($color = null)
  33007. {
  33008. if (null === $color) {
  33009. $this->foreground = null;
  33010. return;
  33011. }
  33012. if (!isset(static::$availableForegroundColors[$color])) {
  33013. throw new InvalidArgumentException(sprintf(
  33014. 'Invalid foreground color specified: "%s". Expected one of (%s)',
  33015. $color,
  33016. implode(', ', array_keys(static::$availableForegroundColors))
  33017. ));
  33018. }
  33019. $this->foreground = static::$availableForegroundColors[$color];
  33020. }
  33021. public function setBackground($color = null)
  33022. {
  33023. if (null === $color) {
  33024. $this->background = null;
  33025. return;
  33026. }
  33027. if (!isset(static::$availableBackgroundColors[$color])) {
  33028. throw new InvalidArgumentException(sprintf(
  33029. 'Invalid background color specified: "%s". Expected one of (%s)',
  33030. $color,
  33031. implode(', ', array_keys(static::$availableBackgroundColors))
  33032. ));
  33033. }
  33034. $this->background = static::$availableBackgroundColors[$color];
  33035. }
  33036. public function setOption($option)
  33037. {
  33038. if (!isset(static::$availableOptions[$option])) {
  33039. throw new InvalidArgumentException(sprintf(
  33040. 'Invalid option specified: "%s". Expected one of (%s)',
  33041. $option,
  33042. implode(', ', array_keys(static::$availableOptions))
  33043. ));
  33044. }
  33045. if (!in_array(static::$availableOptions[$option], $this->options)) {
  33046. $this->options[] = static::$availableOptions[$option];
  33047. }
  33048. }
  33049. public function unsetOption($option)
  33050. {
  33051. if (!isset(static::$availableOptions[$option])) {
  33052. throw new InvalidArgumentException(sprintf(
  33053. 'Invalid option specified: "%s". Expected one of (%s)',
  33054. $option,
  33055. implode(', ', array_keys(static::$availableOptions))
  33056. ));
  33057. }
  33058. $pos = array_search(static::$availableOptions[$option], $this->options);
  33059. if (false !== $pos) {
  33060. unset($this->options[$pos]);
  33061. }
  33062. }
  33063. public function setOptions(array $options)
  33064. {
  33065. $this->options = array();
  33066. foreach ($options as $option) {
  33067. $this->setOption($option);
  33068. }
  33069. }
  33070. public function apply($text)
  33071. {
  33072. $setCodes = array();
  33073. $unsetCodes = array();
  33074. if (null !== $this->foreground) {
  33075. $setCodes[] = $this->foreground['set'];
  33076. $unsetCodes[] = $this->foreground['unset'];
  33077. }
  33078. if (null !== $this->background) {
  33079. $setCodes[] = $this->background['set'];
  33080. $unsetCodes[] = $this->background['unset'];
  33081. }
  33082. if (count($this->options)) {
  33083. foreach ($this->options as $option) {
  33084. $setCodes[] = $option['set'];
  33085. $unsetCodes[] = $option['unset'];
  33086. }
  33087. }
  33088. if (0 === count($setCodes)) {
  33089. return $text;
  33090. }
  33091. return sprintf("\033[%sm%s\033[%sm", implode(';', $setCodes), $text, implode(';', $unsetCodes));
  33092. }
  33093. }
  33094. <?php
  33095. namespace Symfony\Component\Console\Formatter;
  33096. interface OutputFormatterStyleInterface
  33097. {
  33098. public function setForeground($color = null);
  33099. public function setBackground($color = null);
  33100. public function setOption($option);
  33101. public function unsetOption($option);
  33102. public function setOptions(array $options);
  33103. public function apply($text);
  33104. }
  33105. <?php
  33106. namespace Symfony\Component\Console\Formatter;
  33107. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33108. class OutputFormatterStyleStack
  33109. {
  33110. private $styles;
  33111. private $emptyStyle;
  33112. public function __construct(OutputFormatterStyleInterface $emptyStyle = null)
  33113. {
  33114. $this->emptyStyle = $emptyStyle ?: new OutputFormatterStyle();
  33115. $this->reset();
  33116. }
  33117. public function reset()
  33118. {
  33119. $this->styles = array();
  33120. }
  33121. public function push(OutputFormatterStyleInterface $style)
  33122. {
  33123. $this->styles[] = $style;
  33124. }
  33125. public function pop(OutputFormatterStyleInterface $style = null)
  33126. {
  33127. if (empty($this->styles)) {
  33128. return $this->emptyStyle;
  33129. }
  33130. if (null === $style) {
  33131. return array_pop($this->styles);
  33132. }
  33133. foreach (array_reverse($this->styles, true) as $index => $stackedStyle) {
  33134. if ($style->apply('') === $stackedStyle->apply('')) {
  33135. $this->styles = array_slice($this->styles, 0, $index);
  33136. return $stackedStyle;
  33137. }
  33138. }
  33139. throw new InvalidArgumentException('Incorrectly nested style tag found.');
  33140. }
  33141. public function getCurrent()
  33142. {
  33143. if (empty($this->styles)) {
  33144. return $this->emptyStyle;
  33145. }
  33146. return $this->styles[count($this->styles) - 1];
  33147. }
  33148. public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle)
  33149. {
  33150. $this->emptyStyle = $emptyStyle;
  33151. return $this;
  33152. }
  33153. public function getEmptyStyle()
  33154. {
  33155. return $this->emptyStyle;
  33156. }
  33157. }
  33158. <?php
  33159. namespace Symfony\Component\Console\Helper;
  33160. class DebugFormatterHelper extends Helper
  33161. {
  33162. private $colors = array('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default');
  33163. private $started = array();
  33164. private $count = -1;
  33165. public function start($id, $message, $prefix = 'RUN')
  33166. {
  33167. $this->started[$id] = array('border' => ++$this->count % count($this->colors));
  33168. return sprintf("%s<bg=blue;fg=white> %s </> <fg=blue>%s</>\n", $this->getBorder($id), $prefix, $message);
  33169. }
  33170. public function progress($id, $buffer, $error = false, $prefix = 'OUT', $errorPrefix = 'ERR')
  33171. {
  33172. $message = '';
  33173. if ($error) {
  33174. if (isset($this->started[$id]['out'])) {
  33175. $message .= "\n";
  33176. unset($this->started[$id]['out']);
  33177. }
  33178. if (!isset($this->started[$id]['err'])) {
  33179. $message .= sprintf('%s<bg=red;fg=white> %s </> ', $this->getBorder($id), $errorPrefix);
  33180. $this->started[$id]['err'] = true;
  33181. }
  33182. $message .= str_replace("\n", sprintf("\n%s<bg=red;fg=white> %s </> ", $this->getBorder($id), $errorPrefix), $buffer);
  33183. } else {
  33184. if (isset($this->started[$id]['err'])) {
  33185. $message .= "\n";
  33186. unset($this->started[$id]['err']);
  33187. }
  33188. if (!isset($this->started[$id]['out'])) {
  33189. $message .= sprintf('%s<bg=green;fg=white> %s </> ', $this->getBorder($id), $prefix);
  33190. $this->started[$id]['out'] = true;
  33191. }
  33192. $message .= str_replace("\n", sprintf("\n%s<bg=green;fg=white> %s </> ", $this->getBorder($id), $prefix), $buffer);
  33193. }
  33194. return $message;
  33195. }
  33196. public function stop($id, $message, $successful, $prefix = 'RES')
  33197. {
  33198. $trailingEOL = isset($this->started[$id]['out']) || isset($this->started[$id]['err']) ? "\n" : '';
  33199. if ($successful) {
  33200. return sprintf("%s%s<bg=green;fg=white> %s </> <fg=green>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  33201. }
  33202. $message = sprintf("%s%s<bg=red;fg=white> %s </> <fg=red>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  33203. unset($this->started[$id]['out'], $this->started[$id]['err']);
  33204. return $message;
  33205. }
  33206. private function getBorder($id)
  33207. {
  33208. return sprintf('<bg=%s> </>', $this->colors[$this->started[$id]['border']]);
  33209. }
  33210. public function getName()
  33211. {
  33212. return 'debug_formatter';
  33213. }
  33214. }
  33215. <?php
  33216. namespace Symfony\Component\Console\Helper;
  33217. use Symfony\Component\Console\Descriptor\DescriptorInterface;
  33218. use Symfony\Component\Console\Descriptor\JsonDescriptor;
  33219. use Symfony\Component\Console\Descriptor\MarkdownDescriptor;
  33220. use Symfony\Component\Console\Descriptor\TextDescriptor;
  33221. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  33222. use Symfony\Component\Console\Output\OutputInterface;
  33223. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33224. class DescriptorHelper extends Helper
  33225. {
  33226. private $descriptors = array();
  33227. public function __construct()
  33228. {
  33229. $this
  33230. ->register('txt', new TextDescriptor())
  33231. ->register('xml', new XmlDescriptor())
  33232. ->register('json', new JsonDescriptor())
  33233. ->register('md', new MarkdownDescriptor())
  33234. ;
  33235. }
  33236. public function describe(OutputInterface $output, $object, array $options = array())
  33237. {
  33238. $options = array_merge(array(
  33239. 'raw_text' => false,
  33240. 'format' => 'txt',
  33241. ), $options);
  33242. if (!isset($this->descriptors[$options['format']])) {
  33243. throw new InvalidArgumentException(sprintf('Unsupported format "%s".', $options['format']));
  33244. }
  33245. $descriptor = $this->descriptors[$options['format']];
  33246. $descriptor->describe($output, $object, $options);
  33247. }
  33248. public function register($format, DescriptorInterface $descriptor)
  33249. {
  33250. $this->descriptors[$format] = $descriptor;
  33251. return $this;
  33252. }
  33253. public function getName()
  33254. {
  33255. return 'descriptor';
  33256. }
  33257. }
  33258. <?php
  33259. namespace Symfony\Component\Console\Helper;
  33260. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33261. use Symfony\Component\Console\Exception\RuntimeException;
  33262. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  33263. use Symfony\Component\Console\Output\OutputInterface;
  33264. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  33265. class DialogHelper extends InputAwareHelper
  33266. {
  33267. private $inputStream;
  33268. private static $shell;
  33269. private static $stty;
  33270. public function __construct($triggerDeprecationError = true)
  33271. {
  33272. if ($triggerDeprecationError) {
  33273. @trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED);
  33274. }
  33275. }
  33276. public function select(OutputInterface $output, $question, $choices, $default = null, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  33277. {
  33278. if ($output instanceof ConsoleOutputInterface) {
  33279. $output = $output->getErrorOutput();
  33280. }
  33281. $width = max(array_map('strlen', array_keys($choices)));
  33282. $messages = (array) $question;
  33283. foreach ($choices as $key => $value) {
  33284. $messages[] = sprintf(" [<info>%-{$width}s</info>] %s", $key, $value);
  33285. }
  33286. $output->writeln($messages);
  33287. $result = $this->askAndValidate($output, '> ', function ($picked) use ($choices, $errorMessage, $multiselect) {
  33288. $selectedChoices = str_replace(' ', '', $picked);
  33289. if ($multiselect) {
  33290. if (!preg_match('/^[a-zA-Z0-9_-]+(?:,[a-zA-Z0-9_-]+)*$/', $selectedChoices, $matches)) {
  33291. throw new InvalidArgumentException(sprintf($errorMessage, $picked));
  33292. }
  33293. $selectedChoices = explode(',', $selectedChoices);
  33294. } else {
  33295. $selectedChoices = array($picked);
  33296. }
  33297. $multiselectChoices = array();
  33298. foreach ($selectedChoices as $value) {
  33299. if (empty($choices[$value])) {
  33300. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  33301. }
  33302. $multiselectChoices[] = $value;
  33303. }
  33304. if ($multiselect) {
  33305. return $multiselectChoices;
  33306. }
  33307. return $picked;
  33308. }, $attempts, $default);
  33309. return $result;
  33310. }
  33311. public function ask(OutputInterface $output, $question, $default = null, array $autocomplete = null)
  33312. {
  33313. if ($this->input && !$this->input->isInteractive()) {
  33314. return $default;
  33315. }
  33316. if ($output instanceof ConsoleOutputInterface) {
  33317. $output = $output->getErrorOutput();
  33318. }
  33319. $output->write($question);
  33320. $inputStream = $this->inputStream ?: STDIN;
  33321. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  33322. $ret = fgets($inputStream, 4096);
  33323. if (false === $ret) {
  33324. throw new RuntimeException('Aborted');
  33325. }
  33326. $ret = trim($ret);
  33327. } else {
  33328. $ret = '';
  33329. $i = 0;
  33330. $ofs = -1;
  33331. $matches = $autocomplete;
  33332. $numMatches = count($matches);
  33333. $sttyMode = shell_exec('stty -g');
  33334. shell_exec('stty -icanon -echo');
  33335. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  33336. while (!feof($inputStream)) {
  33337. $c = fread($inputStream, 1);
  33338. if ("\177" === $c) {
  33339. if (0 === $numMatches && 0 !== $i) {
  33340. --$i;
  33341. $output->write("\033[1D");
  33342. }
  33343. if (0 === $i) {
  33344. $ofs = -1;
  33345. $matches = $autocomplete;
  33346. $numMatches = count($matches);
  33347. } else {
  33348. $numMatches = 0;
  33349. }
  33350. $ret = substr($ret, 0, $i);
  33351. } elseif ("\033" === $c) {
  33352. $c .= fread($inputStream, 2);
  33353. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  33354. if ('A' === $c[2] && -1 === $ofs) {
  33355. $ofs = 0;
  33356. }
  33357. if (0 === $numMatches) {
  33358. continue;
  33359. }
  33360. $ofs += ('A' === $c[2]) ? -1 : 1;
  33361. $ofs = ($numMatches + $ofs) % $numMatches;
  33362. }
  33363. } elseif (ord($c) < 32) {
  33364. if ("\t" === $c || "\n" === $c) {
  33365. if ($numMatches > 0 && -1 !== $ofs) {
  33366. $ret = $matches[$ofs];
  33367. $output->write(substr($ret, $i));
  33368. $i = strlen($ret);
  33369. }
  33370. if ("\n" === $c) {
  33371. $output->write($c);
  33372. break;
  33373. }
  33374. $numMatches = 0;
  33375. }
  33376. continue;
  33377. } else {
  33378. $output->write($c);
  33379. $ret .= $c;
  33380. ++$i;
  33381. $numMatches = 0;
  33382. $ofs = 0;
  33383. foreach ($autocomplete as $value) {
  33384. if (0 === strpos($value, $ret) && $i !== strlen($value)) {
  33385. $matches[$numMatches++] = $value;
  33386. }
  33387. }
  33388. }
  33389. $output->write("\033[K");
  33390. if ($numMatches > 0 && -1 !== $ofs) {
  33391. $output->write("\0337");
  33392. $output->write('<hl>'.substr($matches[$ofs], $i).'</hl>');
  33393. $output->write("\0338");
  33394. }
  33395. }
  33396. shell_exec(sprintf('stty %s', $sttyMode));
  33397. }
  33398. return strlen($ret) > 0 ? $ret : $default;
  33399. }
  33400. public function askConfirmation(OutputInterface $output, $question, $default = true)
  33401. {
  33402. $answer = 'z';
  33403. while ($answer && !in_array(strtolower($answer[0]), array('y', 'n'))) {
  33404. $answer = $this->ask($output, $question);
  33405. }
  33406. if (false === $default) {
  33407. return $answer && 'y' == strtolower($answer[0]);
  33408. }
  33409. return !$answer || 'y' == strtolower($answer[0]);
  33410. }
  33411. public function askHiddenResponse(OutputInterface $output, $question, $fallback = true)
  33412. {
  33413. if ($output instanceof ConsoleOutputInterface) {
  33414. $output = $output->getErrorOutput();
  33415. }
  33416. if ('\\' === DIRECTORY_SEPARATOR) {
  33417. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  33418. if ('phar:' === substr(__FILE__, 0, 5)) {
  33419. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  33420. copy($exe, $tmpExe);
  33421. $exe = $tmpExe;
  33422. }
  33423. $output->write($question);
  33424. $value = rtrim(shell_exec($exe));
  33425. $output->writeln('');
  33426. if (isset($tmpExe)) {
  33427. unlink($tmpExe);
  33428. }
  33429. return $value;
  33430. }
  33431. if ($this->hasSttyAvailable()) {
  33432. $output->write($question);
  33433. $sttyMode = shell_exec('stty -g');
  33434. shell_exec('stty -echo');
  33435. $value = fgets($this->inputStream ?: STDIN, 4096);
  33436. shell_exec(sprintf('stty %s', $sttyMode));
  33437. if (false === $value) {
  33438. throw new RuntimeException('Aborted');
  33439. }
  33440. $value = trim($value);
  33441. $output->writeln('');
  33442. return $value;
  33443. }
  33444. if (false !== $shell = $this->getShell()) {
  33445. $output->write($question);
  33446. $readCmd = 'csh' === $shell ? 'set mypassword = $<' : 'read -r mypassword';
  33447. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  33448. $value = rtrim(shell_exec($command));
  33449. $output->writeln('');
  33450. return $value;
  33451. }
  33452. if ($fallback) {
  33453. return $this->ask($output, $question);
  33454. }
  33455. throw new RuntimeException('Unable to hide the response');
  33456. }
  33457. public function askAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $default = null, array $autocomplete = null)
  33458. {
  33459. $that = $this;
  33460. $interviewer = function () use ($output, $question, $default, $autocomplete, $that) {
  33461. return $that->ask($output, $question, $default, $autocomplete);
  33462. };
  33463. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  33464. }
  33465. public function askHiddenResponseAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $fallback = true)
  33466. {
  33467. $that = $this;
  33468. $interviewer = function () use ($output, $question, $fallback, $that) {
  33469. return $that->askHiddenResponse($output, $question, $fallback);
  33470. };
  33471. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  33472. }
  33473. public function setInputStream($stream)
  33474. {
  33475. $this->inputStream = $stream;
  33476. }
  33477. public function getInputStream()
  33478. {
  33479. return $this->inputStream;
  33480. }
  33481. public function getName()
  33482. {
  33483. return 'dialog';
  33484. }
  33485. private function getShell()
  33486. {
  33487. if (null !== self::$shell) {
  33488. return self::$shell;
  33489. }
  33490. self::$shell = false;
  33491. if (file_exists('/usr/bin/env')) {
  33492. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  33493. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  33494. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  33495. self::$shell = $sh;
  33496. break;
  33497. }
  33498. }
  33499. }
  33500. return self::$shell;
  33501. }
  33502. private function hasSttyAvailable()
  33503. {
  33504. if (null !== self::$stty) {
  33505. return self::$stty;
  33506. }
  33507. exec('stty 2>&1', $output, $exitcode);
  33508. return self::$stty = 0 === $exitcode;
  33509. }
  33510. private function validateAttempts($interviewer, OutputInterface $output, $validator, $attempts)
  33511. {
  33512. if ($output instanceof ConsoleOutputInterface) {
  33513. $output = $output->getErrorOutput();
  33514. }
  33515. $e = null;
  33516. while (false === $attempts || $attempts--) {
  33517. if (null !== $e) {
  33518. $output->writeln($this->getHelperSet()->get('formatter')->formatBlock($e->getMessage(), 'error'));
  33519. }
  33520. try {
  33521. return call_user_func($validator, $interviewer());
  33522. } catch (\Exception $e) {
  33523. }
  33524. }
  33525. throw $e;
  33526. }
  33527. }
  33528. <?php
  33529. namespace Symfony\Component\Console\Helper;
  33530. use Symfony\Component\Console\Formatter\OutputFormatter;
  33531. class FormatterHelper extends Helper
  33532. {
  33533. public function formatSection($section, $message, $style = 'info')
  33534. {
  33535. return sprintf('<%s>[%s]</%s> %s', $style, $section, $style, $message);
  33536. }
  33537. public function formatBlock($messages, $style, $large = false)
  33538. {
  33539. if (!is_array($messages)) {
  33540. $messages = array($messages);
  33541. }
  33542. $len = 0;
  33543. $lines = array();
  33544. foreach ($messages as $message) {
  33545. $message = OutputFormatter::escape($message);
  33546. $lines[] = sprintf($large ? ' %s ' : ' %s ', $message);
  33547. $len = max($this->strlen($message) + ($large ? 4 : 2), $len);
  33548. }
  33549. $messages = $large ? array(str_repeat(' ', $len)) : array();
  33550. for ($i = 0; isset($lines[$i]); ++$i) {
  33551. $messages[] = $lines[$i].str_repeat(' ', $len - $this->strlen($lines[$i]));
  33552. }
  33553. if ($large) {
  33554. $messages[] = str_repeat(' ', $len);
  33555. }
  33556. for ($i = 0; isset($messages[$i]); ++$i) {
  33557. $messages[$i] = sprintf('<%s>%s</%s>', $style, $messages[$i], $style);
  33558. }
  33559. return implode("\n", $messages);
  33560. }
  33561. public function getName()
  33562. {
  33563. return 'formatter';
  33564. }
  33565. }
  33566. <?php
  33567. namespace Symfony\Component\Console\Helper;
  33568. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  33569. abstract class Helper implements HelperInterface
  33570. {
  33571. protected $helperSet = null;
  33572. public function setHelperSet(HelperSet $helperSet = null)
  33573. {
  33574. $this->helperSet = $helperSet;
  33575. }
  33576. public function getHelperSet()
  33577. {
  33578. return $this->helperSet;
  33579. }
  33580. public static function strlen($string)
  33581. {
  33582. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  33583. return strlen($string);
  33584. }
  33585. return mb_strwidth($string, $encoding);
  33586. }
  33587. public static function formatTime($secs)
  33588. {
  33589. static $timeFormats = array(
  33590. array(0, '< 1 sec'),
  33591. array(1, '1 sec'),
  33592. array(2, 'secs', 1),
  33593. array(60, '1 min'),
  33594. array(120, 'mins', 60),
  33595. array(3600, '1 hr'),
  33596. array(7200, 'hrs', 3600),
  33597. array(86400, '1 day'),
  33598. array(172800, 'days', 86400),
  33599. );
  33600. foreach ($timeFormats as $index => $format) {
  33601. if ($secs >= $format[0]) {
  33602. if ((isset($timeFormats[$index + 1]) && $secs < $timeFormats[$index + 1][0])
  33603. || $index == count($timeFormats) - 1
  33604. ) {
  33605. if (2 == count($format)) {
  33606. return $format[1];
  33607. }
  33608. return floor($secs / $format[2]).' '.$format[1];
  33609. }
  33610. }
  33611. }
  33612. }
  33613. public static function formatMemory($memory)
  33614. {
  33615. if ($memory >= 1024 * 1024 * 1024) {
  33616. return sprintf('%.1f GiB', $memory / 1024 / 1024 / 1024);
  33617. }
  33618. if ($memory >= 1024 * 1024) {
  33619. return sprintf('%.1f MiB', $memory / 1024 / 1024);
  33620. }
  33621. if ($memory >= 1024) {
  33622. return sprintf('%d KiB', $memory / 1024);
  33623. }
  33624. return sprintf('%d B', $memory);
  33625. }
  33626. public static function strlenWithoutDecoration(OutputFormatterInterface $formatter, $string)
  33627. {
  33628. return self::strlen(self::removeDecoration($formatter, $string));
  33629. }
  33630. public static function removeDecoration(OutputFormatterInterface $formatter, $string)
  33631. {
  33632. $isDecorated = $formatter->isDecorated();
  33633. $formatter->setDecorated(false);
  33634. $string = $formatter->format($string);
  33635. $string = preg_replace("/\033\[[^m]*m/", '', $string);
  33636. $formatter->setDecorated($isDecorated);
  33637. return $string;
  33638. }
  33639. }
  33640. <?php
  33641. namespace Symfony\Component\Console\Helper;
  33642. interface HelperInterface
  33643. {
  33644. public function setHelperSet(HelperSet $helperSet = null);
  33645. public function getHelperSet();
  33646. public function getName();
  33647. }
  33648. <?php
  33649. namespace Symfony\Component\Console\Helper;
  33650. use Symfony\Component\Console\Command\Command;
  33651. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33652. class HelperSet implements \IteratorAggregate
  33653. {
  33654. private $helpers = array();
  33655. private $command;
  33656. public function __construct(array $helpers = array())
  33657. {
  33658. foreach ($helpers as $alias => $helper) {
  33659. $this->set($helper, is_int($alias) ? null : $alias);
  33660. }
  33661. }
  33662. public function set(HelperInterface $helper, $alias = null)
  33663. {
  33664. $this->helpers[$helper->getName()] = $helper;
  33665. if (null !== $alias) {
  33666. $this->helpers[$alias] = $helper;
  33667. }
  33668. $helper->setHelperSet($this);
  33669. }
  33670. public function has($name)
  33671. {
  33672. return isset($this->helpers[$name]);
  33673. }
  33674. public function get($name)
  33675. {
  33676. if (!$this->has($name)) {
  33677. throw new InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name));
  33678. }
  33679. if ('dialog' === $name && $this->helpers[$name] instanceof DialogHelper) {
  33680. @trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED);
  33681. } elseif ('progress' === $name && $this->helpers[$name] instanceof ProgressHelper) {
  33682. @trigger_error('"Symfony\Component\Console\Helper\ProgressHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\ProgressBar" instead.', E_USER_DEPRECATED);
  33683. } elseif ('table' === $name && $this->helpers[$name] instanceof TableHelper) {
  33684. @trigger_error('"Symfony\Component\Console\Helper\TableHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\Table" instead.', E_USER_DEPRECATED);
  33685. }
  33686. return $this->helpers[$name];
  33687. }
  33688. public function setCommand(Command $command = null)
  33689. {
  33690. $this->command = $command;
  33691. }
  33692. public function getCommand()
  33693. {
  33694. return $this->command;
  33695. }
  33696. public function getIterator()
  33697. {
  33698. return new \ArrayIterator($this->helpers);
  33699. }
  33700. }
  33701. <?php
  33702. namespace Symfony\Component\Console\Helper;
  33703. use Symfony\Component\Console\Input\InputInterface;
  33704. use Symfony\Component\Console\Input\InputAwareInterface;
  33705. abstract class InputAwareHelper extends Helper implements InputAwareInterface
  33706. {
  33707. protected $input;
  33708. public function setInput(InputInterface $input)
  33709. {
  33710. $this->input = $input;
  33711. }
  33712. }
  33713. <?php
  33714. namespace Symfony\Component\Console\Helper;
  33715. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  33716. use Symfony\Component\Console\Output\OutputInterface;
  33717. use Symfony\Component\Process\Exception\ProcessFailedException;
  33718. use Symfony\Component\Process\Process;
  33719. use Symfony\Component\Process\ProcessBuilder;
  33720. class ProcessHelper extends Helper
  33721. {
  33722. public function run(OutputInterface $output, $cmd, $error = null, $callback = null, $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE)
  33723. {
  33724. if ($output instanceof ConsoleOutputInterface) {
  33725. $output = $output->getErrorOutput();
  33726. }
  33727. $formatter = $this->getHelperSet()->get('debug_formatter');
  33728. if (is_array($cmd)) {
  33729. $process = ProcessBuilder::create($cmd)->getProcess();
  33730. } elseif ($cmd instanceof Process) {
  33731. $process = $cmd;
  33732. } else {
  33733. $process = new Process($cmd);
  33734. }
  33735. if ($verbosity <= $output->getVerbosity()) {
  33736. $output->write($formatter->start(spl_object_hash($process), $this->escapeString($process->getCommandLine())));
  33737. }
  33738. if ($output->isDebug()) {
  33739. $callback = $this->wrapCallback($output, $process, $callback);
  33740. }
  33741. $process->run($callback);
  33742. if ($verbosity <= $output->getVerbosity()) {
  33743. $message = $process->isSuccessful() ? 'Command ran successfully' : sprintf('%s Command did not run successfully', $process->getExitCode());
  33744. $output->write($formatter->stop(spl_object_hash($process), $message, $process->isSuccessful()));
  33745. }
  33746. if (!$process->isSuccessful() && null !== $error) {
  33747. $output->writeln(sprintf('<error>%s</error>', $this->escapeString($error)));
  33748. }
  33749. return $process;
  33750. }
  33751. public function mustRun(OutputInterface $output, $cmd, $error = null, $callback = null)
  33752. {
  33753. $process = $this->run($output, $cmd, $error, $callback);
  33754. if (!$process->isSuccessful()) {
  33755. throw new ProcessFailedException($process);
  33756. }
  33757. return $process;
  33758. }
  33759. public function wrapCallback(OutputInterface $output, Process $process, $callback = null)
  33760. {
  33761. if ($output instanceof ConsoleOutputInterface) {
  33762. $output = $output->getErrorOutput();
  33763. }
  33764. $formatter = $this->getHelperSet()->get('debug_formatter');
  33765. $that = $this;
  33766. return function ($type, $buffer) use ($output, $process, $callback, $formatter, $that) {
  33767. $output->write($formatter->progress(spl_object_hash($process), $that->escapeString($buffer), Process::ERR === $type));
  33768. if (null !== $callback) {
  33769. call_user_func($callback, $type, $buffer);
  33770. }
  33771. };
  33772. }
  33773. public function escapeString($str)
  33774. {
  33775. return str_replace('<', '\\<', $str);
  33776. }
  33777. public function getName()
  33778. {
  33779. return 'process';
  33780. }
  33781. }
  33782. <?php
  33783. namespace Symfony\Component\Console\Helper;
  33784. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  33785. use Symfony\Component\Console\Output\OutputInterface;
  33786. use Symfony\Component\Console\Exception\LogicException;
  33787. class ProgressBar
  33788. {
  33789. private $barWidth = 28;
  33790. private $barChar;
  33791. private $emptyBarChar = '-';
  33792. private $progressChar = '>';
  33793. private $format;
  33794. private $internalFormat;
  33795. private $redrawFreq = 1;
  33796. private $output;
  33797. private $step = 0;
  33798. private $max;
  33799. private $startTime;
  33800. private $stepWidth;
  33801. private $percent = 0.0;
  33802. private $formatLineCount;
  33803. private $messages = array();
  33804. private $overwrite = true;
  33805. private $firstRun = true;
  33806. private static $formatters;
  33807. private static $formats;
  33808. public function __construct(OutputInterface $output, $max = 0)
  33809. {
  33810. if ($output instanceof ConsoleOutputInterface) {
  33811. $output = $output->getErrorOutput();
  33812. }
  33813. $this->output = $output;
  33814. $this->setMaxSteps($max);
  33815. if (!$this->output->isDecorated()) {
  33816. $this->overwrite = false;
  33817. $this->setRedrawFrequency($max / 10);
  33818. }
  33819. $this->startTime = time();
  33820. }
  33821. public static function setPlaceholderFormatterDefinition($name, $callable)
  33822. {
  33823. if (!self::$formatters) {
  33824. self::$formatters = self::initPlaceholderFormatters();
  33825. }
  33826. self::$formatters[$name] = $callable;
  33827. }
  33828. public static function getPlaceholderFormatterDefinition($name)
  33829. {
  33830. if (!self::$formatters) {
  33831. self::$formatters = self::initPlaceholderFormatters();
  33832. }
  33833. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  33834. }
  33835. public static function setFormatDefinition($name, $format)
  33836. {
  33837. if (!self::$formats) {
  33838. self::$formats = self::initFormats();
  33839. }
  33840. self::$formats[$name] = $format;
  33841. }
  33842. public static function getFormatDefinition($name)
  33843. {
  33844. if (!self::$formats) {
  33845. self::$formats = self::initFormats();
  33846. }
  33847. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  33848. }
  33849. public function setMessage($message, $name = 'message')
  33850. {
  33851. $this->messages[$name] = $message;
  33852. }
  33853. public function getMessage($name = 'message')
  33854. {
  33855. return $this->messages[$name];
  33856. }
  33857. public function getStartTime()
  33858. {
  33859. return $this->startTime;
  33860. }
  33861. public function getMaxSteps()
  33862. {
  33863. return $this->max;
  33864. }
  33865. public function getStep()
  33866. {
  33867. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the getProgress() method instead.', E_USER_DEPRECATED);
  33868. return $this->getProgress();
  33869. }
  33870. public function getProgress()
  33871. {
  33872. return $this->step;
  33873. }
  33874. public function getStepWidth()
  33875. {
  33876. return $this->stepWidth;
  33877. }
  33878. public function getProgressPercent()
  33879. {
  33880. return $this->percent;
  33881. }
  33882. public function setBarWidth($size)
  33883. {
  33884. $this->barWidth = (int) $size;
  33885. }
  33886. public function getBarWidth()
  33887. {
  33888. return $this->barWidth;
  33889. }
  33890. public function setBarCharacter($char)
  33891. {
  33892. $this->barChar = $char;
  33893. }
  33894. public function getBarCharacter()
  33895. {
  33896. if (null === $this->barChar) {
  33897. return $this->max ? '=' : $this->emptyBarChar;
  33898. }
  33899. return $this->barChar;
  33900. }
  33901. public function setEmptyBarCharacter($char)
  33902. {
  33903. $this->emptyBarChar = $char;
  33904. }
  33905. public function getEmptyBarCharacter()
  33906. {
  33907. return $this->emptyBarChar;
  33908. }
  33909. public function setProgressCharacter($char)
  33910. {
  33911. $this->progressChar = $char;
  33912. }
  33913. public function getProgressCharacter()
  33914. {
  33915. return $this->progressChar;
  33916. }
  33917. public function setFormat($format)
  33918. {
  33919. $this->format = null;
  33920. $this->internalFormat = $format;
  33921. }
  33922. public function setRedrawFrequency($freq)
  33923. {
  33924. $this->redrawFreq = max((int) $freq, 1);
  33925. }
  33926. public function start($max = null)
  33927. {
  33928. $this->startTime = time();
  33929. $this->step = 0;
  33930. $this->percent = 0.0;
  33931. if (null !== $max) {
  33932. $this->setMaxSteps($max);
  33933. }
  33934. $this->display();
  33935. }
  33936. public function advance($step = 1)
  33937. {
  33938. $this->setProgress($this->step + $step);
  33939. }
  33940. public function setCurrent($step)
  33941. {
  33942. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the setProgress() method instead.', E_USER_DEPRECATED);
  33943. $this->setProgress($step);
  33944. }
  33945. public function setOverwrite($overwrite)
  33946. {
  33947. $this->overwrite = (bool) $overwrite;
  33948. }
  33949. public function setProgress($step)
  33950. {
  33951. $step = (int) $step;
  33952. if ($step < $this->step) {
  33953. throw new LogicException('You can\'t regress the progress bar.');
  33954. }
  33955. if ($this->max && $step > $this->max) {
  33956. $this->max = $step;
  33957. }
  33958. $prevPeriod = (int) ($this->step / $this->redrawFreq);
  33959. $currPeriod = (int) ($step / $this->redrawFreq);
  33960. $this->step = $step;
  33961. $this->percent = $this->max ? (float) $this->step / $this->max : 0;
  33962. if ($prevPeriod !== $currPeriod || $this->max === $step) {
  33963. $this->display();
  33964. }
  33965. }
  33966. public function finish()
  33967. {
  33968. if (!$this->max) {
  33969. $this->max = $this->step;
  33970. }
  33971. if ($this->step === $this->max && !$this->overwrite) {
  33972. return;
  33973. }
  33974. $this->setProgress($this->max);
  33975. }
  33976. public function display()
  33977. {
  33978. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  33979. return;
  33980. }
  33981. if (null === $this->format) {
  33982. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  33983. }
  33984. $self = $this;
  33985. $output = $this->output;
  33986. $messages = $this->messages;
  33987. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self, $output, $messages) {
  33988. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  33989. $text = call_user_func($formatter, $self, $output);
  33990. } elseif (isset($messages[$matches[1]])) {
  33991. $text = $messages[$matches[1]];
  33992. } else {
  33993. return $matches[0];
  33994. }
  33995. if (isset($matches[2])) {
  33996. $text = sprintf('%'.$matches[2], $text);
  33997. }
  33998. return $text;
  33999. }, $this->format));
  34000. }
  34001. public function clear()
  34002. {
  34003. if (!$this->overwrite) {
  34004. return;
  34005. }
  34006. if (null === $this->format) {
  34007. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  34008. }
  34009. $this->overwrite('');
  34010. }
  34011. private function setRealFormat($format)
  34012. {
  34013. if (!$this->max && null !== self::getFormatDefinition($format.'_nomax')) {
  34014. $this->format = self::getFormatDefinition($format.'_nomax');
  34015. } elseif (null !== self::getFormatDefinition($format)) {
  34016. $this->format = self::getFormatDefinition($format);
  34017. } else {
  34018. $this->format = $format;
  34019. }
  34020. $this->formatLineCount = substr_count($this->format, "\n");
  34021. }
  34022. private function setMaxSteps($max)
  34023. {
  34024. $this->max = max(0, (int) $max);
  34025. $this->stepWidth = $this->max ? Helper::strlen($this->max) : 4;
  34026. }
  34027. private function overwrite($message)
  34028. {
  34029. if ($this->overwrite) {
  34030. if (!$this->firstRun) {
  34031. $this->output->write("\x0D");
  34032. $this->output->write("\x1B[2K");
  34033. if ($this->formatLineCount > 0) {
  34034. $this->output->write(str_repeat("\x1B[1A\x1B[2K", $this->formatLineCount));
  34035. }
  34036. }
  34037. } elseif ($this->step > 0) {
  34038. $this->output->writeln('');
  34039. }
  34040. $this->firstRun = false;
  34041. $this->output->write($message);
  34042. }
  34043. private function determineBestFormat()
  34044. {
  34045. switch ($this->output->getVerbosity()) {
  34046. case OutputInterface::VERBOSITY_VERBOSE:
  34047. return $this->max ? 'verbose' : 'verbose_nomax';
  34048. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  34049. return $this->max ? 'very_verbose' : 'very_verbose_nomax';
  34050. case OutputInterface::VERBOSITY_DEBUG:
  34051. return $this->max ? 'debug' : 'debug_nomax';
  34052. default:
  34053. return $this->max ? 'normal' : 'normal_nomax';
  34054. }
  34055. }
  34056. private static function initPlaceholderFormatters()
  34057. {
  34058. return array(
  34059. 'bar' => function (ProgressBar $bar, OutputInterface $output) {
  34060. $completeBars = floor($bar->getMaxSteps() > 0 ? $bar->getProgressPercent() * $bar->getBarWidth() : $bar->getProgress() % $bar->getBarWidth());
  34061. $display = str_repeat($bar->getBarCharacter(), $completeBars);
  34062. if ($completeBars < $bar->getBarWidth()) {
  34063. $emptyBars = $bar->getBarWidth() - $completeBars - Helper::strlenWithoutDecoration($output->getFormatter(), $bar->getProgressCharacter());
  34064. $display .= $bar->getProgressCharacter().str_repeat($bar->getEmptyBarCharacter(), $emptyBars);
  34065. }
  34066. return $display;
  34067. },
  34068. 'elapsed' => function (ProgressBar $bar) {
  34069. return Helper::formatTime(time() - $bar->getStartTime());
  34070. },
  34071. 'remaining' => function (ProgressBar $bar) {
  34072. if (!$bar->getMaxSteps()) {
  34073. throw new LogicException('Unable to display the remaining time if the maximum number of steps is not set.');
  34074. }
  34075. if (!$bar->getProgress()) {
  34076. $remaining = 0;
  34077. } else {
  34078. $remaining = round((time() - $bar->getStartTime()) / $bar->getProgress() * ($bar->getMaxSteps() - $bar->getProgress()));
  34079. }
  34080. return Helper::formatTime($remaining);
  34081. },
  34082. 'estimated' => function (ProgressBar $bar) {
  34083. if (!$bar->getMaxSteps()) {
  34084. throw new LogicException('Unable to display the estimated time if the maximum number of steps is not set.');
  34085. }
  34086. if (!$bar->getProgress()) {
  34087. $estimated = 0;
  34088. } else {
  34089. $estimated = round((time() - $bar->getStartTime()) / $bar->getProgress() * $bar->getMaxSteps());
  34090. }
  34091. return Helper::formatTime($estimated);
  34092. },
  34093. 'memory' => function (ProgressBar $bar) {
  34094. return Helper::formatMemory(memory_get_usage(true));
  34095. },
  34096. 'current' => function (ProgressBar $bar) {
  34097. return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', STR_PAD_LEFT);
  34098. },
  34099. 'max' => function (ProgressBar $bar) {
  34100. return $bar->getMaxSteps();
  34101. },
  34102. 'percent' => function (ProgressBar $bar) {
  34103. return floor($bar->getProgressPercent() * 100);
  34104. },
  34105. );
  34106. }
  34107. private static function initFormats()
  34108. {
  34109. return array(
  34110. 'normal' => ' %current%/%max% [%bar%] %percent:3s%%',
  34111. 'normal_nomax' => ' %current% [%bar%]',
  34112. 'verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%',
  34113. 'verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  34114. 'very_verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s%',
  34115. 'very_verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  34116. 'debug' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%',
  34117. 'debug_nomax' => ' %current% [%bar%] %elapsed:6s% %memory:6s%',
  34118. );
  34119. }
  34120. }
  34121. <?php
  34122. namespace Symfony\Component\Console\Helper;
  34123. use Symfony\Component\Console\Output\NullOutput;
  34124. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  34125. use Symfony\Component\Console\Output\OutputInterface;
  34126. use Symfony\Component\Console\Exception\LogicException;
  34127. class ProgressHelper extends Helper
  34128. {
  34129. const FORMAT_QUIET = ' %percent%%';
  34130. const FORMAT_NORMAL = ' %current%/%max% [%bar%] %percent%%';
  34131. const FORMAT_VERBOSE = ' %current%/%max% [%bar%] %percent%% Elapsed: %elapsed%';
  34132. const FORMAT_QUIET_NOMAX = ' %current%';
  34133. const FORMAT_NORMAL_NOMAX = ' %current% [%bar%]';
  34134. const FORMAT_VERBOSE_NOMAX = ' %current% [%bar%] Elapsed: %elapsed%';
  34135. private $barWidth = 28;
  34136. private $barChar = '=';
  34137. private $emptyBarChar = '-';
  34138. private $progressChar = '>';
  34139. private $format = null;
  34140. private $redrawFreq = 1;
  34141. private $lastMessagesLength;
  34142. private $barCharOriginal;
  34143. private $output;
  34144. private $current;
  34145. private $max;
  34146. private $startTime;
  34147. private $defaultFormatVars = array(
  34148. 'current',
  34149. 'max',
  34150. 'bar',
  34151. 'percent',
  34152. 'elapsed',
  34153. );
  34154. private $formatVars;
  34155. private $widths = array(
  34156. 'current' => 4,
  34157. 'max' => 4,
  34158. 'percent' => 3,
  34159. 'elapsed' => 6,
  34160. );
  34161. private $timeFormats = array(
  34162. array(0, '???'),
  34163. array(2, '1 sec'),
  34164. array(59, 'secs', 1),
  34165. array(60, '1 min'),
  34166. array(3600, 'mins', 60),
  34167. array(5400, '1 hr'),
  34168. array(86400, 'hrs', 3600),
  34169. array(129600, '1 day'),
  34170. array(604800, 'days', 86400),
  34171. );
  34172. public function __construct($triggerDeprecationError = true)
  34173. {
  34174. if ($triggerDeprecationError) {
  34175. @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\ProgressBar class instead.', E_USER_DEPRECATED);
  34176. }
  34177. }
  34178. public function setBarWidth($size)
  34179. {
  34180. $this->barWidth = (int) $size;
  34181. }
  34182. public function setBarCharacter($char)
  34183. {
  34184. $this->barChar = $char;
  34185. }
  34186. public function setEmptyBarCharacter($char)
  34187. {
  34188. $this->emptyBarChar = $char;
  34189. }
  34190. public function setProgressCharacter($char)
  34191. {
  34192. $this->progressChar = $char;
  34193. }
  34194. public function setFormat($format)
  34195. {
  34196. $this->format = $format;
  34197. }
  34198. public function setRedrawFrequency($freq)
  34199. {
  34200. $this->redrawFreq = (int) $freq;
  34201. }
  34202. public function start(OutputInterface $output, $max = null)
  34203. {
  34204. if ($output instanceof ConsoleOutputInterface) {
  34205. $output = $output->getErrorOutput();
  34206. }
  34207. $this->startTime = time();
  34208. $this->current = 0;
  34209. $this->max = (int) $max;
  34210. $this->output = $output->isDecorated() ? $output : new NullOutput();
  34211. $this->lastMessagesLength = 0;
  34212. $this->barCharOriginal = '';
  34213. if (null === $this->format) {
  34214. switch ($output->getVerbosity()) {
  34215. case OutputInterface::VERBOSITY_QUIET:
  34216. $this->format = self::FORMAT_QUIET_NOMAX;
  34217. if ($this->max > 0) {
  34218. $this->format = self::FORMAT_QUIET;
  34219. }
  34220. break;
  34221. case OutputInterface::VERBOSITY_VERBOSE:
  34222. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  34223. case OutputInterface::VERBOSITY_DEBUG:
  34224. $this->format = self::FORMAT_VERBOSE_NOMAX;
  34225. if ($this->max > 0) {
  34226. $this->format = self::FORMAT_VERBOSE;
  34227. }
  34228. break;
  34229. default:
  34230. $this->format = self::FORMAT_NORMAL_NOMAX;
  34231. if ($this->max > 0) {
  34232. $this->format = self::FORMAT_NORMAL;
  34233. }
  34234. break;
  34235. }
  34236. }
  34237. $this->initialize();
  34238. }
  34239. public function advance($step = 1, $redraw = false)
  34240. {
  34241. $this->setCurrent($this->current + $step, $redraw);
  34242. }
  34243. public function setCurrent($current, $redraw = false)
  34244. {
  34245. if (null === $this->startTime) {
  34246. throw new LogicException('You must start the progress bar before calling setCurrent().');
  34247. }
  34248. $current = (int) $current;
  34249. if ($current < $this->current) {
  34250. throw new LogicException('You can\'t regress the progress bar');
  34251. }
  34252. if (0 === $this->current) {
  34253. $redraw = true;
  34254. }
  34255. $prevPeriod = (int) ($this->current / $this->redrawFreq);
  34256. $this->current = $current;
  34257. $currPeriod = (int) ($this->current / $this->redrawFreq);
  34258. if ($redraw || $prevPeriod !== $currPeriod || $this->max === $this->current) {
  34259. $this->display();
  34260. }
  34261. }
  34262. public function display($finish = false)
  34263. {
  34264. if (null === $this->startTime) {
  34265. throw new LogicException('You must start the progress bar before calling display().');
  34266. }
  34267. $message = $this->format;
  34268. foreach ($this->generate($finish) as $name => $value) {
  34269. $message = str_replace("%{$name}%", $value, $message);
  34270. }
  34271. $this->overwrite($this->output, $message);
  34272. }
  34273. public function clear()
  34274. {
  34275. $this->overwrite($this->output, '');
  34276. }
  34277. public function finish()
  34278. {
  34279. if (null === $this->startTime) {
  34280. throw new LogicException('You must start the progress bar before calling finish().');
  34281. }
  34282. if (null !== $this->startTime) {
  34283. if (!$this->max) {
  34284. $this->barChar = $this->barCharOriginal;
  34285. $this->display(true);
  34286. }
  34287. $this->startTime = null;
  34288. $this->output->writeln('');
  34289. $this->output = null;
  34290. }
  34291. }
  34292. private function initialize()
  34293. {
  34294. $this->formatVars = array();
  34295. foreach ($this->defaultFormatVars as $var) {
  34296. if (false !== strpos($this->format, "%{$var}%")) {
  34297. $this->formatVars[$var] = true;
  34298. }
  34299. }
  34300. if ($this->max > 0) {
  34301. $this->widths['max'] = $this->strlen($this->max);
  34302. $this->widths['current'] = $this->widths['max'];
  34303. } else {
  34304. $this->barCharOriginal = $this->barChar;
  34305. $this->barChar = $this->emptyBarChar;
  34306. }
  34307. }
  34308. private function generate($finish = false)
  34309. {
  34310. $vars = array();
  34311. $percent = 0;
  34312. if ($this->max > 0) {
  34313. $percent = (float) $this->current / $this->max;
  34314. }
  34315. if (isset($this->formatVars['bar'])) {
  34316. if ($this->max > 0) {
  34317. $completeBars = floor($percent * $this->barWidth);
  34318. } else {
  34319. if (!$finish) {
  34320. $completeBars = floor($this->current % $this->barWidth);
  34321. } else {
  34322. $completeBars = $this->barWidth;
  34323. }
  34324. }
  34325. $emptyBars = $this->barWidth - $completeBars - $this->strlen($this->progressChar);
  34326. $bar = str_repeat($this->barChar, $completeBars);
  34327. if ($completeBars < $this->barWidth) {
  34328. $bar .= $this->progressChar;
  34329. $bar .= str_repeat($this->emptyBarChar, $emptyBars);
  34330. }
  34331. $vars['bar'] = $bar;
  34332. }
  34333. if (isset($this->formatVars['elapsed'])) {
  34334. $elapsed = time() - $this->startTime;
  34335. $vars['elapsed'] = str_pad($this->humaneTime($elapsed), $this->widths['elapsed'], ' ', STR_PAD_LEFT);
  34336. }
  34337. if (isset($this->formatVars['current'])) {
  34338. $vars['current'] = str_pad($this->current, $this->widths['current'], ' ', STR_PAD_LEFT);
  34339. }
  34340. if (isset($this->formatVars['max'])) {
  34341. $vars['max'] = $this->max;
  34342. }
  34343. if (isset($this->formatVars['percent'])) {
  34344. $vars['percent'] = str_pad(floor($percent * 100), $this->widths['percent'], ' ', STR_PAD_LEFT);
  34345. }
  34346. return $vars;
  34347. }
  34348. private function humaneTime($secs)
  34349. {
  34350. $text = '';
  34351. foreach ($this->timeFormats as $format) {
  34352. if ($secs < $format[0]) {
  34353. if (2 == count($format)) {
  34354. $text = $format[1];
  34355. break;
  34356. } else {
  34357. $text = ceil($secs / $format[2]).' '.$format[1];
  34358. break;
  34359. }
  34360. }
  34361. }
  34362. return $text;
  34363. }
  34364. private function overwrite(OutputInterface $output, $message)
  34365. {
  34366. $length = $this->strlen($message);
  34367. if (null !== $this->lastMessagesLength && $this->lastMessagesLength > $length) {
  34368. $message = str_pad($message, $this->lastMessagesLength, "\x20", STR_PAD_RIGHT);
  34369. }
  34370. $output->write("\x0D");
  34371. $output->write($message);
  34372. $this->lastMessagesLength = $this->strlen($message);
  34373. }
  34374. public function getName()
  34375. {
  34376. return 'progress';
  34377. }
  34378. }
  34379. <?php
  34380. namespace Symfony\Component\Console\Helper;
  34381. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34382. use Symfony\Component\Console\Exception\LogicException;
  34383. use Symfony\Component\Console\Output\OutputInterface;
  34384. class ProgressIndicator
  34385. {
  34386. private $output;
  34387. private $startTime;
  34388. private $format;
  34389. private $message;
  34390. private $indicatorValues;
  34391. private $indicatorCurrent;
  34392. private $indicatorChangeInterval;
  34393. private $indicatorUpdateTime;
  34394. private $started = false;
  34395. private static $formatters;
  34396. private static $formats;
  34397. public function __construct(OutputInterface $output, $format = null, $indicatorChangeInterval = 100, $indicatorValues = null)
  34398. {
  34399. $this->output = $output;
  34400. if (null === $format) {
  34401. $format = $this->determineBestFormat();
  34402. }
  34403. if (null === $indicatorValues) {
  34404. $indicatorValues = array('-', '\\', '|', '/');
  34405. }
  34406. $indicatorValues = array_values($indicatorValues);
  34407. if (2 > count($indicatorValues)) {
  34408. throw new InvalidArgumentException('Must have at least 2 indicator value characters.');
  34409. }
  34410. $this->format = self::getFormatDefinition($format);
  34411. $this->indicatorChangeInterval = $indicatorChangeInterval;
  34412. $this->indicatorValues = $indicatorValues;
  34413. $this->startTime = time();
  34414. }
  34415. public function setMessage($message)
  34416. {
  34417. $this->message = $message;
  34418. $this->display();
  34419. }
  34420. public function getMessage()
  34421. {
  34422. return $this->message;
  34423. }
  34424. public function getStartTime()
  34425. {
  34426. return $this->startTime;
  34427. }
  34428. public function getCurrentValue()
  34429. {
  34430. return $this->indicatorValues[$this->indicatorCurrent % count($this->indicatorValues)];
  34431. }
  34432. public function start($message)
  34433. {
  34434. if ($this->started) {
  34435. throw new LogicException('Progress indicator already started.');
  34436. }
  34437. $this->message = $message;
  34438. $this->started = true;
  34439. $this->startTime = time();
  34440. $this->indicatorUpdateTime = $this->getCurrentTimeInMilliseconds() + $this->indicatorChangeInterval;
  34441. $this->indicatorCurrent = 0;
  34442. $this->display();
  34443. }
  34444. public function advance()
  34445. {
  34446. if (!$this->started) {
  34447. throw new LogicException('Progress indicator has not yet been started.');
  34448. }
  34449. if (!$this->output->isDecorated()) {
  34450. return;
  34451. }
  34452. $currentTime = $this->getCurrentTimeInMilliseconds();
  34453. if ($currentTime < $this->indicatorUpdateTime) {
  34454. return;
  34455. }
  34456. $this->indicatorUpdateTime = $currentTime + $this->indicatorChangeInterval;
  34457. ++$this->indicatorCurrent;
  34458. $this->display();
  34459. }
  34460. public function finish($message)
  34461. {
  34462. if (!$this->started) {
  34463. throw new LogicException('Progress indicator has not yet been started.');
  34464. }
  34465. $this->message = $message;
  34466. $this->display();
  34467. $this->output->writeln('');
  34468. $this->started = false;
  34469. }
  34470. public static function getFormatDefinition($name)
  34471. {
  34472. if (!self::$formats) {
  34473. self::$formats = self::initFormats();
  34474. }
  34475. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  34476. }
  34477. public static function setPlaceholderFormatterDefinition($name, $callable)
  34478. {
  34479. if (!self::$formatters) {
  34480. self::$formatters = self::initPlaceholderFormatters();
  34481. }
  34482. self::$formatters[$name] = $callable;
  34483. }
  34484. public static function getPlaceholderFormatterDefinition($name)
  34485. {
  34486. if (!self::$formatters) {
  34487. self::$formatters = self::initPlaceholderFormatters();
  34488. }
  34489. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  34490. }
  34491. private function display()
  34492. {
  34493. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  34494. return;
  34495. }
  34496. $self = $this;
  34497. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self) {
  34498. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  34499. return call_user_func($formatter, $self);
  34500. }
  34501. return $matches[0];
  34502. }, $this->format));
  34503. }
  34504. private function determineBestFormat()
  34505. {
  34506. switch ($this->output->getVerbosity()) {
  34507. case OutputInterface::VERBOSITY_VERBOSE:
  34508. return $this->output->isDecorated() ? 'verbose' : 'verbose_no_ansi';
  34509. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  34510. case OutputInterface::VERBOSITY_DEBUG:
  34511. return $this->output->isDecorated() ? 'very_verbose' : 'very_verbose_no_ansi';
  34512. default:
  34513. return $this->output->isDecorated() ? 'normal' : 'normal_no_ansi';
  34514. }
  34515. }
  34516. private function overwrite($message)
  34517. {
  34518. if ($this->output->isDecorated()) {
  34519. $this->output->write("\x0D\x1B[2K");
  34520. $this->output->write($message);
  34521. } else {
  34522. $this->output->writeln($message);
  34523. }
  34524. }
  34525. private function getCurrentTimeInMilliseconds()
  34526. {
  34527. return round(microtime(true) * 1000);
  34528. }
  34529. private static function initPlaceholderFormatters()
  34530. {
  34531. return array(
  34532. 'indicator' => function (ProgressIndicator $indicator) {
  34533. return $indicator->getCurrentValue();
  34534. },
  34535. 'message' => function (ProgressIndicator $indicator) {
  34536. return $indicator->getMessage();
  34537. },
  34538. 'elapsed' => function (ProgressIndicator $indicator) {
  34539. return Helper::formatTime(time() - $indicator->getStartTime());
  34540. },
  34541. 'memory' => function () {
  34542. return Helper::formatMemory(memory_get_usage(true));
  34543. },
  34544. );
  34545. }
  34546. private static function initFormats()
  34547. {
  34548. return array(
  34549. 'normal' => ' %indicator% %message%',
  34550. 'normal_no_ansi' => ' %message%',
  34551. 'verbose' => ' %indicator% %message% (%elapsed:6s%)',
  34552. 'verbose_no_ansi' => ' %message% (%elapsed:6s%)',
  34553. 'very_verbose' => ' %indicator% %message% (%elapsed:6s%, %memory:6s%)',
  34554. 'very_verbose_no_ansi' => ' %message% (%elapsed:6s%, %memory:6s%)',
  34555. );
  34556. }
  34557. }
  34558. <?php
  34559. namespace Symfony\Component\Console\Helper;
  34560. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34561. use Symfony\Component\Console\Exception\RuntimeException;
  34562. use Symfony\Component\Console\Formatter\OutputFormatter;
  34563. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  34564. use Symfony\Component\Console\Input\InputInterface;
  34565. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  34566. use Symfony\Component\Console\Output\OutputInterface;
  34567. use Symfony\Component\Console\Question\Question;
  34568. use Symfony\Component\Console\Question\ChoiceQuestion;
  34569. class QuestionHelper extends Helper
  34570. {
  34571. private $inputStream;
  34572. private static $shell;
  34573. private static $stty;
  34574. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  34575. {
  34576. if ($output instanceof ConsoleOutputInterface) {
  34577. $output = $output->getErrorOutput();
  34578. }
  34579. if (!$input->isInteractive()) {
  34580. if ($question instanceof ChoiceQuestion) {
  34581. $choices = $question->getChoices();
  34582. return $choices[$question->getDefault()];
  34583. }
  34584. return $question->getDefault();
  34585. }
  34586. if (!$question->getValidator()) {
  34587. return $this->doAsk($output, $question);
  34588. }
  34589. $that = $this;
  34590. $interviewer = function () use ($output, $question, $that) {
  34591. return $that->doAsk($output, $question);
  34592. };
  34593. return $this->validateAttempts($interviewer, $output, $question);
  34594. }
  34595. public function setInputStream($stream)
  34596. {
  34597. if (!is_resource($stream)) {
  34598. throw new InvalidArgumentException('Input stream must be a valid resource.');
  34599. }
  34600. $this->inputStream = $stream;
  34601. }
  34602. public function getInputStream()
  34603. {
  34604. return $this->inputStream;
  34605. }
  34606. public function getName()
  34607. {
  34608. return 'question';
  34609. }
  34610. public function doAsk(OutputInterface $output, Question $question)
  34611. {
  34612. $this->writePrompt($output, $question);
  34613. $inputStream = $this->inputStream ?: STDIN;
  34614. $autocomplete = $question->getAutocompleterValues();
  34615. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  34616. $ret = false;
  34617. if ($question->isHidden()) {
  34618. try {
  34619. $ret = trim($this->getHiddenResponse($output, $inputStream));
  34620. } catch (RuntimeException $e) {
  34621. if (!$question->isHiddenFallback()) {
  34622. throw $e;
  34623. }
  34624. }
  34625. }
  34626. if (false === $ret) {
  34627. $ret = fgets($inputStream, 4096);
  34628. if (false === $ret) {
  34629. throw new RuntimeException('Aborted');
  34630. }
  34631. $ret = trim($ret);
  34632. }
  34633. } else {
  34634. $ret = trim($this->autocomplete($output, $question, $inputStream, is_array($autocomplete) ? $autocomplete : iterator_to_array($autocomplete, false)));
  34635. }
  34636. $ret = strlen($ret) > 0 ? $ret : $question->getDefault();
  34637. if ($normalizer = $question->getNormalizer()) {
  34638. return $normalizer($ret);
  34639. }
  34640. return $ret;
  34641. }
  34642. protected function writePrompt(OutputInterface $output, Question $question)
  34643. {
  34644. $message = $question->getQuestion();
  34645. if ($question instanceof ChoiceQuestion) {
  34646. $maxWidth = max(array_map(array($this, 'strlen'), array_keys($question->getChoices())));
  34647. $messages = (array) $question->getQuestion();
  34648. foreach ($question->getChoices() as $key => $value) {
  34649. $width = $maxWidth - $this->strlen($key);
  34650. $messages[] = ' [<info>'.$key.str_repeat(' ', $width).'</info>] '.$value;
  34651. }
  34652. $output->writeln($messages);
  34653. $message = $question->getPrompt();
  34654. }
  34655. $output->write($message);
  34656. }
  34657. protected function writeError(OutputInterface $output, \Exception $error)
  34658. {
  34659. if (null !== $this->getHelperSet() && $this->getHelperSet()->has('formatter')) {
  34660. $message = $this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error');
  34661. } else {
  34662. $message = '<error>'.$error->getMessage().'</error>';
  34663. }
  34664. $output->writeln($message);
  34665. }
  34666. private function autocomplete(OutputInterface $output, Question $question, $inputStream, array $autocomplete)
  34667. {
  34668. $ret = '';
  34669. $i = 0;
  34670. $ofs = -1;
  34671. $matches = $autocomplete;
  34672. $numMatches = count($matches);
  34673. $sttyMode = shell_exec('stty -g');
  34674. shell_exec('stty -icanon -echo');
  34675. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  34676. while (!feof($inputStream)) {
  34677. $c = fread($inputStream, 1);
  34678. if ("\177" === $c) {
  34679. if (0 === $numMatches && 0 !== $i) {
  34680. --$i;
  34681. $output->write("\033[1D");
  34682. }
  34683. if (0 === $i) {
  34684. $ofs = -1;
  34685. $matches = $autocomplete;
  34686. $numMatches = count($matches);
  34687. } else {
  34688. $numMatches = 0;
  34689. }
  34690. $ret = substr($ret, 0, $i);
  34691. } elseif ("\033" === $c) {
  34692. $c .= fread($inputStream, 2);
  34693. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  34694. if ('A' === $c[2] && -1 === $ofs) {
  34695. $ofs = 0;
  34696. }
  34697. if (0 === $numMatches) {
  34698. continue;
  34699. }
  34700. $ofs += ('A' === $c[2]) ? -1 : 1;
  34701. $ofs = ($numMatches + $ofs) % $numMatches;
  34702. }
  34703. } elseif (ord($c) < 32) {
  34704. if ("\t" === $c || "\n" === $c) {
  34705. if ($numMatches > 0 && -1 !== $ofs) {
  34706. $ret = $matches[$ofs];
  34707. $output->write(substr($ret, $i));
  34708. $i = strlen($ret);
  34709. }
  34710. if ("\n" === $c) {
  34711. $output->write($c);
  34712. break;
  34713. }
  34714. $numMatches = 0;
  34715. }
  34716. continue;
  34717. } else {
  34718. $output->write($c);
  34719. $ret .= $c;
  34720. ++$i;
  34721. $numMatches = 0;
  34722. $ofs = 0;
  34723. foreach ($autocomplete as $value) {
  34724. if (0 === strpos($value, $ret)) {
  34725. $matches[$numMatches++] = $value;
  34726. }
  34727. }
  34728. }
  34729. $output->write("\033[K");
  34730. if ($numMatches > 0 && -1 !== $ofs) {
  34731. $output->write("\0337");
  34732. $output->write('<hl>'.OutputFormatter::escapeTrailingBackslash(substr($matches[$ofs], $i)).'</hl>');
  34733. $output->write("\0338");
  34734. }
  34735. }
  34736. shell_exec(sprintf('stty %s', $sttyMode));
  34737. return $ret;
  34738. }
  34739. private function getHiddenResponse(OutputInterface $output, $inputStream)
  34740. {
  34741. if ('\\' === DIRECTORY_SEPARATOR) {
  34742. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  34743. if ('phar:' === substr(__FILE__, 0, 5)) {
  34744. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  34745. copy($exe, $tmpExe);
  34746. $exe = $tmpExe;
  34747. }
  34748. $value = rtrim(shell_exec($exe));
  34749. $output->writeln('');
  34750. if (isset($tmpExe)) {
  34751. unlink($tmpExe);
  34752. }
  34753. return $value;
  34754. }
  34755. if ($this->hasSttyAvailable()) {
  34756. $sttyMode = shell_exec('stty -g');
  34757. shell_exec('stty -echo');
  34758. $value = fgets($inputStream, 4096);
  34759. shell_exec(sprintf('stty %s', $sttyMode));
  34760. if (false === $value) {
  34761. throw new RuntimeException('Aborted');
  34762. }
  34763. $value = trim($value);
  34764. $output->writeln('');
  34765. return $value;
  34766. }
  34767. if (false !== $shell = $this->getShell()) {
  34768. $readCmd = 'csh' === $shell ? 'set mypassword = $<' : 'read -r mypassword';
  34769. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  34770. $value = rtrim(shell_exec($command));
  34771. $output->writeln('');
  34772. return $value;
  34773. }
  34774. throw new RuntimeException('Unable to hide the response.');
  34775. }
  34776. private function validateAttempts($interviewer, OutputInterface $output, Question $question)
  34777. {
  34778. $error = null;
  34779. $attempts = $question->getMaxAttempts();
  34780. while (null === $attempts || $attempts--) {
  34781. if (null !== $error) {
  34782. $this->writeError($output, $error);
  34783. }
  34784. try {
  34785. return call_user_func($question->getValidator(), $interviewer());
  34786. } catch (RuntimeException $e) {
  34787. throw $e;
  34788. } catch (\Exception $error) {
  34789. }
  34790. }
  34791. throw $error;
  34792. }
  34793. private function getShell()
  34794. {
  34795. if (null !== self::$shell) {
  34796. return self::$shell;
  34797. }
  34798. self::$shell = false;
  34799. if (file_exists('/usr/bin/env')) {
  34800. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  34801. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  34802. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  34803. self::$shell = $sh;
  34804. break;
  34805. }
  34806. }
  34807. }
  34808. return self::$shell;
  34809. }
  34810. private function hasSttyAvailable()
  34811. {
  34812. if (null !== self::$stty) {
  34813. return self::$stty;
  34814. }
  34815. exec('stty 2>&1', $output, $exitcode);
  34816. return self::$stty = 0 === $exitcode;
  34817. }
  34818. }
  34819. <?php
  34820. namespace Symfony\Component\Console\Helper;
  34821. use Symfony\Component\Console\Exception\LogicException;
  34822. use Symfony\Component\Console\Input\InputInterface;
  34823. use Symfony\Component\Console\Output\OutputInterface;
  34824. use Symfony\Component\Console\Question\ChoiceQuestion;
  34825. use Symfony\Component\Console\Question\ConfirmationQuestion;
  34826. use Symfony\Component\Console\Question\Question;
  34827. use Symfony\Component\Console\Style\SymfonyStyle;
  34828. use Symfony\Component\Console\Formatter\OutputFormatter;
  34829. class SymfonyQuestionHelper extends QuestionHelper
  34830. {
  34831. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  34832. {
  34833. $validator = $question->getValidator();
  34834. $question->setValidator(function ($value) use ($validator) {
  34835. if (null !== $validator) {
  34836. $value = $validator($value);
  34837. } else {
  34838. if (!is_array($value) && !is_bool($value) && 0 === strlen($value)) {
  34839. throw new LogicException('A value is required.');
  34840. }
  34841. }
  34842. return $value;
  34843. });
  34844. return parent::ask($input, $output, $question);
  34845. }
  34846. protected function writePrompt(OutputInterface $output, Question $question)
  34847. {
  34848. $text = OutputFormatter::escapeTrailingBackslash($question->getQuestion());
  34849. $default = $question->getDefault();
  34850. switch (true) {
  34851. case null === $default:
  34852. $text = sprintf(' <info>%s</info>:', $text);
  34853. break;
  34854. case $question instanceof ConfirmationQuestion:
  34855. $text = sprintf(' <info>%s (yes/no)</info> [<comment>%s</comment>]:', $text, $default ? 'yes' : 'no');
  34856. break;
  34857. case $question instanceof ChoiceQuestion && $question->isMultiselect():
  34858. $choices = $question->getChoices();
  34859. $default = explode(',', $default);
  34860. foreach ($default as $key => $value) {
  34861. $default[$key] = $choices[trim($value)];
  34862. }
  34863. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(implode(', ', $default)));
  34864. break;
  34865. case $question instanceof ChoiceQuestion:
  34866. $choices = $question->getChoices();
  34867. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($choices[$default]));
  34868. break;
  34869. default:
  34870. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($default));
  34871. }
  34872. $output->writeln($text);
  34873. if ($question instanceof ChoiceQuestion) {
  34874. $width = max(array_map('strlen', array_keys($question->getChoices())));
  34875. foreach ($question->getChoices() as $key => $value) {
  34876. $output->writeln(sprintf(" [<comment>%-${width}s</comment>] %s", $key, $value));
  34877. }
  34878. }
  34879. $output->write(' > ');
  34880. }
  34881. protected function writeError(OutputInterface $output, \Exception $error)
  34882. {
  34883. if ($output instanceof SymfonyStyle) {
  34884. $output->newLine();
  34885. $output->error($error->getMessage());
  34886. return;
  34887. }
  34888. parent::writeError($output, $error);
  34889. }
  34890. }
  34891. <?php
  34892. namespace Symfony\Component\Console\Helper;
  34893. use Symfony\Component\Console\Output\OutputInterface;
  34894. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34895. class Table
  34896. {
  34897. private $headers = array();
  34898. private $rows = array();
  34899. private $columnWidths = array();
  34900. private $numberOfColumns;
  34901. private $output;
  34902. private $style;
  34903. private $columnStyles = array();
  34904. private static $styles;
  34905. public function __construct(OutputInterface $output)
  34906. {
  34907. $this->output = $output;
  34908. if (!self::$styles) {
  34909. self::$styles = self::initStyles();
  34910. }
  34911. $this->setStyle('default');
  34912. }
  34913. public static function setStyleDefinition($name, TableStyle $style)
  34914. {
  34915. if (!self::$styles) {
  34916. self::$styles = self::initStyles();
  34917. }
  34918. self::$styles[$name] = $style;
  34919. }
  34920. public static function getStyleDefinition($name)
  34921. {
  34922. if (!self::$styles) {
  34923. self::$styles = self::initStyles();
  34924. }
  34925. if (isset(self::$styles[$name])) {
  34926. return self::$styles[$name];
  34927. }
  34928. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  34929. }
  34930. public function setStyle($name)
  34931. {
  34932. $this->style = $this->resolveStyle($name);
  34933. return $this;
  34934. }
  34935. public function getStyle()
  34936. {
  34937. return $this->style;
  34938. }
  34939. public function setColumnStyle($columnIndex, $name)
  34940. {
  34941. $columnIndex = (int) $columnIndex;
  34942. $this->columnStyles[$columnIndex] = $this->resolveStyle($name);
  34943. return $this;
  34944. }
  34945. public function getColumnStyle($columnIndex)
  34946. {
  34947. if (isset($this->columnStyles[$columnIndex])) {
  34948. return $this->columnStyles[$columnIndex];
  34949. }
  34950. return $this->getStyle();
  34951. }
  34952. public function setHeaders(array $headers)
  34953. {
  34954. $headers = array_values($headers);
  34955. if (!empty($headers) && !is_array($headers[0])) {
  34956. $headers = array($headers);
  34957. }
  34958. $this->headers = $headers;
  34959. return $this;
  34960. }
  34961. public function setRows(array $rows)
  34962. {
  34963. $this->rows = array();
  34964. return $this->addRows($rows);
  34965. }
  34966. public function addRows(array $rows)
  34967. {
  34968. foreach ($rows as $row) {
  34969. $this->addRow($row);
  34970. }
  34971. return $this;
  34972. }
  34973. public function addRow($row)
  34974. {
  34975. if ($row instanceof TableSeparator) {
  34976. $this->rows[] = $row;
  34977. return $this;
  34978. }
  34979. if (!is_array($row)) {
  34980. throw new InvalidArgumentException('A row must be an array or a TableSeparator instance.');
  34981. }
  34982. $this->rows[] = array_values($row);
  34983. return $this;
  34984. }
  34985. public function setRow($column, array $row)
  34986. {
  34987. $this->rows[$column] = $row;
  34988. return $this;
  34989. }
  34990. public function render()
  34991. {
  34992. $this->calculateNumberOfColumns();
  34993. $rows = $this->buildTableRows($this->rows);
  34994. $headers = $this->buildTableRows($this->headers);
  34995. $this->calculateColumnsWidth(array_merge($headers, $rows));
  34996. $this->renderRowSeparator();
  34997. if (!empty($headers)) {
  34998. foreach ($headers as $header) {
  34999. $this->renderRow($header, $this->style->getCellHeaderFormat());
  35000. $this->renderRowSeparator();
  35001. }
  35002. }
  35003. foreach ($rows as $row) {
  35004. if ($row instanceof TableSeparator) {
  35005. $this->renderRowSeparator();
  35006. } else {
  35007. $this->renderRow($row, $this->style->getCellRowFormat());
  35008. }
  35009. }
  35010. if (!empty($rows)) {
  35011. $this->renderRowSeparator();
  35012. }
  35013. $this->cleanup();
  35014. }
  35015. private function renderRowSeparator()
  35016. {
  35017. if (0 === $count = $this->numberOfColumns) {
  35018. return;
  35019. }
  35020. if (!$this->style->getHorizontalBorderChar() && !$this->style->getCrossingChar()) {
  35021. return;
  35022. }
  35023. $markup = $this->style->getCrossingChar();
  35024. for ($column = 0; $column < $count; ++$column) {
  35025. $markup .= str_repeat($this->style->getHorizontalBorderChar(), $this->columnWidths[$column]).$this->style->getCrossingChar();
  35026. }
  35027. $this->output->writeln(sprintf($this->style->getBorderFormat(), $markup));
  35028. }
  35029. private function renderColumnSeparator()
  35030. {
  35031. return sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar());
  35032. }
  35033. private function renderRow(array $row, $cellFormat)
  35034. {
  35035. if (empty($row)) {
  35036. return;
  35037. }
  35038. $rowContent = $this->renderColumnSeparator();
  35039. foreach ($this->getRowColumns($row) as $column) {
  35040. $rowContent .= $this->renderCell($row, $column, $cellFormat);
  35041. $rowContent .= $this->renderColumnSeparator();
  35042. }
  35043. $this->output->writeln($rowContent);
  35044. }
  35045. private function renderCell(array $row, $column, $cellFormat)
  35046. {
  35047. $cell = isset($row[$column]) ? $row[$column] : '';
  35048. $width = $this->columnWidths[$column];
  35049. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  35050. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $nextColumn) {
  35051. $width += $this->getColumnSeparatorWidth() + $this->columnWidths[$nextColumn];
  35052. }
  35053. }
  35054. if (false !== $encoding = mb_detect_encoding($cell, null, true)) {
  35055. $width += strlen($cell) - mb_strwidth($cell, $encoding);
  35056. }
  35057. $style = $this->getColumnStyle($column);
  35058. if ($cell instanceof TableSeparator) {
  35059. return sprintf($style->getBorderFormat(), str_repeat($style->getHorizontalBorderChar(), $width));
  35060. }
  35061. $width += Helper::strlen($cell) - Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  35062. $content = sprintf($style->getCellRowContentFormat(), $cell);
  35063. return sprintf($cellFormat, str_pad($content, $width, $style->getPaddingChar(), $style->getPadType()));
  35064. }
  35065. private function calculateNumberOfColumns()
  35066. {
  35067. if (null !== $this->numberOfColumns) {
  35068. return;
  35069. }
  35070. $columns = array(0);
  35071. foreach (array_merge($this->headers, $this->rows) as $row) {
  35072. if ($row instanceof TableSeparator) {
  35073. continue;
  35074. }
  35075. $columns[] = $this->getNumberOfColumns($row);
  35076. }
  35077. $this->numberOfColumns = max($columns);
  35078. }
  35079. private function buildTableRows($rows)
  35080. {
  35081. $unmergedRows = array();
  35082. for ($rowKey = 0; $rowKey < count($rows); ++$rowKey) {
  35083. $rows = $this->fillNextRows($rows, $rowKey);
  35084. foreach ($rows[$rowKey] as $column => $cell) {
  35085. if (!strstr($cell, "\n")) {
  35086. continue;
  35087. }
  35088. $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
  35089. foreach ($lines as $lineKey => $line) {
  35090. if ($cell instanceof TableCell) {
  35091. $line = new TableCell($line, array('colspan' => $cell->getColspan()));
  35092. }
  35093. if (0 === $lineKey) {
  35094. $rows[$rowKey][$column] = $line;
  35095. } else {
  35096. $unmergedRows[$rowKey][$lineKey][$column] = $line;
  35097. }
  35098. }
  35099. }
  35100. }
  35101. $tableRows = array();
  35102. foreach ($rows as $rowKey => $row) {
  35103. $tableRows[] = $this->fillCells($row);
  35104. if (isset($unmergedRows[$rowKey])) {
  35105. $tableRows = array_merge($tableRows, $unmergedRows[$rowKey]);
  35106. }
  35107. }
  35108. return $tableRows;
  35109. }
  35110. private function fillNextRows(array $rows, $line)
  35111. {
  35112. $unmergedRows = array();
  35113. foreach ($rows[$line] as $column => $cell) {
  35114. if ($cell instanceof TableCell && $cell->getRowspan() > 1) {
  35115. $nbLines = $cell->getRowspan() - 1;
  35116. $lines = array($cell);
  35117. if (strstr($cell, "\n")) {
  35118. $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
  35119. $nbLines = count($lines) > $nbLines ? substr_count($cell, "\n") : $nbLines;
  35120. $rows[$line][$column] = new TableCell($lines[0], array('colspan' => $cell->getColspan()));
  35121. unset($lines[0]);
  35122. }
  35123. $unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, array()), $unmergedRows);
  35124. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  35125. $value = isset($lines[$unmergedRowKey - $line]) ? $lines[$unmergedRowKey - $line] : '';
  35126. $unmergedRows[$unmergedRowKey][$column] = new TableCell($value, array('colspan' => $cell->getColspan()));
  35127. if ($nbLines === $unmergedRowKey - $line) {
  35128. break;
  35129. }
  35130. }
  35131. }
  35132. }
  35133. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  35134. if (isset($rows[$unmergedRowKey]) && is_array($rows[$unmergedRowKey]) && ($this->getNumberOfColumns($rows[$unmergedRowKey]) + $this->getNumberOfColumns($unmergedRows[$unmergedRowKey]) <= $this->numberOfColumns)) {
  35135. foreach ($unmergedRow as $cellKey => $cell) {
  35136. array_splice($rows[$unmergedRowKey], $cellKey, 0, array($cell));
  35137. }
  35138. } else {
  35139. $row = $this->copyRow($rows, $unmergedRowKey - 1);
  35140. foreach ($unmergedRow as $column => $cell) {
  35141. if (!empty($cell)) {
  35142. $row[$column] = $unmergedRow[$column];
  35143. }
  35144. }
  35145. array_splice($rows, $unmergedRowKey, 0, array($row));
  35146. }
  35147. }
  35148. return $rows;
  35149. }
  35150. private function fillCells($row)
  35151. {
  35152. $newRow = array();
  35153. foreach ($row as $column => $cell) {
  35154. $newRow[] = $cell;
  35155. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  35156. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $position) {
  35157. $newRow[] = '';
  35158. }
  35159. }
  35160. }
  35161. return $newRow ?: $row;
  35162. }
  35163. private function copyRow(array $rows, $line)
  35164. {
  35165. $row = $rows[$line];
  35166. foreach ($row as $cellKey => $cellValue) {
  35167. $row[$cellKey] = '';
  35168. if ($cellValue instanceof TableCell) {
  35169. $row[$cellKey] = new TableCell('', array('colspan' => $cellValue->getColspan()));
  35170. }
  35171. }
  35172. return $row;
  35173. }
  35174. private function getNumberOfColumns(array $row)
  35175. {
  35176. $columns = count($row);
  35177. foreach ($row as $column) {
  35178. $columns += $column instanceof TableCell ? ($column->getColspan() - 1) : 0;
  35179. }
  35180. return $columns;
  35181. }
  35182. private function getRowColumns(array $row)
  35183. {
  35184. $columns = range(0, $this->numberOfColumns - 1);
  35185. foreach ($row as $cellKey => $cell) {
  35186. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  35187. $columns = array_diff($columns, range($cellKey + 1, $cellKey + $cell->getColspan() - 1));
  35188. }
  35189. }
  35190. return $columns;
  35191. }
  35192. private function calculateColumnsWidth($rows)
  35193. {
  35194. for ($column = 0; $column < $this->numberOfColumns; ++$column) {
  35195. $lengths = array();
  35196. foreach ($rows as $row) {
  35197. if ($row instanceof TableSeparator) {
  35198. continue;
  35199. }
  35200. foreach ($row as $i => $cell) {
  35201. if ($cell instanceof TableCell) {
  35202. $textContent = Helper::removeDecoration($this->output->getFormatter(), $cell);
  35203. $textLength = Helper::strlen($textContent);
  35204. if ($textLength > 0) {
  35205. $contentColumns = str_split($textContent, ceil($textLength / $cell->getColspan()));
  35206. foreach ($contentColumns as $position => $content) {
  35207. $row[$i + $position] = $content;
  35208. }
  35209. }
  35210. }
  35211. }
  35212. $lengths[] = $this->getCellWidth($row, $column);
  35213. }
  35214. $this->columnWidths[$column] = max($lengths) + strlen($this->style->getCellRowContentFormat()) - 2;
  35215. }
  35216. }
  35217. private function getColumnSeparatorWidth()
  35218. {
  35219. return strlen(sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar()));
  35220. }
  35221. private function getCellWidth(array $row, $column)
  35222. {
  35223. if (isset($row[$column])) {
  35224. $cell = $row[$column];
  35225. $cellWidth = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  35226. return $cellWidth;
  35227. }
  35228. return 0;
  35229. }
  35230. private function cleanup()
  35231. {
  35232. $this->columnWidths = array();
  35233. $this->numberOfColumns = null;
  35234. }
  35235. private static function initStyles()
  35236. {
  35237. $borderless = new TableStyle();
  35238. $borderless
  35239. ->setHorizontalBorderChar('=')
  35240. ->setVerticalBorderChar(' ')
  35241. ->setCrossingChar(' ')
  35242. ;
  35243. $compact = new TableStyle();
  35244. $compact
  35245. ->setHorizontalBorderChar('')
  35246. ->setVerticalBorderChar(' ')
  35247. ->setCrossingChar('')
  35248. ->setCellRowContentFormat('%s')
  35249. ;
  35250. $styleGuide = new TableStyle();
  35251. $styleGuide
  35252. ->setHorizontalBorderChar('-')
  35253. ->setVerticalBorderChar(' ')
  35254. ->setCrossingChar(' ')
  35255. ->setCellHeaderFormat('%s')
  35256. ;
  35257. return array(
  35258. 'default' => new TableStyle(),
  35259. 'borderless' => $borderless,
  35260. 'compact' => $compact,
  35261. 'symfony-style-guide' => $styleGuide,
  35262. );
  35263. }
  35264. private function resolveStyle($name)
  35265. {
  35266. if ($name instanceof TableStyle) {
  35267. return $name;
  35268. }
  35269. if (isset(self::$styles[$name])) {
  35270. return self::$styles[$name];
  35271. }
  35272. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  35273. }
  35274. }
  35275. <?php
  35276. namespace Symfony\Component\Console\Helper;
  35277. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35278. class TableCell
  35279. {
  35280. private $value;
  35281. private $options = array(
  35282. 'rowspan' => 1,
  35283. 'colspan' => 1,
  35284. );
  35285. public function __construct($value = '', array $options = array())
  35286. {
  35287. if (is_numeric($value) && !is_string($value)) {
  35288. $value = (string) $value;
  35289. }
  35290. $this->value = $value;
  35291. if ($diff = array_diff(array_keys($options), array_keys($this->options))) {
  35292. throw new InvalidArgumentException(sprintf('The TableCell does not support the following options: \'%s\'.', implode('\', \'', $diff)));
  35293. }
  35294. $this->options = array_merge($this->options, $options);
  35295. }
  35296. public function __toString()
  35297. {
  35298. return $this->value;
  35299. }
  35300. public function getColspan()
  35301. {
  35302. return (int) $this->options['colspan'];
  35303. }
  35304. public function getRowspan()
  35305. {
  35306. return (int) $this->options['rowspan'];
  35307. }
  35308. }
  35309. <?php
  35310. namespace Symfony\Component\Console\Helper;
  35311. use Symfony\Component\Console\Output\OutputInterface;
  35312. use Symfony\Component\Console\Output\NullOutput;
  35313. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35314. class TableHelper extends Helper
  35315. {
  35316. const LAYOUT_DEFAULT = 0;
  35317. const LAYOUT_BORDERLESS = 1;
  35318. const LAYOUT_COMPACT = 2;
  35319. private $table;
  35320. public function __construct($triggerDeprecationError = true)
  35321. {
  35322. if ($triggerDeprecationError) {
  35323. @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\Table class instead.', E_USER_DEPRECATED);
  35324. }
  35325. $this->table = new Table(new NullOutput());
  35326. }
  35327. public function setLayout($layout)
  35328. {
  35329. switch ($layout) {
  35330. case self::LAYOUT_BORDERLESS:
  35331. $this->table->setStyle('borderless');
  35332. break;
  35333. case self::LAYOUT_COMPACT:
  35334. $this->table->setStyle('compact');
  35335. break;
  35336. case self::LAYOUT_DEFAULT:
  35337. $this->table->setStyle('default');
  35338. break;
  35339. default:
  35340. throw new InvalidArgumentException(sprintf('Invalid table layout "%s".', $layout));
  35341. }
  35342. return $this;
  35343. }
  35344. public function setHeaders(array $headers)
  35345. {
  35346. $this->table->setHeaders($headers);
  35347. return $this;
  35348. }
  35349. public function setRows(array $rows)
  35350. {
  35351. $this->table->setRows($rows);
  35352. return $this;
  35353. }
  35354. public function addRows(array $rows)
  35355. {
  35356. $this->table->addRows($rows);
  35357. return $this;
  35358. }
  35359. public function addRow(array $row)
  35360. {
  35361. $this->table->addRow($row);
  35362. return $this;
  35363. }
  35364. public function setRow($column, array $row)
  35365. {
  35366. $this->table->setRow($column, $row);
  35367. return $this;
  35368. }
  35369. public function setPaddingChar($paddingChar)
  35370. {
  35371. $this->table->getStyle()->setPaddingChar($paddingChar);
  35372. return $this;
  35373. }
  35374. public function setHorizontalBorderChar($horizontalBorderChar)
  35375. {
  35376. $this->table->getStyle()->setHorizontalBorderChar($horizontalBorderChar);
  35377. return $this;
  35378. }
  35379. public function setVerticalBorderChar($verticalBorderChar)
  35380. {
  35381. $this->table->getStyle()->setVerticalBorderChar($verticalBorderChar);
  35382. return $this;
  35383. }
  35384. public function setCrossingChar($crossingChar)
  35385. {
  35386. $this->table->getStyle()->setCrossingChar($crossingChar);
  35387. return $this;
  35388. }
  35389. public function setCellHeaderFormat($cellHeaderFormat)
  35390. {
  35391. $this->table->getStyle()->setCellHeaderFormat($cellHeaderFormat);
  35392. return $this;
  35393. }
  35394. public function setCellRowFormat($cellRowFormat)
  35395. {
  35396. $this->table->getStyle()->setCellHeaderFormat($cellRowFormat);
  35397. return $this;
  35398. }
  35399. public function setCellRowContentFormat($cellRowContentFormat)
  35400. {
  35401. $this->table->getStyle()->setCellRowContentFormat($cellRowContentFormat);
  35402. return $this;
  35403. }
  35404. public function setBorderFormat($borderFormat)
  35405. {
  35406. $this->table->getStyle()->setBorderFormat($borderFormat);
  35407. return $this;
  35408. }
  35409. public function setPadType($padType)
  35410. {
  35411. $this->table->getStyle()->setPadType($padType);
  35412. return $this;
  35413. }
  35414. public function render(OutputInterface $output)
  35415. {
  35416. $p = new \ReflectionProperty($this->table, 'output');
  35417. $p->setAccessible(true);
  35418. $p->setValue($this->table, $output);
  35419. $this->table->render();
  35420. }
  35421. public function getName()
  35422. {
  35423. return 'table';
  35424. }
  35425. }
  35426. <?php
  35427. namespace Symfony\Component\Console\Helper;
  35428. class TableSeparator extends TableCell
  35429. {
  35430. public function __construct(array $options = array())
  35431. {
  35432. parent::__construct('', $options);
  35433. }
  35434. }
  35435. <?php
  35436. namespace Symfony\Component\Console\Helper;
  35437. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35438. use Symfony\Component\Console\Exception\LogicException;
  35439. class TableStyle
  35440. {
  35441. private $paddingChar = ' ';
  35442. private $horizontalBorderChar = '-';
  35443. private $verticalBorderChar = '|';
  35444. private $crossingChar = '+';
  35445. private $cellHeaderFormat = '<info>%s</info>';
  35446. private $cellRowFormat = '%s';
  35447. private $cellRowContentFormat = ' %s ';
  35448. private $borderFormat = '%s';
  35449. private $padType = STR_PAD_RIGHT;
  35450. public function setPaddingChar($paddingChar)
  35451. {
  35452. if (!$paddingChar) {
  35453. throw new LogicException('The padding char must not be empty');
  35454. }
  35455. $this->paddingChar = $paddingChar;
  35456. return $this;
  35457. }
  35458. public function getPaddingChar()
  35459. {
  35460. return $this->paddingChar;
  35461. }
  35462. public function setHorizontalBorderChar($horizontalBorderChar)
  35463. {
  35464. $this->horizontalBorderChar = $horizontalBorderChar;
  35465. return $this;
  35466. }
  35467. public function getHorizontalBorderChar()
  35468. {
  35469. return $this->horizontalBorderChar;
  35470. }
  35471. public function setVerticalBorderChar($verticalBorderChar)
  35472. {
  35473. $this->verticalBorderChar = $verticalBorderChar;
  35474. return $this;
  35475. }
  35476. public function getVerticalBorderChar()
  35477. {
  35478. return $this->verticalBorderChar;
  35479. }
  35480. public function setCrossingChar($crossingChar)
  35481. {
  35482. $this->crossingChar = $crossingChar;
  35483. return $this;
  35484. }
  35485. public function getCrossingChar()
  35486. {
  35487. return $this->crossingChar;
  35488. }
  35489. public function setCellHeaderFormat($cellHeaderFormat)
  35490. {
  35491. $this->cellHeaderFormat = $cellHeaderFormat;
  35492. return $this;
  35493. }
  35494. public function getCellHeaderFormat()
  35495. {
  35496. return $this->cellHeaderFormat;
  35497. }
  35498. public function setCellRowFormat($cellRowFormat)
  35499. {
  35500. $this->cellRowFormat = $cellRowFormat;
  35501. return $this;
  35502. }
  35503. public function getCellRowFormat()
  35504. {
  35505. return $this->cellRowFormat;
  35506. }
  35507. public function setCellRowContentFormat($cellRowContentFormat)
  35508. {
  35509. $this->cellRowContentFormat = $cellRowContentFormat;
  35510. return $this;
  35511. }
  35512. public function getCellRowContentFormat()
  35513. {
  35514. return $this->cellRowContentFormat;
  35515. }
  35516. public function setBorderFormat($borderFormat)
  35517. {
  35518. $this->borderFormat = $borderFormat;
  35519. return $this;
  35520. }
  35521. public function getBorderFormat()
  35522. {
  35523. return $this->borderFormat;
  35524. }
  35525. public function setPadType($padType)
  35526. {
  35527. if (!in_array($padType, array(STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH), true)) {
  35528. throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).');
  35529. }
  35530. $this->padType = $padType;
  35531. return $this;
  35532. }
  35533. public function getPadType()
  35534. {
  35535. return $this->padType;
  35536. }
  35537. }
  35538. <?php
  35539. namespace Symfony\Component\Console\Input;
  35540. use Symfony\Component\Console\Exception\RuntimeException;
  35541. class ArgvInput extends Input
  35542. {
  35543. private $tokens;
  35544. private $parsed;
  35545. public function __construct(array $argv = null, InputDefinition $definition = null)
  35546. {
  35547. if (null === $argv) {
  35548. $argv = $_SERVER['argv'];
  35549. }
  35550. array_shift($argv);
  35551. $this->tokens = $argv;
  35552. parent::__construct($definition);
  35553. }
  35554. protected function setTokens(array $tokens)
  35555. {
  35556. $this->tokens = $tokens;
  35557. }
  35558. protected function parse()
  35559. {
  35560. $parseOptions = true;
  35561. $this->parsed = $this->tokens;
  35562. while (null !== $token = array_shift($this->parsed)) {
  35563. if ($parseOptions && '' == $token) {
  35564. $this->parseArgument($token);
  35565. } elseif ($parseOptions && '--' == $token) {
  35566. $parseOptions = false;
  35567. } elseif ($parseOptions && 0 === strpos($token, '--')) {
  35568. $this->parseLongOption($token);
  35569. } elseif ($parseOptions && '-' === $token[0] && '-' !== $token) {
  35570. $this->parseShortOption($token);
  35571. } else {
  35572. $this->parseArgument($token);
  35573. }
  35574. }
  35575. }
  35576. private function parseShortOption($token)
  35577. {
  35578. $name = substr($token, 1);
  35579. if (strlen($name) > 1) {
  35580. if ($this->definition->hasShortcut($name[0]) && $this->definition->getOptionForShortcut($name[0])->acceptValue()) {
  35581. $this->addShortOption($name[0], substr($name, 1));
  35582. } else {
  35583. $this->parseShortOptionSet($name);
  35584. }
  35585. } else {
  35586. $this->addShortOption($name, null);
  35587. }
  35588. }
  35589. private function parseShortOptionSet($name)
  35590. {
  35591. $len = strlen($name);
  35592. for ($i = 0; $i < $len; ++$i) {
  35593. if (!$this->definition->hasShortcut($name[$i])) {
  35594. throw new RuntimeException(sprintf('The "-%s" option does not exist.', $name[$i]));
  35595. }
  35596. $option = $this->definition->getOptionForShortcut($name[$i]);
  35597. if ($option->acceptValue()) {
  35598. $this->addLongOption($option->getName(), $i === $len - 1 ? null : substr($name, $i + 1));
  35599. break;
  35600. } else {
  35601. $this->addLongOption($option->getName(), null);
  35602. }
  35603. }
  35604. }
  35605. private function parseLongOption($token)
  35606. {
  35607. $name = substr($token, 2);
  35608. if (false !== $pos = strpos($name, '=')) {
  35609. if (0 === strlen($value = substr($name, $pos + 1))) {
  35610. array_unshift($this->parsed, null);
  35611. }
  35612. $this->addLongOption(substr($name, 0, $pos), $value);
  35613. } else {
  35614. $this->addLongOption($name, null);
  35615. }
  35616. }
  35617. private function parseArgument($token)
  35618. {
  35619. $c = count($this->arguments);
  35620. if ($this->definition->hasArgument($c)) {
  35621. $arg = $this->definition->getArgument($c);
  35622. $this->arguments[$arg->getName()] = $arg->isArray() ? array($token) : $token;
  35623. } elseif ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) {
  35624. $arg = $this->definition->getArgument($c - 1);
  35625. $this->arguments[$arg->getName()][] = $token;
  35626. } else {
  35627. $all = $this->definition->getArguments();
  35628. if (count($all)) {
  35629. throw new RuntimeException(sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all))));
  35630. }
  35631. throw new RuntimeException(sprintf('No arguments expected, got "%s".', $token));
  35632. }
  35633. }
  35634. private function addShortOption($shortcut, $value)
  35635. {
  35636. if (!$this->definition->hasShortcut($shortcut)) {
  35637. throw new RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut));
  35638. }
  35639. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  35640. }
  35641. private function addLongOption($name, $value)
  35642. {
  35643. if (!$this->definition->hasOption($name)) {
  35644. throw new RuntimeException(sprintf('The "--%s" option does not exist.', $name));
  35645. }
  35646. $option = $this->definition->getOption($name);
  35647. if (!isset($value[0])) {
  35648. $value = null;
  35649. }
  35650. if (null !== $value && !$option->acceptValue()) {
  35651. throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
  35652. }
  35653. if (null === $value && $option->acceptValue() && count($this->parsed)) {
  35654. $next = array_shift($this->parsed);
  35655. if (isset($next[0]) && '-' !== $next[0]) {
  35656. $value = $next;
  35657. } elseif (empty($next)) {
  35658. $value = null;
  35659. } else {
  35660. array_unshift($this->parsed, $next);
  35661. }
  35662. }
  35663. if (null === $value) {
  35664. if ($option->isValueRequired()) {
  35665. throw new RuntimeException(sprintf('The "--%s" option requires a value.', $name));
  35666. }
  35667. if (!$option->isArray()) {
  35668. $value = $option->isValueOptional() ? $option->getDefault() : true;
  35669. }
  35670. }
  35671. if ($option->isArray()) {
  35672. $this->options[$name][] = $value;
  35673. } else {
  35674. $this->options[$name] = $value;
  35675. }
  35676. }
  35677. public function getFirstArgument()
  35678. {
  35679. foreach ($this->tokens as $token) {
  35680. if ($token && '-' === $token[0]) {
  35681. continue;
  35682. }
  35683. return $token;
  35684. }
  35685. }
  35686. public function hasParameterOption($values)
  35687. {
  35688. $values = (array) $values;
  35689. foreach ($this->tokens as $token) {
  35690. foreach ($values as $value) {
  35691. $leading = 0 === strpos($value, '--') ? $value.'=' : $value;
  35692. if ($token === $value || '' !== $leading && 0 === strpos($token, $leading)) {
  35693. return true;
  35694. }
  35695. }
  35696. }
  35697. return false;
  35698. }
  35699. public function getParameterOption($values, $default = false)
  35700. {
  35701. $values = (array) $values;
  35702. $tokens = $this->tokens;
  35703. while (0 < count($tokens)) {
  35704. $token = array_shift($tokens);
  35705. foreach ($values as $value) {
  35706. if ($token === $value) {
  35707. return array_shift($tokens);
  35708. }
  35709. $leading = 0 === strpos($value, '--') ? $value.'=' : $value;
  35710. if ('' !== $leading && 0 === strpos($token, $leading)) {
  35711. return substr($token, strlen($leading));
  35712. }
  35713. }
  35714. }
  35715. return $default;
  35716. }
  35717. public function __toString()
  35718. {
  35719. $self = $this;
  35720. $tokens = array_map(function ($token) use ($self) {
  35721. if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) {
  35722. return $match[1].$self->escapeToken($match[2]);
  35723. }
  35724. if ($token && '-' !== $token[0]) {
  35725. return $self->escapeToken($token);
  35726. }
  35727. return $token;
  35728. }, $this->tokens);
  35729. return implode(' ', $tokens);
  35730. }
  35731. }
  35732. <?php
  35733. namespace Symfony\Component\Console\Input;
  35734. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35735. use Symfony\Component\Console\Exception\InvalidOptionException;
  35736. class ArrayInput extends Input
  35737. {
  35738. private $parameters;
  35739. public function __construct(array $parameters, InputDefinition $definition = null)
  35740. {
  35741. $this->parameters = $parameters;
  35742. parent::__construct($definition);
  35743. }
  35744. public function getFirstArgument()
  35745. {
  35746. foreach ($this->parameters as $key => $value) {
  35747. if ($key && '-' === $key[0]) {
  35748. continue;
  35749. }
  35750. return $value;
  35751. }
  35752. }
  35753. public function hasParameterOption($values)
  35754. {
  35755. $values = (array) $values;
  35756. foreach ($this->parameters as $k => $v) {
  35757. if (!is_int($k)) {
  35758. $v = $k;
  35759. }
  35760. if (in_array($v, $values)) {
  35761. return true;
  35762. }
  35763. }
  35764. return false;
  35765. }
  35766. public function getParameterOption($values, $default = false)
  35767. {
  35768. $values = (array) $values;
  35769. foreach ($this->parameters as $k => $v) {
  35770. if (is_int($k)) {
  35771. if (in_array($v, $values)) {
  35772. return true;
  35773. }
  35774. } elseif (in_array($k, $values)) {
  35775. return $v;
  35776. }
  35777. }
  35778. return $default;
  35779. }
  35780. public function __toString()
  35781. {
  35782. $params = array();
  35783. foreach ($this->parameters as $param => $val) {
  35784. if ($param && '-' === $param[0]) {
  35785. if (is_array($val)) {
  35786. foreach ($val as $v) {
  35787. $params[] = $param.('' != $v ? '='.$this->escapeToken($v) : '');
  35788. }
  35789. } else {
  35790. $params[] = $param.('' != $val ? '='.$this->escapeToken($val) : '');
  35791. }
  35792. } else {
  35793. $params[] = is_array($val) ? implode(' ', array_map(array($this, 'escapeToken'), $val)) : $this->escapeToken($val);
  35794. }
  35795. }
  35796. return implode(' ', $params);
  35797. }
  35798. protected function parse()
  35799. {
  35800. foreach ($this->parameters as $key => $value) {
  35801. if (0 === strpos($key, '--')) {
  35802. $this->addLongOption(substr($key, 2), $value);
  35803. } elseif ('-' === $key[0]) {
  35804. $this->addShortOption(substr($key, 1), $value);
  35805. } else {
  35806. $this->addArgument($key, $value);
  35807. }
  35808. }
  35809. }
  35810. private function addShortOption($shortcut, $value)
  35811. {
  35812. if (!$this->definition->hasShortcut($shortcut)) {
  35813. throw new InvalidOptionException(sprintf('The "-%s" option does not exist.', $shortcut));
  35814. }
  35815. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  35816. }
  35817. private function addLongOption($name, $value)
  35818. {
  35819. if (!$this->definition->hasOption($name)) {
  35820. throw new InvalidOptionException(sprintf('The "--%s" option does not exist.', $name));
  35821. }
  35822. $option = $this->definition->getOption($name);
  35823. if (null === $value) {
  35824. if ($option->isValueRequired()) {
  35825. throw new InvalidOptionException(sprintf('The "--%s" option requires a value.', $name));
  35826. }
  35827. $value = $option->isValueOptional() ? $option->getDefault() : true;
  35828. }
  35829. $this->options[$name] = $value;
  35830. }
  35831. private function addArgument($name, $value)
  35832. {
  35833. if (!$this->definition->hasArgument($name)) {
  35834. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  35835. }
  35836. $this->arguments[$name] = $value;
  35837. }
  35838. }
  35839. <?php
  35840. namespace Symfony\Component\Console\Input;
  35841. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35842. use Symfony\Component\Console\Exception\RuntimeException;
  35843. abstract class Input implements InputInterface
  35844. {
  35845. protected $definition;
  35846. protected $options = array();
  35847. protected $arguments = array();
  35848. protected $interactive = true;
  35849. public function __construct(InputDefinition $definition = null)
  35850. {
  35851. if (null === $definition) {
  35852. $this->definition = new InputDefinition();
  35853. } else {
  35854. $this->bind($definition);
  35855. $this->validate();
  35856. }
  35857. }
  35858. public function bind(InputDefinition $definition)
  35859. {
  35860. $this->arguments = array();
  35861. $this->options = array();
  35862. $this->definition = $definition;
  35863. $this->parse();
  35864. }
  35865. abstract protected function parse();
  35866. public function validate()
  35867. {
  35868. $definition = $this->definition;
  35869. $givenArguments = $this->arguments;
  35870. $missingArguments = array_filter(array_keys($definition->getArguments()), function ($argument) use ($definition, $givenArguments) {
  35871. return !array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired();
  35872. });
  35873. if (count($missingArguments) > 0) {
  35874. throw new RuntimeException(sprintf('Not enough arguments (missing: "%s").', implode(', ', $missingArguments)));
  35875. }
  35876. }
  35877. public function isInteractive()
  35878. {
  35879. return $this->interactive;
  35880. }
  35881. public function setInteractive($interactive)
  35882. {
  35883. $this->interactive = (bool) $interactive;
  35884. }
  35885. public function getArguments()
  35886. {
  35887. return array_merge($this->definition->getArgumentDefaults(), $this->arguments);
  35888. }
  35889. public function getArgument($name)
  35890. {
  35891. if (!$this->definition->hasArgument($name)) {
  35892. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  35893. }
  35894. return isset($this->arguments[$name]) ? $this->arguments[$name] : $this->definition->getArgument($name)->getDefault();
  35895. }
  35896. public function setArgument($name, $value)
  35897. {
  35898. if (!$this->definition->hasArgument($name)) {
  35899. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  35900. }
  35901. $this->arguments[$name] = $value;
  35902. }
  35903. public function hasArgument($name)
  35904. {
  35905. return $this->definition->hasArgument($name);
  35906. }
  35907. public function getOptions()
  35908. {
  35909. return array_merge($this->definition->getOptionDefaults(), $this->options);
  35910. }
  35911. public function getOption($name)
  35912. {
  35913. if (!$this->definition->hasOption($name)) {
  35914. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  35915. }
  35916. return isset($this->options[$name]) ? $this->options[$name] : $this->definition->getOption($name)->getDefault();
  35917. }
  35918. public function setOption($name, $value)
  35919. {
  35920. if (!$this->definition->hasOption($name)) {
  35921. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  35922. }
  35923. $this->options[$name] = $value;
  35924. }
  35925. public function hasOption($name)
  35926. {
  35927. return $this->definition->hasOption($name);
  35928. }
  35929. public function escapeToken($token)
  35930. {
  35931. return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token);
  35932. }
  35933. }
  35934. <?php
  35935. namespace Symfony\Component\Console\Input;
  35936. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35937. use Symfony\Component\Console\Exception\LogicException;
  35938. class InputArgument
  35939. {
  35940. const REQUIRED = 1;
  35941. const OPTIONAL = 2;
  35942. const IS_ARRAY = 4;
  35943. private $name;
  35944. private $mode;
  35945. private $default;
  35946. private $description;
  35947. public function __construct($name, $mode = null, $description = '', $default = null)
  35948. {
  35949. if (null === $mode) {
  35950. $mode = self::OPTIONAL;
  35951. } elseif (!is_int($mode) || $mode > 7 || $mode < 1) {
  35952. throw new InvalidArgumentException(sprintf('Argument mode "%s" is not valid.', $mode));
  35953. }
  35954. $this->name = $name;
  35955. $this->mode = $mode;
  35956. $this->description = $description;
  35957. $this->setDefault($default);
  35958. }
  35959. public function getName()
  35960. {
  35961. return $this->name;
  35962. }
  35963. public function isRequired()
  35964. {
  35965. return self::REQUIRED === (self::REQUIRED & $this->mode);
  35966. }
  35967. public function isArray()
  35968. {
  35969. return self::IS_ARRAY === (self::IS_ARRAY & $this->mode);
  35970. }
  35971. public function setDefault($default = null)
  35972. {
  35973. if (self::REQUIRED === $this->mode && null !== $default) {
  35974. throw new LogicException('Cannot set a default value except for InputArgument::OPTIONAL mode.');
  35975. }
  35976. if ($this->isArray()) {
  35977. if (null === $default) {
  35978. $default = array();
  35979. } elseif (!is_array($default)) {
  35980. throw new LogicException('A default value for an array argument must be an array.');
  35981. }
  35982. }
  35983. $this->default = $default;
  35984. }
  35985. public function getDefault()
  35986. {
  35987. return $this->default;
  35988. }
  35989. public function getDescription()
  35990. {
  35991. return $this->description;
  35992. }
  35993. }
  35994. <?php
  35995. namespace Symfony\Component\Console\Input;
  35996. interface InputAwareInterface
  35997. {
  35998. public function setInput(InputInterface $input);
  35999. }
  36000. <?php
  36001. namespace Symfony\Component\Console\Input;
  36002. use Symfony\Component\Console\Descriptor\TextDescriptor;
  36003. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  36004. use Symfony\Component\Console\Output\BufferedOutput;
  36005. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36006. use Symfony\Component\Console\Exception\LogicException;
  36007. class InputDefinition
  36008. {
  36009. private $arguments;
  36010. private $requiredCount;
  36011. private $hasAnArrayArgument = false;
  36012. private $hasOptional;
  36013. private $options;
  36014. private $shortcuts;
  36015. public function __construct(array $definition = array())
  36016. {
  36017. $this->setDefinition($definition);
  36018. }
  36019. public function setDefinition(array $definition)
  36020. {
  36021. $arguments = array();
  36022. $options = array();
  36023. foreach ($definition as $item) {
  36024. if ($item instanceof InputOption) {
  36025. $options[] = $item;
  36026. } else {
  36027. $arguments[] = $item;
  36028. }
  36029. }
  36030. $this->setArguments($arguments);
  36031. $this->setOptions($options);
  36032. }
  36033. public function setArguments($arguments = array())
  36034. {
  36035. $this->arguments = array();
  36036. $this->requiredCount = 0;
  36037. $this->hasOptional = false;
  36038. $this->hasAnArrayArgument = false;
  36039. $this->addArguments($arguments);
  36040. }
  36041. public function addArguments($arguments = array())
  36042. {
  36043. if (null !== $arguments) {
  36044. foreach ($arguments as $argument) {
  36045. $this->addArgument($argument);
  36046. }
  36047. }
  36048. }
  36049. public function addArgument(InputArgument $argument)
  36050. {
  36051. if (isset($this->arguments[$argument->getName()])) {
  36052. throw new LogicException(sprintf('An argument with name "%s" already exists.', $argument->getName()));
  36053. }
  36054. if ($this->hasAnArrayArgument) {
  36055. throw new LogicException('Cannot add an argument after an array argument.');
  36056. }
  36057. if ($argument->isRequired() && $this->hasOptional) {
  36058. throw new LogicException('Cannot add a required argument after an optional one.');
  36059. }
  36060. if ($argument->isArray()) {
  36061. $this->hasAnArrayArgument = true;
  36062. }
  36063. if ($argument->isRequired()) {
  36064. ++$this->requiredCount;
  36065. } else {
  36066. $this->hasOptional = true;
  36067. }
  36068. $this->arguments[$argument->getName()] = $argument;
  36069. }
  36070. public function getArgument($name)
  36071. {
  36072. if (!$this->hasArgument($name)) {
  36073. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  36074. }
  36075. $arguments = is_int($name) ? array_values($this->arguments) : $this->arguments;
  36076. return $arguments[$name];
  36077. }
  36078. public function hasArgument($name)
  36079. {
  36080. $arguments = is_int($name) ? array_values($this->arguments) : $this->arguments;
  36081. return isset($arguments[$name]);
  36082. }
  36083. public function getArguments()
  36084. {
  36085. return $this->arguments;
  36086. }
  36087. public function getArgumentCount()
  36088. {
  36089. return $this->hasAnArrayArgument ? PHP_INT_MAX : count($this->arguments);
  36090. }
  36091. public function getArgumentRequiredCount()
  36092. {
  36093. return $this->requiredCount;
  36094. }
  36095. public function getArgumentDefaults()
  36096. {
  36097. $values = array();
  36098. foreach ($this->arguments as $argument) {
  36099. $values[$argument->getName()] = $argument->getDefault();
  36100. }
  36101. return $values;
  36102. }
  36103. public function setOptions($options = array())
  36104. {
  36105. $this->options = array();
  36106. $this->shortcuts = array();
  36107. $this->addOptions($options);
  36108. }
  36109. public function addOptions($options = array())
  36110. {
  36111. foreach ($options as $option) {
  36112. $this->addOption($option);
  36113. }
  36114. }
  36115. public function addOption(InputOption $option)
  36116. {
  36117. if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) {
  36118. throw new LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
  36119. }
  36120. if ($option->getShortcut()) {
  36121. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  36122. if (isset($this->shortcuts[$shortcut]) && !$option->equals($this->options[$this->shortcuts[$shortcut]])) {
  36123. throw new LogicException(sprintf('An option with shortcut "%s" already exists.', $shortcut));
  36124. }
  36125. }
  36126. }
  36127. $this->options[$option->getName()] = $option;
  36128. if ($option->getShortcut()) {
  36129. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  36130. $this->shortcuts[$shortcut] = $option->getName();
  36131. }
  36132. }
  36133. }
  36134. public function getOption($name)
  36135. {
  36136. if (!$this->hasOption($name)) {
  36137. throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $name));
  36138. }
  36139. return $this->options[$name];
  36140. }
  36141. public function hasOption($name)
  36142. {
  36143. return isset($this->options[$name]);
  36144. }
  36145. public function getOptions()
  36146. {
  36147. return $this->options;
  36148. }
  36149. public function hasShortcut($name)
  36150. {
  36151. return isset($this->shortcuts[$name]);
  36152. }
  36153. public function getOptionForShortcut($shortcut)
  36154. {
  36155. return $this->getOption($this->shortcutToName($shortcut));
  36156. }
  36157. public function getOptionDefaults()
  36158. {
  36159. $values = array();
  36160. foreach ($this->options as $option) {
  36161. $values[$option->getName()] = $option->getDefault();
  36162. }
  36163. return $values;
  36164. }
  36165. private function shortcutToName($shortcut)
  36166. {
  36167. if (!isset($this->shortcuts[$shortcut])) {
  36168. throw new InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut));
  36169. }
  36170. return $this->shortcuts[$shortcut];
  36171. }
  36172. public function getSynopsis($short = false)
  36173. {
  36174. $elements = array();
  36175. if ($short && $this->getOptions()) {
  36176. $elements[] = '[options]';
  36177. } elseif (!$short) {
  36178. foreach ($this->getOptions() as $option) {
  36179. $value = '';
  36180. if ($option->acceptValue()) {
  36181. $value = sprintf(
  36182. ' %s%s%s',
  36183. $option->isValueOptional() ? '[' : '',
  36184. strtoupper($option->getName()),
  36185. $option->isValueOptional() ? ']' : ''
  36186. );
  36187. }
  36188. $shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : '';
  36189. $elements[] = sprintf('[%s--%s%s]', $shortcut, $option->getName(), $value);
  36190. }
  36191. }
  36192. if (count($elements) && $this->getArguments()) {
  36193. $elements[] = '[--]';
  36194. }
  36195. foreach ($this->getArguments() as $argument) {
  36196. $element = '<'.$argument->getName().'>';
  36197. if (!$argument->isRequired()) {
  36198. $element = '['.$element.']';
  36199. } elseif ($argument->isArray()) {
  36200. $element = $element.' ('.$element.')';
  36201. }
  36202. if ($argument->isArray()) {
  36203. $element .= '...';
  36204. }
  36205. $elements[] = $element;
  36206. }
  36207. return implode(' ', $elements);
  36208. }
  36209. public function asText()
  36210. {
  36211. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  36212. $descriptor = new TextDescriptor();
  36213. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  36214. $descriptor->describe($output, $this, array('raw_output' => true));
  36215. return $output->fetch();
  36216. }
  36217. public function asXml($asDom = false)
  36218. {
  36219. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  36220. $descriptor = new XmlDescriptor();
  36221. if ($asDom) {
  36222. return $descriptor->getInputDefinitionDocument($this);
  36223. }
  36224. $output = new BufferedOutput();
  36225. $descriptor->describe($output, $this);
  36226. return $output->fetch();
  36227. }
  36228. }
  36229. <?php
  36230. namespace Symfony\Component\Console\Input;
  36231. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36232. use Symfony\Component\Console\Exception\RuntimeException;
  36233. interface InputInterface
  36234. {
  36235. public function getFirstArgument();
  36236. public function hasParameterOption($values);
  36237. public function getParameterOption($values, $default = false);
  36238. public function bind(InputDefinition $definition);
  36239. public function validate();
  36240. public function getArguments();
  36241. public function getArgument($name);
  36242. public function setArgument($name, $value);
  36243. public function hasArgument($name);
  36244. public function getOptions();
  36245. public function getOption($name);
  36246. public function setOption($name, $value);
  36247. public function hasOption($name);
  36248. public function isInteractive();
  36249. public function setInteractive($interactive);
  36250. }
  36251. <?php
  36252. namespace Symfony\Component\Console\Input;
  36253. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36254. use Symfony\Component\Console\Exception\LogicException;
  36255. class InputOption
  36256. {
  36257. const VALUE_NONE = 1;
  36258. const VALUE_REQUIRED = 2;
  36259. const VALUE_OPTIONAL = 4;
  36260. const VALUE_IS_ARRAY = 8;
  36261. private $name;
  36262. private $shortcut;
  36263. private $mode;
  36264. private $default;
  36265. private $description;
  36266. public function __construct($name, $shortcut = null, $mode = null, $description = '', $default = null)
  36267. {
  36268. if (0 === strpos($name, '--')) {
  36269. $name = substr($name, 2);
  36270. }
  36271. if (empty($name)) {
  36272. throw new InvalidArgumentException('An option name cannot be empty.');
  36273. }
  36274. if (empty($shortcut)) {
  36275. $shortcut = null;
  36276. }
  36277. if (null !== $shortcut) {
  36278. if (is_array($shortcut)) {
  36279. $shortcut = implode('|', $shortcut);
  36280. }
  36281. $shortcuts = preg_split('{(\|)-?}', ltrim($shortcut, '-'));
  36282. $shortcuts = array_filter($shortcuts);
  36283. $shortcut = implode('|', $shortcuts);
  36284. if (empty($shortcut)) {
  36285. throw new InvalidArgumentException('An option shortcut cannot be empty.');
  36286. }
  36287. }
  36288. if (null === $mode) {
  36289. $mode = self::VALUE_NONE;
  36290. } elseif (!is_int($mode) || $mode > 15 || $mode < 1) {
  36291. throw new InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode));
  36292. }
  36293. $this->name = $name;
  36294. $this->shortcut = $shortcut;
  36295. $this->mode = $mode;
  36296. $this->description = $description;
  36297. if ($this->isArray() && !$this->acceptValue()) {
  36298. throw new InvalidArgumentException('Impossible to have an option mode VALUE_IS_ARRAY if the option does not accept a value.');
  36299. }
  36300. $this->setDefault($default);
  36301. }
  36302. public function getShortcut()
  36303. {
  36304. return $this->shortcut;
  36305. }
  36306. public function getName()
  36307. {
  36308. return $this->name;
  36309. }
  36310. public function acceptValue()
  36311. {
  36312. return $this->isValueRequired() || $this->isValueOptional();
  36313. }
  36314. public function isValueRequired()
  36315. {
  36316. return self::VALUE_REQUIRED === (self::VALUE_REQUIRED & $this->mode);
  36317. }
  36318. public function isValueOptional()
  36319. {
  36320. return self::VALUE_OPTIONAL === (self::VALUE_OPTIONAL & $this->mode);
  36321. }
  36322. public function isArray()
  36323. {
  36324. return self::VALUE_IS_ARRAY === (self::VALUE_IS_ARRAY & $this->mode);
  36325. }
  36326. public function setDefault($default = null)
  36327. {
  36328. if (self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default) {
  36329. throw new LogicException('Cannot set a default value when using InputOption::VALUE_NONE mode.');
  36330. }
  36331. if ($this->isArray()) {
  36332. if (null === $default) {
  36333. $default = array();
  36334. } elseif (!is_array($default)) {
  36335. throw new LogicException('A default value for an array option must be an array.');
  36336. }
  36337. }
  36338. $this->default = $this->acceptValue() ? $default : false;
  36339. }
  36340. public function getDefault()
  36341. {
  36342. return $this->default;
  36343. }
  36344. public function getDescription()
  36345. {
  36346. return $this->description;
  36347. }
  36348. public function equals(self $option)
  36349. {
  36350. return $option->getName() === $this->getName()
  36351. && $option->getShortcut() === $this->getShortcut()
  36352. && $option->getDefault() === $this->getDefault()
  36353. && $option->isArray() === $this->isArray()
  36354. && $option->isValueRequired() === $this->isValueRequired()
  36355. && $option->isValueOptional() === $this->isValueOptional()
  36356. ;
  36357. }
  36358. }
  36359. <?php
  36360. namespace Symfony\Component\Console\Input;
  36361. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36362. class StringInput extends ArgvInput
  36363. {
  36364. const REGEX_STRING = '([^\s]+?)(?:\s|(?<!\\\\)"|(?<!\\\\)\'|$)';
  36365. const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';
  36366. public function __construct($input, InputDefinition $definition = null)
  36367. {
  36368. if ($definition) {
  36369. @trigger_error('The $definition argument of the '.__METHOD__.' method is deprecated and will be removed in 3.0. Set this parameter with the bind() method instead.', E_USER_DEPRECATED);
  36370. }
  36371. parent::__construct(array(), null);
  36372. $this->setTokens($this->tokenize($input));
  36373. if (null !== $definition) {
  36374. $this->bind($definition);
  36375. }
  36376. }
  36377. private function tokenize($input)
  36378. {
  36379. $tokens = array();
  36380. $length = strlen($input);
  36381. $cursor = 0;
  36382. while ($cursor < $length) {
  36383. if (preg_match('/\s+/A', $input, $match, null, $cursor)) {
  36384. } elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, null, $cursor)) {
  36385. $tokens[] = $match[1].$match[2].stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, strlen($match[3]) - 2)));
  36386. } elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, null, $cursor)) {
  36387. $tokens[] = stripcslashes(substr($match[0], 1, strlen($match[0]) - 2));
  36388. } elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, null, $cursor)) {
  36389. $tokens[] = stripcslashes($match[1]);
  36390. } else {
  36391. throw new InvalidArgumentException(sprintf('Unable to parse input near "... %s ..."', substr($input, $cursor, 10)));
  36392. }
  36393. $cursor += strlen($match[0]);
  36394. }
  36395. return $tokens;
  36396. }
  36397. }
  36398. Copyright (c) 2004-2018 Fabien Potencier
  36399. Permission is hereby granted, free of charge, to any person obtaining a copy
  36400. of this software and associated documentation files (the "Software"), to deal
  36401. in the Software without restriction, including without limitation the rights
  36402. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  36403. copies of the Software, and to permit persons to whom the Software is furnished
  36404. to do so, subject to the following conditions:
  36405. The above copyright notice and this permission notice shall be included in all
  36406. copies or substantial portions of the Software.
  36407. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  36408. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  36409. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  36410. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  36411. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  36412. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  36413. THE SOFTWARE.
  36414. <?php
  36415. namespace Symfony\Component\Console\Logger;
  36416. use Psr\Log\AbstractLogger;
  36417. use Psr\Log\InvalidArgumentException;
  36418. use Psr\Log\LogLevel;
  36419. use Symfony\Component\Console\Output\OutputInterface;
  36420. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  36421. class ConsoleLogger extends AbstractLogger
  36422. {
  36423. const INFO = 'info';
  36424. const ERROR = 'error';
  36425. private $output;
  36426. private $verbosityLevelMap = array(
  36427. LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL,
  36428. LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL,
  36429. LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL,
  36430. LogLevel::ERROR => OutputInterface::VERBOSITY_NORMAL,
  36431. LogLevel::WARNING => OutputInterface::VERBOSITY_NORMAL,
  36432. LogLevel::NOTICE => OutputInterface::VERBOSITY_VERBOSE,
  36433. LogLevel::INFO => OutputInterface::VERBOSITY_VERY_VERBOSE,
  36434. LogLevel::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  36435. );
  36436. private $formatLevelMap = array(
  36437. LogLevel::EMERGENCY => self::ERROR,
  36438. LogLevel::ALERT => self::ERROR,
  36439. LogLevel::CRITICAL => self::ERROR,
  36440. LogLevel::ERROR => self::ERROR,
  36441. LogLevel::WARNING => self::INFO,
  36442. LogLevel::NOTICE => self::INFO,
  36443. LogLevel::INFO => self::INFO,
  36444. LogLevel::DEBUG => self::INFO,
  36445. );
  36446. public function __construct(OutputInterface $output, array $verbosityLevelMap = array(), array $formatLevelMap = array())
  36447. {
  36448. $this->output = $output;
  36449. $this->verbosityLevelMap = $verbosityLevelMap + $this->verbosityLevelMap;
  36450. $this->formatLevelMap = $formatLevelMap + $this->formatLevelMap;
  36451. }
  36452. public function log($level, $message, array $context = array())
  36453. {
  36454. if (!isset($this->verbosityLevelMap[$level])) {
  36455. throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level));
  36456. }
  36457. if (self::ERROR === $this->formatLevelMap[$level] && $this->output instanceof ConsoleOutputInterface) {
  36458. $output = $this->output->getErrorOutput();
  36459. } else {
  36460. $output = $this->output;
  36461. }
  36462. if ($output->getVerbosity() >= $this->verbosityLevelMap[$level]) {
  36463. $output->writeln(sprintf('<%1$s>[%2$s] %3$s</%1$s>', $this->formatLevelMap[$level], $level, $this->interpolate($message, $context)));
  36464. }
  36465. }
  36466. private function interpolate($message, array $context)
  36467. {
  36468. $replace = array();
  36469. foreach ($context as $key => $val) {
  36470. if (!is_array($val) && (!is_object($val) || method_exists($val, '__toString'))) {
  36471. $replace[sprintf('{%s}', $key)] = $val;
  36472. }
  36473. }
  36474. return strtr($message, $replace);
  36475. }
  36476. }
  36477. <?php
  36478. namespace Symfony\Component\Console\Output;
  36479. class BufferedOutput extends Output
  36480. {
  36481. private $buffer = '';
  36482. public function fetch()
  36483. {
  36484. $content = $this->buffer;
  36485. $this->buffer = '';
  36486. return $content;
  36487. }
  36488. protected function doWrite($message, $newline)
  36489. {
  36490. $this->buffer .= $message;
  36491. if ($newline) {
  36492. $this->buffer .= PHP_EOL;
  36493. }
  36494. }
  36495. }
  36496. <?php
  36497. namespace Symfony\Component\Console\Output;
  36498. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  36499. class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
  36500. {
  36501. private $stderr;
  36502. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  36503. {
  36504. parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter);
  36505. $actualDecorated = $this->isDecorated();
  36506. $this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated, $this->getFormatter());
  36507. if (null === $decorated) {
  36508. $this->setDecorated($actualDecorated && $this->stderr->isDecorated());
  36509. }
  36510. }
  36511. public function setDecorated($decorated)
  36512. {
  36513. parent::setDecorated($decorated);
  36514. $this->stderr->setDecorated($decorated);
  36515. }
  36516. public function setFormatter(OutputFormatterInterface $formatter)
  36517. {
  36518. parent::setFormatter($formatter);
  36519. $this->stderr->setFormatter($formatter);
  36520. }
  36521. public function setVerbosity($level)
  36522. {
  36523. parent::setVerbosity($level);
  36524. $this->stderr->setVerbosity($level);
  36525. }
  36526. public function getErrorOutput()
  36527. {
  36528. return $this->stderr;
  36529. }
  36530. public function setErrorOutput(OutputInterface $error)
  36531. {
  36532. $this->stderr = $error;
  36533. }
  36534. protected function hasStdoutSupport()
  36535. {
  36536. return false === $this->isRunningOS400();
  36537. }
  36538. protected function hasStderrSupport()
  36539. {
  36540. return false === $this->isRunningOS400();
  36541. }
  36542. private function isRunningOS400()
  36543. {
  36544. $checks = array(
  36545. function_exists('php_uname') ? php_uname('s') : '',
  36546. getenv('OSTYPE'),
  36547. PHP_OS,
  36548. );
  36549. return false !== stripos(implode(';', $checks), 'OS400');
  36550. }
  36551. private function openOutputStream()
  36552. {
  36553. $outputStream = $this->hasStdoutSupport() ? 'php://stdout' : 'php://output';
  36554. return @fopen($outputStream, 'w') ?: fopen('php://output', 'w');
  36555. }
  36556. private function openErrorStream()
  36557. {
  36558. $errorStream = $this->hasStderrSupport() ? 'php://stderr' : 'php://output';
  36559. return fopen($errorStream, 'w');
  36560. }
  36561. }
  36562. <?php
  36563. namespace Symfony\Component\Console\Output;
  36564. interface ConsoleOutputInterface extends OutputInterface
  36565. {
  36566. public function getErrorOutput();
  36567. public function setErrorOutput(OutputInterface $error);
  36568. }
  36569. <?php
  36570. namespace Symfony\Component\Console\Output;
  36571. use Symfony\Component\Console\Formatter\OutputFormatter;
  36572. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  36573. class NullOutput implements OutputInterface
  36574. {
  36575. public function setFormatter(OutputFormatterInterface $formatter)
  36576. {
  36577. }
  36578. public function getFormatter()
  36579. {
  36580. return new OutputFormatter();
  36581. }
  36582. public function setDecorated($decorated)
  36583. {
  36584. }
  36585. public function isDecorated()
  36586. {
  36587. return false;
  36588. }
  36589. public function setVerbosity($level)
  36590. {
  36591. }
  36592. public function getVerbosity()
  36593. {
  36594. return self::VERBOSITY_QUIET;
  36595. }
  36596. public function isQuiet()
  36597. {
  36598. return true;
  36599. }
  36600. public function isVerbose()
  36601. {
  36602. return false;
  36603. }
  36604. public function isVeryVerbose()
  36605. {
  36606. return false;
  36607. }
  36608. public function isDebug()
  36609. {
  36610. return false;
  36611. }
  36612. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  36613. {
  36614. }
  36615. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  36616. {
  36617. }
  36618. }
  36619. <?php
  36620. namespace Symfony\Component\Console\Output;
  36621. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  36622. use Symfony\Component\Console\Formatter\OutputFormatter;
  36623. abstract class Output implements OutputInterface
  36624. {
  36625. private $verbosity;
  36626. private $formatter;
  36627. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = false, OutputFormatterInterface $formatter = null)
  36628. {
  36629. $this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity;
  36630. $this->formatter = $formatter ?: new OutputFormatter();
  36631. $this->formatter->setDecorated($decorated);
  36632. }
  36633. public function setFormatter(OutputFormatterInterface $formatter)
  36634. {
  36635. $this->formatter = $formatter;
  36636. }
  36637. public function getFormatter()
  36638. {
  36639. return $this->formatter;
  36640. }
  36641. public function setDecorated($decorated)
  36642. {
  36643. $this->formatter->setDecorated($decorated);
  36644. }
  36645. public function isDecorated()
  36646. {
  36647. return $this->formatter->isDecorated();
  36648. }
  36649. public function setVerbosity($level)
  36650. {
  36651. $this->verbosity = (int) $level;
  36652. }
  36653. public function getVerbosity()
  36654. {
  36655. return $this->verbosity;
  36656. }
  36657. public function isQuiet()
  36658. {
  36659. return self::VERBOSITY_QUIET === $this->verbosity;
  36660. }
  36661. public function isVerbose()
  36662. {
  36663. return self::VERBOSITY_VERBOSE <= $this->verbosity;
  36664. }
  36665. public function isVeryVerbose()
  36666. {
  36667. return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity;
  36668. }
  36669. public function isDebug()
  36670. {
  36671. return self::VERBOSITY_DEBUG <= $this->verbosity;
  36672. }
  36673. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  36674. {
  36675. $this->write($messages, true, $options);
  36676. }
  36677. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  36678. {
  36679. $messages = (array) $messages;
  36680. $types = self::OUTPUT_NORMAL | self::OUTPUT_RAW | self::OUTPUT_PLAIN;
  36681. $type = $types & $options ?: self::OUTPUT_NORMAL;
  36682. $verbosities = self::VERBOSITY_QUIET | self::VERBOSITY_NORMAL | self::VERBOSITY_VERBOSE | self::VERBOSITY_VERY_VERBOSE | self::VERBOSITY_DEBUG;
  36683. $verbosity = $verbosities & $options ?: self::VERBOSITY_NORMAL;
  36684. if ($verbosity > $this->getVerbosity()) {
  36685. return;
  36686. }
  36687. foreach ($messages as $message) {
  36688. switch ($type) {
  36689. case OutputInterface::OUTPUT_NORMAL:
  36690. $message = $this->formatter->format($message);
  36691. break;
  36692. case OutputInterface::OUTPUT_RAW:
  36693. break;
  36694. case OutputInterface::OUTPUT_PLAIN:
  36695. $message = strip_tags($this->formatter->format($message));
  36696. break;
  36697. }
  36698. $this->doWrite($message, $newline);
  36699. }
  36700. }
  36701. abstract protected function doWrite($message, $newline);
  36702. }
  36703. <?php
  36704. namespace Symfony\Component\Console\Output;
  36705. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  36706. interface OutputInterface
  36707. {
  36708. const VERBOSITY_QUIET = 16;
  36709. const VERBOSITY_NORMAL = 32;
  36710. const VERBOSITY_VERBOSE = 64;
  36711. const VERBOSITY_VERY_VERBOSE = 128;
  36712. const VERBOSITY_DEBUG = 256;
  36713. const OUTPUT_NORMAL = 1;
  36714. const OUTPUT_RAW = 2;
  36715. const OUTPUT_PLAIN = 4;
  36716. public function write($messages, $newline = false, $options = 0);
  36717. public function writeln($messages, $options = 0);
  36718. public function setVerbosity($level);
  36719. public function getVerbosity();
  36720. public function setDecorated($decorated);
  36721. public function isDecorated();
  36722. public function setFormatter(OutputFormatterInterface $formatter);
  36723. public function getFormatter();
  36724. }
  36725. <?php
  36726. namespace Symfony\Component\Console\Output;
  36727. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36728. use Symfony\Component\Console\Exception\RuntimeException;
  36729. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  36730. class StreamOutput extends Output
  36731. {
  36732. private $stream;
  36733. public function __construct($stream, $verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  36734. {
  36735. if (!is_resource($stream) || 'stream' !== get_resource_type($stream)) {
  36736. throw new InvalidArgumentException('The StreamOutput class needs a stream as its first argument.');
  36737. }
  36738. $this->stream = $stream;
  36739. if (null === $decorated) {
  36740. $decorated = $this->hasColorSupport();
  36741. }
  36742. parent::__construct($verbosity, $decorated, $formatter);
  36743. }
  36744. public function getStream()
  36745. {
  36746. return $this->stream;
  36747. }
  36748. protected function doWrite($message, $newline)
  36749. {
  36750. if (false === @fwrite($this->stream, $message) || ($newline && (false === @fwrite($this->stream, PHP_EOL)))) {
  36751. throw new RuntimeException('Unable to write output.');
  36752. }
  36753. fflush($this->stream);
  36754. }
  36755. protected function hasColorSupport()
  36756. {
  36757. if ('Hyper' === getenv('TERM_PROGRAM')) {
  36758. return true;
  36759. }
  36760. if (DIRECTORY_SEPARATOR === '\\') {
  36761. return (function_exists('sapi_windows_vt100_support')
  36762. && @sapi_windows_vt100_support($this->stream))
  36763. || false !== getenv('ANSICON')
  36764. || 'ON' === getenv('ConEmuANSI')
  36765. || 'xterm' === getenv('TERM');
  36766. }
  36767. if (function_exists('stream_isatty')) {
  36768. return @stream_isatty($this->stream);
  36769. }
  36770. if (function_exists('posix_isatty')) {
  36771. return @posix_isatty($this->stream);
  36772. }
  36773. $stat = @fstat($this->stream);
  36774. return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
  36775. }
  36776. }
  36777. <?php
  36778. namespace Symfony\Component\Console\Question;
  36779. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36780. class ChoiceQuestion extends Question
  36781. {
  36782. private $choices;
  36783. private $multiselect = false;
  36784. private $prompt = ' > ';
  36785. private $errorMessage = 'Value "%s" is invalid';
  36786. public function __construct($question, array $choices, $default = null)
  36787. {
  36788. if (!$choices) {
  36789. throw new \LogicException('Choice question must have at least 1 choice available.');
  36790. }
  36791. parent::__construct($question, $default);
  36792. $this->choices = $choices;
  36793. $this->setValidator($this->getDefaultValidator());
  36794. $this->setAutocompleterValues($choices);
  36795. }
  36796. public function getChoices()
  36797. {
  36798. return $this->choices;
  36799. }
  36800. public function setMultiselect($multiselect)
  36801. {
  36802. $this->multiselect = $multiselect;
  36803. $this->setValidator($this->getDefaultValidator());
  36804. return $this;
  36805. }
  36806. public function isMultiselect()
  36807. {
  36808. return $this->multiselect;
  36809. }
  36810. public function getPrompt()
  36811. {
  36812. return $this->prompt;
  36813. }
  36814. public function setPrompt($prompt)
  36815. {
  36816. $this->prompt = $prompt;
  36817. return $this;
  36818. }
  36819. public function setErrorMessage($errorMessage)
  36820. {
  36821. $this->errorMessage = $errorMessage;
  36822. $this->setValidator($this->getDefaultValidator());
  36823. return $this;
  36824. }
  36825. private function getDefaultValidator()
  36826. {
  36827. $choices = $this->choices;
  36828. $errorMessage = $this->errorMessage;
  36829. $multiselect = $this->multiselect;
  36830. $isAssoc = $this->isAssoc($choices);
  36831. return function ($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) {
  36832. $selectedChoices = str_replace(' ', '', $selected);
  36833. if ($multiselect) {
  36834. if (!preg_match('/^[^,]+(?:,[^,]+)*$/', $selectedChoices, $matches)) {
  36835. throw new InvalidArgumentException(sprintf($errorMessage, $selected));
  36836. }
  36837. $selectedChoices = explode(',', $selectedChoices);
  36838. } else {
  36839. $selectedChoices = array($selected);
  36840. }
  36841. $multiselectChoices = array();
  36842. foreach ($selectedChoices as $value) {
  36843. $results = array();
  36844. foreach ($choices as $key => $choice) {
  36845. if ($choice === $value) {
  36846. $results[] = $key;
  36847. }
  36848. }
  36849. if (count($results) > 1) {
  36850. throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of %s.', implode(' or ', $results)));
  36851. }
  36852. $result = array_search($value, $choices);
  36853. if (!$isAssoc) {
  36854. if (false !== $result) {
  36855. $result = $choices[$result];
  36856. } elseif (isset($choices[$value])) {
  36857. $result = $choices[$value];
  36858. }
  36859. } elseif (false === $result && isset($choices[$value])) {
  36860. $result = $value;
  36861. }
  36862. if (false === $result) {
  36863. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  36864. }
  36865. $multiselectChoices[] = (string) $result;
  36866. }
  36867. if ($multiselect) {
  36868. return $multiselectChoices;
  36869. }
  36870. return current($multiselectChoices);
  36871. };
  36872. }
  36873. }
  36874. <?php
  36875. namespace Symfony\Component\Console\Question;
  36876. class ConfirmationQuestion extends Question
  36877. {
  36878. private $trueAnswerRegex;
  36879. public function __construct($question, $default = true, $trueAnswerRegex = '/^y/i')
  36880. {
  36881. parent::__construct($question, (bool) $default);
  36882. $this->trueAnswerRegex = $trueAnswerRegex;
  36883. $this->setNormalizer($this->getDefaultNormalizer());
  36884. }
  36885. private function getDefaultNormalizer()
  36886. {
  36887. $default = $this->getDefault();
  36888. $regex = $this->trueAnswerRegex;
  36889. return function ($answer) use ($default, $regex) {
  36890. if (is_bool($answer)) {
  36891. return $answer;
  36892. }
  36893. $answerIsTrue = (bool) preg_match($regex, $answer);
  36894. if (false === $default) {
  36895. return $answer && $answerIsTrue;
  36896. }
  36897. return !$answer || $answerIsTrue;
  36898. };
  36899. }
  36900. }
  36901. <?php
  36902. namespace Symfony\Component\Console\Question;
  36903. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36904. use Symfony\Component\Console\Exception\LogicException;
  36905. class Question
  36906. {
  36907. private $question;
  36908. private $attempts;
  36909. private $hidden = false;
  36910. private $hiddenFallback = true;
  36911. private $autocompleterValues;
  36912. private $validator;
  36913. private $default;
  36914. private $normalizer;
  36915. public function __construct($question, $default = null)
  36916. {
  36917. $this->question = $question;
  36918. $this->default = $default;
  36919. }
  36920. public function getQuestion()
  36921. {
  36922. return $this->question;
  36923. }
  36924. public function getDefault()
  36925. {
  36926. return $this->default;
  36927. }
  36928. public function isHidden()
  36929. {
  36930. return $this->hidden;
  36931. }
  36932. public function setHidden($hidden)
  36933. {
  36934. if ($this->autocompleterValues) {
  36935. throw new LogicException('A hidden question cannot use the autocompleter.');
  36936. }
  36937. $this->hidden = (bool) $hidden;
  36938. return $this;
  36939. }
  36940. public function isHiddenFallback()
  36941. {
  36942. return $this->hiddenFallback;
  36943. }
  36944. public function setHiddenFallback($fallback)
  36945. {
  36946. $this->hiddenFallback = (bool) $fallback;
  36947. return $this;
  36948. }
  36949. public function getAutocompleterValues()
  36950. {
  36951. return $this->autocompleterValues;
  36952. }
  36953. public function setAutocompleterValues($values)
  36954. {
  36955. if (is_array($values)) {
  36956. $values = $this->isAssoc($values) ? array_merge(array_keys($values), array_values($values)) : array_values($values);
  36957. }
  36958. if (null !== $values && !is_array($values) && !$values instanceof \Traversable) {
  36959. throw new InvalidArgumentException('Autocompleter values can be either an array, `null` or a `Traversable` object.');
  36960. }
  36961. if ($this->hidden) {
  36962. throw new LogicException('A hidden question cannot use the autocompleter.');
  36963. }
  36964. $this->autocompleterValues = $values;
  36965. return $this;
  36966. }
  36967. public function setValidator($validator)
  36968. {
  36969. $this->validator = $validator;
  36970. return $this;
  36971. }
  36972. public function getValidator()
  36973. {
  36974. return $this->validator;
  36975. }
  36976. public function setMaxAttempts($attempts)
  36977. {
  36978. if (null !== $attempts && $attempts < 1) {
  36979. throw new InvalidArgumentException('Maximum number of attempts must be a positive value.');
  36980. }
  36981. $this->attempts = $attempts;
  36982. return $this;
  36983. }
  36984. public function getMaxAttempts()
  36985. {
  36986. return $this->attempts;
  36987. }
  36988. public function setNormalizer($normalizer)
  36989. {
  36990. $this->normalizer = $normalizer;
  36991. return $this;
  36992. }
  36993. public function getNormalizer()
  36994. {
  36995. return $this->normalizer;
  36996. }
  36997. protected function isAssoc($array)
  36998. {
  36999. return (bool) count(array_filter(array_keys($array), 'is_string'));
  37000. }
  37001. }
  37002. <?php
  37003. namespace Symfony\Component\Console;
  37004. use Symfony\Component\Console\Exception\RuntimeException;
  37005. use Symfony\Component\Console\Input\StringInput;
  37006. use Symfony\Component\Console\Output\ConsoleOutput;
  37007. use Symfony\Component\Process\ProcessBuilder;
  37008. use Symfony\Component\Process\PhpExecutableFinder;
  37009. class Shell
  37010. {
  37011. private $application;
  37012. private $history;
  37013. private $output;
  37014. private $hasReadline;
  37015. private $processIsolation = false;
  37016. public function __construct(Application $application)
  37017. {
  37018. @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  37019. $this->hasReadline = function_exists('readline');
  37020. $this->application = $application;
  37021. $this->history = getenv('HOME').'/.history_'.$application->getName();
  37022. $this->output = new ConsoleOutput();
  37023. }
  37024. public function run()
  37025. {
  37026. $this->application->setAutoExit(false);
  37027. $this->application->setCatchExceptions(true);
  37028. if ($this->hasReadline) {
  37029. readline_read_history($this->history);
  37030. readline_completion_function(array($this, 'autocompleter'));
  37031. }
  37032. $this->output->writeln($this->getHeader());
  37033. $php = null;
  37034. if ($this->processIsolation) {
  37035. $finder = new PhpExecutableFinder();
  37036. $php = $finder->find();
  37037. $this->output->writeln(<<<'EOF'
  37038. <info>Running with process isolation, you should consider this:</info>
  37039. * each command is executed as separate process,
  37040. * commands don't support interactivity, all params must be passed explicitly,
  37041. * commands output is not colorized.
  37042. EOF
  37043. );
  37044. }
  37045. while (true) {
  37046. $command = $this->readline();
  37047. if (false === $command) {
  37048. $this->output->writeln("\n");
  37049. break;
  37050. }
  37051. if ($this->hasReadline) {
  37052. readline_add_history($command);
  37053. readline_write_history($this->history);
  37054. }
  37055. if ($this->processIsolation) {
  37056. $pb = new ProcessBuilder();
  37057. $process = $pb
  37058. ->add($php)
  37059. ->add($_SERVER['argv'][0])
  37060. ->add($command)
  37061. ->inheritEnvironmentVariables(true)
  37062. ->getProcess()
  37063. ;
  37064. $output = $this->output;
  37065. $process->run(function ($type, $data) use ($output) {
  37066. $output->writeln($data);
  37067. });
  37068. $ret = $process->getExitCode();
  37069. } else {
  37070. $ret = $this->application->run(new StringInput($command), $this->output);
  37071. }
  37072. if (0 !== $ret) {
  37073. $this->output->writeln(sprintf('<error>The command terminated with an error status (%s)</error>', $ret));
  37074. }
  37075. }
  37076. }
  37077. protected function getHeader()
  37078. {
  37079. return <<<EOF
  37080. Welcome to the <info>{$this->application->getName()}</info> shell (<comment>{$this->application->getVersion()}</comment>).
  37081. At the prompt, type <comment>help</comment> for some help,
  37082. or <comment>list</comment> to get a list of available commands.
  37083. To exit the shell, type <comment>^D</comment>.
  37084. EOF;
  37085. }
  37086. protected function getPrompt()
  37087. {
  37088. return $this->output->getFormatter()->format($this->application->getName().' > ');
  37089. }
  37090. protected function getOutput()
  37091. {
  37092. return $this->output;
  37093. }
  37094. protected function getApplication()
  37095. {
  37096. return $this->application;
  37097. }
  37098. private function autocompleter($text)
  37099. {
  37100. $info = readline_info();
  37101. $text = substr($info['line_buffer'], 0, $info['end']);
  37102. if ($info['point'] !== $info['end']) {
  37103. return true;
  37104. }
  37105. if (false === strpos($text, ' ') || !$text) {
  37106. return array_keys($this->application->all());
  37107. }
  37108. try {
  37109. $command = $this->application->find(substr($text, 0, strpos($text, ' ')));
  37110. } catch (\Exception $e) {
  37111. return true;
  37112. }
  37113. $list = array('--help');
  37114. foreach ($command->getDefinition()->getOptions() as $option) {
  37115. $list[] = '--'.$option->getName();
  37116. }
  37117. return $list;
  37118. }
  37119. private function readline()
  37120. {
  37121. if ($this->hasReadline) {
  37122. $line = readline($this->getPrompt());
  37123. } else {
  37124. $this->output->write($this->getPrompt());
  37125. $line = fgets(STDIN, 1024);
  37126. $line = (false === $line || '' === $line) ? false : rtrim($line);
  37127. }
  37128. return $line;
  37129. }
  37130. public function getProcessIsolation()
  37131. {
  37132. return $this->processIsolation;
  37133. }
  37134. public function setProcessIsolation($processIsolation)
  37135. {
  37136. $this->processIsolation = (bool) $processIsolation;
  37137. if ($this->processIsolation && !class_exists('Symfony\\Component\\Process\\Process')) {
  37138. throw new RuntimeException('Unable to isolate processes as the Symfony Process Component is not installed.');
  37139. }
  37140. }
  37141. }
  37142. <?php
  37143. namespace Symfony\Component\Console\Style;
  37144. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  37145. use Symfony\Component\Console\Helper\ProgressBar;
  37146. use Symfony\Component\Console\Output\OutputInterface;
  37147. abstract class OutputStyle implements OutputInterface, StyleInterface
  37148. {
  37149. private $output;
  37150. public function __construct(OutputInterface $output)
  37151. {
  37152. $this->output = $output;
  37153. }
  37154. public function newLine($count = 1)
  37155. {
  37156. $this->output->write(str_repeat(PHP_EOL, $count));
  37157. }
  37158. public function createProgressBar($max = 0)
  37159. {
  37160. return new ProgressBar($this->output, $max);
  37161. }
  37162. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  37163. {
  37164. $this->output->write($messages, $newline, $type);
  37165. }
  37166. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  37167. {
  37168. $this->output->writeln($messages, $type);
  37169. }
  37170. public function setVerbosity($level)
  37171. {
  37172. $this->output->setVerbosity($level);
  37173. }
  37174. public function getVerbosity()
  37175. {
  37176. return $this->output->getVerbosity();
  37177. }
  37178. public function setDecorated($decorated)
  37179. {
  37180. $this->output->setDecorated($decorated);
  37181. }
  37182. public function isDecorated()
  37183. {
  37184. return $this->output->isDecorated();
  37185. }
  37186. public function setFormatter(OutputFormatterInterface $formatter)
  37187. {
  37188. $this->output->setFormatter($formatter);
  37189. }
  37190. public function getFormatter()
  37191. {
  37192. return $this->output->getFormatter();
  37193. }
  37194. }
  37195. <?php
  37196. namespace Symfony\Component\Console\Style;
  37197. interface StyleInterface
  37198. {
  37199. public function title($message);
  37200. public function section($message);
  37201. public function listing(array $elements);
  37202. public function text($message);
  37203. public function success($message);
  37204. public function error($message);
  37205. public function warning($message);
  37206. public function note($message);
  37207. public function caution($message);
  37208. public function table(array $headers, array $rows);
  37209. public function ask($question, $default = null, $validator = null);
  37210. public function askHidden($question, $validator = null);
  37211. public function confirm($question, $default = true);
  37212. public function choice($question, array $choices, $default = null);
  37213. public function newLine($count = 1);
  37214. public function progressStart($max = 0);
  37215. public function progressAdvance($step = 1);
  37216. public function progressFinish();
  37217. }
  37218. <?php
  37219. namespace Symfony\Component\Console\Style;
  37220. use Symfony\Component\Console\Application;
  37221. use Symfony\Component\Console\Exception\RuntimeException;
  37222. use Symfony\Component\Console\Formatter\OutputFormatter;
  37223. use Symfony\Component\Console\Helper\Helper;
  37224. use Symfony\Component\Console\Helper\ProgressBar;
  37225. use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
  37226. use Symfony\Component\Console\Helper\Table;
  37227. use Symfony\Component\Console\Input\InputInterface;
  37228. use Symfony\Component\Console\Output\BufferedOutput;
  37229. use Symfony\Component\Console\Output\OutputInterface;
  37230. use Symfony\Component\Console\Question\ChoiceQuestion;
  37231. use Symfony\Component\Console\Question\ConfirmationQuestion;
  37232. use Symfony\Component\Console\Question\Question;
  37233. class SymfonyStyle extends OutputStyle
  37234. {
  37235. const MAX_LINE_LENGTH = 120;
  37236. private $input;
  37237. private $questionHelper;
  37238. private $progressBar;
  37239. private $lineLength;
  37240. private $bufferedOutput;
  37241. public function __construct(InputInterface $input, OutputInterface $output)
  37242. {
  37243. $this->input = $input;
  37244. $this->bufferedOutput = new BufferedOutput($output->getVerbosity(), false, clone $output->getFormatter());
  37245. $this->lineLength = min($this->getTerminalWidth() - (int) (DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH);
  37246. parent::__construct($output);
  37247. }
  37248. public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false)
  37249. {
  37250. $messages = is_array($messages) ? array_values($messages) : array($messages);
  37251. $this->autoPrependBlock();
  37252. $this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, true));
  37253. $this->newLine();
  37254. }
  37255. public function title($message)
  37256. {
  37257. $this->autoPrependBlock();
  37258. $this->writeln(array(
  37259. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  37260. sprintf('<comment>%s</>', str_repeat('=', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  37261. ));
  37262. $this->newLine();
  37263. }
  37264. public function section($message)
  37265. {
  37266. $this->autoPrependBlock();
  37267. $this->writeln(array(
  37268. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  37269. sprintf('<comment>%s</>', str_repeat('-', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  37270. ));
  37271. $this->newLine();
  37272. }
  37273. public function listing(array $elements)
  37274. {
  37275. $this->autoPrependText();
  37276. $elements = array_map(function ($element) {
  37277. return sprintf(' * %s', $element);
  37278. }, $elements);
  37279. $this->writeln($elements);
  37280. $this->newLine();
  37281. }
  37282. public function text($message)
  37283. {
  37284. $this->autoPrependText();
  37285. $messages = is_array($message) ? array_values($message) : array($message);
  37286. foreach ($messages as $message) {
  37287. $this->writeln(sprintf(' %s', $message));
  37288. }
  37289. }
  37290. public function comment($message)
  37291. {
  37292. $messages = is_array($message) ? array_values($message) : array($message);
  37293. $this->autoPrependBlock();
  37294. $this->writeln($this->createBlock($messages, null, null, '<fg=default;bg=default> // </>'));
  37295. $this->newLine();
  37296. }
  37297. public function success($message)
  37298. {
  37299. $this->block($message, 'OK', 'fg=black;bg=green', ' ', true);
  37300. }
  37301. public function error($message)
  37302. {
  37303. $this->block($message, 'ERROR', 'fg=white;bg=red', ' ', true);
  37304. }
  37305. public function warning($message)
  37306. {
  37307. $this->block($message, 'WARNING', 'fg=white;bg=red', ' ', true);
  37308. }
  37309. public function note($message)
  37310. {
  37311. $this->block($message, 'NOTE', 'fg=yellow', ' ! ');
  37312. }
  37313. public function caution($message)
  37314. {
  37315. $this->block($message, 'CAUTION', 'fg=white;bg=red', ' ! ', true);
  37316. }
  37317. public function table(array $headers, array $rows)
  37318. {
  37319. $style = clone Table::getStyleDefinition('symfony-style-guide');
  37320. $style->setCellHeaderFormat('<info>%s</info>');
  37321. $table = new Table($this);
  37322. $table->setHeaders($headers);
  37323. $table->setRows($rows);
  37324. $table->setStyle($style);
  37325. $table->render();
  37326. $this->newLine();
  37327. }
  37328. public function ask($question, $default = null, $validator = null)
  37329. {
  37330. $question = new Question($question, $default);
  37331. $question->setValidator($validator);
  37332. return $this->askQuestion($question);
  37333. }
  37334. public function askHidden($question, $validator = null)
  37335. {
  37336. $question = new Question($question);
  37337. $question->setHidden(true);
  37338. $question->setValidator($validator);
  37339. return $this->askQuestion($question);
  37340. }
  37341. public function confirm($question, $default = true)
  37342. {
  37343. return $this->askQuestion(new ConfirmationQuestion($question, $default));
  37344. }
  37345. public function choice($question, array $choices, $default = null)
  37346. {
  37347. if (null !== $default) {
  37348. $values = array_flip($choices);
  37349. $default = $values[$default];
  37350. }
  37351. return $this->askQuestion(new ChoiceQuestion($question, $choices, $default));
  37352. }
  37353. public function progressStart($max = 0)
  37354. {
  37355. $this->progressBar = $this->createProgressBar($max);
  37356. $this->progressBar->start();
  37357. }
  37358. public function progressAdvance($step = 1)
  37359. {
  37360. $this->getProgressBar()->advance($step);
  37361. }
  37362. public function progressFinish()
  37363. {
  37364. $this->getProgressBar()->finish();
  37365. $this->newLine(2);
  37366. $this->progressBar = null;
  37367. }
  37368. public function createProgressBar($max = 0)
  37369. {
  37370. $progressBar = parent::createProgressBar($max);
  37371. if ('\\' !== DIRECTORY_SEPARATOR || 'Hyper' === getenv('TERM_PROGRAM')) {
  37372. $progressBar->setEmptyBarCharacter('â–‘');
  37373. $progressBar->setProgressCharacter('');
  37374. $progressBar->setBarCharacter('â–“');
  37375. }
  37376. return $progressBar;
  37377. }
  37378. public function askQuestion(Question $question)
  37379. {
  37380. if ($this->input->isInteractive()) {
  37381. $this->autoPrependBlock();
  37382. }
  37383. if (!$this->questionHelper) {
  37384. $this->questionHelper = new SymfonyQuestionHelper();
  37385. }
  37386. $answer = $this->questionHelper->ask($this->input, $this, $question);
  37387. if ($this->input->isInteractive()) {
  37388. $this->newLine();
  37389. $this->bufferedOutput->write("\n");
  37390. }
  37391. return $answer;
  37392. }
  37393. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  37394. {
  37395. parent::writeln($messages, $type);
  37396. $this->bufferedOutput->writeln($this->reduceBuffer($messages), $type);
  37397. }
  37398. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  37399. {
  37400. parent::write($messages, $newline, $type);
  37401. $this->bufferedOutput->write($this->reduceBuffer($messages), $newline, $type);
  37402. }
  37403. public function newLine($count = 1)
  37404. {
  37405. parent::newLine($count);
  37406. $this->bufferedOutput->write(str_repeat("\n", $count));
  37407. }
  37408. private function getProgressBar()
  37409. {
  37410. if (!$this->progressBar) {
  37411. throw new RuntimeException('The ProgressBar is not started.');
  37412. }
  37413. return $this->progressBar;
  37414. }
  37415. private function getTerminalWidth()
  37416. {
  37417. $application = new Application();
  37418. $dimensions = $application->getTerminalDimensions();
  37419. return $dimensions[0] ?: self::MAX_LINE_LENGTH;
  37420. }
  37421. private function autoPrependBlock()
  37422. {
  37423. $chars = substr(str_replace(PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
  37424. if (!isset($chars[0])) {
  37425. return $this->newLine();
  37426. }
  37427. $this->newLine(2 - substr_count($chars, "\n"));
  37428. }
  37429. private function autoPrependText()
  37430. {
  37431. $fetched = $this->bufferedOutput->fetch();
  37432. if ("\n" !== substr($fetched, -1)) {
  37433. $this->newLine();
  37434. }
  37435. }
  37436. private function reduceBuffer($messages)
  37437. {
  37438. return array_map(function ($value) {
  37439. return substr($value, -4);
  37440. }, array_merge(array($this->bufferedOutput->fetch()), (array) $messages));
  37441. }
  37442. private function createBlock($messages, $type = null, $style = null, $prefix = ' ', $padding = false, $escape = false)
  37443. {
  37444. $indentLength = 0;
  37445. $prefixLength = Helper::strlenWithoutDecoration($this->getFormatter(), $prefix);
  37446. $lines = array();
  37447. if (null !== $type) {
  37448. $type = sprintf('[%s] ', $type);
  37449. $indentLength = strlen($type);
  37450. $lineIndentation = str_repeat(' ', $indentLength);
  37451. }
  37452. foreach ($messages as $key => $message) {
  37453. if ($escape) {
  37454. $message = OutputFormatter::escape($message);
  37455. }
  37456. $lines = array_merge($lines, explode(PHP_EOL, wordwrap($message, $this->lineLength - $prefixLength - $indentLength, PHP_EOL, true)));
  37457. if (count($messages) > 1 && $key < count($messages) - 1) {
  37458. $lines[] = '';
  37459. }
  37460. }
  37461. $firstLineIndex = 0;
  37462. if ($padding && $this->isDecorated()) {
  37463. $firstLineIndex = 1;
  37464. array_unshift($lines, '');
  37465. $lines[] = '';
  37466. }
  37467. foreach ($lines as $i => &$line) {
  37468. if (null !== $type) {
  37469. $line = $firstLineIndex === $i ? $type.$line : $lineIndentation.$line;
  37470. }
  37471. $line = $prefix.$line;
  37472. $line .= str_repeat(' ', $this->lineLength - Helper::strlenWithoutDecoration($this->getFormatter(), $line));
  37473. if ($style) {
  37474. $line = sprintf('<%s>%s</>', $style, $line);
  37475. }
  37476. }
  37477. return $lines;
  37478. }
  37479. }
  37480. <?php
  37481. namespace Symfony\Component\Console\Tester;
  37482. use Symfony\Component\Console\Application;
  37483. use Symfony\Component\Console\Input\ArrayInput;
  37484. use Symfony\Component\Console\Input\InputInterface;
  37485. use Symfony\Component\Console\Output\OutputInterface;
  37486. use Symfony\Component\Console\Output\StreamOutput;
  37487. class ApplicationTester
  37488. {
  37489. private $application;
  37490. private $input;
  37491. private $output;
  37492. private $statusCode;
  37493. public function __construct(Application $application)
  37494. {
  37495. $this->application = $application;
  37496. }
  37497. public function run(array $input, $options = array())
  37498. {
  37499. $this->input = new ArrayInput($input);
  37500. if (isset($options['interactive'])) {
  37501. $this->input->setInteractive($options['interactive']);
  37502. }
  37503. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  37504. if (isset($options['decorated'])) {
  37505. $this->output->setDecorated($options['decorated']);
  37506. }
  37507. if (isset($options['verbosity'])) {
  37508. $this->output->setVerbosity($options['verbosity']);
  37509. }
  37510. return $this->statusCode = $this->application->run($this->input, $this->output);
  37511. }
  37512. public function getDisplay($normalize = false)
  37513. {
  37514. rewind($this->output->getStream());
  37515. $display = stream_get_contents($this->output->getStream());
  37516. if ($normalize) {
  37517. $display = str_replace(PHP_EOL, "\n", $display);
  37518. }
  37519. return $display;
  37520. }
  37521. public function getInput()
  37522. {
  37523. return $this->input;
  37524. }
  37525. public function getOutput()
  37526. {
  37527. return $this->output;
  37528. }
  37529. public function getStatusCode()
  37530. {
  37531. return $this->statusCode;
  37532. }
  37533. }
  37534. <?php
  37535. namespace Symfony\Component\Console\Tester;
  37536. use Symfony\Component\Console\Command\Command;
  37537. use Symfony\Component\Console\Input\ArrayInput;
  37538. use Symfony\Component\Console\Output\StreamOutput;
  37539. use Symfony\Component\Console\Input\InputInterface;
  37540. use Symfony\Component\Console\Output\OutputInterface;
  37541. class CommandTester
  37542. {
  37543. private $command;
  37544. private $input;
  37545. private $output;
  37546. private $statusCode;
  37547. public function __construct(Command $command)
  37548. {
  37549. $this->command = $command;
  37550. }
  37551. public function execute(array $input, array $options = array())
  37552. {
  37553. if (!isset($input['command'])
  37554. && (null !== $application = $this->command->getApplication())
  37555. && $application->getDefinition()->hasArgument('command')
  37556. ) {
  37557. $input = array_merge(array('command' => $this->command->getName()), $input);
  37558. }
  37559. $this->input = new ArrayInput($input);
  37560. if (isset($options['interactive'])) {
  37561. $this->input->setInteractive($options['interactive']);
  37562. }
  37563. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  37564. $this->output->setDecorated(isset($options['decorated']) ? $options['decorated'] : false);
  37565. if (isset($options['verbosity'])) {
  37566. $this->output->setVerbosity($options['verbosity']);
  37567. }
  37568. return $this->statusCode = $this->command->run($this->input, $this->output);
  37569. }
  37570. public function getDisplay($normalize = false)
  37571. {
  37572. rewind($this->output->getStream());
  37573. $display = stream_get_contents($this->output->getStream());
  37574. if ($normalize) {
  37575. $display = str_replace(PHP_EOL, "\n", $display);
  37576. }
  37577. return $display;
  37578. }
  37579. public function getInput()
  37580. {
  37581. return $this->input;
  37582. }
  37583. public function getOutput()
  37584. {
  37585. return $this->output;
  37586. }
  37587. public function getStatusCode()
  37588. {
  37589. return $this->statusCode;
  37590. }
  37591. }
  37592. <?php
  37593. namespace Symfony\Component\Debug;
  37594. use Psr\Log\AbstractLogger;
  37595. class BufferingLogger extends AbstractLogger
  37596. {
  37597. private $logs = array();
  37598. public function log($level, $message, array $context = array())
  37599. {
  37600. $this->logs[] = array($level, $message, $context);
  37601. }
  37602. public function cleanLogs()
  37603. {
  37604. $logs = $this->logs;
  37605. $this->logs = array();
  37606. return $logs;
  37607. }
  37608. }
  37609. <?php
  37610. namespace Symfony\Component\Debug;
  37611. class Debug
  37612. {
  37613. private static $enabled = false;
  37614. public static function enable($errorReportingLevel = null, $displayErrors = true)
  37615. {
  37616. if (static::$enabled) {
  37617. return;
  37618. }
  37619. static::$enabled = true;
  37620. if (null !== $errorReportingLevel) {
  37621. error_reporting($errorReportingLevel);
  37622. } else {
  37623. error_reporting(-1);
  37624. }
  37625. if (!\in_array(PHP_SAPI, array('cli', 'phpdbg'), true)) {
  37626. ini_set('display_errors', 0);
  37627. ExceptionHandler::register();
  37628. } elseif ($displayErrors && (!ini_get('log_errors') || ini_get('error_log'))) {
  37629. ini_set('display_errors', 1);
  37630. }
  37631. if ($displayErrors) {
  37632. ErrorHandler::register(new ErrorHandler(new BufferingLogger()));
  37633. } else {
  37634. ErrorHandler::register()->throwAt(0, true);
  37635. }
  37636. DebugClassLoader::enable();
  37637. }
  37638. }
  37639. <?php
  37640. namespace Symfony\Component\Debug;
  37641. class DebugClassLoader
  37642. {
  37643. private $classLoader;
  37644. private $isFinder;
  37645. private $loaded = array();
  37646. private $wasFinder;
  37647. private static $caseCheck;
  37648. private static $deprecated = array();
  37649. private static $php7Reserved = array('int', 'float', 'bool', 'string', 'true', 'false', 'null');
  37650. private static $darwinCache = array('/' => array('/', array()));
  37651. public function __construct($classLoader)
  37652. {
  37653. $this->wasFinder = is_object($classLoader) && method_exists($classLoader, 'findFile');
  37654. if ($this->wasFinder) {
  37655. @trigger_error('The '.__METHOD__.' method will no longer support receiving an object into its $classLoader argument in 3.0.', E_USER_DEPRECATED);
  37656. $this->classLoader = array($classLoader, 'loadClass');
  37657. $this->isFinder = true;
  37658. } else {
  37659. $this->classLoader = $classLoader;
  37660. $this->isFinder = is_array($classLoader) && method_exists($classLoader[0], 'findFile');
  37661. }
  37662. if (!isset(self::$caseCheck)) {
  37663. $file = file_exists(__FILE__) ? __FILE__ : rtrim(realpath('.'), DIRECTORY_SEPARATOR);
  37664. $i = strrpos($file, DIRECTORY_SEPARATOR);
  37665. $dir = substr($file, 0, 1 + $i);
  37666. $file = substr($file, 1 + $i);
  37667. $test = strtoupper($file) === $file ? strtolower($file) : strtoupper($file);
  37668. $test = realpath($dir.$test);
  37669. if (false === $test || false === $i) {
  37670. self::$caseCheck = 0;
  37671. } elseif (substr($test, -strlen($file)) === $file) {
  37672. self::$caseCheck = 1;
  37673. } elseif (false !== stripos(PHP_OS, 'darwin')) {
  37674. self::$caseCheck = 2;
  37675. } else {
  37676. self::$caseCheck = 0;
  37677. }
  37678. }
  37679. }
  37680. public function getClassLoader()
  37681. {
  37682. return $this->wasFinder ? $this->classLoader[0] : $this->classLoader;
  37683. }
  37684. public static function enable()
  37685. {
  37686. class_exists('Symfony\Component\Debug\ErrorHandler');
  37687. class_exists('Psr\Log\LogLevel');
  37688. if (!is_array($functions = spl_autoload_functions())) {
  37689. return;
  37690. }
  37691. foreach ($functions as $function) {
  37692. spl_autoload_unregister($function);
  37693. }
  37694. foreach ($functions as $function) {
  37695. if (!is_array($function) || !$function[0] instanceof self) {
  37696. $function = array(new static($function), 'loadClass');
  37697. }
  37698. spl_autoload_register($function);
  37699. }
  37700. }
  37701. public static function disable()
  37702. {
  37703. if (!is_array($functions = spl_autoload_functions())) {
  37704. return;
  37705. }
  37706. foreach ($functions as $function) {
  37707. spl_autoload_unregister($function);
  37708. }
  37709. foreach ($functions as $function) {
  37710. if (is_array($function) && $function[0] instanceof self) {
  37711. $function = $function[0]->getClassLoader();
  37712. }
  37713. spl_autoload_register($function);
  37714. }
  37715. }
  37716. public function findFile($class)
  37717. {
  37718. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  37719. if ($this->wasFinder) {
  37720. return $this->classLoader[0]->findFile($class);
  37721. }
  37722. }
  37723. public function loadClass($class)
  37724. {
  37725. ErrorHandler::stackErrors();
  37726. try {
  37727. if ($this->isFinder && !isset($this->loaded[$class])) {
  37728. $this->loaded[$class] = true;
  37729. if ($file = $this->classLoader[0]->findFile($class)) {
  37730. require $file;
  37731. }
  37732. } else {
  37733. call_user_func($this->classLoader, $class);
  37734. $file = false;
  37735. }
  37736. } catch (\Exception $e) {
  37737. ErrorHandler::unstackErrors();
  37738. throw $e;
  37739. } catch (\Throwable $e) {
  37740. ErrorHandler::unstackErrors();
  37741. throw $e;
  37742. }
  37743. ErrorHandler::unstackErrors();
  37744. $exists = class_exists($class, false) || interface_exists($class, false) || (function_exists('trait_exists') && trait_exists($class, false));
  37745. if ($class && '\\' === $class[0]) {
  37746. $class = substr($class, 1);
  37747. }
  37748. if ($exists) {
  37749. $refl = new \ReflectionClass($class);
  37750. $name = $refl->getName();
  37751. if ($name !== $class && 0 === strcasecmp($name, $class)) {
  37752. throw new \RuntimeException(sprintf('Case mismatch between loaded and declared class names: %s vs %s', $class, $name));
  37753. }
  37754. if (in_array(strtolower($refl->getShortName()), self::$php7Reserved)) {
  37755. @trigger_error(sprintf('%s uses a reserved class name (%s) that will break on PHP 7 and higher', $name, $refl->getShortName()), E_USER_DEPRECATED);
  37756. } elseif (preg_match('#\n \* @deprecated (.*?)\r?\n \*(?: @|/$)#s', $refl->getDocComment(), $notice)) {
  37757. self::$deprecated[$name] = preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]);
  37758. } else {
  37759. if (2 > $len = 1 + (strpos($name, '\\') ?: strpos($name, '_'))) {
  37760. $len = 0;
  37761. $ns = '';
  37762. } else {
  37763. $ns = substr($name, 0, $len);
  37764. }
  37765. $parent = get_parent_class($class);
  37766. if (!$parent || strncmp($ns, $parent, $len)) {
  37767. if ($parent && isset(self::$deprecated[$parent]) && strncmp($ns, $parent, $len)) {
  37768. @trigger_error(sprintf('The %s class extends %s that is deprecated %s', $name, $parent, self::$deprecated[$parent]), E_USER_DEPRECATED);
  37769. }
  37770. $parentInterfaces = array();
  37771. $deprecatedInterfaces = array();
  37772. if ($parent) {
  37773. foreach (class_implements($parent) as $interface) {
  37774. $parentInterfaces[$interface] = 1;
  37775. }
  37776. }
  37777. foreach ($refl->getInterfaceNames() as $interface) {
  37778. if (isset(self::$deprecated[$interface]) && strncmp($ns, $interface, $len)) {
  37779. $deprecatedInterfaces[] = $interface;
  37780. }
  37781. foreach (class_implements($interface) as $interface) {
  37782. $parentInterfaces[$interface] = 1;
  37783. }
  37784. }
  37785. foreach ($deprecatedInterfaces as $interface) {
  37786. if (!isset($parentInterfaces[$interface])) {
  37787. @trigger_error(sprintf('The %s %s %s that is deprecated %s', $name, $refl->isInterface() ? 'interface extends' : 'class implements', $interface, self::$deprecated[$interface]), E_USER_DEPRECATED);
  37788. }
  37789. }
  37790. }
  37791. }
  37792. }
  37793. if ($file) {
  37794. if (!$exists) {
  37795. if (false !== strpos($class, '/')) {
  37796. throw new \RuntimeException(sprintf('Trying to autoload a class with an invalid name "%s". Be careful that the namespace separator is "\" in PHP, not "/".', $class));
  37797. }
  37798. throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.', $class, $file));
  37799. }
  37800. if (self::$caseCheck) {
  37801. $real = explode('\\', $class.strrchr($file, '.'));
  37802. $tail = explode(DIRECTORY_SEPARATOR, str_replace('/', DIRECTORY_SEPARATOR, $file));
  37803. $i = count($tail) - 1;
  37804. $j = count($real) - 1;
  37805. while (isset($tail[$i], $real[$j]) && $tail[$i] === $real[$j]) {
  37806. --$i;
  37807. --$j;
  37808. }
  37809. array_splice($tail, 0, $i + 1);
  37810. }
  37811. if (self::$caseCheck && $tail) {
  37812. $tail = DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR, $tail);
  37813. $tailLen = strlen($tail);
  37814. $real = $refl->getFileName();
  37815. if (2 === self::$caseCheck) {
  37816. $i = 1 + strrpos($real, '/');
  37817. $file = substr($real, $i);
  37818. $real = substr($real, 0, $i);
  37819. if (isset(self::$darwinCache[$real])) {
  37820. $kDir = $real;
  37821. } else {
  37822. $kDir = strtolower($real);
  37823. if (isset(self::$darwinCache[$kDir])) {
  37824. $real = self::$darwinCache[$kDir][0];
  37825. } else {
  37826. $dir = getcwd();
  37827. chdir($real);
  37828. $real = getcwd().'/';
  37829. chdir($dir);
  37830. $dir = $real;
  37831. $k = $kDir;
  37832. $i = strlen($dir) - 1;
  37833. while (!isset(self::$darwinCache[$k])) {
  37834. self::$darwinCache[$k] = array($dir, array());
  37835. self::$darwinCache[$dir] = &self::$darwinCache[$k];
  37836. while ('/' !== $dir[--$i]) {
  37837. }
  37838. $k = substr($k, 0, ++$i);
  37839. $dir = substr($dir, 0, $i--);
  37840. }
  37841. }
  37842. }
  37843. $dirFiles = self::$darwinCache[$kDir][1];
  37844. if (isset($dirFiles[$file])) {
  37845. $kFile = $file;
  37846. } else {
  37847. $kFile = strtolower($file);
  37848. if (!isset($dirFiles[$kFile])) {
  37849. foreach (scandir($real, 2) as $f) {
  37850. if ('.' !== $f[0]) {
  37851. $dirFiles[$f] = $f;
  37852. if ($f === $file) {
  37853. $kFile = $k = $file;
  37854. } elseif ($f !== $k = strtolower($f)) {
  37855. $dirFiles[$k] = $f;
  37856. }
  37857. }
  37858. }
  37859. self::$darwinCache[$kDir][1] = $dirFiles;
  37860. }
  37861. }
  37862. $real .= $dirFiles[$kFile];
  37863. }
  37864. if (0 === substr_compare($real, $tail, -$tailLen, $tailLen, true)
  37865. && 0 !== substr_compare($real, $tail, -$tailLen, $tailLen, false)
  37866. ) {
  37867. throw new \RuntimeException(sprintf('Case mismatch between class and real file names: %s vs %s in %s', substr($tail, -$tailLen + 1), substr($real, -$tailLen + 1), substr($real, 0, -$tailLen + 1)));
  37868. }
  37869. }
  37870. return true;
  37871. }
  37872. }
  37873. }
  37874. <?php
  37875. namespace Symfony\Component\Debug;
  37876. use Psr\Log\LogLevel;
  37877. use Psr\Log\LoggerInterface;
  37878. use Symfony\Component\Debug\Exception\ContextErrorException;
  37879. use Symfony\Component\Debug\Exception\FatalErrorException;
  37880. use Symfony\Component\Debug\Exception\FatalThrowableError;
  37881. use Symfony\Component\Debug\Exception\OutOfMemoryException;
  37882. use Symfony\Component\Debug\FatalErrorHandler\UndefinedFunctionFatalErrorHandler;
  37883. use Symfony\Component\Debug\FatalErrorHandler\UndefinedMethodFatalErrorHandler;
  37884. use Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler;
  37885. use Symfony\Component\Debug\FatalErrorHandler\FatalErrorHandlerInterface;
  37886. class ErrorHandler
  37887. {
  37888. const TYPE_DEPRECATION = -100;
  37889. private $levels = array(
  37890. E_DEPRECATED => 'Deprecated',
  37891. E_USER_DEPRECATED => 'User Deprecated',
  37892. E_NOTICE => 'Notice',
  37893. E_USER_NOTICE => 'User Notice',
  37894. E_STRICT => 'Runtime Notice',
  37895. E_WARNING => 'Warning',
  37896. E_USER_WARNING => 'User Warning',
  37897. E_COMPILE_WARNING => 'Compile Warning',
  37898. E_CORE_WARNING => 'Core Warning',
  37899. E_USER_ERROR => 'User Error',
  37900. E_RECOVERABLE_ERROR => 'Catchable Fatal Error',
  37901. E_COMPILE_ERROR => 'Compile Error',
  37902. E_PARSE => 'Parse Error',
  37903. E_ERROR => 'Error',
  37904. E_CORE_ERROR => 'Core Error',
  37905. );
  37906. private $loggers = array(
  37907. E_DEPRECATED => array(null, LogLevel::INFO),
  37908. E_USER_DEPRECATED => array(null, LogLevel::INFO),
  37909. E_NOTICE => array(null, LogLevel::WARNING),
  37910. E_USER_NOTICE => array(null, LogLevel::WARNING),
  37911. E_STRICT => array(null, LogLevel::WARNING),
  37912. E_WARNING => array(null, LogLevel::WARNING),
  37913. E_USER_WARNING => array(null, LogLevel::WARNING),
  37914. E_COMPILE_WARNING => array(null, LogLevel::WARNING),
  37915. E_CORE_WARNING => array(null, LogLevel::WARNING),
  37916. E_USER_ERROR => array(null, LogLevel::CRITICAL),
  37917. E_RECOVERABLE_ERROR => array(null, LogLevel::CRITICAL),
  37918. E_COMPILE_ERROR => array(null, LogLevel::CRITICAL),
  37919. E_PARSE => array(null, LogLevel::CRITICAL),
  37920. E_ERROR => array(null, LogLevel::CRITICAL),
  37921. E_CORE_ERROR => array(null, LogLevel::CRITICAL),
  37922. );
  37923. private $thrownErrors = 0x1FFF;
  37924. private $scopedErrors = 0x1FFF;
  37925. private $tracedErrors = 0x77FB;
  37926. private $screamedErrors = 0x55;
  37927. private $loggedErrors = 0;
  37928. private $loggedTraces = array();
  37929. private $isRecursive = 0;
  37930. private $isRoot = false;
  37931. private $exceptionHandler;
  37932. private $bootstrappingLogger;
  37933. private static $reservedMemory;
  37934. private static $stackedErrors = array();
  37935. private static $stackedErrorLevels = array();
  37936. private static $toStringException = null;
  37937. private static $exitCode = 0;
  37938. private $displayErrors = 0x1FFF;
  37939. public static function register($handler = null, $replace = true)
  37940. {
  37941. if (null === self::$reservedMemory) {
  37942. self::$reservedMemory = str_repeat('x', 10240);
  37943. register_shutdown_function(__CLASS__.'::handleFatalError');
  37944. }
  37945. $levels = -1;
  37946. if ($handlerIsNew = !$handler instanceof self) {
  37947. if (null !== $handler) {
  37948. $levels = $replace ? $handler : 0;
  37949. $replace = true;
  37950. }
  37951. $handler = new static();
  37952. }
  37953. if (null === $prev = set_error_handler(array($handler, 'handleError'))) {
  37954. restore_error_handler();
  37955. set_error_handler(array($handler, 'handleError'), $handler->thrownErrors | $handler->loggedErrors);
  37956. $handler->isRoot = true;
  37957. }
  37958. if ($handlerIsNew && is_array($prev) && $prev[0] instanceof self) {
  37959. $handler = $prev[0];
  37960. $replace = false;
  37961. }
  37962. if (!$replace && $prev) {
  37963. restore_error_handler();
  37964. $handlerIsRegistered = is_array($prev) && $handler === $prev[0];
  37965. } else {
  37966. $handlerIsRegistered = true;
  37967. }
  37968. if (is_array($prev = set_exception_handler(array($handler, 'handleException'))) && $prev[0] instanceof self) {
  37969. restore_exception_handler();
  37970. if (!$handlerIsRegistered) {
  37971. $handler = $prev[0];
  37972. } elseif ($handler !== $prev[0] && $replace) {
  37973. set_exception_handler(array($handler, 'handleException'));
  37974. $p = $prev[0]->setExceptionHandler(null);
  37975. $handler->setExceptionHandler($p);
  37976. $prev[0]->setExceptionHandler($p);
  37977. }
  37978. } else {
  37979. $handler->setExceptionHandler($prev);
  37980. }
  37981. $handler->throwAt($levels & $handler->thrownErrors, true);
  37982. return $handler;
  37983. }
  37984. public function __construct(BufferingLogger $bootstrappingLogger = null)
  37985. {
  37986. if ($bootstrappingLogger) {
  37987. $this->bootstrappingLogger = $bootstrappingLogger;
  37988. $this->setDefaultLogger($bootstrappingLogger);
  37989. }
  37990. }
  37991. public function setDefaultLogger(LoggerInterface $logger, $levels = null, $replace = false)
  37992. {
  37993. $loggers = array();
  37994. if (is_array($levels)) {
  37995. foreach ($levels as $type => $logLevel) {
  37996. if (empty($this->loggers[$type][0]) || $replace || $this->loggers[$type][0] === $this->bootstrappingLogger) {
  37997. $loggers[$type] = array($logger, $logLevel);
  37998. }
  37999. }
  38000. } else {
  38001. if (null === $levels) {
  38002. $levels = E_ALL | E_STRICT;
  38003. }
  38004. foreach ($this->loggers as $type => $log) {
  38005. if (($type & $levels) && (empty($log[0]) || $replace || $log[0] === $this->bootstrappingLogger)) {
  38006. $log[0] = $logger;
  38007. $loggers[$type] = $log;
  38008. }
  38009. }
  38010. }
  38011. $this->setLoggers($loggers);
  38012. }
  38013. public function setLoggers(array $loggers)
  38014. {
  38015. $prevLogged = $this->loggedErrors;
  38016. $prev = $this->loggers;
  38017. $flush = array();
  38018. foreach ($loggers as $type => $log) {
  38019. if (!isset($prev[$type])) {
  38020. throw new \InvalidArgumentException('Unknown error type: '.$type);
  38021. }
  38022. if (!is_array($log)) {
  38023. $log = array($log);
  38024. } elseif (!array_key_exists(0, $log)) {
  38025. throw new \InvalidArgumentException('No logger provided');
  38026. }
  38027. if (null === $log[0]) {
  38028. $this->loggedErrors &= ~$type;
  38029. } elseif ($log[0] instanceof LoggerInterface) {
  38030. $this->loggedErrors |= $type;
  38031. } else {
  38032. throw new \InvalidArgumentException('Invalid logger provided');
  38033. }
  38034. $this->loggers[$type] = $log + $prev[$type];
  38035. if ($this->bootstrappingLogger && $prev[$type][0] === $this->bootstrappingLogger) {
  38036. $flush[$type] = $type;
  38037. }
  38038. }
  38039. $this->reRegister($prevLogged | $this->thrownErrors);
  38040. if ($flush) {
  38041. foreach ($this->bootstrappingLogger->cleanLogs() as $log) {
  38042. $type = $log[2]['type'];
  38043. if (!isset($flush[$type])) {
  38044. $this->bootstrappingLogger->log($log[0], $log[1], $log[2]);
  38045. } elseif ($this->loggers[$type][0]) {
  38046. $this->loggers[$type][0]->log($this->loggers[$type][1], $log[1], $log[2]);
  38047. }
  38048. }
  38049. }
  38050. return $prev;
  38051. }
  38052. public function setExceptionHandler($handler)
  38053. {
  38054. if (null !== $handler && !is_callable($handler)) {
  38055. throw new \LogicException('The exception handler must be a valid PHP callable.');
  38056. }
  38057. $prev = $this->exceptionHandler;
  38058. $this->exceptionHandler = $handler;
  38059. return $prev;
  38060. }
  38061. public function throwAt($levels, $replace = false)
  38062. {
  38063. $prev = $this->thrownErrors;
  38064. $this->thrownErrors = ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED;
  38065. if (!$replace) {
  38066. $this->thrownErrors |= $prev;
  38067. }
  38068. $this->reRegister($prev | $this->loggedErrors);
  38069. $this->displayErrors = $this->thrownErrors;
  38070. return $prev;
  38071. }
  38072. public function scopeAt($levels, $replace = false)
  38073. {
  38074. $prev = $this->scopedErrors;
  38075. $this->scopedErrors = (int) $levels;
  38076. if (!$replace) {
  38077. $this->scopedErrors |= $prev;
  38078. }
  38079. return $prev;
  38080. }
  38081. public function traceAt($levels, $replace = false)
  38082. {
  38083. $prev = $this->tracedErrors;
  38084. $this->tracedErrors = (int) $levels;
  38085. if (!$replace) {
  38086. $this->tracedErrors |= $prev;
  38087. }
  38088. return $prev;
  38089. }
  38090. public function screamAt($levels, $replace = false)
  38091. {
  38092. $prev = $this->screamedErrors;
  38093. $this->screamedErrors = (int) $levels;
  38094. if (!$replace) {
  38095. $this->screamedErrors |= $prev;
  38096. }
  38097. return $prev;
  38098. }
  38099. private function reRegister($prev)
  38100. {
  38101. if ($prev !== $this->thrownErrors | $this->loggedErrors) {
  38102. $handler = set_error_handler('var_dump');
  38103. $handler = is_array($handler) ? $handler[0] : null;
  38104. restore_error_handler();
  38105. if ($handler === $this) {
  38106. restore_error_handler();
  38107. if ($this->isRoot) {
  38108. set_error_handler(array($this, 'handleError'), $this->thrownErrors | $this->loggedErrors);
  38109. } else {
  38110. set_error_handler(array($this, 'handleError'));
  38111. }
  38112. }
  38113. }
  38114. }
  38115. public function handleError($type, $message, $file, $line)
  38116. {
  38117. $level = error_reporting();
  38118. $silenced = 0 === ($level & $type);
  38119. $level |= E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED;
  38120. $log = $this->loggedErrors & $type;
  38121. $throw = $this->thrownErrors & $type & $level;
  38122. $type &= $level | $this->screamedErrors;
  38123. if (!$type || (!$log && !$throw)) {
  38124. return !$silenced && $type && $log;
  38125. }
  38126. $scope = $this->scopedErrors & $type;
  38127. if (4 < $numArgs = func_num_args()) {
  38128. $context = $scope ? (func_get_arg(4) ?: array()) : array();
  38129. $backtrace = 5 < $numArgs ? func_get_arg(5) : null;
  38130. } else {
  38131. $context = array();
  38132. $backtrace = null;
  38133. }
  38134. if (isset($context['GLOBALS']) && $scope) {
  38135. $e = $context;
  38136. unset($e['GLOBALS'], $context);
  38137. $context = $e;
  38138. }
  38139. if (null !== $backtrace && $type & E_ERROR) {
  38140. $this->handleFatalError(compact('type', 'message', 'file', 'line', 'backtrace'));
  38141. return true;
  38142. }
  38143. if ($throw) {
  38144. if (null !== self::$toStringException) {
  38145. $throw = self::$toStringException;
  38146. self::$toStringException = null;
  38147. } elseif ($scope && class_exists('Symfony\Component\Debug\Exception\ContextErrorException')) {
  38148. $throw = new ContextErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line, $context);
  38149. } else {
  38150. $throw = new \ErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line);
  38151. }
  38152. if (\PHP_VERSION_ID <= 50407 && (\PHP_VERSION_ID >= 50400 || \PHP_VERSION_ID <= 50317)) {
  38153. $throw->errorHandlerCanary = new ErrorHandlerCanary();
  38154. }
  38155. if (E_USER_ERROR & $type) {
  38156. $backtrace = $backtrace ?: $throw->getTrace();
  38157. for ($i = 1; isset($backtrace[$i]); ++$i) {
  38158. if (isset($backtrace[$i]['function'], $backtrace[$i]['type'], $backtrace[$i - 1]['function'])
  38159. && '__toString' === $backtrace[$i]['function']
  38160. && '->' === $backtrace[$i]['type']
  38161. && !isset($backtrace[$i - 1]['class'])
  38162. && ('trigger_error' === $backtrace[$i - 1]['function'] || 'user_error' === $backtrace[$i - 1]['function'])
  38163. ) {
  38164. foreach ($context as $e) {
  38165. if (($e instanceof \Exception || $e instanceof \Throwable) && $e->__toString() === $message) {
  38166. if (1 === $i) {
  38167. $throw = $e;
  38168. break;
  38169. }
  38170. self::$toStringException = $e;
  38171. return true;
  38172. }
  38173. }
  38174. if (1 < $i) {
  38175. $this->handleException($throw);
  38176. return false;
  38177. }
  38178. }
  38179. }
  38180. }
  38181. throw $throw;
  38182. }
  38183. $e = md5("{$type}/{$line}/{$file}\x00{$message}", true);
  38184. $trace = true;
  38185. if (!($this->tracedErrors & $type) || isset($this->loggedTraces[$e])) {
  38186. $trace = false;
  38187. } else {
  38188. $this->loggedTraces[$e] = 1;
  38189. }
  38190. $e = compact('type', 'file', 'line', 'level');
  38191. if ($type & $level) {
  38192. if ($scope) {
  38193. $e['scope_vars'] = $context;
  38194. if ($trace) {
  38195. $e['stack'] = $backtrace ?: debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT);
  38196. }
  38197. } elseif ($trace) {
  38198. if (null === $backtrace) {
  38199. $e['stack'] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
  38200. } else {
  38201. foreach ($backtrace as &$frame) {
  38202. unset($frame['args'], $frame);
  38203. }
  38204. $e['stack'] = $backtrace;
  38205. }
  38206. }
  38207. }
  38208. if ($this->isRecursive) {
  38209. $log = 0;
  38210. } elseif (self::$stackedErrorLevels) {
  38211. self::$stackedErrors[] = array($this->loggers[$type][0], ($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
  38212. } else {
  38213. try {
  38214. $this->isRecursive = true;
  38215. $this->loggers[$type][0]->log(($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
  38216. $this->isRecursive = false;
  38217. } catch (\Exception $e) {
  38218. $this->isRecursive = false;
  38219. throw $e;
  38220. } catch (\Throwable $e) {
  38221. $this->isRecursive = false;
  38222. throw $e;
  38223. }
  38224. }
  38225. return !$silenced && $type && $log;
  38226. }
  38227. public function handleException($exception, array $error = null)
  38228. {
  38229. if (null === $error) {
  38230. self::$exitCode = 255;
  38231. }
  38232. if (!$exception instanceof \Exception) {
  38233. $exception = new FatalThrowableError($exception);
  38234. }
  38235. $type = $exception instanceof FatalErrorException ? $exception->getSeverity() : E_ERROR;
  38236. $handlerException = null;
  38237. if (($this->loggedErrors & $type) || $exception instanceof FatalThrowableError) {
  38238. $e = array(
  38239. 'type' => $type,
  38240. 'file' => $exception->getFile(),
  38241. 'line' => $exception->getLine(),
  38242. 'level' => error_reporting(),
  38243. 'stack' => $exception->getTrace(),
  38244. );
  38245. if ($exception instanceof FatalErrorException) {
  38246. if ($exception instanceof FatalThrowableError) {
  38247. $error = array(
  38248. 'type' => $type,
  38249. 'message' => $message = $exception->getMessage(),
  38250. 'file' => $e['file'],
  38251. 'line' => $e['line'],
  38252. );
  38253. } else {
  38254. $message = 'Fatal '.$exception->getMessage();
  38255. }
  38256. } elseif ($exception instanceof \ErrorException) {
  38257. $message = 'Uncaught '.$exception->getMessage();
  38258. if ($exception instanceof ContextErrorException) {
  38259. $e['context'] = $exception->getContext();
  38260. }
  38261. } else {
  38262. $message = 'Uncaught Exception: '.$exception->getMessage();
  38263. }
  38264. }
  38265. if ($this->loggedErrors & $type) {
  38266. try {
  38267. $this->loggers[$type][0]->log($this->loggers[$type][1], $message, $e);
  38268. } catch (\Exception $handlerException) {
  38269. } catch (\Throwable $handlerException) {
  38270. }
  38271. }
  38272. if ($exception instanceof FatalErrorException && !$exception instanceof OutOfMemoryException && $error) {
  38273. foreach ($this->getFatalErrorHandlers() as $handler) {
  38274. if ($e = $handler->handleError($error, $exception)) {
  38275. $exception = $e;
  38276. break;
  38277. }
  38278. }
  38279. }
  38280. $exceptionHandler = $this->exceptionHandler;
  38281. $this->exceptionHandler = null;
  38282. try {
  38283. if (null !== $exceptionHandler) {
  38284. return \call_user_func($exceptionHandler, $exception);
  38285. }
  38286. $handlerException = $handlerException ?: $exception;
  38287. } catch (\Exception $handlerException) {
  38288. } catch (\Throwable $handlerException) {
  38289. }
  38290. if ($exception === $handlerException) {
  38291. self::$reservedMemory = null;
  38292. throw $exception;
  38293. }
  38294. $this->handleException($handlerException);
  38295. }
  38296. public static function handleFatalError(array $error = null)
  38297. {
  38298. if (null === self::$reservedMemory) {
  38299. return;
  38300. }
  38301. $handler = self::$reservedMemory = null;
  38302. $handlers = array();
  38303. $previousHandler = null;
  38304. $sameHandlerLimit = 10;
  38305. while (!is_array($handler) || !$handler[0] instanceof self) {
  38306. $handler = set_exception_handler('var_dump');
  38307. restore_exception_handler();
  38308. if (!$handler) {
  38309. break;
  38310. }
  38311. restore_exception_handler();
  38312. if ($handler !== $previousHandler) {
  38313. array_unshift($handlers, $handler);
  38314. $previousHandler = $handler;
  38315. } elseif (0 === --$sameHandlerLimit) {
  38316. $handler = null;
  38317. break;
  38318. }
  38319. }
  38320. foreach ($handlers as $h) {
  38321. set_exception_handler($h);
  38322. }
  38323. if (!$handler) {
  38324. return;
  38325. }
  38326. if ($handler !== $h) {
  38327. $handler[0]->setExceptionHandler($h);
  38328. }
  38329. $handler = $handler[0];
  38330. $handlers = array();
  38331. if ($exit = null === $error) {
  38332. $error = error_get_last();
  38333. }
  38334. try {
  38335. while (self::$stackedErrorLevels) {
  38336. static::unstackErrors();
  38337. }
  38338. } catch (\Exception $exception) {
  38339. } catch (\Throwable $exception) {
  38340. }
  38341. if ($error && $error['type'] &= E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR) {
  38342. $handler->throwAt(0, true);
  38343. $trace = isset($error['backtrace']) ? $error['backtrace'] : null;
  38344. if (0 === strpos($error['message'], 'Allowed memory') || 0 === strpos($error['message'], 'Out of memory')) {
  38345. $exception = new OutOfMemoryException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, false, $trace);
  38346. } else {
  38347. $exception = new FatalErrorException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, true, $trace);
  38348. }
  38349. }
  38350. try {
  38351. if (isset($exception)) {
  38352. self::$exitCode = 255;
  38353. $handler->handleException($exception, $error);
  38354. }
  38355. } catch (FatalErrorException $e) {
  38356. }
  38357. if ($exit && self::$exitCode) {
  38358. $exitCode = self::$exitCode;
  38359. register_shutdown_function('register_shutdown_function', function () use ($exitCode) { exit($exitCode); });
  38360. }
  38361. }
  38362. public static function stackErrors()
  38363. {
  38364. self::$stackedErrorLevels[] = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
  38365. }
  38366. public static function unstackErrors()
  38367. {
  38368. $level = array_pop(self::$stackedErrorLevels);
  38369. if (null !== $level) {
  38370. $e = error_reporting($level);
  38371. if ($e !== ($level | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR)) {
  38372. error_reporting($e);
  38373. }
  38374. }
  38375. if (empty(self::$stackedErrorLevels)) {
  38376. $errors = self::$stackedErrors;
  38377. self::$stackedErrors = array();
  38378. foreach ($errors as $e) {
  38379. $e[0]->log($e[1], $e[2], $e[3]);
  38380. }
  38381. }
  38382. }
  38383. protected function getFatalErrorHandlers()
  38384. {
  38385. return array(
  38386. new UndefinedFunctionFatalErrorHandler(),
  38387. new UndefinedMethodFatalErrorHandler(),
  38388. new ClassNotFoundFatalErrorHandler(),
  38389. );
  38390. }
  38391. public function setLevel($level)
  38392. {
  38393. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the throwAt() method instead.', E_USER_DEPRECATED);
  38394. $level = null === $level ? error_reporting() : $level;
  38395. $this->throwAt($level, true);
  38396. }
  38397. public function setDisplayErrors($displayErrors)
  38398. {
  38399. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the throwAt() method instead.', E_USER_DEPRECATED);
  38400. if ($displayErrors) {
  38401. $this->throwAt($this->displayErrors, true);
  38402. } else {
  38403. $displayErrors = $this->displayErrors;
  38404. $this->throwAt(0, true);
  38405. $this->displayErrors = $displayErrors;
  38406. }
  38407. }
  38408. public static function setLogger(LoggerInterface $logger, $channel = 'deprecation')
  38409. {
  38410. @trigger_error('The '.__METHOD__.' static method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the setLoggers() or setDefaultLogger() methods instead.', E_USER_DEPRECATED);
  38411. $handler = set_error_handler('var_dump');
  38412. $handler = is_array($handler) ? $handler[0] : null;
  38413. restore_error_handler();
  38414. if (!$handler instanceof self) {
  38415. return;
  38416. }
  38417. if ('deprecation' === $channel) {
  38418. $handler->setDefaultLogger($logger, E_DEPRECATED | E_USER_DEPRECATED, true);
  38419. $handler->screamAt(E_DEPRECATED | E_USER_DEPRECATED);
  38420. } elseif ('scream' === $channel) {
  38421. $handler->setDefaultLogger($logger, E_ALL | E_STRICT, false);
  38422. $handler->screamAt(E_ALL | E_STRICT);
  38423. } elseif ('emergency' === $channel) {
  38424. $handler->setDefaultLogger($logger, E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR, true);
  38425. $handler->screamAt(E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
  38426. }
  38427. }
  38428. public function handle($level, $message, $file = 'unknown', $line = 0, $context = array())
  38429. {
  38430. $this->handleError(E_USER_DEPRECATED, 'The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the handleError() method instead.', __FILE__, __LINE__, array());
  38431. return $this->handleError($level, $message, $file, $line, (array) $context);
  38432. }
  38433. public function handleFatal()
  38434. {
  38435. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the handleFatalError() method instead.', E_USER_DEPRECATED);
  38436. static::handleFatalError();
  38437. }
  38438. }
  38439. class ErrorHandlerCanary
  38440. {
  38441. private static $displayErrors = null;
  38442. public function __construct()
  38443. {
  38444. if (null === self::$displayErrors) {
  38445. self::$displayErrors = ini_set('display_errors', 1);
  38446. }
  38447. }
  38448. public function __destruct()
  38449. {
  38450. if (null !== self::$displayErrors) {
  38451. ini_set('display_errors', self::$displayErrors);
  38452. self::$displayErrors = null;
  38453. }
  38454. }
  38455. }
  38456. <?php
  38457. namespace Symfony\Component\Debug\Exception;
  38458. class ClassNotFoundException extends FatalErrorException
  38459. {
  38460. public function __construct($message, \ErrorException $previous)
  38461. {
  38462. parent::__construct(
  38463. $message,
  38464. $previous->getCode(),
  38465. $previous->getSeverity(),
  38466. $previous->getFile(),
  38467. $previous->getLine(),
  38468. null,
  38469. true,
  38470. null,
  38471. $previous->getPrevious()
  38472. );
  38473. $this->setTrace($previous->getTrace());
  38474. }
  38475. }
  38476. <?php
  38477. namespace Symfony\Component\Debug\Exception;
  38478. class ContextErrorException extends \ErrorException
  38479. {
  38480. private $context = array();
  38481. public function __construct($message, $code, $severity, $filename, $lineno, $context = array())
  38482. {
  38483. parent::__construct($message, $code, $severity, $filename, $lineno);
  38484. $this->context = $context;
  38485. }
  38486. public function getContext()
  38487. {
  38488. return $this->context;
  38489. }
  38490. }
  38491. <?php
  38492. namespace Symfony\Component\Debug\Exception;
  38493. @trigger_error('The '.__NAMESPACE__.'\DummyException class is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  38494. class DummyException extends \ErrorException
  38495. {
  38496. }
  38497. <?php
  38498. namespace Symfony\Component\HttpKernel\Exception;
  38499. class FatalErrorException extends \ErrorException
  38500. {
  38501. }
  38502. namespace Symfony\Component\Debug\Exception;
  38503. use Symfony\Component\HttpKernel\Exception\FatalErrorException as LegacyFatalErrorException;
  38504. class FatalErrorException extends LegacyFatalErrorException
  38505. {
  38506. public function __construct($message, $code, $severity, $filename, $lineno, $traceOffset = null, $traceArgs = true, array $trace = null, $previous = null)
  38507. {
  38508. parent::__construct($message, $code, $severity, $filename, $lineno, $previous);
  38509. if (null !== $trace) {
  38510. if (!$traceArgs) {
  38511. foreach ($trace as &$frame) {
  38512. unset($frame['args'], $frame['this'], $frame);
  38513. }
  38514. }
  38515. $this->setTrace($trace);
  38516. } elseif (null !== $traceOffset) {
  38517. if (function_exists('xdebug_get_function_stack')) {
  38518. $trace = xdebug_get_function_stack();
  38519. if (0 < $traceOffset) {
  38520. array_splice($trace, -$traceOffset);
  38521. }
  38522. foreach ($trace as &$frame) {
  38523. if (!isset($frame['type'])) {
  38524. if (isset($frame['class'])) {
  38525. $frame['type'] = '::';
  38526. }
  38527. } elseif ('dynamic' === $frame['type']) {
  38528. $frame['type'] = '->';
  38529. } elseif ('static' === $frame['type']) {
  38530. $frame['type'] = '::';
  38531. }
  38532. if (!$traceArgs) {
  38533. unset($frame['params'], $frame['args']);
  38534. } elseif (isset($frame['params']) && !isset($frame['args'])) {
  38535. $frame['args'] = $frame['params'];
  38536. unset($frame['params']);
  38537. }
  38538. }
  38539. unset($frame);
  38540. $trace = array_reverse($trace);
  38541. } elseif (function_exists('symfony_debug_backtrace')) {
  38542. $trace = symfony_debug_backtrace();
  38543. if (0 < $traceOffset) {
  38544. array_splice($trace, 0, $traceOffset);
  38545. }
  38546. } else {
  38547. $trace = array();
  38548. }
  38549. $this->setTrace($trace);
  38550. }
  38551. }
  38552. protected function setTrace($trace)
  38553. {
  38554. $traceReflector = new \ReflectionProperty('Exception', 'trace');
  38555. $traceReflector->setAccessible(true);
  38556. $traceReflector->setValue($this, $trace);
  38557. }
  38558. }
  38559. <?php
  38560. namespace Symfony\Component\Debug\Exception;
  38561. class FatalThrowableError extends FatalErrorException
  38562. {
  38563. public function __construct(\Throwable $e)
  38564. {
  38565. if ($e instanceof \ParseError) {
  38566. $message = 'Parse error: '.$e->getMessage();
  38567. $severity = E_PARSE;
  38568. } elseif ($e instanceof \TypeError) {
  38569. $message = 'Type error: '.$e->getMessage();
  38570. $severity = E_RECOVERABLE_ERROR;
  38571. } else {
  38572. $message = $e->getMessage();
  38573. $severity = E_ERROR;
  38574. }
  38575. \ErrorException::__construct(
  38576. $message,
  38577. $e->getCode(),
  38578. $severity,
  38579. $e->getFile(),
  38580. $e->getLine(),
  38581. $e->getPrevious()
  38582. );
  38583. $this->setTrace($e->getTrace());
  38584. }
  38585. }
  38586. <?php
  38587. namespace Symfony\Component\HttpKernel\Exception;
  38588. use Symfony\Component\Debug\Exception\FlattenException as DebugFlattenException;
  38589. class FlattenException
  38590. {
  38591. private $handler;
  38592. public static function __callStatic($method, $args)
  38593. {
  38594. if (!method_exists('Symfony\Component\Debug\Exception\FlattenException', $method)) {
  38595. throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', get_called_class(), $method));
  38596. }
  38597. return call_user_func_array(array('Symfony\Component\Debug\Exception\FlattenException', $method), $args);
  38598. }
  38599. public function __call($method, $args)
  38600. {
  38601. if (!isset($this->handler)) {
  38602. $this->handler = new DebugFlattenException();
  38603. }
  38604. if (!method_exists($this->handler, $method)) {
  38605. throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', get_class($this), $method));
  38606. }
  38607. return call_user_func_array(array($this->handler, $method), $args);
  38608. }
  38609. }
  38610. namespace Symfony\Component\Debug\Exception;
  38611. use Symfony\Component\HttpKernel\Exception\FlattenException as LegacyFlattenException;
  38612. use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
  38613. class FlattenException extends LegacyFlattenException
  38614. {
  38615. private $message;
  38616. private $code;
  38617. private $previous;
  38618. private $trace;
  38619. private $class;
  38620. private $statusCode;
  38621. private $headers;
  38622. private $file;
  38623. private $line;
  38624. public static function create(\Exception $exception, $statusCode = null, array $headers = array())
  38625. {
  38626. $e = new static();
  38627. $e->setMessage($exception->getMessage());
  38628. $e->setCode($exception->getCode());
  38629. if ($exception instanceof HttpExceptionInterface) {
  38630. $statusCode = $exception->getStatusCode();
  38631. $headers = array_merge($headers, $exception->getHeaders());
  38632. }
  38633. if (null === $statusCode) {
  38634. $statusCode = 500;
  38635. }
  38636. $e->setStatusCode($statusCode);
  38637. $e->setHeaders($headers);
  38638. $e->setTraceFromException($exception);
  38639. $e->setClass(get_class($exception));
  38640. $e->setFile($exception->getFile());
  38641. $e->setLine($exception->getLine());
  38642. $previous = $exception->getPrevious();
  38643. if ($previous instanceof \Exception) {
  38644. $e->setPrevious(static::create($previous));
  38645. } elseif ($previous instanceof \Throwable) {
  38646. $e->setPrevious(static::create(new FatalThrowableError($previous)));
  38647. }
  38648. return $e;
  38649. }
  38650. public function toArray()
  38651. {
  38652. $exceptions = array();
  38653. foreach (array_merge(array($this), $this->getAllPrevious()) as $exception) {
  38654. $exceptions[] = array(
  38655. 'message' => $exception->getMessage(),
  38656. 'class' => $exception->getClass(),
  38657. 'trace' => $exception->getTrace(),
  38658. );
  38659. }
  38660. return $exceptions;
  38661. }
  38662. public function getStatusCode()
  38663. {
  38664. return $this->statusCode;
  38665. }
  38666. public function setStatusCode($code)
  38667. {
  38668. $this->statusCode = $code;
  38669. }
  38670. public function getHeaders()
  38671. {
  38672. return $this->headers;
  38673. }
  38674. public function setHeaders(array $headers)
  38675. {
  38676. $this->headers = $headers;
  38677. }
  38678. public function getClass()
  38679. {
  38680. return $this->class;
  38681. }
  38682. public function setClass($class)
  38683. {
  38684. $this->class = $class;
  38685. }
  38686. public function getFile()
  38687. {
  38688. return $this->file;
  38689. }
  38690. public function setFile($file)
  38691. {
  38692. $this->file = $file;
  38693. }
  38694. public function getLine()
  38695. {
  38696. return $this->line;
  38697. }
  38698. public function setLine($line)
  38699. {
  38700. $this->line = $line;
  38701. }
  38702. public function getMessage()
  38703. {
  38704. return $this->message;
  38705. }
  38706. public function setMessage($message)
  38707. {
  38708. $this->message = $message;
  38709. }
  38710. public function getCode()
  38711. {
  38712. return $this->code;
  38713. }
  38714. public function setCode($code)
  38715. {
  38716. $this->code = $code;
  38717. }
  38718. public function getPrevious()
  38719. {
  38720. return $this->previous;
  38721. }
  38722. public function setPrevious(FlattenException $previous)
  38723. {
  38724. $this->previous = $previous;
  38725. }
  38726. public function getAllPrevious()
  38727. {
  38728. $exceptions = array();
  38729. $e = $this;
  38730. while ($e = $e->getPrevious()) {
  38731. $exceptions[] = $e;
  38732. }
  38733. return $exceptions;
  38734. }
  38735. public function getTrace()
  38736. {
  38737. return $this->trace;
  38738. }
  38739. public function setTraceFromException(\Exception $exception)
  38740. {
  38741. $this->setTrace($exception->getTrace(), $exception->getFile(), $exception->getLine());
  38742. }
  38743. public function setTrace($trace, $file, $line)
  38744. {
  38745. $this->trace = array();
  38746. $this->trace[] = array(
  38747. 'namespace' => '',
  38748. 'short_class' => '',
  38749. 'class' => '',
  38750. 'type' => '',
  38751. 'function' => '',
  38752. 'file' => $file,
  38753. 'line' => $line,
  38754. 'args' => array(),
  38755. );
  38756. foreach ($trace as $entry) {
  38757. $class = '';
  38758. $namespace = '';
  38759. if (isset($entry['class'])) {
  38760. $parts = explode('\\', $entry['class']);
  38761. $class = array_pop($parts);
  38762. $namespace = implode('\\', $parts);
  38763. }
  38764. $this->trace[] = array(
  38765. 'namespace' => $namespace,
  38766. 'short_class' => $class,
  38767. 'class' => isset($entry['class']) ? $entry['class'] : '',
  38768. 'type' => isset($entry['type']) ? $entry['type'] : '',
  38769. 'function' => isset($entry['function']) ? $entry['function'] : null,
  38770. 'file' => isset($entry['file']) ? $entry['file'] : null,
  38771. 'line' => isset($entry['line']) ? $entry['line'] : null,
  38772. 'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : array(),
  38773. );
  38774. }
  38775. }
  38776. private function flattenArgs($args, $level = 0, &$count = 0)
  38777. {
  38778. $result = array();
  38779. foreach ($args as $key => $value) {
  38780. if (++$count > 1e4) {
  38781. return array('array', '*SKIPPED over 10000 entries*');
  38782. }
  38783. if ($value instanceof \__PHP_Incomplete_Class) {
  38784. $result[$key] = array('incomplete-object', $this->getClassNameFromIncomplete($value));
  38785. } elseif (is_object($value)) {
  38786. $result[$key] = array('object', get_class($value));
  38787. } elseif (is_array($value)) {
  38788. if ($level > 10) {
  38789. $result[$key] = array('array', '*DEEP NESTED ARRAY*');
  38790. } else {
  38791. $result[$key] = array('array', $this->flattenArgs($value, $level + 1, $count));
  38792. }
  38793. } elseif (null === $value) {
  38794. $result[$key] = array('null', null);
  38795. } elseif (is_bool($value)) {
  38796. $result[$key] = array('boolean', $value);
  38797. } elseif (is_resource($value)) {
  38798. $result[$key] = array('resource', get_resource_type($value));
  38799. } else {
  38800. $result[$key] = array('string', (string) $value);
  38801. }
  38802. }
  38803. return $result;
  38804. }
  38805. private function getClassNameFromIncomplete(\__PHP_Incomplete_Class $value)
  38806. {
  38807. $array = new \ArrayObject($value);
  38808. return $array['__PHP_Incomplete_Class_Name'];
  38809. }
  38810. }
  38811. <?php
  38812. namespace Symfony\Component\Debug\Exception;
  38813. class OutOfMemoryException extends FatalErrorException
  38814. {
  38815. }
  38816. <?php
  38817. namespace Symfony\Component\Debug\Exception;
  38818. class UndefinedFunctionException extends FatalErrorException
  38819. {
  38820. public function __construct($message, \ErrorException $previous)
  38821. {
  38822. parent::__construct(
  38823. $message,
  38824. $previous->getCode(),
  38825. $previous->getSeverity(),
  38826. $previous->getFile(),
  38827. $previous->getLine(),
  38828. null,
  38829. true,
  38830. null,
  38831. $previous->getPrevious()
  38832. );
  38833. $this->setTrace($previous->getTrace());
  38834. }
  38835. }
  38836. <?php
  38837. namespace Symfony\Component\Debug\Exception;
  38838. class UndefinedMethodException extends FatalErrorException
  38839. {
  38840. public function __construct($message, \ErrorException $previous)
  38841. {
  38842. parent::__construct(
  38843. $message,
  38844. $previous->getCode(),
  38845. $previous->getSeverity(),
  38846. $previous->getFile(),
  38847. $previous->getLine(),
  38848. null,
  38849. true,
  38850. null,
  38851. $previous->getPrevious()
  38852. );
  38853. $this->setTrace($previous->getTrace());
  38854. }
  38855. }
  38856. <?php
  38857. namespace Symfony\Component\Debug;
  38858. use Symfony\Component\HttpFoundation\Response;
  38859. use Symfony\Component\Debug\Exception\FlattenException;
  38860. use Symfony\Component\Debug\Exception\OutOfMemoryException;
  38861. class ExceptionHandler
  38862. {
  38863. private $debug;
  38864. private $charset;
  38865. private $handler;
  38866. private $caughtBuffer;
  38867. private $caughtLength;
  38868. private $fileLinkFormat;
  38869. public function __construct($debug = true, $charset = null, $fileLinkFormat = null)
  38870. {
  38871. if (false !== strpos($charset, '%')) {
  38872. @trigger_error('Providing $fileLinkFormat as second argument to '.__METHOD__.' is deprecated since Symfony 2.8 and will be unsupported in 3.0. Please provide it as third argument, after $charset.', E_USER_DEPRECATED);
  38873. $pivot = $fileLinkFormat;
  38874. $fileLinkFormat = $charset;
  38875. $charset = $pivot;
  38876. }
  38877. $this->debug = $debug;
  38878. $this->charset = $charset ?: ini_get('default_charset') ?: 'UTF-8';
  38879. $this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
  38880. }
  38881. public static function register($debug = true, $charset = null, $fileLinkFormat = null)
  38882. {
  38883. $handler = new static($debug, $charset, $fileLinkFormat);
  38884. $prev = set_exception_handler(array($handler, 'handle'));
  38885. if (is_array($prev) && $prev[0] instanceof ErrorHandler) {
  38886. restore_exception_handler();
  38887. $prev[0]->setExceptionHandler(array($handler, 'handle'));
  38888. }
  38889. return $handler;
  38890. }
  38891. public function setHandler($handler)
  38892. {
  38893. if (null !== $handler && !is_callable($handler)) {
  38894. throw new \LogicException('The exception handler must be a valid PHP callable.');
  38895. }
  38896. $old = $this->handler;
  38897. $this->handler = $handler;
  38898. return $old;
  38899. }
  38900. public function setFileLinkFormat($format)
  38901. {
  38902. $old = $this->fileLinkFormat;
  38903. $this->fileLinkFormat = $format;
  38904. return $old;
  38905. }
  38906. public function handle(\Exception $exception)
  38907. {
  38908. if (null === $this->handler || $exception instanceof OutOfMemoryException) {
  38909. $this->failSafeHandle($exception);
  38910. return;
  38911. }
  38912. $caughtLength = $this->caughtLength = 0;
  38913. ob_start(array($this, 'catchOutput'));
  38914. $this->failSafeHandle($exception);
  38915. while (null === $this->caughtBuffer && ob_end_flush()) {
  38916. }
  38917. if (isset($this->caughtBuffer[0])) {
  38918. ob_start(array($this, 'cleanOutput'));
  38919. echo $this->caughtBuffer;
  38920. $caughtLength = ob_get_length();
  38921. }
  38922. $this->caughtBuffer = null;
  38923. try {
  38924. call_user_func($this->handler, $exception);
  38925. $this->caughtLength = $caughtLength;
  38926. } catch (\Exception $e) {
  38927. if (!$caughtLength) {
  38928. throw $exception;
  38929. }
  38930. }
  38931. }
  38932. private function failSafeHandle(\Exception $exception)
  38933. {
  38934. if (class_exists('Symfony\Component\HttpFoundation\Response', false)
  38935. && __CLASS__ !== get_class($this)
  38936. && ($reflector = new \ReflectionMethod($this, 'createResponse'))
  38937. && __CLASS__ !== $reflector->class
  38938. ) {
  38939. $response = $this->createResponse($exception);
  38940. $response->sendHeaders();
  38941. $response->sendContent();
  38942. @trigger_error(sprintf("The %s::createResponse method is deprecated since Symfony 2.8 and won't be called anymore when handling an exception in 3.0.", $reflector->class), E_USER_DEPRECATED);
  38943. return;
  38944. }
  38945. $this->sendPhpResponse($exception);
  38946. }
  38947. public function sendPhpResponse($exception)
  38948. {
  38949. if (!$exception instanceof FlattenException) {
  38950. $exception = FlattenException::create($exception);
  38951. }
  38952. if (!headers_sent()) {
  38953. header(sprintf('HTTP/1.0 %s', $exception->getStatusCode()));
  38954. foreach ($exception->getHeaders() as $name => $value) {
  38955. header($name.': '.$value, false);
  38956. }
  38957. header('Content-Type: text/html; charset='.$this->charset);
  38958. }
  38959. echo $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
  38960. }
  38961. public function createResponse($exception)
  38962. {
  38963. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  38964. if (!$exception instanceof FlattenException) {
  38965. $exception = FlattenException::create($exception);
  38966. }
  38967. return Response::create($this->getHtml($exception), $exception->getStatusCode(), $exception->getHeaders())->setCharset($this->charset);
  38968. }
  38969. public function getHtml($exception)
  38970. {
  38971. if (!$exception instanceof FlattenException) {
  38972. $exception = FlattenException::create($exception);
  38973. }
  38974. return $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
  38975. }
  38976. public function getContent(FlattenException $exception)
  38977. {
  38978. switch ($exception->getStatusCode()) {
  38979. case 404:
  38980. $title = 'Sorry, the page you are looking for could not be found.';
  38981. break;
  38982. default:
  38983. $title = 'Whoops, looks like something went wrong.';
  38984. }
  38985. $content = '';
  38986. if ($this->debug) {
  38987. try {
  38988. $count = count($exception->getAllPrevious());
  38989. $total = $count + 1;
  38990. foreach ($exception->toArray() as $position => $e) {
  38991. $ind = $count - $position + 1;
  38992. $class = $this->formatClass($e['class']);
  38993. $message = nl2br($this->escapeHtml($e['message']));
  38994. $content .= sprintf(<<<'EOF'
  38995. <h2 class="block_exception clear_fix">
  38996. <span class="exception_counter">%d/%d</span>
  38997. <span class="exception_title">%s%s:</span>
  38998. <span class="exception_message">%s</span>
  38999. </h2>
  39000. <div class="block">
  39001. <ol class="traces list_exception">
  39002. EOF
  39003. , $ind, $total, $class, $this->formatPath($e['trace'][0]['file'], $e['trace'][0]['line']), $message);
  39004. foreach ($e['trace'] as $trace) {
  39005. $content .= ' <li>';
  39006. if ($trace['function']) {
  39007. $content .= sprintf('at %s%s%s(%s)', $this->formatClass($trace['class']), $trace['type'], $trace['function'], $this->formatArgs($trace['args']));
  39008. }
  39009. if (isset($trace['file']) && isset($trace['line'])) {
  39010. $content .= $this->formatPath($trace['file'], $trace['line']);
  39011. }
  39012. $content .= "</li>\n";
  39013. }
  39014. $content .= " </ol>\n</div>\n";
  39015. }
  39016. } catch (\Exception $e) {
  39017. if ($this->debug) {
  39018. $title = sprintf('Exception thrown when handling an exception (%s: %s)', get_class($e), $this->escapeHtml($e->getMessage()));
  39019. } else {
  39020. $title = 'Whoops, looks like something went wrong.';
  39021. }
  39022. }
  39023. }
  39024. return <<<EOF
  39025. <div id="sf-resetcontent" class="sf-reset">
  39026. <h1>$title</h1>
  39027. $content
  39028. </div>
  39029. EOF;
  39030. }
  39031. public function getStylesheet(FlattenException $exception)
  39032. {
  39033. return <<<'EOF'
  39034. .sf-reset { font: 11px Verdana, Arial, sans-serif; color: #333 }
  39035. .sf-reset .clear { clear:both; height:0; font-size:0; line-height:0; }
  39036. .sf-reset .clear_fix:after { display:block; height:0; clear:both; visibility:hidden; }
  39037. .sf-reset .clear_fix { display:inline-block; }
  39038. .sf-reset * html .clear_fix { height:1%; }
  39039. .sf-reset .clear_fix { display:block; }
  39040. .sf-reset, .sf-reset .block { margin: auto }
  39041. .sf-reset abbr { border-bottom: 1px dotted #000; cursor: help; }
  39042. .sf-reset p { font-size:14px; line-height:20px; color:#868686; padding-bottom:20px }
  39043. .sf-reset strong { font-weight:bold; }
  39044. .sf-reset a { color:#6c6159; cursor: default; }
  39045. .sf-reset a img { border:none; }
  39046. .sf-reset a:hover { text-decoration:underline; }
  39047. .sf-reset em { font-style:italic; }
  39048. .sf-reset h1, .sf-reset h2 { font: 20px Georgia, "Times New Roman", Times, serif }
  39049. .sf-reset .exception_counter { background-color: #fff; color: #333; padding: 6px; float: left; margin-right: 10px; float: left; display: block; }
  39050. .sf-reset .exception_title { margin-left: 3em; margin-bottom: 0.7em; display: block; }
  39051. .sf-reset .exception_message { margin-left: 3em; display: block; }
  39052. .sf-reset .traces li { font-size:12px; padding: 2px 4px; list-style-type:decimal; margin-left:20px; }
  39053. .sf-reset .block { background-color:#FFFFFF; padding:10px 28px; margin-bottom:20px;
  39054. -webkit-border-bottom-right-radius: 16px;
  39055. -webkit-border-bottom-left-radius: 16px;
  39056. -moz-border-radius-bottomright: 16px;
  39057. -moz-border-radius-bottomleft: 16px;
  39058. border-bottom-right-radius: 16px;
  39059. border-bottom-left-radius: 16px;
  39060. border-bottom:1px solid #ccc;
  39061. border-right:1px solid #ccc;
  39062. border-left:1px solid #ccc;
  39063. word-wrap: break-word;
  39064. }
  39065. .sf-reset .block_exception { background-color:#ddd; color: #333; padding:20px;
  39066. -webkit-border-top-left-radius: 16px;
  39067. -webkit-border-top-right-radius: 16px;
  39068. -moz-border-radius-topleft: 16px;
  39069. -moz-border-radius-topright: 16px;
  39070. border-top-left-radius: 16px;
  39071. border-top-right-radius: 16px;
  39072. border-top:1px solid #ccc;
  39073. border-right:1px solid #ccc;
  39074. border-left:1px solid #ccc;
  39075. overflow: hidden;
  39076. word-wrap: break-word;
  39077. }
  39078. .sf-reset a { background:none; color:#868686; text-decoration:none; }
  39079. .sf-reset a:hover { background:none; color:#313131; text-decoration:underline; }
  39080. .sf-reset ol { padding: 10px 0; }
  39081. .sf-reset h1 { background-color:#FFFFFF; padding: 15px 28px; margin-bottom: 20px;
  39082. -webkit-border-radius: 10px;
  39083. -moz-border-radius: 10px;
  39084. border-radius: 10px;
  39085. border: 1px solid #ccc;
  39086. }
  39087. EOF;
  39088. }
  39089. private function decorate($content, $css)
  39090. {
  39091. return <<<EOF
  39092. <!DOCTYPE html>
  39093. <html>
  39094. <head>
  39095. <meta charset="{$this->charset}" />
  39096. <meta name="robots" content="noindex,nofollow" />
  39097. <style>
  39098. /* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html */
  39099. html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}
  39100. html { background: #eee; padding: 10px }
  39101. img { border: 0; }
  39102. #sf-resetcontent { width:970px; margin:0 auto; }
  39103. $css
  39104. </style>
  39105. </head>
  39106. <body>
  39107. $content
  39108. </body>
  39109. </html>
  39110. EOF;
  39111. }
  39112. private function formatClass($class)
  39113. {
  39114. $parts = explode('\\', $class);
  39115. return sprintf('<abbr title="%s">%s</abbr>', $class, array_pop($parts));
  39116. }
  39117. private function formatPath($path, $line)
  39118. {
  39119. $path = $this->escapeHtml($path);
  39120. $file = preg_match('#[^/\\\\]*$#', $path, $file) ? $file[0] : $path;
  39121. if ($linkFormat = $this->fileLinkFormat) {
  39122. $link = strtr($this->escapeHtml($linkFormat), array('%f' => $path, '%l' => (int) $line));
  39123. return sprintf(' in <a href="%s" title="Go to source">%s line %d</a>', $link, $file, $line);
  39124. }
  39125. return sprintf(' in <a title="%s line %3$d" ondblclick="var f=this.innerHTML;this.innerHTML=this.title;this.title=f;">%s line %d</a>', $path, $file, $line);
  39126. }
  39127. private function formatArgs(array $args)
  39128. {
  39129. $result = array();
  39130. foreach ($args as $key => $item) {
  39131. if ('object' === $item[0]) {
  39132. $formattedValue = sprintf('<em>object</em>(%s)', $this->formatClass($item[1]));
  39133. } elseif ('array' === $item[0]) {
  39134. $formattedValue = sprintf('<em>array</em>(%s)', is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
  39135. } elseif ('string' === $item[0]) {
  39136. $formattedValue = sprintf("'%s'", $this->escapeHtml($item[1]));
  39137. } elseif ('null' === $item[0]) {
  39138. $formattedValue = '<em>null</em>';
  39139. } elseif ('boolean' === $item[0]) {
  39140. $formattedValue = '<em>'.strtolower(var_export($item[1], true)).'</em>';
  39141. } elseif ('resource' === $item[0]) {
  39142. $formattedValue = '<em>resource</em>';
  39143. } else {
  39144. $formattedValue = str_replace("\n", '', var_export($this->escapeHtml((string) $item[1]), true));
  39145. }
  39146. $result[] = is_int($key) ? $formattedValue : sprintf("'%s' => %s", $this->escapeHtml($key), $formattedValue);
  39147. }
  39148. return implode(', ', $result);
  39149. }
  39150. protected static function utf8Htmlize($str)
  39151. {
  39152. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
  39153. return htmlspecialchars($str, ENT_QUOTES | (\PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), 'UTF-8');
  39154. }
  39155. private function escapeHtml($str)
  39156. {
  39157. return htmlspecialchars($str, ENT_QUOTES | (\PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), $this->charset);
  39158. }
  39159. public function catchOutput($buffer)
  39160. {
  39161. $this->caughtBuffer = $buffer;
  39162. return '';
  39163. }
  39164. public function cleanOutput($buffer)
  39165. {
  39166. if ($this->caughtLength) {
  39167. $cleanBuffer = substr_replace($buffer, '', 0, $this->caughtLength);
  39168. if (isset($cleanBuffer[0])) {
  39169. $buffer = $cleanBuffer;
  39170. }
  39171. }
  39172. return $buffer;
  39173. }
  39174. }
  39175. <?php
  39176. namespace Symfony\Component\Debug\FatalErrorHandler;
  39177. use Symfony\Component\Debug\Exception\ClassNotFoundException;
  39178. use Symfony\Component\Debug\Exception\FatalErrorException;
  39179. use Symfony\Component\Debug\DebugClassLoader;
  39180. use Composer\Autoload\ClassLoader as ComposerClassLoader;
  39181. use Symfony\Component\ClassLoader\ClassLoader as SymfonyClassLoader;
  39182. use Symfony\Component\ClassLoader\UniversalClassLoader as SymfonyUniversalClassLoader;
  39183. class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface
  39184. {
  39185. public function handleError(array $error, FatalErrorException $exception)
  39186. {
  39187. $messageLen = strlen($error['message']);
  39188. $notFoundSuffix = '\' not found';
  39189. $notFoundSuffixLen = strlen($notFoundSuffix);
  39190. if ($notFoundSuffixLen > $messageLen) {
  39191. return;
  39192. }
  39193. if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) {
  39194. return;
  39195. }
  39196. foreach (array('class', 'interface', 'trait') as $typeName) {
  39197. $prefix = ucfirst($typeName).' \'';
  39198. $prefixLen = strlen($prefix);
  39199. if (0 !== strpos($error['message'], $prefix)) {
  39200. continue;
  39201. }
  39202. $fullyQualifiedClassName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);
  39203. if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedClassName, '\\')) {
  39204. $className = substr($fullyQualifiedClassName, $namespaceSeparatorIndex + 1);
  39205. $namespacePrefix = substr($fullyQualifiedClassName, 0, $namespaceSeparatorIndex);
  39206. $message = sprintf('Attempted to load %s "%s" from namespace "%s".', $typeName, $className, $namespacePrefix);
  39207. $tail = ' for another namespace?';
  39208. } else {
  39209. $className = $fullyQualifiedClassName;
  39210. $message = sprintf('Attempted to load %s "%s" from the global namespace.', $typeName, $className);
  39211. $tail = '?';
  39212. }
  39213. if ($candidates = $this->getClassCandidates($className)) {
  39214. $tail = array_pop($candidates).'"?';
  39215. if ($candidates) {
  39216. $tail = ' for e.g. "'.implode('", "', $candidates).'" or "'.$tail;
  39217. } else {
  39218. $tail = ' for "'.$tail;
  39219. }
  39220. }
  39221. $message .= "\nDid you forget a \"use\" statement".$tail;
  39222. return new ClassNotFoundException($message, $exception);
  39223. }
  39224. }
  39225. private function getClassCandidates($class)
  39226. {
  39227. if (!is_array($functions = spl_autoload_functions())) {
  39228. return array();
  39229. }
  39230. $classes = array();
  39231. foreach ($functions as $function) {
  39232. if (!is_array($function)) {
  39233. continue;
  39234. }
  39235. if ($function[0] instanceof DebugClassLoader) {
  39236. $function = $function[0]->getClassLoader();
  39237. if (is_object($function)) {
  39238. $function = array($function);
  39239. }
  39240. if (!is_array($function)) {
  39241. continue;
  39242. }
  39243. }
  39244. if ($function[0] instanceof ComposerClassLoader || $function[0] instanceof SymfonyClassLoader || $function[0] instanceof SymfonyUniversalClassLoader) {
  39245. foreach ($function[0]->getPrefixes() as $prefix => $paths) {
  39246. foreach ($paths as $path) {
  39247. $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
  39248. }
  39249. }
  39250. }
  39251. if ($function[0] instanceof ComposerClassLoader) {
  39252. foreach ($function[0]->getPrefixesPsr4() as $prefix => $paths) {
  39253. foreach ($paths as $path) {
  39254. $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
  39255. }
  39256. }
  39257. }
  39258. }
  39259. return array_unique($classes);
  39260. }
  39261. private function findClassInPath($path, $class, $prefix)
  39262. {
  39263. if (!$path = realpath($path.'/'.strtr($prefix, '\\_', '//')) ?: realpath($path.'/'.dirname(strtr($prefix, '\\_', '//'))) ?: realpath($path)) {
  39264. return array();
  39265. }
  39266. $classes = array();
  39267. $filename = $class.'.php';
  39268. foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
  39269. if ($filename == $file->getFileName() && $class = $this->convertFileToClass($path, $file->getPathName(), $prefix)) {
  39270. $classes[] = $class;
  39271. }
  39272. }
  39273. return $classes;
  39274. }
  39275. private function convertFileToClass($path, $file, $prefix)
  39276. {
  39277. $candidates = array(
  39278. $namespacedClass = str_replace(array($path.DIRECTORY_SEPARATOR, '.php', '/'), array('', '', '\\'), $file),
  39279. $prefix.$namespacedClass,
  39280. $prefix.'\\'.$namespacedClass,
  39281. str_replace('\\', '_', $namespacedClass),
  39282. str_replace('\\', '_', $prefix.$namespacedClass),
  39283. str_replace('\\', '_', $prefix.'\\'.$namespacedClass),
  39284. );
  39285. if ($prefix) {
  39286. $candidates = array_filter($candidates, function ($candidate) use ($prefix) { return 0 === strpos($candidate, $prefix); });
  39287. }
  39288. foreach ($candidates as $candidate) {
  39289. if ($this->classExists($candidate)) {
  39290. return $candidate;
  39291. }
  39292. }
  39293. require_once $file;
  39294. foreach ($candidates as $candidate) {
  39295. if ($this->classExists($candidate)) {
  39296. return $candidate;
  39297. }
  39298. }
  39299. }
  39300. private function classExists($class)
  39301. {
  39302. return class_exists($class, false) || interface_exists($class, false) || (function_exists('trait_exists') && trait_exists($class, false));
  39303. }
  39304. }
  39305. <?php
  39306. namespace Symfony\Component\Debug\FatalErrorHandler;
  39307. use Symfony\Component\Debug\Exception\FatalErrorException;
  39308. interface FatalErrorHandlerInterface
  39309. {
  39310. public function handleError(array $error, FatalErrorException $exception);
  39311. }
  39312. <?php
  39313. namespace Symfony\Component\Debug\FatalErrorHandler;
  39314. use Symfony\Component\Debug\Exception\UndefinedFunctionException;
  39315. use Symfony\Component\Debug\Exception\FatalErrorException;
  39316. class UndefinedFunctionFatalErrorHandler implements FatalErrorHandlerInterface
  39317. {
  39318. public function handleError(array $error, FatalErrorException $exception)
  39319. {
  39320. $messageLen = strlen($error['message']);
  39321. $notFoundSuffix = '()';
  39322. $notFoundSuffixLen = strlen($notFoundSuffix);
  39323. if ($notFoundSuffixLen > $messageLen) {
  39324. return;
  39325. }
  39326. if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) {
  39327. return;
  39328. }
  39329. $prefix = 'Call to undefined function ';
  39330. $prefixLen = strlen($prefix);
  39331. if (0 !== strpos($error['message'], $prefix)) {
  39332. return;
  39333. }
  39334. $fullyQualifiedFunctionName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);
  39335. if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedFunctionName, '\\')) {
  39336. $functionName = substr($fullyQualifiedFunctionName, $namespaceSeparatorIndex + 1);
  39337. $namespacePrefix = substr($fullyQualifiedFunctionName, 0, $namespaceSeparatorIndex);
  39338. $message = sprintf('Attempted to call function "%s" from namespace "%s".', $functionName, $namespacePrefix);
  39339. } else {
  39340. $functionName = $fullyQualifiedFunctionName;
  39341. $message = sprintf('Attempted to call function "%s" from the global namespace.', $functionName);
  39342. }
  39343. $candidates = array();
  39344. foreach (get_defined_functions() as $type => $definedFunctionNames) {
  39345. foreach ($definedFunctionNames as $definedFunctionName) {
  39346. if (false !== $namespaceSeparatorIndex = strrpos($definedFunctionName, '\\')) {
  39347. $definedFunctionNameBasename = substr($definedFunctionName, $namespaceSeparatorIndex + 1);
  39348. } else {
  39349. $definedFunctionNameBasename = $definedFunctionName;
  39350. }
  39351. if ($definedFunctionNameBasename === $functionName) {
  39352. $candidates[] = '\\'.$definedFunctionName;
  39353. }
  39354. }
  39355. }
  39356. if ($candidates) {
  39357. sort($candidates);
  39358. $last = array_pop($candidates).'"?';
  39359. if ($candidates) {
  39360. $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
  39361. } else {
  39362. $candidates = '"'.$last;
  39363. }
  39364. $message .= "\nDid you mean to call ".$candidates;
  39365. }
  39366. return new UndefinedFunctionException($message, $exception);
  39367. }
  39368. }
  39369. <?php
  39370. namespace Symfony\Component\Debug\FatalErrorHandler;
  39371. use Symfony\Component\Debug\Exception\FatalErrorException;
  39372. use Symfony\Component\Debug\Exception\UndefinedMethodException;
  39373. class UndefinedMethodFatalErrorHandler implements FatalErrorHandlerInterface
  39374. {
  39375. public function handleError(array $error, FatalErrorException $exception)
  39376. {
  39377. preg_match('/^Call to undefined method (.*)::(.*)\(\)$/', $error['message'], $matches);
  39378. if (!$matches) {
  39379. return;
  39380. }
  39381. $className = $matches[1];
  39382. $methodName = $matches[2];
  39383. $message = sprintf('Attempted to call an undefined method named "%s" of class "%s".', $methodName, $className);
  39384. if (!class_exists($className) || null === $methods = get_class_methods($className)) {
  39385. return new UndefinedMethodException($message, $exception);
  39386. }
  39387. $candidates = array();
  39388. foreach ($methods as $definedMethodName) {
  39389. $lev = levenshtein($methodName, $definedMethodName);
  39390. if ($lev <= strlen($methodName) / 3 || false !== strpos($definedMethodName, $methodName)) {
  39391. $candidates[] = $definedMethodName;
  39392. }
  39393. }
  39394. if ($candidates) {
  39395. sort($candidates);
  39396. $last = array_pop($candidates).'"?';
  39397. if ($candidates) {
  39398. $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
  39399. } else {
  39400. $candidates = '"'.$last;
  39401. }
  39402. $message .= "\nDid you mean to call ".$candidates;
  39403. }
  39404. return new UndefinedMethodException($message, $exception);
  39405. }
  39406. }
  39407. Copyright (c) 2004-2018 Fabien Potencier
  39408. Permission is hereby granted, free of charge, to any person obtaining a copy
  39409. of this software and associated documentation files (the "Software"), to deal
  39410. in the Software without restriction, including without limitation the rights
  39411. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  39412. copies of the Software, and to permit persons to whom the Software is furnished
  39413. to do so, subject to the following conditions:
  39414. The above copyright notice and this permission notice shall be included in all
  39415. copies or substantial portions of the Software.
  39416. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  39417. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  39418. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  39419. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  39420. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  39421. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  39422. THE SOFTWARE.
  39423. <?php
  39424. namespace Symfony\Component\Filesystem\Exception;
  39425. interface ExceptionInterface
  39426. {
  39427. }
  39428. <?php
  39429. namespace Symfony\Component\Filesystem\Exception;
  39430. class FileNotFoundException extends IOException
  39431. {
  39432. public function __construct($message = null, $code = 0, \Exception $previous = null, $path = null)
  39433. {
  39434. if (null === $message) {
  39435. if (null === $path) {
  39436. $message = 'File could not be found.';
  39437. } else {
  39438. $message = sprintf('File "%s" could not be found.', $path);
  39439. }
  39440. }
  39441. parent::__construct($message, $code, $previous, $path);
  39442. }
  39443. }
  39444. <?php
  39445. namespace Symfony\Component\Filesystem\Exception;
  39446. class IOException extends \RuntimeException implements IOExceptionInterface
  39447. {
  39448. private $path;
  39449. public function __construct($message, $code = 0, \Exception $previous = null, $path = null)
  39450. {
  39451. $this->path = $path;
  39452. parent::__construct($message, $code, $previous);
  39453. }
  39454. public function getPath()
  39455. {
  39456. return $this->path;
  39457. }
  39458. }
  39459. <?php
  39460. namespace Symfony\Component\Filesystem\Exception;
  39461. interface IOExceptionInterface extends ExceptionInterface
  39462. {
  39463. public function getPath();
  39464. }
  39465. <?php
  39466. namespace Symfony\Component\Filesystem;
  39467. use Symfony\Component\Filesystem\Exception\IOException;
  39468. use Symfony\Component\Filesystem\Exception\FileNotFoundException;
  39469. class Filesystem
  39470. {
  39471. private static $lastError;
  39472. public function copy($originFile, $targetFile, $overwriteNewerFiles = false)
  39473. {
  39474. $originIsLocal = stream_is_local($originFile) || 0 === stripos($originFile, 'file://');
  39475. if ($originIsLocal && !is_file($originFile)) {
  39476. throw new FileNotFoundException(sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile);
  39477. }
  39478. $this->mkdir(dirname($targetFile));
  39479. $doCopy = true;
  39480. if (!$overwriteNewerFiles && null === parse_url($originFile, PHP_URL_HOST) && is_file($targetFile)) {
  39481. $doCopy = filemtime($originFile) > filemtime($targetFile);
  39482. }
  39483. if ($doCopy) {
  39484. if (false === $source = @fopen($originFile, 'r')) {
  39485. throw new IOException(sprintf('Failed to copy "%s" to "%s" because source file could not be opened for reading.', $originFile, $targetFile), 0, null, $originFile);
  39486. }
  39487. if (false === $target = @fopen($targetFile, 'w', null, stream_context_create(array('ftp' => array('overwrite' => true))))) {
  39488. throw new IOException(sprintf('Failed to copy "%s" to "%s" because target file could not be opened for writing.', $originFile, $targetFile), 0, null, $originFile);
  39489. }
  39490. $bytesCopied = stream_copy_to_stream($source, $target);
  39491. fclose($source);
  39492. fclose($target);
  39493. unset($source, $target);
  39494. if (!is_file($targetFile)) {
  39495. throw new IOException(sprintf('Failed to copy "%s" to "%s".', $originFile, $targetFile), 0, null, $originFile);
  39496. }
  39497. if ($originIsLocal) {
  39498. @chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111));
  39499. if ($bytesCopied !== $bytesOrigin = filesize($originFile)) {
  39500. throw new IOException(sprintf('Failed to copy the whole content of "%s" to "%s" (%g of %g bytes copied).', $originFile, $targetFile, $bytesCopied, $bytesOrigin), 0, null, $originFile);
  39501. }
  39502. }
  39503. }
  39504. }
  39505. public function mkdir($dirs, $mode = 0777)
  39506. {
  39507. foreach ($this->toIterator($dirs) as $dir) {
  39508. if (is_dir($dir)) {
  39509. continue;
  39510. }
  39511. if (!self::box('mkdir', $dir, $mode, true)) {
  39512. if (!is_dir($dir)) {
  39513. if (self::$lastError) {
  39514. throw new IOException(sprintf('Failed to create "%s": %s.', $dir, self::$lastError), 0, null, $dir);
  39515. }
  39516. throw new IOException(sprintf('Failed to create "%s"', $dir), 0, null, $dir);
  39517. }
  39518. }
  39519. }
  39520. }
  39521. public function exists($files)
  39522. {
  39523. $maxPathLength = PHP_MAXPATHLEN - 2;
  39524. foreach ($this->toIterator($files) as $file) {
  39525. if (strlen($file) > $maxPathLength) {
  39526. throw new IOException(sprintf('Could not check if file exist because path length exceeds %d characters.', $maxPathLength), 0, null, $file);
  39527. }
  39528. if (!file_exists($file)) {
  39529. return false;
  39530. }
  39531. }
  39532. return true;
  39533. }
  39534. public function touch($files, $time = null, $atime = null)
  39535. {
  39536. foreach ($this->toIterator($files) as $file) {
  39537. $touch = $time ? @touch($file, $time, $atime) : @touch($file);
  39538. if (true !== $touch) {
  39539. throw new IOException(sprintf('Failed to touch "%s".', $file), 0, null, $file);
  39540. }
  39541. }
  39542. }
  39543. public function remove($files)
  39544. {
  39545. if ($files instanceof \Traversable) {
  39546. $files = iterator_to_array($files, false);
  39547. } elseif (!is_array($files)) {
  39548. $files = array($files);
  39549. }
  39550. $files = array_reverse($files);
  39551. foreach ($files as $file) {
  39552. if (is_link($file)) {
  39553. if (!(self::box('unlink', $file) || '\\' !== DIRECTORY_SEPARATOR || self::box('rmdir', $file)) && file_exists($file)) {
  39554. throw new IOException(sprintf('Failed to remove symlink "%s": %s.', $file, self::$lastError));
  39555. }
  39556. } elseif (is_dir($file)) {
  39557. $this->remove(new \FilesystemIterator($file, \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS));
  39558. if (!self::box('rmdir', $file) && file_exists($file)) {
  39559. throw new IOException(sprintf('Failed to remove directory "%s": %s.', $file, self::$lastError));
  39560. }
  39561. } elseif (!self::box('unlink', $file) && file_exists($file)) {
  39562. throw new IOException(sprintf('Failed to remove file "%s": %s.', $file, self::$lastError));
  39563. }
  39564. }
  39565. }
  39566. public function chmod($files, $mode, $umask = 0000, $recursive = false)
  39567. {
  39568. foreach ($this->toIterator($files) as $file) {
  39569. if (true !== @chmod($file, $mode & ~$umask)) {
  39570. throw new IOException(sprintf('Failed to chmod file "%s".', $file), 0, null, $file);
  39571. }
  39572. if ($recursive && is_dir($file) && !is_link($file)) {
  39573. $this->chmod(new \FilesystemIterator($file), $mode, $umask, true);
  39574. }
  39575. }
  39576. }
  39577. public function chown($files, $user, $recursive = false)
  39578. {
  39579. foreach ($this->toIterator($files) as $file) {
  39580. if ($recursive && is_dir($file) && !is_link($file)) {
  39581. $this->chown(new \FilesystemIterator($file), $user, true);
  39582. }
  39583. if (is_link($file) && function_exists('lchown')) {
  39584. if (true !== @lchown($file, $user)) {
  39585. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  39586. }
  39587. } else {
  39588. if (true !== @chown($file, $user)) {
  39589. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  39590. }
  39591. }
  39592. }
  39593. }
  39594. public function chgrp($files, $group, $recursive = false)
  39595. {
  39596. foreach ($this->toIterator($files) as $file) {
  39597. if ($recursive && is_dir($file) && !is_link($file)) {
  39598. $this->chgrp(new \FilesystemIterator($file), $group, true);
  39599. }
  39600. if (is_link($file) && function_exists('lchgrp')) {
  39601. if (true !== @lchgrp($file, $group) || (defined('HHVM_VERSION') && !posix_getgrnam($group))) {
  39602. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  39603. }
  39604. } else {
  39605. if (true !== @chgrp($file, $group)) {
  39606. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  39607. }
  39608. }
  39609. }
  39610. }
  39611. public function rename($origin, $target, $overwrite = false)
  39612. {
  39613. if (!$overwrite && $this->isReadable($target)) {
  39614. throw new IOException(sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target);
  39615. }
  39616. if (true !== @rename($origin, $target)) {
  39617. if (is_dir($origin)) {
  39618. $this->mirror($origin, $target, null, array('override' => $overwrite, 'delete' => $overwrite));
  39619. $this->remove($origin);
  39620. return;
  39621. }
  39622. throw new IOException(sprintf('Cannot rename "%s" to "%s".', $origin, $target), 0, null, $target);
  39623. }
  39624. }
  39625. private function isReadable($filename)
  39626. {
  39627. $maxPathLength = PHP_MAXPATHLEN - 2;
  39628. if (strlen($filename) > $maxPathLength) {
  39629. throw new IOException(sprintf('Could not check if file is readable because path length exceeds %d characters.', $maxPathLength), 0, null, $filename);
  39630. }
  39631. return is_readable($filename);
  39632. }
  39633. public function symlink($originDir, $targetDir, $copyOnWindows = false)
  39634. {
  39635. if ('\\' === DIRECTORY_SEPARATOR) {
  39636. $originDir = strtr($originDir, '/', '\\');
  39637. $targetDir = strtr($targetDir, '/', '\\');
  39638. if ($copyOnWindows) {
  39639. $this->mirror($originDir, $targetDir);
  39640. return;
  39641. }
  39642. }
  39643. $this->mkdir(dirname($targetDir));
  39644. if (is_link($targetDir)) {
  39645. if (readlink($targetDir) === $originDir) {
  39646. return;
  39647. }
  39648. $this->remove($targetDir);
  39649. }
  39650. if (!self::box('symlink', $originDir, $targetDir)) {
  39651. if (null !== self::$lastError) {
  39652. if ('\\' === DIRECTORY_SEPARATOR && false !== strpos(self::$lastError, 'error code(1314)')) {
  39653. throw new IOException('Unable to create symlink due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?', 0, null, $targetDir);
  39654. }
  39655. }
  39656. throw new IOException(sprintf('Failed to create symbolic link from "%s" to "%s".', $originDir, $targetDir), 0, null, $targetDir);
  39657. }
  39658. }
  39659. public function makePathRelative($endPath, $startPath)
  39660. {
  39661. if ('\\' === DIRECTORY_SEPARATOR) {
  39662. $endPath = str_replace('\\', '/', $endPath);
  39663. $startPath = str_replace('\\', '/', $startPath);
  39664. }
  39665. $stripDriveLetter = function ($path) {
  39666. if (strlen($path) > 2 && ':' === $path[1] && '/' === $path[2] && ctype_alpha($path[0])) {
  39667. return substr($path, 2);
  39668. }
  39669. return $path;
  39670. };
  39671. $endPath = $stripDriveLetter($endPath);
  39672. $startPath = $stripDriveLetter($startPath);
  39673. $startPathArr = explode('/', trim($startPath, '/'));
  39674. $endPathArr = explode('/', trim($endPath, '/'));
  39675. $normalizePathArray = function ($pathSegments, $absolute) {
  39676. $result = array();
  39677. foreach ($pathSegments as $segment) {
  39678. if ('..' === $segment && ($absolute || count($result))) {
  39679. array_pop($result);
  39680. } elseif ('.' !== $segment) {
  39681. $result[] = $segment;
  39682. }
  39683. }
  39684. return $result;
  39685. };
  39686. $startPathArr = $normalizePathArray($startPathArr, static::isAbsolutePath($startPath));
  39687. $endPathArr = $normalizePathArray($endPathArr, static::isAbsolutePath($endPath));
  39688. $index = 0;
  39689. while (isset($startPathArr[$index]) && isset($endPathArr[$index]) && $startPathArr[$index] === $endPathArr[$index]) {
  39690. ++$index;
  39691. }
  39692. if (1 === count($startPathArr) && '' === $startPathArr[0]) {
  39693. $depth = 0;
  39694. } else {
  39695. $depth = count($startPathArr) - $index;
  39696. }
  39697. $traverser = str_repeat('../', $depth);
  39698. $endPathRemainder = implode('/', array_slice($endPathArr, $index));
  39699. $relativePath = $traverser.('' !== $endPathRemainder ? $endPathRemainder.'/' : '');
  39700. return '' === $relativePath ? './' : $relativePath;
  39701. }
  39702. public function mirror($originDir, $targetDir, \Traversable $iterator = null, $options = array())
  39703. {
  39704. $targetDir = rtrim($targetDir, '/\\');
  39705. $originDir = rtrim($originDir, '/\\');
  39706. $originDirLen = strlen($originDir);
  39707. if ($this->exists($targetDir) && isset($options['delete']) && $options['delete']) {
  39708. $deleteIterator = $iterator;
  39709. if (null === $deleteIterator) {
  39710. $flags = \FilesystemIterator::SKIP_DOTS;
  39711. $deleteIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($targetDir, $flags), \RecursiveIteratorIterator::CHILD_FIRST);
  39712. }
  39713. $targetDirLen = strlen($targetDir);
  39714. foreach ($deleteIterator as $file) {
  39715. $origin = $originDir.substr($file->getPathname(), $targetDirLen);
  39716. if (!$this->exists($origin)) {
  39717. $this->remove($file);
  39718. }
  39719. }
  39720. }
  39721. $copyOnWindows = false;
  39722. if (isset($options['copy_on_windows'])) {
  39723. $copyOnWindows = $options['copy_on_windows'];
  39724. }
  39725. if (null === $iterator) {
  39726. $flags = $copyOnWindows ? \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS : \FilesystemIterator::SKIP_DOTS;
  39727. $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($originDir, $flags), \RecursiveIteratorIterator::SELF_FIRST);
  39728. }
  39729. if ($this->exists($originDir)) {
  39730. $this->mkdir($targetDir);
  39731. }
  39732. foreach ($iterator as $file) {
  39733. $target = $targetDir.substr($file->getPathname(), $originDirLen);
  39734. if ($copyOnWindows) {
  39735. if (is_file($file)) {
  39736. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  39737. } elseif (is_dir($file)) {
  39738. $this->mkdir($target);
  39739. } else {
  39740. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  39741. }
  39742. } else {
  39743. if (is_link($file)) {
  39744. $this->symlink($file->getLinkTarget(), $target);
  39745. } elseif (is_dir($file)) {
  39746. $this->mkdir($target);
  39747. } elseif (is_file($file)) {
  39748. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  39749. } else {
  39750. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  39751. }
  39752. }
  39753. }
  39754. }
  39755. public function isAbsolutePath($file)
  39756. {
  39757. return strspn($file, '/\\', 0, 1)
  39758. || (strlen($file) > 3 && ctype_alpha($file[0])
  39759. && ':' === substr($file, 1, 1)
  39760. && strspn($file, '/\\', 2, 1)
  39761. )
  39762. || null !== parse_url($file, PHP_URL_SCHEME)
  39763. ;
  39764. }
  39765. public function tempnam($dir, $prefix)
  39766. {
  39767. list($scheme, $hierarchy) = $this->getSchemeAndHierarchy($dir);
  39768. if (null === $scheme || 'file' === $scheme || 'gs' === $scheme) {
  39769. $tmpFile = @tempnam($hierarchy, $prefix);
  39770. if (false !== $tmpFile) {
  39771. if (null !== $scheme && 'gs' !== $scheme) {
  39772. return $scheme.'://'.$tmpFile;
  39773. }
  39774. return $tmpFile;
  39775. }
  39776. throw new IOException('A temporary file could not be created.');
  39777. }
  39778. for ($i = 0; $i < 10; ++$i) {
  39779. $tmpFile = $dir.'/'.$prefix.uniqid(mt_rand(), true);
  39780. $handle = @fopen($tmpFile, 'x+');
  39781. if (false === $handle) {
  39782. continue;
  39783. }
  39784. @fclose($handle);
  39785. return $tmpFile;
  39786. }
  39787. throw new IOException('A temporary file could not be created.');
  39788. }
  39789. public function dumpFile($filename, $content, $mode = 0666)
  39790. {
  39791. $dir = dirname($filename);
  39792. if (!is_dir($dir)) {
  39793. $this->mkdir($dir);
  39794. }
  39795. if (!is_writable($dir)) {
  39796. throw new IOException(sprintf('Unable to write to the "%s" directory.', $dir), 0, null, $dir);
  39797. }
  39798. $tmpFile = $this->tempnam($dir, basename($filename));
  39799. if (false === @file_put_contents($tmpFile, $content)) {
  39800. throw new IOException(sprintf('Failed to write file "%s".', $filename), 0, null, $filename);
  39801. }
  39802. if (null !== $mode) {
  39803. if (func_num_args() > 2) {
  39804. @trigger_error('Support for modifying file permissions is deprecated since Symfony 2.3.12 and will be removed in 3.0.', E_USER_DEPRECATED);
  39805. }
  39806. $this->chmod($tmpFile, $mode);
  39807. } elseif (file_exists($filename)) {
  39808. @chmod($tmpFile, fileperms($filename));
  39809. }
  39810. $this->rename($tmpFile, $filename, true);
  39811. }
  39812. private function toIterator($files)
  39813. {
  39814. if (!$files instanceof \Traversable) {
  39815. $files = new \ArrayObject(is_array($files) ? $files : array($files));
  39816. }
  39817. return $files;
  39818. }
  39819. private function getSchemeAndHierarchy($filename)
  39820. {
  39821. $components = explode('://', $filename, 2);
  39822. return 2 === count($components) ? array($components[0], $components[1]) : array(null, $components[0]);
  39823. }
  39824. private static function box($func)
  39825. {
  39826. self::$lastError = null;
  39827. \set_error_handler(__CLASS__.'::handleError');
  39828. try {
  39829. $result = \call_user_func_array($func, \array_slice(\func_get_args(), 1));
  39830. \restore_error_handler();
  39831. return $result;
  39832. } catch (\Throwable $e) {
  39833. } catch (\Exception $e) {
  39834. }
  39835. \restore_error_handler();
  39836. throw $e;
  39837. }
  39838. public static function handleError($type, $msg)
  39839. {
  39840. self::$lastError = $msg;
  39841. }
  39842. }
  39843. Copyright (c) 2004-2018 Fabien Potencier
  39844. Permission is hereby granted, free of charge, to any person obtaining a copy
  39845. of this software and associated documentation files (the "Software"), to deal
  39846. in the Software without restriction, including without limitation the rights
  39847. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  39848. copies of the Software, and to permit persons to whom the Software is furnished
  39849. to do so, subject to the following conditions:
  39850. The above copyright notice and this permission notice shall be included in all
  39851. copies or substantial portions of the Software.
  39852. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  39853. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  39854. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  39855. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  39856. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  39857. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  39858. THE SOFTWARE.
  39859. <?php
  39860. namespace Symfony\Component\Filesystem;
  39861. use Symfony\Component\Filesystem\Exception\IOException;
  39862. class LockHandler
  39863. {
  39864. private $file;
  39865. private $handle;
  39866. public function __construct($name, $lockPath = null)
  39867. {
  39868. $lockPath = $lockPath ?: sys_get_temp_dir();
  39869. if (!is_dir($lockPath)) {
  39870. $fs = new Filesystem();
  39871. $fs->mkdir($lockPath);
  39872. }
  39873. if (!is_writable($lockPath)) {
  39874. throw new IOException(sprintf('The directory "%s" is not writable.', $lockPath), 0, null, $lockPath);
  39875. }
  39876. $this->file = sprintf('%s/sf.%s.%s.lock', $lockPath, preg_replace('/[^a-z0-9\._-]+/i', '-', $name), hash('sha256', $name));
  39877. }
  39878. public function lock($blocking = false)
  39879. {
  39880. if ($this->handle) {
  39881. return true;
  39882. }
  39883. $error = null;
  39884. set_error_handler(function ($errno, $msg) use (&$error) {
  39885. $error = $msg;
  39886. });
  39887. if (!$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r')) {
  39888. if ($this->handle = fopen($this->file, 'x')) {
  39889. chmod($this->file, 0666);
  39890. } elseif (!$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r')) {
  39891. usleep(100);
  39892. $this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r');
  39893. }
  39894. }
  39895. restore_error_handler();
  39896. if (!$this->handle) {
  39897. throw new IOException($error, 0, null, $this->file);
  39898. }
  39899. if (!flock($this->handle, LOCK_EX | ($blocking ? 0 : LOCK_NB))) {
  39900. fclose($this->handle);
  39901. $this->handle = null;
  39902. return false;
  39903. }
  39904. return true;
  39905. }
  39906. public function release()
  39907. {
  39908. if ($this->handle) {
  39909. flock($this->handle, LOCK_UN | LOCK_NB);
  39910. fclose($this->handle);
  39911. $this->handle = null;
  39912. }
  39913. }
  39914. }
  39915. <?php
  39916. namespace Symfony\Component\Finder\Adapter;
  39917. @trigger_error('The '.__NAMESPACE__.'\AbstractAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  39918. abstract class AbstractAdapter implements AdapterInterface
  39919. {
  39920. protected $followLinks = false;
  39921. protected $mode = 0;
  39922. protected $minDepth = 0;
  39923. protected $maxDepth = PHP_INT_MAX;
  39924. protected $exclude = array();
  39925. protected $names = array();
  39926. protected $notNames = array();
  39927. protected $contains = array();
  39928. protected $notContains = array();
  39929. protected $sizes = array();
  39930. protected $dates = array();
  39931. protected $filters = array();
  39932. protected $sort = false;
  39933. protected $paths = array();
  39934. protected $notPaths = array();
  39935. protected $ignoreUnreadableDirs = false;
  39936. private static $areSupported = array();
  39937. public function isSupported()
  39938. {
  39939. $name = $this->getName();
  39940. if (!array_key_exists($name, self::$areSupported)) {
  39941. self::$areSupported[$name] = $this->canBeUsed();
  39942. }
  39943. return self::$areSupported[$name];
  39944. }
  39945. public function setFollowLinks($followLinks)
  39946. {
  39947. $this->followLinks = $followLinks;
  39948. return $this;
  39949. }
  39950. public function setMode($mode)
  39951. {
  39952. $this->mode = $mode;
  39953. return $this;
  39954. }
  39955. public function setDepths(array $depths)
  39956. {
  39957. $this->minDepth = 0;
  39958. $this->maxDepth = PHP_INT_MAX;
  39959. foreach ($depths as $comparator) {
  39960. switch ($comparator->getOperator()) {
  39961. case '>':
  39962. $this->minDepth = $comparator->getTarget() + 1;
  39963. break;
  39964. case '>=':
  39965. $this->minDepth = $comparator->getTarget();
  39966. break;
  39967. case '<':
  39968. $this->maxDepth = $comparator->getTarget() - 1;
  39969. break;
  39970. case '<=':
  39971. $this->maxDepth = $comparator->getTarget();
  39972. break;
  39973. default:
  39974. $this->minDepth = $this->maxDepth = $comparator->getTarget();
  39975. }
  39976. }
  39977. return $this;
  39978. }
  39979. public function setExclude(array $exclude)
  39980. {
  39981. $this->exclude = $exclude;
  39982. return $this;
  39983. }
  39984. public function setNames(array $names)
  39985. {
  39986. $this->names = $names;
  39987. return $this;
  39988. }
  39989. public function setNotNames(array $notNames)
  39990. {
  39991. $this->notNames = $notNames;
  39992. return $this;
  39993. }
  39994. public function setContains(array $contains)
  39995. {
  39996. $this->contains = $contains;
  39997. return $this;
  39998. }
  39999. public function setNotContains(array $notContains)
  40000. {
  40001. $this->notContains = $notContains;
  40002. return $this;
  40003. }
  40004. public function setSizes(array $sizes)
  40005. {
  40006. $this->sizes = $sizes;
  40007. return $this;
  40008. }
  40009. public function setDates(array $dates)
  40010. {
  40011. $this->dates = $dates;
  40012. return $this;
  40013. }
  40014. public function setFilters(array $filters)
  40015. {
  40016. $this->filters = $filters;
  40017. return $this;
  40018. }
  40019. public function setSort($sort)
  40020. {
  40021. $this->sort = $sort;
  40022. return $this;
  40023. }
  40024. public function setPath(array $paths)
  40025. {
  40026. $this->paths = $paths;
  40027. return $this;
  40028. }
  40029. public function setNotPath(array $notPaths)
  40030. {
  40031. $this->notPaths = $notPaths;
  40032. return $this;
  40033. }
  40034. public function ignoreUnreadableDirs($ignore = true)
  40035. {
  40036. $this->ignoreUnreadableDirs = (bool) $ignore;
  40037. return $this;
  40038. }
  40039. abstract protected function canBeUsed();
  40040. }
  40041. <?php
  40042. namespace Symfony\Component\Finder\Adapter;
  40043. @trigger_error('The '.__NAMESPACE__.'\AbstractFindAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  40044. use Symfony\Component\Finder\Exception\AccessDeniedException;
  40045. use Symfony\Component\Finder\Iterator;
  40046. use Symfony\Component\Finder\Shell\Shell;
  40047. use Symfony\Component\Finder\Expression\Expression;
  40048. use Symfony\Component\Finder\Shell\Command;
  40049. use Symfony\Component\Finder\Comparator\NumberComparator;
  40050. use Symfony\Component\Finder\Comparator\DateComparator;
  40051. abstract class AbstractFindAdapter extends AbstractAdapter
  40052. {
  40053. protected $shell;
  40054. public function __construct()
  40055. {
  40056. $this->shell = new Shell();
  40057. }
  40058. public function searchInDirectory($dir)
  40059. {
  40060. $dir = realpath($dir);
  40061. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode && ($this->contains || $this->notContains)) {
  40062. return new Iterator\FilePathsIterator(array(), $dir);
  40063. }
  40064. $command = Command::create();
  40065. $find = $this->buildFindCommand($command, $dir);
  40066. if ($this->followLinks) {
  40067. $find->add('-follow');
  40068. }
  40069. $find->add('-mindepth')->add($this->minDepth + 1);
  40070. if (PHP_INT_MAX !== $this->maxDepth) {
  40071. $find->add('-maxdepth')->add($this->maxDepth + 1);
  40072. }
  40073. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode) {
  40074. $find->add('-type d');
  40075. } elseif (Iterator\FileTypeFilterIterator::ONLY_FILES === $this->mode) {
  40076. $find->add('-type f');
  40077. }
  40078. $this->buildNamesFiltering($find, $this->names);
  40079. $this->buildNamesFiltering($find, $this->notNames, true);
  40080. $this->buildPathsFiltering($find, $dir, $this->paths);
  40081. $this->buildPathsFiltering($find, $dir, $this->notPaths, true);
  40082. $this->buildSizesFiltering($find, $this->sizes);
  40083. $this->buildDatesFiltering($find, $this->dates);
  40084. $useGrep = $this->shell->testCommand('grep') && $this->shell->testCommand('xargs');
  40085. $useSort = is_int($this->sort) && $this->shell->testCommand('sort') && $this->shell->testCommand('cut');
  40086. if ($useGrep && ($this->contains || $this->notContains)) {
  40087. $grep = $command->ins('grep');
  40088. $this->buildContentFiltering($grep, $this->contains);
  40089. $this->buildContentFiltering($grep, $this->notContains, true);
  40090. }
  40091. if ($useSort) {
  40092. $this->buildSorting($command, $this->sort);
  40093. }
  40094. $command->setErrorHandler(
  40095. $this->ignoreUnreadableDirs
  40096. ? function ($stderr) { }
  40097. : function ($stderr) { throw new AccessDeniedException($stderr); }
  40098. );
  40099. $paths = $this->shell->testCommand('uniq') ? $command->add('| uniq')->execute() : array_unique($command->execute());
  40100. $iterator = new Iterator\FilePathsIterator($paths, $dir);
  40101. if ($this->exclude) {
  40102. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  40103. }
  40104. if (!$useGrep && ($this->contains || $this->notContains)) {
  40105. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  40106. }
  40107. if ($this->filters) {
  40108. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  40109. }
  40110. if (!$useSort && $this->sort) {
  40111. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  40112. $iterator = $iteratorAggregate->getIterator();
  40113. }
  40114. return $iterator;
  40115. }
  40116. protected function canBeUsed()
  40117. {
  40118. return $this->shell->testCommand('find');
  40119. }
  40120. protected function buildFindCommand(Command $command, $dir)
  40121. {
  40122. return $command
  40123. ->ins('find')
  40124. ->add('find ')
  40125. ->arg($dir)
  40126. ->add('-noleaf');
  40127. }
  40128. private function buildNamesFiltering(Command $command, array $names, $not = false)
  40129. {
  40130. if (0 === count($names)) {
  40131. return;
  40132. }
  40133. $command->add($not ? '-not' : null)->cmd('(');
  40134. foreach ($names as $i => $name) {
  40135. $expr = Expression::create($name);
  40136. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  40137. $expr = Expression::create($expr->getGlob()->toRegex(false));
  40138. }
  40139. if ($expr->isRegex()) {
  40140. $regex = $expr->getRegex();
  40141. $regex->prepend($regex->hasStartFlag() ? '/' : '/[^/]*')
  40142. ->setStartFlag(false)
  40143. ->setStartJoker(true)
  40144. ->replaceJokers('[^/]');
  40145. if (!$regex->hasEndFlag() || $regex->hasEndJoker()) {
  40146. $regex->setEndJoker(false)->append('[^/]*');
  40147. }
  40148. }
  40149. $command
  40150. ->add($i > 0 ? '-or' : null)
  40151. ->add($expr->isRegex()
  40152. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  40153. : ($expr->isCaseSensitive() ? '-name' : '-iname')
  40154. )
  40155. ->arg($expr->renderPattern());
  40156. }
  40157. $command->cmd(')');
  40158. }
  40159. private function buildPathsFiltering(Command $command, $dir, array $paths, $not = false)
  40160. {
  40161. if (0 === count($paths)) {
  40162. return;
  40163. }
  40164. $command->add($not ? '-not' : null)->cmd('(');
  40165. foreach ($paths as $i => $path) {
  40166. $expr = Expression::create($path);
  40167. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  40168. $expr = Expression::create($expr->getGlob()->toRegex(false));
  40169. }
  40170. if ($expr->isRegex()) {
  40171. $regex = $expr->getRegex();
  40172. $regex->prepend($regex->hasStartFlag() ? preg_quote($dir).DIRECTORY_SEPARATOR : '.*')->setEndJoker(!$regex->hasEndFlag());
  40173. } else {
  40174. $expr->prepend('*')->append('*');
  40175. }
  40176. $command
  40177. ->add($i > 0 ? '-or' : null)
  40178. ->add($expr->isRegex()
  40179. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  40180. : ($expr->isCaseSensitive() ? '-path' : '-ipath')
  40181. )
  40182. ->arg($expr->renderPattern());
  40183. }
  40184. $command->cmd(')');
  40185. }
  40186. private function buildSizesFiltering(Command $command, array $sizes)
  40187. {
  40188. foreach ($sizes as $i => $size) {
  40189. $command->add($i > 0 ? '-and' : null);
  40190. switch ($size->getOperator()) {
  40191. case '<=':
  40192. $command->add('-size -'.($size->getTarget() + 1).'c');
  40193. break;
  40194. case '>=':
  40195. $command->add('-size +'.($size->getTarget() - 1).'c');
  40196. break;
  40197. case '>':
  40198. $command->add('-size +'.$size->getTarget().'c');
  40199. break;
  40200. case '!=':
  40201. $command->add('-size -'.$size->getTarget().'c');
  40202. $command->add('-size +'.$size->getTarget().'c');
  40203. break;
  40204. case '<':
  40205. default:
  40206. $command->add('-size -'.$size->getTarget().'c');
  40207. }
  40208. }
  40209. }
  40210. private function buildDatesFiltering(Command $command, array $dates)
  40211. {
  40212. foreach ($dates as $i => $date) {
  40213. $command->add($i > 0 ? '-and' : null);
  40214. $mins = (int) round((time() - $date->getTarget()) / 60);
  40215. if (0 > $mins) {
  40216. $command->add(' -mmin -0');
  40217. return;
  40218. }
  40219. switch ($date->getOperator()) {
  40220. case '<=':
  40221. $command->add('-mmin +'.($mins - 1));
  40222. break;
  40223. case '>=':
  40224. $command->add('-mmin -'.($mins + 1));
  40225. break;
  40226. case '>':
  40227. $command->add('-mmin -'.$mins);
  40228. break;
  40229. case '!=':
  40230. $command->add('-mmin +'.$mins.' -or -mmin -'.$mins);
  40231. break;
  40232. case '<':
  40233. default:
  40234. $command->add('-mmin +'.$mins);
  40235. }
  40236. }
  40237. }
  40238. private function buildSorting(Command $command, $sort)
  40239. {
  40240. $this->buildFormatSorting($command, $sort);
  40241. }
  40242. abstract protected function buildFormatSorting(Command $command, $sort);
  40243. abstract protected function buildContentFiltering(Command $command, array $contains, $not = false);
  40244. }
  40245. <?php
  40246. namespace Symfony\Component\Finder\Adapter;
  40247. interface AdapterInterface
  40248. {
  40249. public function setFollowLinks($followLinks);
  40250. public function setMode($mode);
  40251. public function setExclude(array $exclude);
  40252. public function setDepths(array $depths);
  40253. public function setNames(array $names);
  40254. public function setNotNames(array $notNames);
  40255. public function setContains(array $contains);
  40256. public function setNotContains(array $notContains);
  40257. public function setSizes(array $sizes);
  40258. public function setDates(array $dates);
  40259. public function setFilters(array $filters);
  40260. public function setSort($sort);
  40261. public function setPath(array $paths);
  40262. public function setNotPath(array $notPaths);
  40263. public function ignoreUnreadableDirs($ignore = true);
  40264. public function searchInDirectory($dir);
  40265. public function isSupported();
  40266. public function getName();
  40267. }
  40268. <?php
  40269. namespace Symfony\Component\Finder\Adapter;
  40270. @trigger_error('The '.__NAMESPACE__.'\BsdFindAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  40271. use Symfony\Component\Finder\Shell\Shell;
  40272. use Symfony\Component\Finder\Shell\Command;
  40273. use Symfony\Component\Finder\Iterator\SortableIterator;
  40274. use Symfony\Component\Finder\Expression\Expression;
  40275. class BsdFindAdapter extends AbstractFindAdapter
  40276. {
  40277. public function getName()
  40278. {
  40279. return 'bsd_find';
  40280. }
  40281. protected function canBeUsed()
  40282. {
  40283. return in_array($this->shell->getType(), array(Shell::TYPE_BSD, Shell::TYPE_DARWIN)) && parent::canBeUsed();
  40284. }
  40285. protected function buildFormatSorting(Command $command, $sort)
  40286. {
  40287. switch ($sort) {
  40288. case SortableIterator::SORT_BY_NAME:
  40289. $command->ins('sort')->add('| sort');
  40290. return;
  40291. case SortableIterator::SORT_BY_TYPE:
  40292. $format = '%HT';
  40293. break;
  40294. case SortableIterator::SORT_BY_ACCESSED_TIME:
  40295. $format = '%a';
  40296. break;
  40297. case SortableIterator::SORT_BY_CHANGED_TIME:
  40298. $format = '%c';
  40299. break;
  40300. case SortableIterator::SORT_BY_MODIFIED_TIME:
  40301. $format = '%m';
  40302. break;
  40303. default:
  40304. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  40305. }
  40306. $command
  40307. ->add('-print0 | xargs -0 stat -f')
  40308. ->arg($format.'%t%N')
  40309. ->add('| sort | cut -f 2');
  40310. }
  40311. protected function buildFindCommand(Command $command, $dir)
  40312. {
  40313. parent::buildFindCommand($command, $dir)->addAtIndex('-E', 1);
  40314. return $command;
  40315. }
  40316. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  40317. {
  40318. foreach ($contains as $contain) {
  40319. $expr = Expression::create($contain);
  40320. $command
  40321. ->add('| grep -v \'^$\'')
  40322. ->add('| xargs -I{} grep -I')
  40323. ->add($expr->isCaseSensitive() ? null : '-i')
  40324. ->add($not ? '-L' : '-l')
  40325. ->add('-Ee')->arg($expr->renderPattern())
  40326. ->add('{}')
  40327. ;
  40328. }
  40329. }
  40330. }
  40331. <?php
  40332. namespace Symfony\Component\Finder\Adapter;
  40333. @trigger_error('The '.__NAMESPACE__.'\GnuFindAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  40334. use Symfony\Component\Finder\Shell\Shell;
  40335. use Symfony\Component\Finder\Shell\Command;
  40336. use Symfony\Component\Finder\Iterator\SortableIterator;
  40337. use Symfony\Component\Finder\Expression\Expression;
  40338. class GnuFindAdapter extends AbstractFindAdapter
  40339. {
  40340. public function getName()
  40341. {
  40342. return 'gnu_find';
  40343. }
  40344. protected function buildFormatSorting(Command $command, $sort)
  40345. {
  40346. switch ($sort) {
  40347. case SortableIterator::SORT_BY_NAME:
  40348. $command->ins('sort')->add('| sort');
  40349. return;
  40350. case SortableIterator::SORT_BY_TYPE:
  40351. $format = '%y';
  40352. break;
  40353. case SortableIterator::SORT_BY_ACCESSED_TIME:
  40354. $format = '%A@';
  40355. break;
  40356. case SortableIterator::SORT_BY_CHANGED_TIME:
  40357. $format = '%C@';
  40358. break;
  40359. case SortableIterator::SORT_BY_MODIFIED_TIME:
  40360. $format = '%T@';
  40361. break;
  40362. default:
  40363. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  40364. }
  40365. $command
  40366. ->get('find')
  40367. ->add('-printf')
  40368. ->arg($format.' %h/%f\\n')
  40369. ->add('| sort | cut')
  40370. ->arg('-d ')
  40371. ->arg('-f2-')
  40372. ;
  40373. }
  40374. protected function canBeUsed()
  40375. {
  40376. return Shell::TYPE_UNIX === $this->shell->getType() && parent::canBeUsed();
  40377. }
  40378. protected function buildFindCommand(Command $command, $dir)
  40379. {
  40380. return parent::buildFindCommand($command, $dir)->add('-regextype posix-extended');
  40381. }
  40382. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  40383. {
  40384. foreach ($contains as $contain) {
  40385. $expr = Expression::create($contain);
  40386. $command
  40387. ->add('| xargs -I{} -r grep -I')
  40388. ->add($expr->isCaseSensitive() ? null : '-i')
  40389. ->add($not ? '-L' : '-l')
  40390. ->add('-Ee')->arg($expr->renderPattern())
  40391. ->add('{}')
  40392. ;
  40393. }
  40394. }
  40395. }
  40396. <?php
  40397. namespace Symfony\Component\Finder\Adapter;
  40398. @trigger_error('The '.__NAMESPACE__.'\PhpAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  40399. use Symfony\Component\Finder\Iterator;
  40400. class PhpAdapter extends AbstractAdapter
  40401. {
  40402. public function searchInDirectory($dir)
  40403. {
  40404. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  40405. if ($this->followLinks) {
  40406. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  40407. }
  40408. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  40409. if ($this->exclude) {
  40410. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  40411. }
  40412. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  40413. if ($this->minDepth > 0 || $this->maxDepth < PHP_INT_MAX) {
  40414. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $this->minDepth, $this->maxDepth);
  40415. }
  40416. if ($this->mode) {
  40417. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  40418. }
  40419. if ($this->names || $this->notNames) {
  40420. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  40421. }
  40422. if ($this->contains || $this->notContains) {
  40423. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  40424. }
  40425. if ($this->sizes) {
  40426. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  40427. }
  40428. if ($this->dates) {
  40429. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  40430. }
  40431. if ($this->filters) {
  40432. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  40433. }
  40434. if ($this->paths || $this->notPaths) {
  40435. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  40436. }
  40437. if ($this->sort) {
  40438. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  40439. $iterator = $iteratorAggregate->getIterator();
  40440. }
  40441. return $iterator;
  40442. }
  40443. public function getName()
  40444. {
  40445. return 'php';
  40446. }
  40447. protected function canBeUsed()
  40448. {
  40449. return true;
  40450. }
  40451. }
  40452. <?php
  40453. namespace Symfony\Component\Finder\Comparator;
  40454. class Comparator
  40455. {
  40456. private $target;
  40457. private $operator = '==';
  40458. public function getTarget()
  40459. {
  40460. return $this->target;
  40461. }
  40462. public function setTarget($target)
  40463. {
  40464. $this->target = $target;
  40465. }
  40466. public function getOperator()
  40467. {
  40468. return $this->operator;
  40469. }
  40470. public function setOperator($operator)
  40471. {
  40472. if (!$operator) {
  40473. $operator = '==';
  40474. }
  40475. if (!in_array($operator, array('>', '<', '>=', '<=', '==', '!='))) {
  40476. throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
  40477. }
  40478. $this->operator = $operator;
  40479. }
  40480. public function test($test)
  40481. {
  40482. switch ($this->operator) {
  40483. case '>':
  40484. return $test > $this->target;
  40485. case '>=':
  40486. return $test >= $this->target;
  40487. case '<':
  40488. return $test < $this->target;
  40489. case '<=':
  40490. return $test <= $this->target;
  40491. case '!=':
  40492. return $test != $this->target;
  40493. }
  40494. return $test == $this->target;
  40495. }
  40496. }
  40497. <?php
  40498. namespace Symfony\Component\Finder\Comparator;
  40499. class DateComparator extends Comparator
  40500. {
  40501. public function __construct($test)
  40502. {
  40503. if (!preg_match('#^\s*(==|!=|[<>]=?|after|since|before|until)?\s*(.+?)\s*$#i', $test, $matches)) {
  40504. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a date test.', $test));
  40505. }
  40506. try {
  40507. $date = new \DateTime($matches[2]);
  40508. $target = $date->format('U');
  40509. } catch (\Exception $e) {
  40510. throw new \InvalidArgumentException(sprintf('"%s" is not a valid date.', $matches[2]));
  40511. }
  40512. $operator = isset($matches[1]) ? $matches[1] : '==';
  40513. if ('since' === $operator || 'after' === $operator) {
  40514. $operator = '>';
  40515. }
  40516. if ('until' === $operator || 'before' === $operator) {
  40517. $operator = '<';
  40518. }
  40519. $this->setOperator($operator);
  40520. $this->setTarget($target);
  40521. }
  40522. }
  40523. <?php
  40524. namespace Symfony\Component\Finder\Comparator;
  40525. class NumberComparator extends Comparator
  40526. {
  40527. public function __construct($test)
  40528. {
  40529. if (!preg_match('#^\s*(==|!=|[<>]=?)?\s*([0-9\.]+)\s*([kmg]i?)?\s*$#i', $test, $matches)) {
  40530. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a number test.', $test));
  40531. }
  40532. $target = $matches[2];
  40533. if (!is_numeric($target)) {
  40534. throw new \InvalidArgumentException(sprintf('Invalid number "%s".', $target));
  40535. }
  40536. if (isset($matches[3])) {
  40537. switch (strtolower($matches[3])) {
  40538. case 'k':
  40539. $target *= 1000;
  40540. break;
  40541. case 'ki':
  40542. $target *= 1024;
  40543. break;
  40544. case 'm':
  40545. $target *= 1000000;
  40546. break;
  40547. case 'mi':
  40548. $target *= 1024 * 1024;
  40549. break;
  40550. case 'g':
  40551. $target *= 1000000000;
  40552. break;
  40553. case 'gi':
  40554. $target *= 1024 * 1024 * 1024;
  40555. break;
  40556. }
  40557. }
  40558. $this->setTarget($target);
  40559. $this->setOperator(isset($matches[1]) ? $matches[1] : '==');
  40560. }
  40561. }
  40562. <?php
  40563. namespace Symfony\Component\Finder\Exception;
  40564. class AccessDeniedException extends \UnexpectedValueException
  40565. {
  40566. }
  40567. <?php
  40568. namespace Symfony\Component\Finder\Exception;
  40569. @trigger_error('The '.__NAMESPACE__.'\AdapterFailureException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40570. use Symfony\Component\Finder\Adapter\AdapterInterface;
  40571. class AdapterFailureException extends \RuntimeException implements ExceptionInterface
  40572. {
  40573. private $adapter;
  40574. public function __construct(AdapterInterface $adapter, $message = null, \Exception $previous = null)
  40575. {
  40576. $this->adapter = $adapter;
  40577. parent::__construct($message ?: 'Search failed with "'.$adapter->getName().'" adapter.', $previous);
  40578. }
  40579. public function getAdapter()
  40580. {
  40581. return $this->adapter;
  40582. }
  40583. }
  40584. <?php
  40585. namespace Symfony\Component\Finder\Exception;
  40586. interface ExceptionInterface
  40587. {
  40588. public function getAdapter();
  40589. }
  40590. <?php
  40591. namespace Symfony\Component\Finder\Exception;
  40592. @trigger_error('The '.__NAMESPACE__.'\OperationNotPermitedException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40593. class OperationNotPermitedException extends AdapterFailureException
  40594. {
  40595. }
  40596. <?php
  40597. namespace Symfony\Component\Finder\Exception;
  40598. @trigger_error('The '.__NAMESPACE__.'\ShellCommandFailureException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40599. use Symfony\Component\Finder\Adapter\AdapterInterface;
  40600. use Symfony\Component\Finder\Shell\Command;
  40601. class ShellCommandFailureException extends AdapterFailureException
  40602. {
  40603. private $command;
  40604. public function __construct(AdapterInterface $adapter, Command $command, \Exception $previous = null)
  40605. {
  40606. $this->command = $command;
  40607. parent::__construct($adapter, 'Shell command failed: "'.$command->join().'".', $previous);
  40608. }
  40609. public function getCommand()
  40610. {
  40611. return $this->command;
  40612. }
  40613. }
  40614. <?php
  40615. namespace Symfony\Component\Finder\Expression;
  40616. @trigger_error('The '.__NAMESPACE__.'\Expression class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40617. class Expression implements ValueInterface
  40618. {
  40619. const TYPE_REGEX = 1;
  40620. const TYPE_GLOB = 2;
  40621. private $value;
  40622. public static function create($expr)
  40623. {
  40624. return new self($expr);
  40625. }
  40626. public function __construct($expr)
  40627. {
  40628. try {
  40629. $this->value = Regex::create($expr);
  40630. } catch (\InvalidArgumentException $e) {
  40631. $this->value = new Glob($expr);
  40632. }
  40633. }
  40634. public function __toString()
  40635. {
  40636. return $this->render();
  40637. }
  40638. public function render()
  40639. {
  40640. return $this->value->render();
  40641. }
  40642. public function renderPattern()
  40643. {
  40644. return $this->value->renderPattern();
  40645. }
  40646. public function isCaseSensitive()
  40647. {
  40648. return $this->value->isCaseSensitive();
  40649. }
  40650. public function getType()
  40651. {
  40652. return $this->value->getType();
  40653. }
  40654. public function prepend($expr)
  40655. {
  40656. $this->value->prepend($expr);
  40657. return $this;
  40658. }
  40659. public function append($expr)
  40660. {
  40661. $this->value->append($expr);
  40662. return $this;
  40663. }
  40664. public function isRegex()
  40665. {
  40666. return self::TYPE_REGEX === $this->value->getType();
  40667. }
  40668. public function isGlob()
  40669. {
  40670. return self::TYPE_GLOB === $this->value->getType();
  40671. }
  40672. public function getGlob()
  40673. {
  40674. if (self::TYPE_GLOB !== $this->value->getType()) {
  40675. throw new \LogicException('Regex can\'t be transformed to glob.');
  40676. }
  40677. return $this->value;
  40678. }
  40679. public function getRegex()
  40680. {
  40681. return self::TYPE_REGEX === $this->value->getType() ? $this->value : $this->value->toRegex();
  40682. }
  40683. }
  40684. <?php
  40685. namespace Symfony\Component\Finder\Expression;
  40686. @trigger_error('The '.__NAMESPACE__.'\Glob class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40687. use Symfony\Component\Finder\Glob as FinderGlob;
  40688. class Glob implements ValueInterface
  40689. {
  40690. private $pattern;
  40691. public function __construct($pattern)
  40692. {
  40693. $this->pattern = $pattern;
  40694. }
  40695. public function render()
  40696. {
  40697. return $this->pattern;
  40698. }
  40699. public function renderPattern()
  40700. {
  40701. return $this->pattern;
  40702. }
  40703. public function getType()
  40704. {
  40705. return Expression::TYPE_GLOB;
  40706. }
  40707. public function isCaseSensitive()
  40708. {
  40709. return true;
  40710. }
  40711. public function prepend($expr)
  40712. {
  40713. $this->pattern = $expr.$this->pattern;
  40714. return $this;
  40715. }
  40716. public function append($expr)
  40717. {
  40718. $this->pattern .= $expr;
  40719. return $this;
  40720. }
  40721. public function isExpandable()
  40722. {
  40723. return false !== strpos($this->pattern, '{')
  40724. && false !== strpos($this->pattern, '}');
  40725. }
  40726. public function toRegex($strictLeadingDot = true, $strictWildcardSlash = true)
  40727. {
  40728. $regex = FinderGlob::toRegex($this->pattern, $strictLeadingDot, $strictWildcardSlash, '');
  40729. return new Regex($regex);
  40730. }
  40731. }
  40732. <?php
  40733. namespace Symfony\Component\Finder\Expression;
  40734. @trigger_error('The '.__NAMESPACE__.'\Regex class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40735. class Regex implements ValueInterface
  40736. {
  40737. const START_FLAG = '^';
  40738. const END_FLAG = '$';
  40739. const BOUNDARY = '~';
  40740. const JOKER = '.*';
  40741. const ESCAPING = '\\';
  40742. private $pattern;
  40743. private $options;
  40744. private $startFlag;
  40745. private $endFlag;
  40746. private $startJoker;
  40747. private $endJoker;
  40748. public static function create($expr)
  40749. {
  40750. if (preg_match('/^(.{3,}?)([imsxuADU]*)$/', $expr, $m)) {
  40751. $start = substr($m[1], 0, 1);
  40752. $end = substr($m[1], -1);
  40753. if (
  40754. ($start === $end && !preg_match('/[*?[:alnum:] \\\\]/', $start))
  40755. || ('{' === $start && '}' === $end)
  40756. || ('(' === $start && ')' === $end)
  40757. ) {
  40758. return new self(substr($m[1], 1, -1), $m[2], $end);
  40759. }
  40760. }
  40761. throw new \InvalidArgumentException('Given expression is not a regex.');
  40762. }
  40763. public function __construct($pattern, $options = '', $delimiter = null)
  40764. {
  40765. if (null !== $delimiter) {
  40766. $pattern = str_replace('\\'.$delimiter, $delimiter, $pattern);
  40767. }
  40768. $this->parsePattern($pattern);
  40769. $this->options = $options;
  40770. }
  40771. public function __toString()
  40772. {
  40773. return $this->render();
  40774. }
  40775. public function render()
  40776. {
  40777. return self::BOUNDARY
  40778. .$this->renderPattern()
  40779. .self::BOUNDARY
  40780. .$this->options;
  40781. }
  40782. public function renderPattern()
  40783. {
  40784. return ($this->startFlag ? self::START_FLAG : '')
  40785. .($this->startJoker ? self::JOKER : '')
  40786. .str_replace(self::BOUNDARY, '\\'.self::BOUNDARY, $this->pattern)
  40787. .($this->endJoker ? self::JOKER : '')
  40788. .($this->endFlag ? self::END_FLAG : '');
  40789. }
  40790. public function isCaseSensitive()
  40791. {
  40792. return !$this->hasOption('i');
  40793. }
  40794. public function getType()
  40795. {
  40796. return Expression::TYPE_REGEX;
  40797. }
  40798. public function prepend($expr)
  40799. {
  40800. $this->pattern = $expr.$this->pattern;
  40801. return $this;
  40802. }
  40803. public function append($expr)
  40804. {
  40805. $this->pattern .= $expr;
  40806. return $this;
  40807. }
  40808. public function hasOption($option)
  40809. {
  40810. return false !== strpos($this->options, $option);
  40811. }
  40812. public function addOption($option)
  40813. {
  40814. if (!$this->hasOption($option)) {
  40815. $this->options .= $option;
  40816. }
  40817. return $this;
  40818. }
  40819. public function removeOption($option)
  40820. {
  40821. $this->options = str_replace($option, '', $this->options);
  40822. return $this;
  40823. }
  40824. public function setStartFlag($startFlag)
  40825. {
  40826. $this->startFlag = $startFlag;
  40827. return $this;
  40828. }
  40829. public function hasStartFlag()
  40830. {
  40831. return $this->startFlag;
  40832. }
  40833. public function setEndFlag($endFlag)
  40834. {
  40835. $this->endFlag = (bool) $endFlag;
  40836. return $this;
  40837. }
  40838. public function hasEndFlag()
  40839. {
  40840. return $this->endFlag;
  40841. }
  40842. public function setStartJoker($startJoker)
  40843. {
  40844. $this->startJoker = $startJoker;
  40845. return $this;
  40846. }
  40847. public function hasStartJoker()
  40848. {
  40849. return $this->startJoker;
  40850. }
  40851. public function setEndJoker($endJoker)
  40852. {
  40853. $this->endJoker = (bool) $endJoker;
  40854. return $this;
  40855. }
  40856. public function hasEndJoker()
  40857. {
  40858. return $this->endJoker;
  40859. }
  40860. public function replaceJokers($replacement)
  40861. {
  40862. $replace = function ($subject) use ($replacement) {
  40863. $subject = $subject[0];
  40864. $replace = 0 === substr_count($subject, '\\') % 2;
  40865. return $replace ? str_replace('.', $replacement, $subject) : $subject;
  40866. };
  40867. $this->pattern = preg_replace_callback('~[\\\\]*\\.~', $replace, $this->pattern);
  40868. return $this;
  40869. }
  40870. private function parsePattern($pattern)
  40871. {
  40872. if ($this->startFlag = self::START_FLAG === substr($pattern, 0, 1)) {
  40873. $pattern = substr($pattern, 1);
  40874. }
  40875. if ($this->startJoker = self::JOKER === substr($pattern, 0, 2)) {
  40876. $pattern = substr($pattern, 2);
  40877. }
  40878. if ($this->endFlag = (self::END_FLAG === substr($pattern, -1) && self::ESCAPING !== substr($pattern, -2, -1))) {
  40879. $pattern = substr($pattern, 0, -1);
  40880. }
  40881. if ($this->endJoker = (self::JOKER === substr($pattern, -2) && self::ESCAPING !== substr($pattern, -3, -2))) {
  40882. $pattern = substr($pattern, 0, -2);
  40883. }
  40884. $this->pattern = $pattern;
  40885. }
  40886. }
  40887. <?php
  40888. namespace Symfony\Component\Finder\Expression;
  40889. @trigger_error('The '.__NAMESPACE__.'\ValueInterface interface is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40890. interface ValueInterface
  40891. {
  40892. public function render();
  40893. public function renderPattern();
  40894. public function isCaseSensitive();
  40895. public function getType();
  40896. public function prepend($expr);
  40897. public function append($expr);
  40898. }
  40899. <?php
  40900. namespace Symfony\Component\Finder;
  40901. use Symfony\Component\Finder\Adapter\AdapterInterface;
  40902. use Symfony\Component\Finder\Adapter\GnuFindAdapter;
  40903. use Symfony\Component\Finder\Adapter\BsdFindAdapter;
  40904. use Symfony\Component\Finder\Adapter\PhpAdapter;
  40905. use Symfony\Component\Finder\Comparator\DateComparator;
  40906. use Symfony\Component\Finder\Comparator\NumberComparator;
  40907. use Symfony\Component\Finder\Exception\ExceptionInterface;
  40908. use Symfony\Component\Finder\Iterator\CustomFilterIterator;
  40909. use Symfony\Component\Finder\Iterator\DateRangeFilterIterator;
  40910. use Symfony\Component\Finder\Iterator\DepthRangeFilterIterator;
  40911. use Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator;
  40912. use Symfony\Component\Finder\Iterator\FilecontentFilterIterator;
  40913. use Symfony\Component\Finder\Iterator\FilenameFilterIterator;
  40914. use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator;
  40915. use Symfony\Component\Finder\Iterator\SortableIterator;
  40916. class Finder implements \IteratorAggregate, \Countable
  40917. {
  40918. const IGNORE_VCS_FILES = 1;
  40919. const IGNORE_DOT_FILES = 2;
  40920. private $mode = 0;
  40921. private $names = array();
  40922. private $notNames = array();
  40923. private $exclude = array();
  40924. private $filters = array();
  40925. private $depths = array();
  40926. private $sizes = array();
  40927. private $followLinks = false;
  40928. private $sort = false;
  40929. private $ignore = 0;
  40930. private $dirs = array();
  40931. private $dates = array();
  40932. private $iterators = array();
  40933. private $contains = array();
  40934. private $notContains = array();
  40935. private $adapters = null;
  40936. private $paths = array();
  40937. private $notPaths = array();
  40938. private $ignoreUnreadableDirs = false;
  40939. private static $vcsPatterns = array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg');
  40940. public function __construct()
  40941. {
  40942. $this->ignore = static::IGNORE_VCS_FILES | static::IGNORE_DOT_FILES;
  40943. }
  40944. public static function create()
  40945. {
  40946. return new static();
  40947. }
  40948. public function addAdapter(AdapterInterface $adapter, $priority = 0)
  40949. {
  40950. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40951. $this->initDefaultAdapters();
  40952. $this->adapters[$adapter->getName()] = array(
  40953. 'adapter' => $adapter,
  40954. 'priority' => $priority,
  40955. 'selected' => false,
  40956. );
  40957. return $this->sortAdapters();
  40958. }
  40959. public function useBestAdapter()
  40960. {
  40961. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40962. $this->initDefaultAdapters();
  40963. $this->resetAdapterSelection();
  40964. return $this->sortAdapters();
  40965. }
  40966. public function setAdapter($name)
  40967. {
  40968. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40969. $this->initDefaultAdapters();
  40970. if (!isset($this->adapters[$name])) {
  40971. throw new \InvalidArgumentException(sprintf('Adapter "%s" does not exist.', $name));
  40972. }
  40973. $this->resetAdapterSelection();
  40974. $this->adapters[$name]['selected'] = true;
  40975. return $this->sortAdapters();
  40976. }
  40977. public function removeAdapters()
  40978. {
  40979. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40980. $this->adapters = array();
  40981. return $this;
  40982. }
  40983. public function getAdapters()
  40984. {
  40985. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40986. $this->initDefaultAdapters();
  40987. return array_values(array_map(function (array $adapter) {
  40988. return $adapter['adapter'];
  40989. }, $this->adapters));
  40990. }
  40991. public function directories()
  40992. {
  40993. $this->mode = Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES;
  40994. return $this;
  40995. }
  40996. public function files()
  40997. {
  40998. $this->mode = Iterator\FileTypeFilterIterator::ONLY_FILES;
  40999. return $this;
  41000. }
  41001. public function depth($level)
  41002. {
  41003. $this->depths[] = new Comparator\NumberComparator($level);
  41004. return $this;
  41005. }
  41006. public function date($date)
  41007. {
  41008. $this->dates[] = new Comparator\DateComparator($date);
  41009. return $this;
  41010. }
  41011. public function name($pattern)
  41012. {
  41013. $this->names[] = $pattern;
  41014. return $this;
  41015. }
  41016. public function notName($pattern)
  41017. {
  41018. $this->notNames[] = $pattern;
  41019. return $this;
  41020. }
  41021. public function contains($pattern)
  41022. {
  41023. $this->contains[] = $pattern;
  41024. return $this;
  41025. }
  41026. public function notContains($pattern)
  41027. {
  41028. $this->notContains[] = $pattern;
  41029. return $this;
  41030. }
  41031. public function path($pattern)
  41032. {
  41033. $this->paths[] = $pattern;
  41034. return $this;
  41035. }
  41036. public function notPath($pattern)
  41037. {
  41038. $this->notPaths[] = $pattern;
  41039. return $this;
  41040. }
  41041. public function size($size)
  41042. {
  41043. $this->sizes[] = new Comparator\NumberComparator($size);
  41044. return $this;
  41045. }
  41046. public function exclude($dirs)
  41047. {
  41048. $this->exclude = array_merge($this->exclude, (array) $dirs);
  41049. return $this;
  41050. }
  41051. public function ignoreDotFiles($ignoreDotFiles)
  41052. {
  41053. if ($ignoreDotFiles) {
  41054. $this->ignore |= static::IGNORE_DOT_FILES;
  41055. } else {
  41056. $this->ignore &= ~static::IGNORE_DOT_FILES;
  41057. }
  41058. return $this;
  41059. }
  41060. public function ignoreVCS($ignoreVCS)
  41061. {
  41062. if ($ignoreVCS) {
  41063. $this->ignore |= static::IGNORE_VCS_FILES;
  41064. } else {
  41065. $this->ignore &= ~static::IGNORE_VCS_FILES;
  41066. }
  41067. return $this;
  41068. }
  41069. public static function addVCSPattern($pattern)
  41070. {
  41071. foreach ((array) $pattern as $p) {
  41072. self::$vcsPatterns[] = $p;
  41073. }
  41074. self::$vcsPatterns = array_unique(self::$vcsPatterns);
  41075. }
  41076. public function sort(\Closure $closure)
  41077. {
  41078. $this->sort = $closure;
  41079. return $this;
  41080. }
  41081. public function sortByName()
  41082. {
  41083. $this->sort = Iterator\SortableIterator::SORT_BY_NAME;
  41084. return $this;
  41085. }
  41086. public function sortByType()
  41087. {
  41088. $this->sort = Iterator\SortableIterator::SORT_BY_TYPE;
  41089. return $this;
  41090. }
  41091. public function sortByAccessedTime()
  41092. {
  41093. $this->sort = Iterator\SortableIterator::SORT_BY_ACCESSED_TIME;
  41094. return $this;
  41095. }
  41096. public function sortByChangedTime()
  41097. {
  41098. $this->sort = Iterator\SortableIterator::SORT_BY_CHANGED_TIME;
  41099. return $this;
  41100. }
  41101. public function sortByModifiedTime()
  41102. {
  41103. $this->sort = Iterator\SortableIterator::SORT_BY_MODIFIED_TIME;
  41104. return $this;
  41105. }
  41106. public function filter(\Closure $closure)
  41107. {
  41108. $this->filters[] = $closure;
  41109. return $this;
  41110. }
  41111. public function followLinks()
  41112. {
  41113. $this->followLinks = true;
  41114. return $this;
  41115. }
  41116. public function ignoreUnreadableDirs($ignore = true)
  41117. {
  41118. $this->ignoreUnreadableDirs = (bool) $ignore;
  41119. return $this;
  41120. }
  41121. public function in($dirs)
  41122. {
  41123. $resolvedDirs = array();
  41124. foreach ((array) $dirs as $dir) {
  41125. if (is_dir($dir)) {
  41126. $resolvedDirs[] = $this->normalizeDir($dir);
  41127. } elseif ($glob = glob($dir, (defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
  41128. $resolvedDirs = array_merge($resolvedDirs, array_map(array($this, 'normalizeDir'), $glob));
  41129. } else {
  41130. throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir));
  41131. }
  41132. }
  41133. $this->dirs = array_merge($this->dirs, $resolvedDirs);
  41134. return $this;
  41135. }
  41136. public function getIterator()
  41137. {
  41138. if (0 === count($this->dirs) && 0 === count($this->iterators)) {
  41139. throw new \LogicException('You must call one of in() or append() methods before iterating over a Finder.');
  41140. }
  41141. if (1 === count($this->dirs) && 0 === count($this->iterators)) {
  41142. return $this->searchInDirectory($this->dirs[0]);
  41143. }
  41144. $iterator = new \AppendIterator();
  41145. foreach ($this->dirs as $dir) {
  41146. $iterator->append($this->searchInDirectory($dir));
  41147. }
  41148. foreach ($this->iterators as $it) {
  41149. $iterator->append($it);
  41150. }
  41151. return $iterator;
  41152. }
  41153. public function append($iterator)
  41154. {
  41155. if ($iterator instanceof \IteratorAggregate) {
  41156. $this->iterators[] = $iterator->getIterator();
  41157. } elseif ($iterator instanceof \Iterator) {
  41158. $this->iterators[] = $iterator;
  41159. } elseif ($iterator instanceof \Traversable || is_array($iterator)) {
  41160. $it = new \ArrayIterator();
  41161. foreach ($iterator as $file) {
  41162. $it->append($file instanceof \SplFileInfo ? $file : new \SplFileInfo($file));
  41163. }
  41164. $this->iterators[] = $it;
  41165. } else {
  41166. throw new \InvalidArgumentException('Finder::append() method wrong argument type.');
  41167. }
  41168. return $this;
  41169. }
  41170. public function count()
  41171. {
  41172. return iterator_count($this->getIterator());
  41173. }
  41174. private function sortAdapters()
  41175. {
  41176. uasort($this->adapters, function (array $a, array $b) {
  41177. if ($a['selected'] || $b['selected']) {
  41178. return $a['selected'] ? -1 : 1;
  41179. }
  41180. return $a['priority'] > $b['priority'] ? -1 : 1;
  41181. });
  41182. return $this;
  41183. }
  41184. private function searchInDirectory($dir)
  41185. {
  41186. if (static::IGNORE_VCS_FILES === (static::IGNORE_VCS_FILES & $this->ignore)) {
  41187. $this->exclude = array_merge($this->exclude, self::$vcsPatterns);
  41188. }
  41189. if (static::IGNORE_DOT_FILES === (static::IGNORE_DOT_FILES & $this->ignore)) {
  41190. $this->notPaths[] = '#(^|/)\..+(/|$)#';
  41191. }
  41192. if ($this->adapters) {
  41193. foreach ($this->adapters as $adapter) {
  41194. if ($adapter['adapter']->isSupported()) {
  41195. try {
  41196. return $this
  41197. ->buildAdapter($adapter['adapter'])
  41198. ->searchInDirectory($dir);
  41199. } catch (ExceptionInterface $e) {
  41200. }
  41201. }
  41202. }
  41203. }
  41204. $minDepth = 0;
  41205. $maxDepth = PHP_INT_MAX;
  41206. foreach ($this->depths as $comparator) {
  41207. switch ($comparator->getOperator()) {
  41208. case '>':
  41209. $minDepth = $comparator->getTarget() + 1;
  41210. break;
  41211. case '>=':
  41212. $minDepth = $comparator->getTarget();
  41213. break;
  41214. case '<':
  41215. $maxDepth = $comparator->getTarget() - 1;
  41216. break;
  41217. case '<=':
  41218. $maxDepth = $comparator->getTarget();
  41219. break;
  41220. default:
  41221. $minDepth = $maxDepth = $comparator->getTarget();
  41222. }
  41223. }
  41224. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  41225. if ($this->followLinks) {
  41226. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  41227. }
  41228. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  41229. if ($this->exclude) {
  41230. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  41231. }
  41232. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  41233. if ($minDepth > 0 || $maxDepth < PHP_INT_MAX) {
  41234. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $minDepth, $maxDepth);
  41235. }
  41236. if ($this->mode) {
  41237. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  41238. }
  41239. if ($this->names || $this->notNames) {
  41240. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  41241. }
  41242. if ($this->contains || $this->notContains) {
  41243. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  41244. }
  41245. if ($this->sizes) {
  41246. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  41247. }
  41248. if ($this->dates) {
  41249. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  41250. }
  41251. if ($this->filters) {
  41252. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  41253. }
  41254. if ($this->paths || $this->notPaths) {
  41255. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  41256. }
  41257. if ($this->sort) {
  41258. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  41259. $iterator = $iteratorAggregate->getIterator();
  41260. }
  41261. return $iterator;
  41262. }
  41263. private function buildAdapter(AdapterInterface $adapter)
  41264. {
  41265. return $adapter
  41266. ->setFollowLinks($this->followLinks)
  41267. ->setDepths($this->depths)
  41268. ->setMode($this->mode)
  41269. ->setExclude($this->exclude)
  41270. ->setNames($this->names)
  41271. ->setNotNames($this->notNames)
  41272. ->setContains($this->contains)
  41273. ->setNotContains($this->notContains)
  41274. ->setSizes($this->sizes)
  41275. ->setDates($this->dates)
  41276. ->setFilters($this->filters)
  41277. ->setSort($this->sort)
  41278. ->setPath($this->paths)
  41279. ->setNotPath($this->notPaths)
  41280. ->ignoreUnreadableDirs($this->ignoreUnreadableDirs);
  41281. }
  41282. private function resetAdapterSelection()
  41283. {
  41284. $this->adapters = array_map(function (array $properties) {
  41285. $properties['selected'] = false;
  41286. return $properties;
  41287. }, $this->adapters);
  41288. }
  41289. private function initDefaultAdapters()
  41290. {
  41291. if (null === $this->adapters) {
  41292. $this->adapters = array();
  41293. $this
  41294. ->addAdapter(new GnuFindAdapter())
  41295. ->addAdapter(new BsdFindAdapter())
  41296. ->addAdapter(new PhpAdapter(), -50)
  41297. ->setAdapter('php')
  41298. ;
  41299. }
  41300. }
  41301. private function normalizeDir($dir)
  41302. {
  41303. return rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
  41304. }
  41305. }
  41306. <?php
  41307. namespace Symfony\Component\Finder;
  41308. class Glob
  41309. {
  41310. public static function toRegex($glob, $strictLeadingDot = true, $strictWildcardSlash = true, $delimiter = '#')
  41311. {
  41312. $firstByte = true;
  41313. $escaping = false;
  41314. $inCurlies = 0;
  41315. $regex = '';
  41316. $sizeGlob = strlen($glob);
  41317. for ($i = 0; $i < $sizeGlob; ++$i) {
  41318. $car = $glob[$i];
  41319. if ($firstByte) {
  41320. if ($strictLeadingDot && '.' !== $car) {
  41321. $regex .= '(?=[^\.])';
  41322. }
  41323. $firstByte = false;
  41324. }
  41325. if ('/' === $car) {
  41326. $firstByte = true;
  41327. }
  41328. if ($delimiter === $car || '.' === $car || '(' === $car || ')' === $car || '|' === $car || '+' === $car || '^' === $car || '$' === $car) {
  41329. $regex .= "\\$car";
  41330. } elseif ('*' === $car) {
  41331. $regex .= $escaping ? '\\*' : ($strictWildcardSlash ? '[^/]*' : '.*');
  41332. } elseif ('?' === $car) {
  41333. $regex .= $escaping ? '\\?' : ($strictWildcardSlash ? '[^/]' : '.');
  41334. } elseif ('{' === $car) {
  41335. $regex .= $escaping ? '\\{' : '(';
  41336. if (!$escaping) {
  41337. ++$inCurlies;
  41338. }
  41339. } elseif ('}' === $car && $inCurlies) {
  41340. $regex .= $escaping ? '}' : ')';
  41341. if (!$escaping) {
  41342. --$inCurlies;
  41343. }
  41344. } elseif (',' === $car && $inCurlies) {
  41345. $regex .= $escaping ? ',' : '|';
  41346. } elseif ('\\' === $car) {
  41347. if ($escaping) {
  41348. $regex .= '\\\\';
  41349. $escaping = false;
  41350. } else {
  41351. $escaping = true;
  41352. }
  41353. continue;
  41354. } else {
  41355. $regex .= $car;
  41356. }
  41357. $escaping = false;
  41358. }
  41359. return $delimiter.'^'.$regex.'$'.$delimiter;
  41360. }
  41361. }
  41362. <?php
  41363. namespace Symfony\Component\Finder\Iterator;
  41364. class CustomFilterIterator extends FilterIterator
  41365. {
  41366. private $filters = array();
  41367. public function __construct(\Iterator $iterator, array $filters)
  41368. {
  41369. foreach ($filters as $filter) {
  41370. if (!is_callable($filter)) {
  41371. throw new \InvalidArgumentException('Invalid PHP callback.');
  41372. }
  41373. }
  41374. $this->filters = $filters;
  41375. parent::__construct($iterator);
  41376. }
  41377. public function accept()
  41378. {
  41379. $fileinfo = $this->current();
  41380. foreach ($this->filters as $filter) {
  41381. if (false === call_user_func($filter, $fileinfo)) {
  41382. return false;
  41383. }
  41384. }
  41385. return true;
  41386. }
  41387. }
  41388. <?php
  41389. namespace Symfony\Component\Finder\Iterator;
  41390. use Symfony\Component\Finder\Comparator\DateComparator;
  41391. class DateRangeFilterIterator extends FilterIterator
  41392. {
  41393. private $comparators = array();
  41394. public function __construct(\Iterator $iterator, array $comparators)
  41395. {
  41396. $this->comparators = $comparators;
  41397. parent::__construct($iterator);
  41398. }
  41399. public function accept()
  41400. {
  41401. $fileinfo = $this->current();
  41402. if (!file_exists($fileinfo->getPathname())) {
  41403. return false;
  41404. }
  41405. $filedate = $fileinfo->getMTime();
  41406. foreach ($this->comparators as $compare) {
  41407. if (!$compare->test($filedate)) {
  41408. return false;
  41409. }
  41410. }
  41411. return true;
  41412. }
  41413. }
  41414. <?php
  41415. namespace Symfony\Component\Finder\Iterator;
  41416. class DepthRangeFilterIterator extends FilterIterator
  41417. {
  41418. private $minDepth = 0;
  41419. public function __construct(\RecursiveIteratorIterator $iterator, $minDepth = 0, $maxDepth = PHP_INT_MAX)
  41420. {
  41421. $this->minDepth = $minDepth;
  41422. $iterator->setMaxDepth(PHP_INT_MAX === $maxDepth ? -1 : $maxDepth);
  41423. parent::__construct($iterator);
  41424. }
  41425. public function accept()
  41426. {
  41427. return $this->getInnerIterator()->getDepth() >= $this->minDepth;
  41428. }
  41429. }
  41430. <?php
  41431. namespace Symfony\Component\Finder\Iterator;
  41432. class ExcludeDirectoryFilterIterator extends FilterIterator implements \RecursiveIterator
  41433. {
  41434. private $iterator;
  41435. private $isRecursive;
  41436. private $excludedDirs = array();
  41437. private $excludedPattern;
  41438. public function __construct(\Iterator $iterator, array $directories)
  41439. {
  41440. $this->iterator = $iterator;
  41441. $this->isRecursive = $iterator instanceof \RecursiveIterator;
  41442. $patterns = array();
  41443. foreach ($directories as $directory) {
  41444. $directory = rtrim($directory, '/');
  41445. if (!$this->isRecursive || false !== strpos($directory, '/')) {
  41446. $patterns[] = preg_quote($directory, '#');
  41447. } else {
  41448. $this->excludedDirs[$directory] = true;
  41449. }
  41450. }
  41451. if ($patterns) {
  41452. $this->excludedPattern = '#(?:^|/)(?:'.implode('|', $patterns).')(?:/|$)#';
  41453. }
  41454. parent::__construct($iterator);
  41455. }
  41456. public function accept()
  41457. {
  41458. if ($this->isRecursive && isset($this->excludedDirs[$this->getFilename()]) && $this->isDir()) {
  41459. return false;
  41460. }
  41461. if ($this->excludedPattern) {
  41462. $path = $this->isDir() ? $this->current()->getRelativePathname() : $this->current()->getRelativePath();
  41463. $path = str_replace('\\', '/', $path);
  41464. return !preg_match($this->excludedPattern, $path);
  41465. }
  41466. return true;
  41467. }
  41468. public function hasChildren()
  41469. {
  41470. return $this->isRecursive && $this->iterator->hasChildren();
  41471. }
  41472. public function getChildren()
  41473. {
  41474. $children = new self($this->iterator->getChildren(), array());
  41475. $children->excludedDirs = $this->excludedDirs;
  41476. $children->excludedPattern = $this->excludedPattern;
  41477. return $children;
  41478. }
  41479. }
  41480. <?php
  41481. namespace Symfony\Component\Finder\Iterator;
  41482. @trigger_error('The '.__NAMESPACE__.'\FilePathsIterator class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41483. use Symfony\Component\Finder\SplFileInfo;
  41484. class FilePathsIterator extends \ArrayIterator
  41485. {
  41486. private $baseDir;
  41487. private $baseDirLength;
  41488. private $subPath;
  41489. private $subPathname;
  41490. private $current;
  41491. public function __construct(array $paths, $baseDir)
  41492. {
  41493. $this->baseDir = $baseDir;
  41494. $this->baseDirLength = strlen($baseDir);
  41495. parent::__construct($paths);
  41496. }
  41497. public function __call($name, array $arguments)
  41498. {
  41499. return call_user_func_array(array($this->current(), $name), $arguments);
  41500. }
  41501. public function current()
  41502. {
  41503. return $this->current;
  41504. }
  41505. public function key()
  41506. {
  41507. return $this->current->getPathname();
  41508. }
  41509. public function next()
  41510. {
  41511. parent::next();
  41512. $this->buildProperties();
  41513. }
  41514. public function rewind()
  41515. {
  41516. parent::rewind();
  41517. $this->buildProperties();
  41518. }
  41519. public function getSubPath()
  41520. {
  41521. return $this->subPath;
  41522. }
  41523. public function getSubPathname()
  41524. {
  41525. return $this->subPathname;
  41526. }
  41527. private function buildProperties()
  41528. {
  41529. $absolutePath = parent::current();
  41530. if ($this->baseDir === substr($absolutePath, 0, $this->baseDirLength)) {
  41531. $this->subPathname = ltrim(substr($absolutePath, $this->baseDirLength), '/\\');
  41532. $dir = dirname($this->subPathname);
  41533. $this->subPath = '.' === $dir ? '' : $dir;
  41534. } else {
  41535. $this->subPath = $this->subPathname = '';
  41536. }
  41537. $this->current = new SplFileInfo(parent::current(), $this->subPath, $this->subPathname);
  41538. }
  41539. }
  41540. <?php
  41541. namespace Symfony\Component\Finder\Iterator;
  41542. class FileTypeFilterIterator extends FilterIterator
  41543. {
  41544. const ONLY_FILES = 1;
  41545. const ONLY_DIRECTORIES = 2;
  41546. private $mode;
  41547. public function __construct(\Iterator $iterator, $mode)
  41548. {
  41549. $this->mode = $mode;
  41550. parent::__construct($iterator);
  41551. }
  41552. public function accept()
  41553. {
  41554. $fileinfo = $this->current();
  41555. if (self::ONLY_DIRECTORIES === (self::ONLY_DIRECTORIES & $this->mode) && $fileinfo->isFile()) {
  41556. return false;
  41557. } elseif (self::ONLY_FILES === (self::ONLY_FILES & $this->mode) && $fileinfo->isDir()) {
  41558. return false;
  41559. }
  41560. return true;
  41561. }
  41562. }
  41563. <?php
  41564. namespace Symfony\Component\Finder\Iterator;
  41565. class FilecontentFilterIterator extends MultiplePcreFilterIterator
  41566. {
  41567. public function accept()
  41568. {
  41569. if (!$this->matchRegexps && !$this->noMatchRegexps) {
  41570. return true;
  41571. }
  41572. $fileinfo = $this->current();
  41573. if ($fileinfo->isDir() || !$fileinfo->isReadable()) {
  41574. return false;
  41575. }
  41576. $content = $fileinfo->getContents();
  41577. if (!$content) {
  41578. return false;
  41579. }
  41580. return $this->isAccepted($content);
  41581. }
  41582. protected function toRegex($str)
  41583. {
  41584. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  41585. }
  41586. }
  41587. <?php
  41588. namespace Symfony\Component\Finder\Iterator;
  41589. use Symfony\Component\Finder\Glob;
  41590. class FilenameFilterIterator extends MultiplePcreFilterIterator
  41591. {
  41592. public function accept()
  41593. {
  41594. return $this->isAccepted($this->current()->getFilename());
  41595. }
  41596. protected function toRegex($str)
  41597. {
  41598. return $this->isRegex($str) ? $str : Glob::toRegex($str);
  41599. }
  41600. }
  41601. <?php
  41602. namespace Symfony\Component\Finder\Iterator;
  41603. abstract class FilterIterator extends \FilterIterator
  41604. {
  41605. public function rewind()
  41606. {
  41607. if (\PHP_VERSION_ID > 50607 || (\PHP_VERSION_ID > 50523 && \PHP_VERSION_ID < 50600)) {
  41608. parent::rewind();
  41609. return;
  41610. }
  41611. $iterator = $this;
  41612. while ($iterator instanceof \OuterIterator) {
  41613. $innerIterator = $iterator->getInnerIterator();
  41614. if ($innerIterator instanceof RecursiveDirectoryIterator) {
  41615. if ($innerIterator->isRewindable()) {
  41616. $innerIterator->next();
  41617. $innerIterator->rewind();
  41618. }
  41619. } elseif ($innerIterator instanceof \FilesystemIterator) {
  41620. $innerIterator->next();
  41621. $innerIterator->rewind();
  41622. }
  41623. $iterator = $innerIterator;
  41624. }
  41625. parent::rewind();
  41626. }
  41627. }
  41628. <?php
  41629. namespace Symfony\Component\Finder\Iterator;
  41630. abstract class MultiplePcreFilterIterator extends FilterIterator
  41631. {
  41632. protected $matchRegexps = array();
  41633. protected $noMatchRegexps = array();
  41634. public function __construct(\Iterator $iterator, array $matchPatterns, array $noMatchPatterns)
  41635. {
  41636. foreach ($matchPatterns as $pattern) {
  41637. $this->matchRegexps[] = $this->toRegex($pattern);
  41638. }
  41639. foreach ($noMatchPatterns as $pattern) {
  41640. $this->noMatchRegexps[] = $this->toRegex($pattern);
  41641. }
  41642. parent::__construct($iterator);
  41643. }
  41644. protected function isAccepted($string)
  41645. {
  41646. foreach ($this->noMatchRegexps as $regex) {
  41647. if (preg_match($regex, $string)) {
  41648. return false;
  41649. }
  41650. }
  41651. if ($this->matchRegexps) {
  41652. foreach ($this->matchRegexps as $regex) {
  41653. if (preg_match($regex, $string)) {
  41654. return true;
  41655. }
  41656. }
  41657. return false;
  41658. }
  41659. return true;
  41660. }
  41661. protected function isRegex($str)
  41662. {
  41663. if (preg_match('/^(.{3,}?)[imsxuADU]*$/', $str, $m)) {
  41664. $start = substr($m[1], 0, 1);
  41665. $end = substr($m[1], -1);
  41666. if ($start === $end) {
  41667. return !preg_match('/[*?[:alnum:] \\\\]/', $start);
  41668. }
  41669. foreach (array(array('{', '}'), array('(', ')'), array('[', ']'), array('<', '>')) as $delimiters) {
  41670. if ($start === $delimiters[0] && $end === $delimiters[1]) {
  41671. return true;
  41672. }
  41673. }
  41674. }
  41675. return false;
  41676. }
  41677. abstract protected function toRegex($str);
  41678. }
  41679. <?php
  41680. namespace Symfony\Component\Finder\Iterator;
  41681. class PathFilterIterator extends MultiplePcreFilterIterator
  41682. {
  41683. public function accept()
  41684. {
  41685. $filename = $this->current()->getRelativePathname();
  41686. if ('\\' === DIRECTORY_SEPARATOR) {
  41687. $filename = str_replace('\\', '/', $filename);
  41688. }
  41689. return $this->isAccepted($filename);
  41690. }
  41691. protected function toRegex($str)
  41692. {
  41693. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  41694. }
  41695. }
  41696. <?php
  41697. namespace Symfony\Component\Finder\Iterator;
  41698. use Symfony\Component\Finder\Exception\AccessDeniedException;
  41699. use Symfony\Component\Finder\SplFileInfo;
  41700. class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
  41701. {
  41702. private $ignoreUnreadableDirs;
  41703. private $rewindable;
  41704. private $rootPath;
  41705. private $subPath;
  41706. private $directorySeparator = '/';
  41707. public function __construct($path, $flags, $ignoreUnreadableDirs = false)
  41708. {
  41709. if ($flags & (self::CURRENT_AS_PATHNAME | self::CURRENT_AS_SELF)) {
  41710. throw new \RuntimeException('This iterator only support returning current as fileinfo.');
  41711. }
  41712. parent::__construct($path, $flags);
  41713. $this->ignoreUnreadableDirs = $ignoreUnreadableDirs;
  41714. $this->rootPath = (string) $path;
  41715. if ('/' !== DIRECTORY_SEPARATOR && !($flags & self::UNIX_PATHS)) {
  41716. $this->directorySeparator = DIRECTORY_SEPARATOR;
  41717. }
  41718. }
  41719. public function current()
  41720. {
  41721. if (null === $subPathname = $this->subPath) {
  41722. $subPathname = $this->subPath = (string) $this->getSubPath();
  41723. }
  41724. if ('' !== $subPathname) {
  41725. $subPathname .= $this->directorySeparator;
  41726. }
  41727. $subPathname .= $this->getFilename();
  41728. return new SplFileInfo($this->rootPath.$this->directorySeparator.$subPathname, $this->subPath, $subPathname);
  41729. }
  41730. public function getChildren()
  41731. {
  41732. try {
  41733. $children = parent::getChildren();
  41734. if ($children instanceof self) {
  41735. $children->ignoreUnreadableDirs = $this->ignoreUnreadableDirs;
  41736. $children->rewindable = &$this->rewindable;
  41737. $children->rootPath = $this->rootPath;
  41738. }
  41739. return $children;
  41740. } catch (\UnexpectedValueException $e) {
  41741. if ($this->ignoreUnreadableDirs) {
  41742. return new \RecursiveArrayIterator(array());
  41743. } else {
  41744. throw new AccessDeniedException($e->getMessage(), $e->getCode(), $e);
  41745. }
  41746. }
  41747. }
  41748. public function rewind()
  41749. {
  41750. if (false === $this->isRewindable()) {
  41751. return;
  41752. }
  41753. if (\PHP_VERSION_ID < 50523 || \PHP_VERSION_ID >= 50600 && \PHP_VERSION_ID < 50607) {
  41754. parent::next();
  41755. }
  41756. parent::rewind();
  41757. }
  41758. public function isRewindable()
  41759. {
  41760. if (null !== $this->rewindable) {
  41761. return $this->rewindable;
  41762. }
  41763. if ('' === $this->getPath()) {
  41764. return $this->rewindable = false;
  41765. }
  41766. if (false !== $stream = @opendir($this->getPath())) {
  41767. $infos = stream_get_meta_data($stream);
  41768. closedir($stream);
  41769. if ($infos['seekable']) {
  41770. return $this->rewindable = true;
  41771. }
  41772. }
  41773. return $this->rewindable = false;
  41774. }
  41775. }
  41776. <?php
  41777. namespace Symfony\Component\Finder\Iterator;
  41778. use Symfony\Component\Finder\Comparator\NumberComparator;
  41779. class SizeRangeFilterIterator extends FilterIterator
  41780. {
  41781. private $comparators = array();
  41782. public function __construct(\Iterator $iterator, array $comparators)
  41783. {
  41784. $this->comparators = $comparators;
  41785. parent::__construct($iterator);
  41786. }
  41787. public function accept()
  41788. {
  41789. $fileinfo = $this->current();
  41790. if (!$fileinfo->isFile()) {
  41791. return true;
  41792. }
  41793. $filesize = $fileinfo->getSize();
  41794. foreach ($this->comparators as $compare) {
  41795. if (!$compare->test($filesize)) {
  41796. return false;
  41797. }
  41798. }
  41799. return true;
  41800. }
  41801. }
  41802. <?php
  41803. namespace Symfony\Component\Finder\Iterator;
  41804. class SortableIterator implements \IteratorAggregate
  41805. {
  41806. const SORT_BY_NAME = 1;
  41807. const SORT_BY_TYPE = 2;
  41808. const SORT_BY_ACCESSED_TIME = 3;
  41809. const SORT_BY_CHANGED_TIME = 4;
  41810. const SORT_BY_MODIFIED_TIME = 5;
  41811. private $iterator;
  41812. private $sort;
  41813. public function __construct(\Traversable $iterator, $sort)
  41814. {
  41815. $this->iterator = $iterator;
  41816. if (self::SORT_BY_NAME === $sort) {
  41817. $this->sort = function ($a, $b) {
  41818. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  41819. };
  41820. } elseif (self::SORT_BY_TYPE === $sort) {
  41821. $this->sort = function ($a, $b) {
  41822. if ($a->isDir() && $b->isFile()) {
  41823. return -1;
  41824. } elseif ($a->isFile() && $b->isDir()) {
  41825. return 1;
  41826. }
  41827. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  41828. };
  41829. } elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
  41830. $this->sort = function ($a, $b) {
  41831. return $a->getATime() - $b->getATime();
  41832. };
  41833. } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
  41834. $this->sort = function ($a, $b) {
  41835. return $a->getCTime() - $b->getCTime();
  41836. };
  41837. } elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
  41838. $this->sort = function ($a, $b) {
  41839. return $a->getMTime() - $b->getMTime();
  41840. };
  41841. } elseif (is_callable($sort)) {
  41842. $this->sort = $sort;
  41843. } else {
  41844. throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.');
  41845. }
  41846. }
  41847. public function getIterator()
  41848. {
  41849. $array = iterator_to_array($this->iterator, true);
  41850. uasort($array, $this->sort);
  41851. return new \ArrayIterator($array);
  41852. }
  41853. }
  41854. Copyright (c) 2004-2018 Fabien Potencier
  41855. Permission is hereby granted, free of charge, to any person obtaining a copy
  41856. of this software and associated documentation files (the "Software"), to deal
  41857. in the Software without restriction, including without limitation the rights
  41858. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  41859. copies of the Software, and to permit persons to whom the Software is furnished
  41860. to do so, subject to the following conditions:
  41861. The above copyright notice and this permission notice shall be included in all
  41862. copies or substantial portions of the Software.
  41863. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  41864. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  41865. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  41866. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  41867. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  41868. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  41869. THE SOFTWARE.
  41870. <?php
  41871. namespace Symfony\Component\Finder\Shell;
  41872. @trigger_error('The '.__NAMESPACE__.'\Command class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41873. class Command
  41874. {
  41875. private $parent;
  41876. private $bits = array();
  41877. private $labels = array();
  41878. private $errorHandler;
  41879. public function __construct(Command $parent = null)
  41880. {
  41881. $this->parent = $parent;
  41882. }
  41883. public function __toString()
  41884. {
  41885. return $this->join();
  41886. }
  41887. public static function create(Command $parent = null)
  41888. {
  41889. return new self($parent);
  41890. }
  41891. public static function escape($input)
  41892. {
  41893. return escapeshellcmd($input);
  41894. }
  41895. public static function quote($input)
  41896. {
  41897. return escapeshellarg($input);
  41898. }
  41899. public function add($bit)
  41900. {
  41901. $this->bits[] = $bit;
  41902. return $this;
  41903. }
  41904. public function top($bit)
  41905. {
  41906. array_unshift($this->bits, $bit);
  41907. foreach ($this->labels as $label => $index) {
  41908. ++$this->labels[$label];
  41909. }
  41910. return $this;
  41911. }
  41912. public function arg($arg)
  41913. {
  41914. $this->bits[] = self::quote($arg);
  41915. return $this;
  41916. }
  41917. public function cmd($esc)
  41918. {
  41919. $this->bits[] = self::escape($esc);
  41920. return $this;
  41921. }
  41922. public function ins($label)
  41923. {
  41924. if (isset($this->labels[$label])) {
  41925. throw new \RuntimeException(sprintf('Label "%s" already exists.', $label));
  41926. }
  41927. $this->bits[] = self::create($this);
  41928. $this->labels[$label] = count($this->bits) - 1;
  41929. return $this->bits[$this->labels[$label]];
  41930. }
  41931. public function get($label)
  41932. {
  41933. if (!isset($this->labels[$label])) {
  41934. throw new \RuntimeException(sprintf('Label "%s" does not exist.', $label));
  41935. }
  41936. return $this->bits[$this->labels[$label]];
  41937. }
  41938. public function end()
  41939. {
  41940. if (null === $this->parent) {
  41941. throw new \RuntimeException('Calling end on root command doesn\'t make sense.');
  41942. }
  41943. return $this->parent;
  41944. }
  41945. public function length()
  41946. {
  41947. return count($this->bits);
  41948. }
  41949. public function setErrorHandler(\Closure $errorHandler)
  41950. {
  41951. $this->errorHandler = $errorHandler;
  41952. return $this;
  41953. }
  41954. public function getErrorHandler()
  41955. {
  41956. return $this->errorHandler;
  41957. }
  41958. public function execute()
  41959. {
  41960. if (null === $errorHandler = $this->errorHandler) {
  41961. exec($this->join(), $output);
  41962. } else {
  41963. $process = proc_open($this->join(), array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w')), $pipes);
  41964. $output = preg_split('~(\r\n|\r|\n)~', stream_get_contents($pipes[1]), -1, PREG_SPLIT_NO_EMPTY);
  41965. if ($error = stream_get_contents($pipes[2])) {
  41966. $errorHandler($error);
  41967. }
  41968. proc_close($process);
  41969. }
  41970. return $output ?: array();
  41971. }
  41972. public function join()
  41973. {
  41974. return implode(' ', array_filter(
  41975. array_map(function ($bit) {
  41976. return $bit instanceof Command ? $bit->join() : ($bit ?: null);
  41977. }, $this->bits),
  41978. function ($bit) { return null !== $bit; }
  41979. ));
  41980. }
  41981. public function addAtIndex($bit, $index)
  41982. {
  41983. array_splice($this->bits, $index, 0, $bit instanceof self ? array($bit) : $bit);
  41984. return $this;
  41985. }
  41986. }
  41987. <?php
  41988. namespace Symfony\Component\Finder\Shell;
  41989. @trigger_error('The '.__NAMESPACE__.'\Shell class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41990. class Shell
  41991. {
  41992. const TYPE_UNIX = 1;
  41993. const TYPE_DARWIN = 2;
  41994. const TYPE_CYGWIN = 3;
  41995. const TYPE_WINDOWS = 4;
  41996. const TYPE_BSD = 5;
  41997. private $type;
  41998. public function getType()
  41999. {
  42000. if (null === $this->type) {
  42001. $this->type = $this->guessType();
  42002. }
  42003. return $this->type;
  42004. }
  42005. public function testCommand($command)
  42006. {
  42007. if (!function_exists('exec')) {
  42008. return false;
  42009. }
  42010. $testCommand = 'which ';
  42011. if (self::TYPE_WINDOWS === $this->type) {
  42012. $testCommand = 'where ';
  42013. }
  42014. $command = escapeshellcmd($command);
  42015. exec($testCommand.$command, $output, $code);
  42016. return 0 === $code && count($output) > 0;
  42017. }
  42018. private function guessType()
  42019. {
  42020. $os = strtolower(PHP_OS);
  42021. if (false !== strpos($os, 'cygwin')) {
  42022. return self::TYPE_CYGWIN;
  42023. }
  42024. if (false !== strpos($os, 'darwin')) {
  42025. return self::TYPE_DARWIN;
  42026. }
  42027. if (false !== strpos($os, 'bsd')) {
  42028. return self::TYPE_BSD;
  42029. }
  42030. if (0 === strpos($os, 'win')) {
  42031. return self::TYPE_WINDOWS;
  42032. }
  42033. return self::TYPE_UNIX;
  42034. }
  42035. }
  42036. <?php
  42037. namespace Symfony\Component\Finder;
  42038. class SplFileInfo extends \SplFileInfo
  42039. {
  42040. private $relativePath;
  42041. private $relativePathname;
  42042. public function __construct($file, $relativePath, $relativePathname)
  42043. {
  42044. parent::__construct($file);
  42045. $this->relativePath = $relativePath;
  42046. $this->relativePathname = $relativePathname;
  42047. }
  42048. public function getRelativePath()
  42049. {
  42050. return $this->relativePath;
  42051. }
  42052. public function getRelativePathname()
  42053. {
  42054. return $this->relativePathname;
  42055. }
  42056. public function getContents()
  42057. {
  42058. set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
  42059. $content = file_get_contents($this->getPathname());
  42060. restore_error_handler();
  42061. if (false === $content) {
  42062. throw new \RuntimeException($error);
  42063. }
  42064. return $content;
  42065. }
  42066. }
  42067. <?php
  42068. namespace Symfony\Polyfill\Ctype;
  42069. final class Ctype
  42070. {
  42071. public static function ctype_alnum($text)
  42072. {
  42073. $text = self::convert_int_to_char_for_ctype($text);
  42074. return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z0-9]/', $text);
  42075. }
  42076. public static function ctype_alpha($text)
  42077. {
  42078. $text = self::convert_int_to_char_for_ctype($text);
  42079. return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z]/', $text);
  42080. }
  42081. public static function ctype_cntrl($text)
  42082. {
  42083. $text = self::convert_int_to_char_for_ctype($text);
  42084. return \is_string($text) && '' !== $text && !preg_match('/[^\x00-\x1f\x7f]/', $text);
  42085. }
  42086. public static function ctype_digit($text)
  42087. {
  42088. $text = self::convert_int_to_char_for_ctype($text);
  42089. return \is_string($text) && '' !== $text && !preg_match('/[^0-9]/', $text);
  42090. }
  42091. public static function ctype_graph($text)
  42092. {
  42093. $text = self::convert_int_to_char_for_ctype($text);
  42094. return \is_string($text) && '' !== $text && !preg_match('/[^!-~]/', $text);
  42095. }
  42096. public static function ctype_lower($text)
  42097. {
  42098. $text = self::convert_int_to_char_for_ctype($text);
  42099. return \is_string($text) && '' !== $text && !preg_match('/[^a-z]/', $text);
  42100. }
  42101. public static function ctype_print($text)
  42102. {
  42103. $text = self::convert_int_to_char_for_ctype($text);
  42104. return \is_string($text) && '' !== $text && !preg_match('/[^ -~]/', $text);
  42105. }
  42106. public static function ctype_punct($text)
  42107. {
  42108. $text = self::convert_int_to_char_for_ctype($text);
  42109. return \is_string($text) && '' !== $text && !preg_match('/[^!-\/\:-@\[-`\{-~]/', $text);
  42110. }
  42111. public static function ctype_space($text)
  42112. {
  42113. $text = self::convert_int_to_char_for_ctype($text);
  42114. return \is_string($text) && '' !== $text && !preg_match('/[^\s]/', $text);
  42115. }
  42116. public static function ctype_upper($text)
  42117. {
  42118. $text = self::convert_int_to_char_for_ctype($text);
  42119. return \is_string($text) && '' !== $text && !preg_match('/[^A-Z]/', $text);
  42120. }
  42121. public static function ctype_xdigit($text)
  42122. {
  42123. $text = self::convert_int_to_char_for_ctype($text);
  42124. return \is_string($text) && '' !== $text && !preg_match('/[^A-Fa-f0-9]/', $text);
  42125. }
  42126. private static function convert_int_to_char_for_ctype($int)
  42127. {
  42128. if (!\is_int($int)) {
  42129. return $int;
  42130. }
  42131. if ($int < -128 || $int > 255) {
  42132. return (string) $int;
  42133. }
  42134. if ($int < 0) {
  42135. $int += 256;
  42136. }
  42137. return \chr($int);
  42138. }
  42139. }
  42140. Copyright (c) 2018 Fabien Potencier
  42141. Permission is hereby granted, free of charge, to any person obtaining a copy
  42142. of this software and associated documentation files (the "Software"), to deal
  42143. in the Software without restriction, including without limitation the rights
  42144. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  42145. copies of the Software, and to permit persons to whom the Software is furnished
  42146. to do so, subject to the following conditions:
  42147. The above copyright notice and this permission notice shall be included in all
  42148. copies or substantial portions of the Software.
  42149. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  42150. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  42151. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  42152. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  42153. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  42154. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  42155. THE SOFTWARE.
  42156. <?php
  42157. use Symfony\Polyfill\Ctype as p;
  42158. if (!function_exists('ctype_alnum')) {
  42159. function ctype_alnum($text) { return p\Ctype::ctype_alnum($text); }
  42160. function ctype_alpha($text) { return p\Ctype::ctype_alpha($text); }
  42161. function ctype_cntrl($text) { return p\Ctype::ctype_cntrl($text); }
  42162. function ctype_digit($text) { return p\Ctype::ctype_digit($text); }
  42163. function ctype_graph($text) { return p\Ctype::ctype_graph($text); }
  42164. function ctype_lower($text) { return p\Ctype::ctype_lower($text); }
  42165. function ctype_print($text) { return p\Ctype::ctype_print($text); }
  42166. function ctype_punct($text) { return p\Ctype::ctype_punct($text); }
  42167. function ctype_space($text) { return p\Ctype::ctype_space($text); }
  42168. function ctype_upper($text) { return p\Ctype::ctype_upper($text); }
  42169. function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text); }
  42170. }
  42171. Copyright (c) 2015-2018 Fabien Potencier
  42172. Permission is hereby granted, free of charge, to any person obtaining a copy
  42173. of this software and associated documentation files (the "Software"), to deal
  42174. in the Software without restriction, including without limitation the rights
  42175. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  42176. copies of the Software, and to permit persons to whom the Software is furnished
  42177. to do so, subject to the following conditions:
  42178. The above copyright notice and this permission notice shall be included in all
  42179. copies or substantial portions of the Software.
  42180. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  42181. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  42182. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  42183. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  42184. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  42185. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  42186. THE SOFTWARE.
  42187. <?php
  42188. namespace Symfony\Polyfill\Mbstring;
  42189. final class Mbstring
  42190. {
  42191. const MB_CASE_FOLD = PHP_INT_MAX;
  42192. private static $encodingList = array('ASCII', 'UTF-8');
  42193. private static $language = 'neutral';
  42194. private static $internalEncoding = 'UTF-8';
  42195. private static $caseFold = array(
  42196. array('µ','ſ',"\xCD\x85",'ς',"\xCF\x90","\xCF\x91","\xCF\x95","\xCF\x96","\xCF\xB0","\xCF\xB1","\xCF\xB5","\xE1\xBA\x9B","\xE1\xBE\xBE"),
  42197. array('μ','s','ι', 'σ','β', 'θ', 'φ', 'π', 'κ', '�', 'ε', "\xE1\xB9\xA1",'ι'),
  42198. );
  42199. public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null)
  42200. {
  42201. if (\is_array($fromEncoding) || false !== strpos($fromEncoding, ',')) {
  42202. $fromEncoding = self::mb_detect_encoding($s, $fromEncoding);
  42203. } else {
  42204. $fromEncoding = self::getEncoding($fromEncoding);
  42205. }
  42206. $toEncoding = self::getEncoding($toEncoding);
  42207. if ('BASE64' === $fromEncoding) {
  42208. $s = base64_decode($s);
  42209. $fromEncoding = $toEncoding;
  42210. }
  42211. if ('BASE64' === $toEncoding) {
  42212. return base64_encode($s);
  42213. }
  42214. if ('HTML-ENTITIES' === $toEncoding || 'HTML' === $toEncoding) {
  42215. if ('HTML-ENTITIES' === $fromEncoding || 'HTML' === $fromEncoding) {
  42216. $fromEncoding = 'Windows-1252';
  42217. }
  42218. if ('UTF-8' !== $fromEncoding) {
  42219. $s = iconv($fromEncoding, 'UTF-8//IGNORE', $s);
  42220. }
  42221. return preg_replace_callback('/[\x80-\xFF]+/', array(__CLASS__, 'html_encoding_callback'), $s);
  42222. }
  42223. if ('HTML-ENTITIES' === $fromEncoding) {
  42224. $s = html_entity_decode($s, ENT_COMPAT, 'UTF-8');
  42225. $fromEncoding = 'UTF-8';
  42226. }
  42227. return iconv($fromEncoding, $toEncoding.'//IGNORE', $s);
  42228. }
  42229. public static function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null)
  42230. {
  42231. $vars = array(&$a, &$b, &$c, &$d, &$e, &$f);
  42232. $ok = true;
  42233. array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) {
  42234. if (false === $v = Mbstring::mb_convert_encoding($v, $toEncoding, $fromEncoding)) {
  42235. $ok = false;
  42236. }
  42237. });
  42238. return $ok ? $fromEncoding : false;
  42239. }
  42240. public static function mb_decode_mimeheader($s)
  42241. {
  42242. return iconv_mime_decode($s, 2, self::$internalEncoding);
  42243. }
  42244. public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null)
  42245. {
  42246. trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', E_USER_WARNING);
  42247. }
  42248. public static function mb_decode_numericentity($s, $convmap, $encoding = null)
  42249. {
  42250. if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) {
  42251. trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.gettype($s).' given', E_USER_WARNING);
  42252. return null;
  42253. }
  42254. if (!\is_array($convmap) || !$convmap) {
  42255. return false;
  42256. }
  42257. if (null !== $encoding && !\is_scalar($encoding)) {
  42258. trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.gettype($s).' given', E_USER_WARNING);
  42259. return '';
  42260. }
  42261. $s = (string) $s;
  42262. if ('' === $s) {
  42263. return '';
  42264. }
  42265. $encoding = self::getEncoding($encoding);
  42266. if ('UTF-8' === $encoding) {
  42267. $encoding = null;
  42268. if (!preg_match('//u', $s)) {
  42269. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  42270. }
  42271. } else {
  42272. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  42273. }
  42274. $cnt = floor(\count($convmap) / 4) * 4;
  42275. for ($i = 0; $i < $cnt; $i += 4) {
  42276. $convmap[$i] += $convmap[$i + 2];
  42277. $convmap[$i + 1] += $convmap[$i + 2];
  42278. }
  42279. $s = preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function (array $m) use ($cnt, $convmap) {
  42280. $c = isset($m[2]) ? (int) hexdec($m[2]) : $m[1];
  42281. for ($i = 0; $i < $cnt; $i += 4) {
  42282. if ($c >= $convmap[$i] && $c <= $convmap[$i + 1]) {
  42283. return Mbstring::mb_chr($c - $convmap[$i + 2]);
  42284. }
  42285. }
  42286. return $m[0];
  42287. }, $s);
  42288. if (null === $encoding) {
  42289. return $s;
  42290. }
  42291. return iconv('UTF-8', $encoding.'//IGNORE', $s);
  42292. }
  42293. public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false)
  42294. {
  42295. if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) {
  42296. trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.gettype($s).' given', E_USER_WARNING);
  42297. return null;
  42298. }
  42299. if (!\is_array($convmap) || !$convmap) {
  42300. return false;
  42301. }
  42302. if (null !== $encoding && !\is_scalar($encoding)) {
  42303. trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.gettype($s).' given', E_USER_WARNING);
  42304. return null;
  42305. }
  42306. if (null !== $is_hex && !\is_scalar($is_hex)) {
  42307. trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.gettype($s).' given', E_USER_WARNING);
  42308. return null;
  42309. }
  42310. $s = (string) $s;
  42311. if ('' === $s) {
  42312. return '';
  42313. }
  42314. $encoding = self::getEncoding($encoding);
  42315. if ('UTF-8' === $encoding) {
  42316. $encoding = null;
  42317. if (!preg_match('//u', $s)) {
  42318. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  42319. }
  42320. } else {
  42321. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  42322. }
  42323. static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
  42324. $cnt = floor(\count($convmap) / 4) * 4;
  42325. $i = 0;
  42326. $len = \strlen($s);
  42327. $result = '';
  42328. while ($i < $len) {
  42329. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  42330. $uchr = substr($s, $i, $ulen);
  42331. $i += $ulen;
  42332. $c = self::mb_ord($uchr);
  42333. for ($j = 0; $j < $cnt; $j += 4) {
  42334. if ($c >= $convmap[$j] && $c <= $convmap[$j + 1]) {
  42335. $cOffset = ($c + $convmap[$j + 2]) & $convmap[$j + 3];
  42336. $result .= $is_hex ? sprintf('&#x%X;', $cOffset) : '&#'.$cOffset.';';
  42337. continue 2;
  42338. }
  42339. }
  42340. $result .= $uchr;
  42341. }
  42342. if (null === $encoding) {
  42343. return $result;
  42344. }
  42345. return iconv('UTF-8', $encoding.'//IGNORE', $result);
  42346. }
  42347. public static function mb_convert_case($s, $mode, $encoding = null)
  42348. {
  42349. $s = (string) $s;
  42350. if ('' === $s) {
  42351. return '';
  42352. }
  42353. $encoding = self::getEncoding($encoding);
  42354. if ('UTF-8' === $encoding) {
  42355. $encoding = null;
  42356. if (!preg_match('//u', $s)) {
  42357. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  42358. }
  42359. } else {
  42360. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  42361. }
  42362. if (MB_CASE_TITLE == $mode) {
  42363. $s = preg_replace_callback('/\b\p{Ll}/u', array(__CLASS__, 'title_case_upper'), $s);
  42364. $s = preg_replace_callback('/\B[\p{Lu}\p{Lt}]+/u', array(__CLASS__, 'title_case_lower'), $s);
  42365. } else {
  42366. if (MB_CASE_UPPER == $mode) {
  42367. static $upper = null;
  42368. if (null === $upper) {
  42369. $upper = self::getData('upperCase');
  42370. }
  42371. $map = $upper;
  42372. } else {
  42373. if (self::MB_CASE_FOLD === $mode) {
  42374. $s = str_replace(self::$caseFold[0], self::$caseFold[1], $s);
  42375. }
  42376. static $lower = null;
  42377. if (null === $lower) {
  42378. $lower = self::getData('lowerCase');
  42379. }
  42380. $map = $lower;
  42381. }
  42382. static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
  42383. $i = 0;
  42384. $len = \strlen($s);
  42385. while ($i < $len) {
  42386. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  42387. $uchr = substr($s, $i, $ulen);
  42388. $i += $ulen;
  42389. if (isset($map[$uchr])) {
  42390. $uchr = $map[$uchr];
  42391. $nlen = \strlen($uchr);
  42392. if ($nlen == $ulen) {
  42393. $nlen = $i;
  42394. do {
  42395. $s[--$nlen] = $uchr[--$ulen];
  42396. } while ($ulen);
  42397. } else {
  42398. $s = substr_replace($s, $uchr, $i - $ulen, $ulen);
  42399. $len += $nlen - $ulen;
  42400. $i += $nlen - $ulen;
  42401. }
  42402. }
  42403. }
  42404. }
  42405. if (null === $encoding) {
  42406. return $s;
  42407. }
  42408. return iconv('UTF-8', $encoding.'//IGNORE', $s);
  42409. }
  42410. public static function mb_internal_encoding($encoding = null)
  42411. {
  42412. if (null === $encoding) {
  42413. return self::$internalEncoding;
  42414. }
  42415. $encoding = self::getEncoding($encoding);
  42416. if ('UTF-8' === $encoding || false !== @iconv($encoding, $encoding, ' ')) {
  42417. self::$internalEncoding = $encoding;
  42418. return true;
  42419. }
  42420. return false;
  42421. }
  42422. public static function mb_language($lang = null)
  42423. {
  42424. if (null === $lang) {
  42425. return self::$language;
  42426. }
  42427. switch ($lang = strtolower($lang)) {
  42428. case 'uni':
  42429. case 'neutral':
  42430. self::$language = $lang;
  42431. return true;
  42432. }
  42433. return false;
  42434. }
  42435. public static function mb_list_encodings()
  42436. {
  42437. return array('UTF-8');
  42438. }
  42439. public static function mb_encoding_aliases($encoding)
  42440. {
  42441. switch (strtoupper($encoding)) {
  42442. case 'UTF8':
  42443. case 'UTF-8':
  42444. return array('utf8');
  42445. }
  42446. return false;
  42447. }
  42448. public static function mb_check_encoding($var = null, $encoding = null)
  42449. {
  42450. if (null === $encoding) {
  42451. if (null === $var) {
  42452. return false;
  42453. }
  42454. $encoding = self::$internalEncoding;
  42455. }
  42456. return self::mb_detect_encoding($var, array($encoding)) || false !== @iconv($encoding, $encoding, $var);
  42457. }
  42458. public static function mb_detect_encoding($str, $encodingList = null, $strict = false)
  42459. {
  42460. if (null === $encodingList) {
  42461. $encodingList = self::$encodingList;
  42462. } else {
  42463. if (!\is_array($encodingList)) {
  42464. $encodingList = array_map('trim', explode(',', $encodingList));
  42465. }
  42466. $encodingList = array_map('strtoupper', $encodingList);
  42467. }
  42468. foreach ($encodingList as $enc) {
  42469. switch ($enc) {
  42470. case 'ASCII':
  42471. if (!preg_match('/[\x80-\xFF]/', $str)) {
  42472. return $enc;
  42473. }
  42474. break;
  42475. case 'UTF8':
  42476. case 'UTF-8':
  42477. if (preg_match('//u', $str)) {
  42478. return 'UTF-8';
  42479. }
  42480. break;
  42481. default:
  42482. if (0 === strncmp($enc, 'ISO-8859-', 9)) {
  42483. return $enc;
  42484. }
  42485. }
  42486. }
  42487. return false;
  42488. }
  42489. public static function mb_detect_order($encodingList = null)
  42490. {
  42491. if (null === $encodingList) {
  42492. return self::$encodingList;
  42493. }
  42494. if (!\is_array($encodingList)) {
  42495. $encodingList = array_map('trim', explode(',', $encodingList));
  42496. }
  42497. $encodingList = array_map('strtoupper', $encodingList);
  42498. foreach ($encodingList as $enc) {
  42499. switch ($enc) {
  42500. default:
  42501. if (strncmp($enc, 'ISO-8859-', 9)) {
  42502. return false;
  42503. }
  42504. case 'ASCII':
  42505. case 'UTF8':
  42506. case 'UTF-8':
  42507. }
  42508. }
  42509. self::$encodingList = $encodingList;
  42510. return true;
  42511. }
  42512. public static function mb_strlen($s, $encoding = null)
  42513. {
  42514. $encoding = self::getEncoding($encoding);
  42515. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  42516. return \strlen($s);
  42517. }
  42518. return @iconv_strlen($s, $encoding);
  42519. }
  42520. public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null)
  42521. {
  42522. $encoding = self::getEncoding($encoding);
  42523. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  42524. return strpos($haystack, $needle, $offset);
  42525. }
  42526. $needle = (string) $needle;
  42527. if ('' === $needle) {
  42528. trigger_error(__METHOD__.': Empty delimiter', E_USER_WARNING);
  42529. return false;
  42530. }
  42531. return iconv_strpos($haystack, $needle, $offset, $encoding);
  42532. }
  42533. public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null)
  42534. {
  42535. $encoding = self::getEncoding($encoding);
  42536. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  42537. return strrpos($haystack, $needle, $offset);
  42538. }
  42539. if ($offset != (int) $offset) {
  42540. $offset = 0;
  42541. } elseif ($offset = (int) $offset) {
  42542. if ($offset < 0) {
  42543. $haystack = self::mb_substr($haystack, 0, $offset, $encoding);
  42544. $offset = 0;
  42545. } else {
  42546. $haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding);
  42547. }
  42548. }
  42549. $pos = iconv_strrpos($haystack, $needle, $encoding);
  42550. return false !== $pos ? $offset + $pos : false;
  42551. }
  42552. public static function mb_strtolower($s, $encoding = null)
  42553. {
  42554. return self::mb_convert_case($s, MB_CASE_LOWER, $encoding);
  42555. }
  42556. public static function mb_strtoupper($s, $encoding = null)
  42557. {
  42558. return self::mb_convert_case($s, MB_CASE_UPPER, $encoding);
  42559. }
  42560. public static function mb_substitute_character($c = null)
  42561. {
  42562. if (0 === strcasecmp($c, 'none')) {
  42563. return true;
  42564. }
  42565. return null !== $c ? false : 'none';
  42566. }
  42567. public static function mb_substr($s, $start, $length = null, $encoding = null)
  42568. {
  42569. $encoding = self::getEncoding($encoding);
  42570. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  42571. return substr($s, $start, null === $length ? 2147483647 : $length);
  42572. }
  42573. if ($start < 0) {
  42574. $start = iconv_strlen($s, $encoding) + $start;
  42575. if ($start < 0) {
  42576. $start = 0;
  42577. }
  42578. }
  42579. if (null === $length) {
  42580. $length = 2147483647;
  42581. } elseif ($length < 0) {
  42582. $length = iconv_strlen($s, $encoding) + $length - $start;
  42583. if ($length < 0) {
  42584. return '';
  42585. }
  42586. }
  42587. return (string) iconv_substr($s, $start, $length, $encoding);
  42588. }
  42589. public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null)
  42590. {
  42591. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  42592. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  42593. return self::mb_strpos($haystack, $needle, $offset, $encoding);
  42594. }
  42595. public static function mb_stristr($haystack, $needle, $part = false, $encoding = null)
  42596. {
  42597. $pos = self::mb_stripos($haystack, $needle, 0, $encoding);
  42598. return self::getSubpart($pos, $part, $haystack, $encoding);
  42599. }
  42600. public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null)
  42601. {
  42602. $encoding = self::getEncoding($encoding);
  42603. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  42604. return strrchr($haystack, $needle, $part);
  42605. }
  42606. $needle = self::mb_substr($needle, 0, 1, $encoding);
  42607. $pos = iconv_strrpos($haystack, $needle, $encoding);
  42608. return self::getSubpart($pos, $part, $haystack, $encoding);
  42609. }
  42610. public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null)
  42611. {
  42612. $needle = self::mb_substr($needle, 0, 1, $encoding);
  42613. $pos = self::mb_strripos($haystack, $needle, $encoding);
  42614. return self::getSubpart($pos, $part, $haystack, $encoding);
  42615. }
  42616. public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null)
  42617. {
  42618. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  42619. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  42620. return self::mb_strrpos($haystack, $needle, $offset, $encoding);
  42621. }
  42622. public static function mb_strstr($haystack, $needle, $part = false, $encoding = null)
  42623. {
  42624. $pos = strpos($haystack, $needle);
  42625. if (false === $pos) {
  42626. return false;
  42627. }
  42628. if ($part) {
  42629. return substr($haystack, 0, $pos);
  42630. }
  42631. return substr($haystack, $pos);
  42632. }
  42633. public static function mb_get_info($type = 'all')
  42634. {
  42635. $info = array(
  42636. 'internal_encoding' => self::$internalEncoding,
  42637. 'http_output' => 'pass',
  42638. 'http_output_conv_mimetypes' => '^(text/|application/xhtml\+xml)',
  42639. 'func_overload' => 0,
  42640. 'func_overload_list' => 'no overload',
  42641. 'mail_charset' => 'UTF-8',
  42642. 'mail_header_encoding' => 'BASE64',
  42643. 'mail_body_encoding' => 'BASE64',
  42644. 'illegal_chars' => 0,
  42645. 'encoding_translation' => 'Off',
  42646. 'language' => self::$language,
  42647. 'detect_order' => self::$encodingList,
  42648. 'substitute_character' => 'none',
  42649. 'strict_detection' => 'Off',
  42650. );
  42651. if ('all' === $type) {
  42652. return $info;
  42653. }
  42654. if (isset($info[$type])) {
  42655. return $info[$type];
  42656. }
  42657. return false;
  42658. }
  42659. public static function mb_http_input($type = '')
  42660. {
  42661. return false;
  42662. }
  42663. public static function mb_http_output($encoding = null)
  42664. {
  42665. return null !== $encoding ? 'pass' === $encoding : 'pass';
  42666. }
  42667. public static function mb_strwidth($s, $encoding = null)
  42668. {
  42669. $encoding = self::getEncoding($encoding);
  42670. if ('UTF-8' !== $encoding) {
  42671. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  42672. }
  42673. $s = preg_replace('/[\x{1100}-\x{115F}\x{2329}\x{232A}\x{2E80}-\x{303E}\x{3040}-\x{A4CF}\x{AC00}-\x{D7A3}\x{F900}-\x{FAFF}\x{FE10}-\x{FE19}\x{FE30}-\x{FE6F}\x{FF00}-\x{FF60}\x{FFE0}-\x{FFE6}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}]/u', '', $s, -1, $wide);
  42674. return ($wide << 1) + iconv_strlen($s, 'UTF-8');
  42675. }
  42676. public static function mb_substr_count($haystack, $needle, $encoding = null)
  42677. {
  42678. return substr_count($haystack, $needle);
  42679. }
  42680. public static function mb_output_handler($contents, $status)
  42681. {
  42682. return $contents;
  42683. }
  42684. public static function mb_chr($code, $encoding = null)
  42685. {
  42686. if (0x80 > $code %= 0x200000) {
  42687. $s = \chr($code);
  42688. } elseif (0x800 > $code) {
  42689. $s = \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F);
  42690. } elseif (0x10000 > $code) {
  42691. $s = \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
  42692. } else {
  42693. $s = \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
  42694. }
  42695. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  42696. $s = mb_convert_encoding($s, $encoding, 'UTF-8');
  42697. }
  42698. return $s;
  42699. }
  42700. public static function mb_ord($s, $encoding = null)
  42701. {
  42702. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  42703. $s = mb_convert_encoding($s, 'UTF-8', $encoding);
  42704. }
  42705. $code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0;
  42706. if (0xF0 <= $code) {
  42707. return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80;
  42708. }
  42709. if (0xE0 <= $code) {
  42710. return (($code - 0xE0) << 12) + (($s[2] - 0x80) << 6) + $s[3] - 0x80;
  42711. }
  42712. if (0xC0 <= $code) {
  42713. return (($code - 0xC0) << 6) + $s[2] - 0x80;
  42714. }
  42715. return $code;
  42716. }
  42717. private static function getSubpart($pos, $part, $haystack, $encoding)
  42718. {
  42719. if (false === $pos) {
  42720. return false;
  42721. }
  42722. if ($part) {
  42723. return self::mb_substr($haystack, 0, $pos, $encoding);
  42724. }
  42725. return self::mb_substr($haystack, $pos, null, $encoding);
  42726. }
  42727. private static function html_encoding_callback(array $m)
  42728. {
  42729. $i = 1;
  42730. $entities = '';
  42731. $m = unpack('C*', htmlentities($m[0], ENT_COMPAT, 'UTF-8'));
  42732. while (isset($m[$i])) {
  42733. if (0x80 > $m[$i]) {
  42734. $entities .= \chr($m[$i++]);
  42735. continue;
  42736. }
  42737. if (0xF0 <= $m[$i]) {
  42738. $c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  42739. } elseif (0xE0 <= $m[$i]) {
  42740. $c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  42741. } else {
  42742. $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80;
  42743. }
  42744. $entities .= '&#'.$c.';';
  42745. }
  42746. return $entities;
  42747. }
  42748. private static function title_case_lower(array $s)
  42749. {
  42750. return self::mb_convert_case($s[0], MB_CASE_LOWER, 'UTF-8');
  42751. }
  42752. private static function title_case_upper(array $s)
  42753. {
  42754. return self::mb_convert_case($s[0], MB_CASE_UPPER, 'UTF-8');
  42755. }
  42756. private static function getData($file)
  42757. {
  42758. if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) {
  42759. return require $file;
  42760. }
  42761. return false;
  42762. }
  42763. private static function getEncoding($encoding)
  42764. {
  42765. if (null === $encoding) {
  42766. return self::$internalEncoding;
  42767. }
  42768. $encoding = strtoupper($encoding);
  42769. if ('8BIT' === $encoding || 'BINARY' === $encoding) {
  42770. return 'CP850';
  42771. }
  42772. if ('UTF8' === $encoding) {
  42773. return 'UTF-8';
  42774. }
  42775. return $encoding;
  42776. }
  42777. }
  42778. <?php
  42779. static $data = array (
  42780. 'A' => 'a',
  42781. 'B' => 'b',
  42782. 'C' => 'c',
  42783. 'D' => 'd',
  42784. 'E' => 'e',
  42785. 'F' => 'f',
  42786. 'G' => 'g',
  42787. 'H' => 'h',
  42788. 'I' => 'i',
  42789. 'J' => 'j',
  42790. 'K' => 'k',
  42791. 'L' => 'l',
  42792. 'M' => 'm',
  42793. 'N' => 'n',
  42794. 'O' => 'o',
  42795. 'P' => 'p',
  42796. 'Q' => 'q',
  42797. 'R' => 'r',
  42798. 'S' => 's',
  42799. 'T' => 't',
  42800. 'U' => 'u',
  42801. 'V' => 'v',
  42802. 'W' => 'w',
  42803. 'X' => 'x',
  42804. 'Y' => 'y',
  42805. 'Z' => 'z',
  42806. 'À' => 'à',
  42807. '�' => 'á',
  42808. 'Â' => 'â',
  42809. 'Ã' => 'ã',
  42810. 'Ä' => 'ä',
  42811. 'Ã…' => 'Ã¥',
  42812. 'Æ' => 'æ',
  42813. 'Ç' => 'ç',
  42814. 'È' => 'è',
  42815. 'É' => 'é',
  42816. 'Ê' => 'ê',
  42817. 'Ë' => 'ë',
  42818. 'Ì' => 'ì',
  42819. '�' => 'í',
  42820. 'Î' => 'î',
  42821. '�' => 'ï',
  42822. '�' => 'ð',
  42823. 'Ñ' => 'ñ',
  42824. 'Ò' => 'ò',
  42825. 'Ó' => 'ó',
  42826. 'Ô' => 'ô',
  42827. 'Õ' => 'õ',
  42828. 'Ö' => 'ö',
  42829. 'Ø' => 'ø',
  42830. 'Ù' => 'ù',
  42831. 'Ú' => 'ú',
  42832. 'Û' => 'û',
  42833. 'Ü' => 'ü',
  42834. '�' => 'ý',
  42835. 'Þ' => 'þ',
  42836. 'Ā' => '�',
  42837. 'Ă' => 'ă',
  42838. 'Ä„' => 'Ä…',
  42839. 'Ć' => 'ć',
  42840. 'Ĉ' => 'ĉ',
  42841. 'ÄŠ' => 'Ä‹',
  42842. 'Č' => '�',
  42843. 'Ď' => '�',
  42844. '�' => 'đ',
  42845. 'Ä’' => 'Ä“',
  42846. 'Ä”' => 'Ä•',
  42847. 'Ä–' => 'Ä—',
  42848. 'Ę' => 'ę',
  42849. 'Äš' => 'Ä›',
  42850. 'Ĝ' => '�',
  42851. 'Äž' => 'ÄŸ',
  42852. 'Ä ' => 'Ä¡',
  42853. 'Ä¢' => 'Ä£',
  42854. 'Ĥ' => 'ĥ',
  42855. 'Ħ' => 'ħ',
  42856. 'Ĩ' => 'ĩ',
  42857. 'Ī' => 'ī',
  42858. 'Ĭ' => 'ĭ',
  42859. 'Į' => 'į',
  42860. 'Ä°' => 'i',
  42861. 'IJ' => 'ij',
  42862. 'Ĵ' => 'ĵ',
  42863. 'Ķ' => 'ķ',
  42864. 'Ĺ' => 'ĺ',
  42865. 'Ļ' => 'ļ',
  42866. 'Ľ' => 'ľ',
  42867. 'Ä¿' => 'Å€',
  42868. '�' => 'ł',
  42869. 'Ń' => 'ń',
  42870. 'Ņ' => 'ņ',
  42871. 'Ň' => 'ň',
  42872. 'ÅŠ' => 'Å‹',
  42873. 'Ō' => '�',
  42874. 'Ŏ' => '�',
  42875. '�' => 'ő',
  42876. 'Å’' => 'Å“',
  42877. 'Å”' => 'Å•',
  42878. 'Å–' => 'Å—',
  42879. 'Ř' => 'ř',
  42880. 'Åš' => 'Å›',
  42881. 'Ŝ' => '�',
  42882. 'Åž' => 'ÅŸ',
  42883. 'Å ' => 'Å¡',
  42884. 'Å¢' => 'Å£',
  42885. 'Ť' => 'ť',
  42886. 'Ŧ' => 'ŧ',
  42887. 'Ũ' => 'ũ',
  42888. 'Ū' => 'ū',
  42889. 'Ŭ' => 'ŭ',
  42890. 'Ů' => 'ů',
  42891. 'Ű' => 'ű',
  42892. 'Ų' => 'ų',
  42893. 'Ŵ' => 'ŵ',
  42894. 'Ŷ' => 'ŷ',
  42895. 'Ÿ' => 'ÿ',
  42896. 'Ź' => 'ź',
  42897. 'Ż' => 'ż',
  42898. 'Ž' => 'ž',
  42899. '�' => 'ɓ',
  42900. 'Ƃ' => 'ƃ',
  42901. 'Æ„' => 'Æ…',
  42902. 'Ɔ' => 'ɔ',
  42903. 'Ƈ' => 'ƈ',
  42904. 'Ɖ' => 'ɖ',
  42905. 'ÆŠ' => 'É—',
  42906. 'Ƌ' => 'ƌ',
  42907. 'Ǝ' => '�',
  42908. '�' => 'ə',
  42909. '�' => 'ɛ',
  42910. 'Æ‘' => 'Æ’',
  42911. 'Æ“' => 'É ',
  42912. 'Æ”' => 'É£',
  42913. 'Æ–' => 'É©',
  42914. 'Ɨ' => 'ɨ',
  42915. 'Ƙ' => 'ƙ',
  42916. 'Ɯ' => 'ɯ',
  42917. '�' => 'ɲ',
  42918. 'Ɵ' => 'ɵ',
  42919. 'Æ ' => 'Æ¡',
  42920. 'Æ¢' => 'Æ£',
  42921. 'Ƥ' => 'ƥ',
  42922. 'Ʀ' => 'ʀ',
  42923. 'Ƨ' => 'ƨ',
  42924. 'Ʃ' => 'ʃ',
  42925. 'Ƭ' => 'ƭ',
  42926. 'Ʈ' => 'ʈ',
  42927. 'Ư' => 'ư',
  42928. 'Ʊ' => 'ʊ',
  42929. 'Ʋ' => 'ʋ',
  42930. 'Ƴ' => 'ƴ',
  42931. 'Ƶ' => 'ƶ',
  42932. 'Æ·' => 'Ê’',
  42933. 'Ƹ' => 'ƹ',
  42934. 'Ƽ' => 'ƽ',
  42935. 'DŽ' => 'dž',
  42936. 'Dž' => 'dž',
  42937. 'LJ' => 'lj',
  42938. 'Lj' => 'lj',
  42939. 'NJ' => 'nj',
  42940. 'Nj' => 'nj',
  42941. '�' => 'ǎ',
  42942. '�' => '�',
  42943. 'Ç‘' => 'Ç’',
  42944. 'Ç“' => 'Ç”',
  42945. 'Ç•' => 'Ç–',
  42946. 'Ǘ' => 'ǘ',
  42947. 'Ç™' => 'Çš',
  42948. 'Ǜ' => 'ǜ',
  42949. 'Çž' => 'ÇŸ',
  42950. 'Ç ' => 'Ç¡',
  42951. 'Ç¢' => 'Ç£',
  42952. 'Ǥ' => 'ǥ',
  42953. 'Ǧ' => 'ǧ',
  42954. 'Ǩ' => 'ǩ',
  42955. 'Ǫ' => 'ǫ',
  42956. 'Ǭ' => 'ǭ',
  42957. 'Ǯ' => 'ǯ',
  42958. 'DZ' => 'dz',
  42959. 'Dz' => 'dz',
  42960. 'Ǵ' => 'ǵ',
  42961. 'Ƕ' => 'ƕ',
  42962. 'Ç·' => 'Æ¿',
  42963. 'Ǹ' => 'ǹ',
  42964. 'Ǻ' => 'ǻ',
  42965. 'Ǽ' => 'ǽ',
  42966. 'Ǿ' => 'ǿ',
  42967. 'Ȁ' => '�',
  42968. 'Ȃ' => 'ȃ',
  42969. 'È„' => 'È…',
  42970. 'Ȇ' => 'ȇ',
  42971. 'Ȉ' => 'ȉ',
  42972. 'ÈŠ' => 'È‹',
  42973. 'Ȍ' => '�',
  42974. 'Ȏ' => '�',
  42975. '�' => 'ȑ',
  42976. 'È’' => 'È“',
  42977. 'È”' => 'È•',
  42978. 'È–' => 'È—',
  42979. 'Ș' => 'ș',
  42980. 'Èš' => 'È›',
  42981. 'Ȝ' => '�',
  42982. 'Èž' => 'ÈŸ',
  42983. 'È ' => 'Æž',
  42984. 'È¢' => 'È£',
  42985. 'Ȥ' => 'ȥ',
  42986. 'Ȧ' => 'ȧ',
  42987. 'Ȩ' => 'ȩ',
  42988. 'Ȫ' => 'ȫ',
  42989. 'Ȭ' => 'ȭ',
  42990. 'Ȯ' => 'ȯ',
  42991. 'Ȱ' => 'ȱ',
  42992. 'Ȳ' => 'ȳ',
  42993. 'Ⱥ' => 'ⱥ',
  42994. 'Ȼ' => 'ȼ',
  42995. 'Ƚ' => 'ƚ',
  42996. 'Ⱦ' => 'ⱦ',
  42997. '�' => 'ɂ',
  42998. 'Ƀ' => 'ƀ',
  42999. 'Ʉ' => 'ʉ',
  43000. 'Ʌ' => 'ʌ',
  43001. 'Ɇ' => 'ɇ',
  43002. 'Ɉ' => 'ɉ',
  43003. 'ÉŠ' => 'É‹',
  43004. 'Ɍ' => '�',
  43005. 'Ɏ' => '�',
  43006. 'Ͱ' => 'ͱ',
  43007. 'Ͳ' => 'ͳ',
  43008. 'Ͷ' => 'ͷ',
  43009. 'Ϳ' => 'ϳ',
  43010. 'Ά' => 'ά',
  43011. 'Έ' => 'έ',
  43012. 'Ή' => 'ή',
  43013. 'Ί' => 'ί',
  43014. 'Ό' => 'ό',
  43015. 'Ύ' => '�',
  43016. '�' => 'ώ',
  43017. 'Α' => 'α',
  43018. 'Β' => 'β',
  43019. 'Γ' => 'γ',
  43020. 'Δ' => 'δ',
  43021. 'Ε' => 'ε',
  43022. 'Ζ' => 'ζ',
  43023. 'Η' => 'η',
  43024. 'Θ' => 'θ',
  43025. 'Ι' => 'ι',
  43026. 'Κ' => 'κ',
  43027. 'Λ' => 'λ',
  43028. 'Μ' => 'μ',
  43029. '�' => 'ν',
  43030. 'Ξ' => 'ξ',
  43031. 'Ο' => 'ο',
  43032. 'Π' => 'π',
  43033. 'Ρ' => '�',
  43034. 'Σ' => 'σ',
  43035. 'Τ' => 'τ',
  43036. 'Î¥' => 'Ï…',
  43037. 'Φ' => 'φ',
  43038. 'Χ' => 'χ',
  43039. 'Ψ' => 'ψ',
  43040. 'Ω' => 'ω',
  43041. 'Ϊ' => 'ϊ',
  43042. 'Ϋ' => 'ϋ',
  43043. '�' => 'ϗ',
  43044. 'Ϙ' => 'ϙ',
  43045. 'Ïš' => 'Ï›',
  43046. 'Ϝ' => '�',
  43047. 'Ïž' => 'ÏŸ',
  43048. 'Ï ' => 'Ï¡',
  43049. 'Ï¢' => 'Ï£',
  43050. 'Ϥ' => 'ϥ',
  43051. 'Ϧ' => 'ϧ',
  43052. 'Ϩ' => 'ϩ',
  43053. 'Ϫ' => 'ϫ',
  43054. 'Ϭ' => 'ϭ',
  43055. 'Ϯ' => 'ϯ',
  43056. 'ϴ' => 'θ',
  43057. 'Ϸ' => 'ϸ',
  43058. 'Ϲ' => 'ϲ',
  43059. 'Ϻ' => 'ϻ',
  43060. 'Ͻ' => 'ͻ',
  43061. 'Ͼ' => 'ͼ',
  43062. 'Ͽ' => 'ͽ',
  43063. 'Ѐ' => '�',
  43064. '�' => 'ё',
  43065. 'Ђ' => 'ђ',
  43066. 'Ѓ' => 'ѓ',
  43067. 'Є' => 'є',
  43068. 'Ð…' => 'Ñ•',
  43069. 'І' => 'і',
  43070. 'Ї' => 'ї',
  43071. 'Ј' => 'ј',
  43072. 'Љ' => 'љ',
  43073. 'Њ' => 'њ',
  43074. 'Ћ' => 'ћ',
  43075. 'Ќ' => 'ќ',
  43076. '�' => '�',
  43077. 'ÐŽ' => 'Ñž',
  43078. '�' => 'џ',
  43079. '�' => 'а',
  43080. 'Б' => 'б',
  43081. 'В' => 'в',
  43082. 'Г' => 'г',
  43083. 'Д' => 'д',
  43084. 'Е' => 'е',
  43085. 'Ж' => 'ж',
  43086. 'З' => 'з',
  43087. 'И' => 'и',
  43088. 'Й' => 'й',
  43089. 'К' => 'к',
  43090. 'Л' => 'л',
  43091. 'М' => 'м',
  43092. '�' => 'н',
  43093. 'О' => 'о',
  43094. 'П' => 'п',
  43095. 'Р' => 'р',
  43096. 'С' => '�',
  43097. 'Т' => 'т',
  43098. 'У' => 'у',
  43099. 'Ф' => 'ф',
  43100. 'Ð¥' => 'Ñ…',
  43101. 'Ц' => 'ц',
  43102. 'Ч' => 'ч',
  43103. 'Ш' => 'ш',
  43104. 'Щ' => 'щ',
  43105. 'Ъ' => 'ъ',
  43106. 'Ы' => 'ы',
  43107. 'Ь' => 'ь',
  43108. 'Э' => '�',
  43109. 'Ю' => 'ю',
  43110. 'Я' => '�',
  43111. 'Ñ ' => 'Ñ¡',
  43112. 'Ñ¢' => 'Ñ£',
  43113. 'Ѥ' => 'ѥ',
  43114. 'Ѧ' => 'ѧ',
  43115. 'Ѩ' => 'ѩ',
  43116. 'Ѫ' => 'ѫ',
  43117. 'Ѭ' => 'ѭ',
  43118. 'Ѯ' => 'ѯ',
  43119. 'Ѱ' => 'ѱ',
  43120. 'Ѳ' => 'ѳ',
  43121. 'Ѵ' => 'ѵ',
  43122. 'Ѷ' => 'ѷ',
  43123. 'Ѹ' => 'ѹ',
  43124. 'Ѻ' => 'ѻ',
  43125. 'Ѽ' => 'ѽ',
  43126. 'Ѿ' => 'ѿ',
  43127. 'Ò€' => 'Ò�',
  43128. 'ÒŠ' => 'Ò‹',
  43129. 'Ҍ' => '�',
  43130. 'ÒŽ' => 'Ò�',
  43131. 'Ò�' => 'Ò‘',
  43132. 'Ò’' => 'Ò“',
  43133. 'Ò”' => 'Ò•',
  43134. 'Ò–' => 'Ò—',
  43135. 'Ò˜' => 'Ò™',
  43136. 'Òš' => 'Ò›',
  43137. 'Ҝ' => '�',
  43138. 'Òž' => 'ÒŸ',
  43139. 'Ò ' => 'Ò¡',
  43140. 'Ò¢' => 'Ò£',
  43141. 'Ò¤' => 'Ò¥',
  43142. 'Ò¦' => 'Ò§',
  43143. 'Ò¨' => 'Ò©',
  43144. 'Òª' => 'Ò«',
  43145. 'Ò¬' => 'Ò­',
  43146. 'Ò®' => 'Ò¯',
  43147. 'Ò°' => 'Ò±',
  43148. 'Ò²' => 'Ò³',
  43149. 'Ò´' => 'Òµ',
  43150. 'Ò¶' => 'Ò·',
  43151. 'Ò¸' => 'Ò¹',
  43152. 'Òº' => 'Ò»',
  43153. 'Ò¼' => 'Ò½',
  43154. 'Ò¾' => 'Ò¿',
  43155. 'Ó€' => 'Ó�',
  43156. 'Ó�' => 'Ó‚',
  43157. 'Óƒ' => 'Ó„',
  43158. 'Ó…' => 'Ó†',
  43159. 'Ó‡' => 'Óˆ',
  43160. 'Ó‰' => 'ÓŠ',
  43161. 'Ӌ' => 'ӌ',
  43162. 'Ó�' => 'ÓŽ',
  43163. 'Ó�' => 'Ó‘',
  43164. 'Ó’' => 'Ó“',
  43165. 'Ó”' => 'Ó•',
  43166. 'Ó–' => 'Ó—',
  43167. 'Ó˜' => 'Ó™',
  43168. 'Óš' => 'Ó›',
  43169. 'Ӝ' => '�',
  43170. 'Óž' => 'ÓŸ',
  43171. 'Ó ' => 'Ó¡',
  43172. 'Ó¢' => 'Ó£',
  43173. 'Ó¤' => 'Ó¥',
  43174. 'Ó¦' => 'Ó§',
  43175. 'Ó¨' => 'Ó©',
  43176. 'Óª' => 'Ó«',
  43177. 'Ó¬' => 'Ó­',
  43178. 'Ó®' => 'Ó¯',
  43179. 'Ó°' => 'Ó±',
  43180. 'Ó²' => 'Ó³',
  43181. 'Ó´' => 'Óµ',
  43182. 'Ó¶' => 'Ó·',
  43183. 'Ó¸' => 'Ó¹',
  43184. 'Óº' => 'Ó»',
  43185. 'Ó¼' => 'Ó½',
  43186. 'Ó¾' => 'Ó¿',
  43187. 'Ô€' => 'Ô�',
  43188. 'Ô‚' => 'Ôƒ',
  43189. 'Ô„' => 'Ô…',
  43190. 'Ô†' => 'Ô‡',
  43191. 'Ôˆ' => 'Ô‰',
  43192. 'ÔŠ' => 'Ô‹',
  43193. 'Ԍ' => '�',
  43194. 'ÔŽ' => 'Ô�',
  43195. 'Ô�' => 'Ô‘',
  43196. 'Ô’' => 'Ô“',
  43197. 'Ô”' => 'Ô•',
  43198. 'Ô–' => 'Ô—',
  43199. 'Ô˜' => 'Ô™',
  43200. 'Ôš' => 'Ô›',
  43201. 'Ԝ' => '�',
  43202. 'Ôž' => 'ÔŸ',
  43203. 'Ô ' => 'Ô¡',
  43204. 'Ô¢' => 'Ô£',
  43205. 'Ô¤' => 'Ô¥',
  43206. 'Ô¦' => 'Ô§',
  43207. 'Ô¨' => 'Ô©',
  43208. 'Ôª' => 'Ô«',
  43209. 'Ô¬' => 'Ô­',
  43210. 'Ô®' => 'Ô¯',
  43211. 'Ô±' => 'Õ¡',
  43212. 'Ô²' => 'Õ¢',
  43213. 'Ô³' => 'Õ£',
  43214. 'Ô´' => 'Õ¤',
  43215. 'Ôµ' => 'Õ¥',
  43216. 'Ô¶' => 'Õ¦',
  43217. 'Ô·' => 'Õ§',
  43218. 'Ô¸' => 'Õ¨',
  43219. 'Ô¹' => 'Õ©',
  43220. 'Ôº' => 'Õª',
  43221. 'Ô»' => 'Õ«',
  43222. 'Ô¼' => 'Õ¬',
  43223. 'Ô½' => 'Õ­',
  43224. 'Ô¾' => 'Õ®',
  43225. 'Ô¿' => 'Õ¯',
  43226. 'Õ€' => 'Õ°',
  43227. 'Õ�' => 'Õ±',
  43228. 'Õ‚' => 'Õ²',
  43229. 'Õƒ' => 'Õ³',
  43230. 'Õ„' => 'Õ´',
  43231. 'Õ…' => 'Õµ',
  43232. 'Õ†' => 'Õ¶',
  43233. 'Õ‡' => 'Õ·',
  43234. 'Õˆ' => 'Õ¸',
  43235. 'Õ‰' => 'Õ¹',
  43236. 'ÕŠ' => 'Õº',
  43237. 'Õ‹' => 'Õ»',
  43238. 'Ռ' => 'ռ',
  43239. 'Õ�' => 'Õ½',
  43240. 'ÕŽ' => 'Õ¾',
  43241. 'Õ�' => 'Õ¿',
  43242. 'Õ�' => 'Ö€',
  43243. 'Õ‘' => 'Ö�',
  43244. 'Õ’' => 'Ö‚',
  43245. 'Õ“' => 'Öƒ',
  43246. 'Õ”' => 'Ö„',
  43247. 'Õ•' => 'Ö…',
  43248. 'Õ–' => 'Ö†',
  43249. 'á‚ ' => 'â´€',
  43250. 'á‚¡' => 'â´�',
  43251. 'á‚¢' => 'â´‚',
  43252. 'á‚£' => 'â´ƒ',
  43253. 'Ⴄ' => 'ⴄ',
  43254. 'á‚¥' => 'â´…',
  43255. 'Ⴆ' => 'ⴆ',
  43256. 'Ⴇ' => 'ⴇ',
  43257. 'Ⴈ' => 'ⴈ',
  43258. 'á‚©' => 'â´‰',
  43259. 'Ⴊ' => 'ⴊ',
  43260. 'á‚«' => 'â´‹',
  43261. 'Ⴌ' => 'ⴌ',
  43262. 'á‚­' => 'â´�',
  43263. 'á‚®' => 'â´Ž',
  43264. 'Ⴏ' => '�',
  43265. 'á‚°' => 'â´�',
  43266. 'Ⴑ' => 'ⴑ',
  43267. 'Ⴒ' => 'ⴒ',
  43268. 'Ⴓ' => 'ⴓ',
  43269. 'á‚´' => 'â´”',
  43270. 'Ⴕ' => 'ⴕ',
  43271. 'Ⴖ' => 'ⴖ',
  43272. 'á‚·' => 'â´—',
  43273. 'Ⴘ' => 'ⴘ',
  43274. 'Ⴙ' => 'ⴙ',
  43275. 'Ⴚ' => 'ⴚ',
  43276. 'á‚»' => 'â´›',
  43277. 'Ⴜ' => 'ⴜ',
  43278. 'Ⴝ' => '�',
  43279. 'Ⴞ' => 'ⴞ',
  43280. 'á‚¿' => 'â´Ÿ',
  43281. 'Ⴠ' => 'ⴠ',
  43282. '�' => 'ⴡ',
  43283. 'Ⴢ' => 'ⴢ',
  43284. 'Ⴣ' => 'ⴣ',
  43285. 'Ⴤ' => 'ⴤ',
  43286. 'Ⴥ' => 'ⴥ',
  43287. 'Ⴧ' => 'ⴧ',
  43288. '�' => 'ⴭ',
  43289. 'Ḁ' => '�',
  43290. 'Ḃ' => 'ḃ',
  43291. 'Ḅ' => 'ḅ',
  43292. 'Ḇ' => 'ḇ',
  43293. 'Ḉ' => 'ḉ',
  43294. 'Ḋ' => 'ḋ',
  43295. 'Ḍ' => '�',
  43296. 'Ḏ' => '�',
  43297. '�' => 'ḑ',
  43298. 'Ḓ' => 'ḓ',
  43299. 'Ḕ' => 'ḕ',
  43300. 'Ḗ' => 'ḗ',
  43301. 'Ḙ' => 'ḙ',
  43302. 'Ḛ' => 'ḛ',
  43303. 'Ḝ' => '�',
  43304. 'Ḟ' => 'ḟ',
  43305. 'Ḡ' => 'ḡ',
  43306. 'Ḣ' => 'ḣ',
  43307. 'Ḥ' => 'ḥ',
  43308. 'Ḧ' => 'ḧ',
  43309. 'Ḩ' => 'ḩ',
  43310. 'Ḫ' => 'ḫ',
  43311. 'Ḭ' => 'ḭ',
  43312. 'Ḯ' => 'ḯ',
  43313. 'Ḱ' => 'ḱ',
  43314. 'Ḳ' => 'ḳ',
  43315. 'Ḵ' => 'ḵ',
  43316. 'Ḷ' => 'ḷ',
  43317. 'Ḹ' => 'ḹ',
  43318. 'Ḻ' => 'ḻ',
  43319. 'Ḽ' => 'ḽ',
  43320. 'Ḿ' => 'ḿ',
  43321. 'Ṁ' => '�',
  43322. 'Ṃ' => 'ṃ',
  43323. 'Ṅ' => 'ṅ',
  43324. 'Ṇ' => 'ṇ',
  43325. 'Ṉ' => 'ṉ',
  43326. 'Ṋ' => 'ṋ',
  43327. 'Ṍ' => '�',
  43328. 'Ṏ' => '�',
  43329. '�' => 'ṑ',
  43330. 'Ṓ' => 'ṓ',
  43331. 'Ṕ' => 'ṕ',
  43332. 'á¹–' => 'á¹—',
  43333. 'Ṙ' => 'ṙ',
  43334. 'Ṛ' => 'ṛ',
  43335. 'Ṝ' => '�',
  43336. 'Ṟ' => 'ṟ',
  43337. 'Ṡ' => 'ṡ',
  43338. 'á¹¢' => 'á¹£',
  43339. 'Ṥ' => 'ṥ',
  43340. 'Ṧ' => 'ṧ',
  43341. 'Ṩ' => 'ṩ',
  43342. 'Ṫ' => 'ṫ',
  43343. 'Ṭ' => 'ṭ',
  43344. 'Ṯ' => 'ṯ',
  43345. 'á¹°' => 'á¹±',
  43346. 'á¹²' => 'á¹³',
  43347. 'á¹´' => 'á¹µ',
  43348. 'Ṷ' => 'ṷ',
  43349. 'Ṹ' => 'ṹ',
  43350. 'Ṻ' => 'ṻ',
  43351. 'á¹¼' => 'á¹½',
  43352. 'Ṿ' => 'ṿ',
  43353. 'Ẁ' => '�',
  43354. 'Ẃ' => 'ẃ',
  43355. 'Ẅ' => 'ẅ',
  43356. 'Ẇ' => 'ẇ',
  43357. 'Ẉ' => 'ẉ',
  43358. 'Ẋ' => 'ẋ',
  43359. 'Ẍ' => '�',
  43360. 'Ẏ' => '�',
  43361. '�' => 'ẑ',
  43362. 'Ẓ' => 'ẓ',
  43363. 'Ẕ' => 'ẕ',
  43364. 'ẞ' => 'ß',
  43365. 'Ạ' => 'ạ',
  43366. 'Ả' => 'ả',
  43367. 'Ấ' => 'ấ',
  43368. 'Ầ' => 'ầ',
  43369. 'Ẩ' => 'ẩ',
  43370. 'Ẫ' => 'ẫ',
  43371. 'Ậ' => 'ậ',
  43372. 'Ắ' => 'ắ',
  43373. 'Ằ' => 'ằ',
  43374. 'Ẳ' => 'ẳ',
  43375. 'Ẵ' => 'ẵ',
  43376. 'Ặ' => 'ặ',
  43377. 'Ẹ' => 'ẹ',
  43378. 'Ẻ' => 'ẻ',
  43379. 'Ẽ' => 'ẽ',
  43380. 'Ế' => 'ế',
  43381. 'Ề' => '�',
  43382. 'Ể' => 'ể',
  43383. 'Ễ' => 'ễ',
  43384. 'Ệ' => 'ệ',
  43385. 'Ỉ' => 'ỉ',
  43386. 'Ị' => 'ị',
  43387. 'Ọ' => '�',
  43388. 'Ỏ' => '�',
  43389. '�' => 'ố',
  43390. 'Ồ' => 'ồ',
  43391. 'Ổ' => 'ổ',
  43392. 'á»–' => 'á»—',
  43393. 'Ộ' => 'ộ',
  43394. 'Ớ' => 'ớ',
  43395. 'Ờ' => '�',
  43396. 'Ở' => 'ở',
  43397. 'Ỡ' => 'ỡ',
  43398. 'Ợ' => 'ợ',
  43399. 'Ụ' => 'ụ',
  43400. 'Ủ' => 'ủ',
  43401. 'Ứ' => 'ứ',
  43402. 'Ừ' => 'ừ',
  43403. 'Ử' => 'ử',
  43404. 'Ữ' => 'ữ',
  43405. 'á»°' => 'á»±',
  43406. 'Ỳ' => 'ỳ',
  43407. 'Ỵ' => 'ỵ',
  43408. 'Ỷ' => 'ỷ',
  43409. 'Ỹ' => 'ỹ',
  43410. 'Ỻ' => 'ỻ',
  43411. 'Ỽ' => 'ỽ',
  43412. 'Ỿ' => 'ỿ',
  43413. 'Ἀ' => 'ἀ',
  43414. 'Ἁ' => '�',
  43415. 'Ἂ' => 'ἂ',
  43416. 'Ἃ' => 'ἃ',
  43417. 'Ἄ' => 'ἄ',
  43418. '�' => 'ἅ',
  43419. 'Ἆ' => 'ἆ',
  43420. '�' => 'ἇ',
  43421. 'Ἐ' => '�',
  43422. 'Ἑ' => 'ἑ',
  43423. 'Ἒ' => 'ἒ',
  43424. 'Ἓ' => 'ἓ',
  43425. 'Ἔ' => 'ἔ',
  43426. '�' => 'ἕ',
  43427. 'Ἠ' => 'ἠ',
  43428. 'Ἡ' => 'ἡ',
  43429. 'Ἢ' => 'ἢ',
  43430. 'Ἣ' => 'ἣ',
  43431. 'Ἤ' => 'ἤ',
  43432. 'á¼­' => 'á¼¥',
  43433. 'Ἦ' => 'ἦ',
  43434. 'Ἧ' => 'ἧ',
  43435. 'Ἰ' => 'ἰ',
  43436. 'á¼¹' => 'á¼±',
  43437. 'Ἲ' => 'ἲ',
  43438. 'á¼»' => 'á¼³',
  43439. 'á¼¼' => 'á¼´',
  43440. 'á¼½' => 'á¼µ',
  43441. 'Ἶ' => 'ἶ',
  43442. 'Ἷ' => 'ἷ',
  43443. 'Ὀ' => 'ὀ',
  43444. 'Ὁ' => '�',
  43445. 'Ὂ' => 'ὂ',
  43446. 'Ὃ' => 'ὃ',
  43447. 'Ὄ' => 'ὄ',
  43448. '�' => 'ὅ',
  43449. 'Ὑ' => 'ὑ',
  43450. 'Ὓ' => 'ὓ',
  43451. '�' => 'ὕ',
  43452. 'Ὗ' => 'ὗ',
  43453. 'Ὠ' => 'ὠ',
  43454. 'Ὡ' => 'ὡ',
  43455. 'Ὢ' => 'ὢ',
  43456. 'Ὣ' => 'ὣ',
  43457. 'Ὤ' => 'ὤ',
  43458. 'á½­' => 'á½¥',
  43459. 'Ὦ' => 'ὦ',
  43460. 'Ὧ' => 'ὧ',
  43461. 'ᾈ' => 'ᾀ',
  43462. 'ᾉ' => '�',
  43463. 'ᾊ' => 'ᾂ',
  43464. 'ᾋ' => 'ᾃ',
  43465. 'ᾌ' => 'ᾄ',
  43466. '�' => 'ᾅ',
  43467. 'ᾎ' => 'ᾆ',
  43468. '�' => 'ᾇ',
  43469. 'ᾘ' => '�',
  43470. 'ᾙ' => 'ᾑ',
  43471. 'ᾚ' => 'ᾒ',
  43472. 'ᾛ' => 'ᾓ',
  43473. 'ᾜ' => 'ᾔ',
  43474. '�' => 'ᾕ',
  43475. 'ᾞ' => 'ᾖ',
  43476. 'ᾟ' => 'ᾗ',
  43477. 'ᾨ' => 'ᾠ',
  43478. 'ᾩ' => 'ᾡ',
  43479. 'ᾪ' => 'ᾢ',
  43480. 'ᾫ' => 'ᾣ',
  43481. 'ᾬ' => 'ᾤ',
  43482. 'á¾­' => 'á¾¥',
  43483. 'ᾮ' => 'ᾦ',
  43484. 'ᾯ' => 'ᾧ',
  43485. 'Ᾰ' => 'ᾰ',
  43486. 'á¾¹' => 'á¾±',
  43487. 'Ὰ' => 'ὰ',
  43488. 'á¾»' => 'á½±',
  43489. 'á¾¼' => 'á¾³',
  43490. 'Ὲ' => 'ὲ',
  43491. 'Έ' => 'έ',
  43492. 'á¿Š' => 'á½´',
  43493. 'á¿‹' => 'á½µ',
  43494. 'ῌ' => 'ῃ',
  43495. 'Ῐ' => '�',
  43496. 'á¿™' => 'á¿‘',
  43497. 'Ὶ' => 'ὶ',
  43498. 'á¿›' => 'á½·',
  43499. 'Ῠ' => 'ῠ',
  43500. 'á¿©' => 'á¿¡',
  43501. 'Ὺ' => 'ὺ',
  43502. 'á¿«' => 'á½»',
  43503. 'Ῥ' => 'ῥ',
  43504. 'Ὸ' => 'ὸ',
  43505. 'Ό' => 'ό',
  43506. 'Ὼ' => 'ὼ',
  43507. 'á¿»' => 'á½½',
  43508. 'ῼ' => 'ῳ',
  43509. 'Ω' => 'ω',
  43510. 'K' => 'k',
  43511. 'â„«' => 'Ã¥',
  43512. 'Ⅎ' => 'ⅎ',
  43513. 'â… ' => 'â…°',
  43514. 'â…¡' => 'â…±',
  43515. 'â…¢' => 'â…²',
  43516. 'â…£' => 'â…³',
  43517. 'â…¤' => 'â…´',
  43518. 'â…¥' => 'â…µ',
  43519. 'â…¦' => 'â…¶',
  43520. 'â…§' => 'â…·',
  43521. 'â…¨' => 'â…¸',
  43522. 'â…©' => 'â…¹',
  43523. 'â…ª' => 'â…º',
  43524. 'â…«' => 'â…»',
  43525. 'â…¬' => 'â…¼',
  43526. 'â…­' => 'â…½',
  43527. 'â…®' => 'â…¾',
  43528. 'â…¯' => 'â…¿',
  43529. 'Ↄ' => 'ↄ',
  43530. 'Ⓐ' => '�',
  43531. 'â’·' => 'â“‘',
  43532. 'â’¸' => 'â“’',
  43533. 'â’¹' => 'â““',
  43534. 'â’º' => 'â“”',
  43535. 'â’»' => 'â“•',
  43536. 'â’¼' => 'â“–',
  43537. 'â’½' => 'â“—',
  43538. 'Ⓘ' => 'ⓘ',
  43539. 'â’¿' => 'â“™',
  43540. 'â“€' => 'â“š',
  43541. '�' => 'ⓛ',
  43542. 'Ⓜ' => 'ⓜ',
  43543. 'Ⓝ' => '�',
  43544. 'â“„' => 'â“ž',
  43545. 'â“…' => 'â“Ÿ',
  43546. 'Ⓠ' => 'ⓠ',
  43547. 'Ⓡ' => 'ⓡ',
  43548. 'Ⓢ' => 'ⓢ',
  43549. 'Ⓣ' => 'ⓣ',
  43550. 'Ⓤ' => 'ⓤ',
  43551. 'â“‹' => 'â“¥',
  43552. 'Ⓦ' => 'ⓦ',
  43553. '�' => 'ⓧ',
  43554. 'Ⓨ' => 'ⓨ',
  43555. '�' => 'ⓩ',
  43556. 'â°€' => 'â°°',
  43557. 'â°�' => 'â°±',
  43558. 'â°‚' => 'â°²',
  43559. 'â°ƒ' => 'â°³',
  43560. 'â°„' => 'â°´',
  43561. 'â°…' => 'â°µ',
  43562. 'â°†' => 'â°¶',
  43563. 'â°‡' => 'â°·',
  43564. 'â°ˆ' => 'â°¸',
  43565. 'â°‰' => 'â°¹',
  43566. 'â°Š' => 'â°º',
  43567. 'â°‹' => 'â°»',
  43568. 'Ⰼ' => 'ⰼ',
  43569. 'â°�' => 'â°½',
  43570. 'â°Ž' => 'â°¾',
  43571. 'â°�' => 'â°¿',
  43572. 'â°�' => 'â±€',
  43573. 'Ⱁ' => '�',
  43574. 'Ⱂ' => 'ⱂ',
  43575. 'Ⱃ' => 'ⱃ',
  43576. 'Ⱄ' => 'ⱄ',
  43577. 'â°•' => 'â±…',
  43578. 'Ⱆ' => 'ⱆ',
  43579. 'Ⱇ' => 'ⱇ',
  43580. 'Ⱈ' => 'ⱈ',
  43581. 'Ⱉ' => 'ⱉ',
  43582. 'Ⱊ' => 'ⱊ',
  43583. 'Ⱋ' => 'ⱋ',
  43584. 'Ⱌ' => 'ⱌ',
  43585. '�' => '�',
  43586. 'Ⱎ' => 'ⱎ',
  43587. 'Ⱏ' => '�',
  43588. 'Ⱐ' => '�',
  43589. 'Ⱑ' => 'ⱑ',
  43590. 'â°¢' => 'â±’',
  43591. 'Ⱓ' => 'ⱓ',
  43592. 'â°¤' => 'â±”',
  43593. 'Ⱕ' => 'ⱕ',
  43594. 'â°¦' => 'â±–',
  43595. 'â°§' => 'â±—',
  43596. 'Ⱘ' => 'ⱘ',
  43597. 'â°©' => 'â±™',
  43598. 'Ⱚ' => 'ⱚ',
  43599. 'â°«' => 'â±›',
  43600. 'Ⱜ' => 'ⱜ',
  43601. 'Ⱝ' => '�',
  43602. 'Ⱞ' => 'ⱞ',
  43603. 'Ⱡ' => 'ⱡ',
  43604. 'â±¢' => 'É«',
  43605. 'â±£' => 'áµ½',
  43606. 'Ɽ' => 'ɽ',
  43607. 'Ⱨ' => 'ⱨ',
  43608. 'Ⱪ' => 'ⱪ',
  43609. 'Ⱬ' => 'ⱬ',
  43610. 'â±­' => 'É‘',
  43611. 'Ɱ' => 'ɱ',
  43612. 'Ɐ' => '�',
  43613. 'â±°' => 'É’',
  43614. 'â±²' => 'â±³',
  43615. 'Ⱶ' => 'ⱶ',
  43616. 'â±¾' => 'È¿',
  43617. 'Ɀ' => 'ɀ',
  43618. 'Ⲁ' => '�',
  43619. 'Ⲃ' => 'ⲃ',
  43620. 'Ⲅ' => 'ⲅ',
  43621. 'Ⲇ' => 'ⲇ',
  43622. 'Ⲉ' => 'ⲉ',
  43623. 'Ⲋ' => 'ⲋ',
  43624. 'Ⲍ' => '�',
  43625. 'Ⲏ' => '�',
  43626. '�' => 'ⲑ',
  43627. 'Ⲓ' => 'ⲓ',
  43628. 'Ⲕ' => 'ⲕ',
  43629. 'â²–' => 'â²—',
  43630. 'Ⲙ' => 'ⲙ',
  43631. 'Ⲛ' => 'ⲛ',
  43632. 'Ⲝ' => '�',
  43633. 'Ⲟ' => 'ⲟ',
  43634. 'Ⲡ' => 'ⲡ',
  43635. 'â²¢' => 'â²£',
  43636. 'Ⲥ' => 'ⲥ',
  43637. 'Ⲧ' => 'ⲧ',
  43638. 'Ⲩ' => 'ⲩ',
  43639. 'Ⲫ' => 'ⲫ',
  43640. 'Ⲭ' => 'ⲭ',
  43641. 'Ⲯ' => 'ⲯ',
  43642. 'â²°' => 'â²±',
  43643. 'â²²' => 'â²³',
  43644. 'â²´' => 'â²µ',
  43645. 'Ⲷ' => 'ⲷ',
  43646. 'Ⲹ' => 'ⲹ',
  43647. 'Ⲻ' => 'ⲻ',
  43648. 'â²¼' => 'â²½',
  43649. 'Ⲿ' => 'ⲿ',
  43650. 'Ⳁ' => '�',
  43651. 'Ⳃ' => 'ⳃ',
  43652. 'Ⳅ' => 'ⳅ',
  43653. 'Ⳇ' => 'ⳇ',
  43654. 'Ⳉ' => 'ⳉ',
  43655. 'Ⳋ' => 'ⳋ',
  43656. 'Ⳍ' => '�',
  43657. 'Ⳏ' => '�',
  43658. '�' => 'ⳑ',
  43659. 'Ⳓ' => 'ⳓ',
  43660. 'Ⳕ' => 'ⳕ',
  43661. 'â³–' => 'â³—',
  43662. 'Ⳙ' => 'ⳙ',
  43663. 'Ⳛ' => 'ⳛ',
  43664. 'Ⳝ' => '�',
  43665. 'Ⳟ' => 'ⳟ',
  43666. 'Ⳡ' => 'ⳡ',
  43667. 'â³¢' => 'â³£',
  43668. 'Ⳬ' => 'ⳬ',
  43669. 'â³­' => 'â³®',
  43670. 'â³²' => 'â³³',
  43671. 'Ꙁ' => '�',
  43672. 'Ꙃ' => 'ꙃ',
  43673. 'Ꙅ' => 'ꙅ',
  43674. 'Ꙇ' => 'ꙇ',
  43675. 'Ꙉ' => 'ꙉ',
  43676. 'Ꙋ' => 'ꙋ',
  43677. 'Ꙍ' => '�',
  43678. 'Ꙏ' => '�',
  43679. '�' => 'ꙑ',
  43680. 'Ꙓ' => 'ꙓ',
  43681. 'Ꙕ' => 'ꙕ',
  43682. 'ê™–' => 'ê™—',
  43683. 'Ꙙ' => 'ꙙ',
  43684. 'Ꙛ' => 'ꙛ',
  43685. 'Ꙝ' => '�',
  43686. 'Ꙟ' => 'ꙟ',
  43687. 'Ꙡ' => 'ꙡ',
  43688. 'Ꙣ' => 'ꙣ',
  43689. 'Ꙥ' => 'ꙥ',
  43690. 'Ꙧ' => 'ꙧ',
  43691. 'Ꙩ' => 'ꙩ',
  43692. 'Ꙫ' => 'ꙫ',
  43693. 'Ꙭ' => 'ꙭ',
  43694. 'Ꚁ' => '�',
  43695. 'Ꚃ' => 'ꚃ',
  43696. 'êš„' => 'êš…',
  43697. 'Ꚇ' => 'ꚇ',
  43698. 'Ꚉ' => 'ꚉ',
  43699. 'Ꚋ' => 'ꚋ',
  43700. 'Ꚍ' => '�',
  43701. 'Ꚏ' => '�',
  43702. '�' => 'ꚑ',
  43703. 'êš’' => 'êš“',
  43704. 'êš”' => 'êš•',
  43705. 'êš–' => 'êš—',
  43706. 'Ꚙ' => 'ꚙ',
  43707. 'êšš' => 'êš›',
  43708. 'Ꜣ' => 'ꜣ',
  43709. 'Ꜥ' => 'ꜥ',
  43710. 'Ꜧ' => 'ꜧ',
  43711. 'Ꜩ' => 'ꜩ',
  43712. 'Ꜫ' => 'ꜫ',
  43713. 'Ꜭ' => 'ꜭ',
  43714. 'Ꜯ' => 'ꜯ',
  43715. 'Ꜳ' => 'ꜳ',
  43716. 'Ꜵ' => 'ꜵ',
  43717. 'Ꜷ' => 'ꜷ',
  43718. 'Ꜹ' => 'ꜹ',
  43719. 'Ꜻ' => 'ꜻ',
  43720. 'Ꜽ' => 'ꜽ',
  43721. 'Ꜿ' => 'ꜿ',
  43722. '�' => '�',
  43723. '�' => '�',
  43724. '�' => '�',
  43725. '�' => '�',
  43726. '�' => '�',
  43727. '�' => '�',
  43728. '�' => '�',
  43729. '�' => '�',
  43730. '�' => '�',
  43731. '�' => '�',
  43732. '�' => '�',
  43733. '�' => '�',
  43734. '�' => '�',
  43735. '�' => '�',
  43736. '�' => '�',
  43737. '�' => '�',
  43738. '�' => '�',
  43739. '�' => '�',
  43740. '�' => '�',
  43741. '�' => '�',
  43742. '�' => '�',
  43743. '�' => '�',
  43744. '�' => '�',
  43745. '�' => '�',
  43746. '�' => '�',
  43747. '�' => '�',
  43748. '�' => 'ᵹ',
  43749. '�' => '�',
  43750. 'Ꞁ' => '�',
  43751. 'Ꞃ' => 'ꞃ',
  43752. 'êž„' => 'êž…',
  43753. 'Ꞇ' => 'ꞇ',
  43754. 'Ꞌ' => 'ꞌ',
  43755. '�' => 'ɥ',
  43756. '�' => 'ꞑ',
  43757. 'êž’' => 'êž“',
  43758. 'êž–' => 'êž—',
  43759. 'Ꞙ' => 'ꞙ',
  43760. 'êžš' => 'êž›',
  43761. 'Ꞝ' => '�',
  43762. 'Ꞟ' => 'ꞟ',
  43763. 'êž ' => 'êž¡',
  43764. 'Ꞣ' => 'ꞣ',
  43765. 'Ꞥ' => 'ꞥ',
  43766. 'Ꞧ' => 'ꞧ',
  43767. 'Ꞩ' => 'ꞩ',
  43768. 'Ɦ' => 'ɦ',
  43769. 'Ɜ' => 'ɜ',
  43770. 'Ɡ' => 'ɡ',
  43771. 'Ɬ' => 'ɬ',
  43772. 'êž°' => 'Êž',
  43773. 'Ʇ' => 'ʇ',
  43774. 'A' => '�',
  43775. 'B' => 'b',
  43776. 'C' => 'c',
  43777. 'D' => 'd',
  43778. 'ï¼¥' => 'ï½…',
  43779. 'F' => 'f',
  43780. 'G' => 'g',
  43781. 'H' => 'h',
  43782. 'I' => 'i',
  43783. 'J' => 'j',
  43784. 'K' => 'k',
  43785. 'L' => 'l',
  43786. 'M' => '�',
  43787. 'N' => 'n',
  43788. 'O' => '�',
  43789. 'P' => '�',
  43790. 'Q' => 'q',
  43791. 'ï¼²' => 'ï½’',
  43792. 'S' => 's',
  43793. 'ï¼´' => 'ï½”',
  43794. 'U' => 'u',
  43795. 'V' => 'v',
  43796. 'ï¼·' => 'ï½—',
  43797. 'X' => 'x',
  43798. 'ï¼¹' => 'ï½™',
  43799. 'Z' => 'z',
  43800. '�' => '�',
  43801. '�' => '�',
  43802. '�' => '�',
  43803. '�' => '�',
  43804. '�' => '�',
  43805. '�' => '�',
  43806. '�' => '�',
  43807. '�' => '�',
  43808. '�' => '�',
  43809. '�' => '�',
  43810. '�' => '�',
  43811. '�' => '�',
  43812. '�' => '�',
  43813. '�' => '�',
  43814. '�' => '�',
  43815. '�' => '�',
  43816. '�' => '�',
  43817. '�' => '�',
  43818. '�' => '�',
  43819. '�' => '�',
  43820. '�' => '�',
  43821. '�' => '�',
  43822. '�' => '�',
  43823. '�' => '�',
  43824. '�' => '�',
  43825. '�' => '�',
  43826. '�' => '�',
  43827. '�' => '�',
  43828. '�' => '�',
  43829. '�' => '�',
  43830. '�' => '�',
  43831. '�' => '�',
  43832. '�' => '�',
  43833. '�' => '�',
  43834. '�' => '�',
  43835. '�' => '�',
  43836. '�' => '�',
  43837. '�' => '�',
  43838. '�' => '�',
  43839. '�' => '�',
  43840. 'ð‘¢ ' => 'ð‘£€',
  43841. '𑢡' => '�',
  43842. '𑢢' => '𑣂',
  43843. '𑢣' => '𑣃',
  43844. '𑢤' => '𑣄',
  43845. 'ð‘¢¥' => 'ð‘£…',
  43846. '𑢦' => '𑣆',
  43847. '𑢧' => '𑣇',
  43848. '𑢨' => '𑣈',
  43849. '𑢩' => '𑣉',
  43850. '𑢪' => '𑣊',
  43851. '𑢫' => '𑣋',
  43852. '𑢬' => '𑣌',
  43853. '𑢭' => '�',
  43854. '𑢮' => '𑣎',
  43855. '𑢯' => '�',
  43856. '𑢰' => '�',
  43857. '𑢱' => '𑣑',
  43858. 'ð‘¢²' => 'ð‘£’',
  43859. '𑢳' => '𑣓',
  43860. 'ð‘¢´' => 'ð‘£”',
  43861. '𑢵' => '𑣕',
  43862. '𑢶' => '𑣖',
  43863. 'ð‘¢·' => 'ð‘£—',
  43864. '𑢸' => '𑣘',
  43865. 'ð‘¢¹' => 'ð‘£™',
  43866. '𑢺' => '𑣚',
  43867. 'ð‘¢»' => 'ð‘£›',
  43868. '𑢼' => '𑣜',
  43869. '𑢽' => '�',
  43870. '𑢾' => '𑣞',
  43871. '𑢿' => '𑣟',
  43872. );
  43873. $result =& $data;
  43874. unset($data);
  43875. return $result;
  43876. <?php
  43877. static $data = array (
  43878. 'a' => 'A',
  43879. 'b' => 'B',
  43880. 'c' => 'C',
  43881. 'd' => 'D',
  43882. 'e' => 'E',
  43883. 'f' => 'F',
  43884. 'g' => 'G',
  43885. 'h' => 'H',
  43886. 'i' => 'I',
  43887. 'j' => 'J',
  43888. 'k' => 'K',
  43889. 'l' => 'L',
  43890. 'm' => 'M',
  43891. 'n' => 'N',
  43892. 'o' => 'O',
  43893. 'p' => 'P',
  43894. 'q' => 'Q',
  43895. 'r' => 'R',
  43896. 's' => 'S',
  43897. 't' => 'T',
  43898. 'u' => 'U',
  43899. 'v' => 'V',
  43900. 'w' => 'W',
  43901. 'x' => 'X',
  43902. 'y' => 'Y',
  43903. 'z' => 'Z',
  43904. 'µ' => 'Μ',
  43905. 'à' => 'À',
  43906. 'á' => '�',
  43907. 'â' => 'Â',
  43908. 'ã' => 'Ã',
  43909. 'ä' => 'Ä',
  43910. 'Ã¥' => 'Ã…',
  43911. 'æ' => 'Æ',
  43912. 'ç' => 'Ç',
  43913. 'è' => 'È',
  43914. 'é' => 'É',
  43915. 'ê' => 'Ê',
  43916. 'ë' => 'Ë',
  43917. 'ì' => 'Ì',
  43918. 'í' => '�',
  43919. 'î' => 'Î',
  43920. 'ï' => '�',
  43921. 'ð' => '�',
  43922. 'ñ' => 'Ñ',
  43923. 'ò' => 'Ò',
  43924. 'ó' => 'Ó',
  43925. 'ô' => 'Ô',
  43926. 'õ' => 'Õ',
  43927. 'ö' => 'Ö',
  43928. 'ø' => 'Ø',
  43929. 'ù' => 'Ù',
  43930. 'ú' => 'Ú',
  43931. 'û' => 'Û',
  43932. 'ü' => 'Ü',
  43933. 'ý' => '�',
  43934. 'þ' => 'Þ',
  43935. 'ÿ' => 'Ÿ',
  43936. '�' => 'Ā',
  43937. 'ă' => 'Ă',
  43938. 'Ä…' => 'Ä„',
  43939. 'ć' => 'Ć',
  43940. 'ĉ' => 'Ĉ',
  43941. 'Ä‹' => 'ÄŠ',
  43942. '�' => 'Č',
  43943. '�' => 'Ď',
  43944. 'đ' => '�',
  43945. 'Ä“' => 'Ä’',
  43946. 'Ä•' => 'Ä”',
  43947. 'Ä—' => 'Ä–',
  43948. 'ę' => 'Ę',
  43949. 'Ä›' => 'Äš',
  43950. '�' => 'Ĝ',
  43951. 'ÄŸ' => 'Äž',
  43952. 'Ä¡' => 'Ä ',
  43953. 'Ä£' => 'Ä¢',
  43954. 'ĥ' => 'Ĥ',
  43955. 'ħ' => 'Ħ',
  43956. 'ĩ' => 'Ĩ',
  43957. 'ī' => 'Ī',
  43958. 'ĭ' => 'Ĭ',
  43959. 'į' => 'Į',
  43960. 'ı' => 'I',
  43961. 'ij' => 'IJ',
  43962. 'ĵ' => 'Ĵ',
  43963. 'ķ' => 'Ķ',
  43964. 'ĺ' => 'Ĺ',
  43965. 'ļ' => 'Ļ',
  43966. 'ľ' => 'Ľ',
  43967. 'Å€' => 'Ä¿',
  43968. 'ł' => '�',
  43969. 'ń' => 'Ń',
  43970. 'ņ' => 'Ņ',
  43971. 'ň' => 'Ň',
  43972. 'Å‹' => 'ÅŠ',
  43973. '�' => 'Ō',
  43974. '�' => 'Ŏ',
  43975. 'ő' => '�',
  43976. 'Å“' => 'Å’',
  43977. 'Å•' => 'Å”',
  43978. 'Å—' => 'Å–',
  43979. 'ř' => 'Ř',
  43980. 'Å›' => 'Åš',
  43981. '�' => 'Ŝ',
  43982. 'ÅŸ' => 'Åž',
  43983. 'Å¡' => 'Å ',
  43984. 'Å£' => 'Å¢',
  43985. 'ť' => 'Ť',
  43986. 'ŧ' => 'Ŧ',
  43987. 'ũ' => 'Ũ',
  43988. 'ū' => 'Ū',
  43989. 'ŭ' => 'Ŭ',
  43990. 'ů' => 'Ů',
  43991. 'ű' => 'Ű',
  43992. 'ų' => 'Ų',
  43993. 'ŵ' => 'Ŵ',
  43994. 'ŷ' => 'Ŷ',
  43995. 'ź' => 'Ź',
  43996. 'ż' => 'Ż',
  43997. 'ž' => 'Ž',
  43998. 'Å¿' => 'S',
  43999. 'ƀ' => 'Ƀ',
  44000. 'ƃ' => 'Ƃ',
  44001. 'Æ…' => 'Æ„',
  44002. 'ƈ' => 'Ƈ',
  44003. 'ƌ' => 'Ƌ',
  44004. 'Æ’' => 'Æ‘',
  44005. 'ƕ' => 'Ƕ',
  44006. 'ƙ' => 'Ƙ',
  44007. 'ƚ' => 'Ƚ',
  44008. 'Æž' => 'È ',
  44009. 'Æ¡' => 'Æ ',
  44010. 'Æ£' => 'Æ¢',
  44011. 'ƥ' => 'Ƥ',
  44012. 'ƨ' => 'Ƨ',
  44013. 'ƭ' => 'Ƭ',
  44014. 'ư' => 'Ư',
  44015. 'ƴ' => 'Ƴ',
  44016. 'ƶ' => 'Ƶ',
  44017. 'ƹ' => 'Ƹ',
  44018. 'ƽ' => 'Ƽ',
  44019. 'Æ¿' => 'Ç·',
  44020. 'Ç…' => 'Ç„',
  44021. 'dž' => 'DŽ',
  44022. 'Lj' => 'LJ',
  44023. 'lj' => 'LJ',
  44024. 'Ç‹' => 'ÇŠ',
  44025. 'nj' => 'NJ',
  44026. 'ǎ' => '�',
  44027. '�' => '�',
  44028. 'Ç’' => 'Ç‘',
  44029. 'Ç”' => 'Ç“',
  44030. 'Ç–' => 'Ç•',
  44031. 'ǘ' => 'Ǘ',
  44032. 'Çš' => 'Ç™',
  44033. 'ǜ' => 'Ǜ',
  44034. '�' => 'Ǝ',
  44035. 'ÇŸ' => 'Çž',
  44036. 'Ç¡' => 'Ç ',
  44037. 'Ç£' => 'Ç¢',
  44038. 'ǥ' => 'Ǥ',
  44039. 'ǧ' => 'Ǧ',
  44040. 'ǩ' => 'Ǩ',
  44041. 'ǫ' => 'Ǫ',
  44042. 'ǭ' => 'Ǭ',
  44043. 'ǯ' => 'Ǯ',
  44044. 'Dz' => 'DZ',
  44045. 'dz' => 'DZ',
  44046. 'ǵ' => 'Ǵ',
  44047. 'ǹ' => 'Ǹ',
  44048. 'ǻ' => 'Ǻ',
  44049. 'ǽ' => 'Ǽ',
  44050. 'ǿ' => 'Ǿ',
  44051. '�' => 'Ȁ',
  44052. 'ȃ' => 'Ȃ',
  44053. 'È…' => 'È„',
  44054. 'ȇ' => 'Ȇ',
  44055. 'ȉ' => 'Ȉ',
  44056. 'È‹' => 'ÈŠ',
  44057. '�' => 'Ȍ',
  44058. '�' => 'Ȏ',
  44059. 'ȑ' => '�',
  44060. 'È“' => 'È’',
  44061. 'È•' => 'È”',
  44062. 'È—' => 'È–',
  44063. 'ș' => 'Ș',
  44064. 'È›' => 'Èš',
  44065. '�' => 'Ȝ',
  44066. 'ÈŸ' => 'Èž',
  44067. 'È£' => 'È¢',
  44068. 'ȥ' => 'Ȥ',
  44069. 'ȧ' => 'Ȧ',
  44070. 'ȩ' => 'Ȩ',
  44071. 'ȫ' => 'Ȫ',
  44072. 'ȭ' => 'Ȭ',
  44073. 'ȯ' => 'Ȯ',
  44074. 'ȱ' => 'Ȱ',
  44075. 'ȳ' => 'Ȳ',
  44076. 'ȼ' => 'Ȼ',
  44077. 'È¿' => 'â±¾',
  44078. 'ɀ' => 'Ɀ',
  44079. 'ɂ' => '�',
  44080. 'ɇ' => 'Ɇ',
  44081. 'ɉ' => 'Ɉ',
  44082. 'É‹' => 'ÉŠ',
  44083. '�' => 'Ɍ',
  44084. '�' => 'Ɏ',
  44085. '�' => 'Ɐ',
  44086. 'É‘' => 'â±­',
  44087. 'É’' => 'â±°',
  44088. 'ɓ' => '�',
  44089. 'ɔ' => 'Ɔ',
  44090. 'ɖ' => 'Ɖ',
  44091. 'É—' => 'ÆŠ',
  44092. 'ə' => '�',
  44093. 'ɛ' => '�',
  44094. 'ɜ' => 'Ɜ',
  44095. 'É ' => 'Æ“',
  44096. 'ɡ' => 'Ɡ',
  44097. 'É£' => 'Æ”',
  44098. 'ɥ' => '�',
  44099. 'ɦ' => 'Ɦ',
  44100. 'ɨ' => 'Ɨ',
  44101. 'É©' => 'Æ–',
  44102. 'É«' => 'â±¢',
  44103. 'ɬ' => 'Ɬ',
  44104. 'ɯ' => 'Ɯ',
  44105. 'ɱ' => 'Ɱ',
  44106. 'ɲ' => '�',
  44107. 'ɵ' => 'Ɵ',
  44108. 'ɽ' => 'Ɽ',
  44109. 'ʀ' => 'Ʀ',
  44110. 'ʃ' => 'Ʃ',
  44111. 'ʇ' => 'Ʇ',
  44112. 'ʈ' => 'Ʈ',
  44113. 'ʉ' => 'Ʉ',
  44114. 'ʊ' => 'Ʊ',
  44115. 'ʋ' => 'Ʋ',
  44116. 'ʌ' => 'Ʌ',
  44117. 'Ê’' => 'Æ·',
  44118. 'Êž' => 'êž°',
  44119. 'ͅ' => 'Ι',
  44120. 'ͱ' => 'Ͱ',
  44121. 'ͳ' => 'Ͳ',
  44122. 'ͷ' => 'Ͷ',
  44123. 'ͻ' => 'Ͻ',
  44124. 'ͼ' => 'Ͼ',
  44125. 'ͽ' => 'Ͽ',
  44126. 'ά' => 'Ά',
  44127. 'έ' => 'Έ',
  44128. 'ή' => 'Ή',
  44129. 'ί' => 'Ί',
  44130. 'α' => 'Α',
  44131. 'β' => 'Β',
  44132. 'γ' => 'Γ',
  44133. 'δ' => 'Δ',
  44134. 'ε' => 'Ε',
  44135. 'ζ' => 'Ζ',
  44136. 'η' => 'Η',
  44137. 'θ' => 'Θ',
  44138. 'ι' => 'Ι',
  44139. 'κ' => 'Κ',
  44140. 'λ' => 'Λ',
  44141. 'μ' => 'Μ',
  44142. 'ν' => '�',
  44143. 'ξ' => 'Ξ',
  44144. 'ο' => 'Ο',
  44145. 'π' => 'Π',
  44146. '�' => 'Ρ',
  44147. 'ς' => 'Σ',
  44148. 'σ' => 'Σ',
  44149. 'τ' => 'Τ',
  44150. 'Ï…' => 'Î¥',
  44151. 'φ' => 'Φ',
  44152. 'χ' => 'Χ',
  44153. 'ψ' => 'Ψ',
  44154. 'ω' => 'Ω',
  44155. 'ϊ' => 'Ϊ',
  44156. 'ϋ' => 'Ϋ',
  44157. 'ό' => 'Ό',
  44158. '�' => 'Ύ',
  44159. 'ώ' => '�',
  44160. '�' => 'Β',
  44161. 'ϑ' => 'Θ',
  44162. 'ϕ' => 'Φ',
  44163. 'ϖ' => 'Π',
  44164. 'ϗ' => '�',
  44165. 'ϙ' => 'Ϙ',
  44166. 'Ï›' => 'Ïš',
  44167. '�' => 'Ϝ',
  44168. 'ÏŸ' => 'Ïž',
  44169. 'Ï¡' => 'Ï ',
  44170. 'Ï£' => 'Ï¢',
  44171. 'ϥ' => 'Ϥ',
  44172. 'ϧ' => 'Ϧ',
  44173. 'ϩ' => 'Ϩ',
  44174. 'ϫ' => 'Ϫ',
  44175. 'ϭ' => 'Ϭ',
  44176. 'ϯ' => 'Ϯ',
  44177. 'ϰ' => 'Κ',
  44178. 'ϱ' => 'Ρ',
  44179. 'ϲ' => 'Ϲ',
  44180. 'ϳ' => 'Ϳ',
  44181. 'ϵ' => 'Ε',
  44182. 'ϸ' => 'Ϸ',
  44183. 'ϻ' => 'Ϻ',
  44184. 'а' => '�',
  44185. 'б' => 'Б',
  44186. 'в' => 'В',
  44187. 'г' => 'Г',
  44188. 'д' => 'Д',
  44189. 'е' => 'Е',
  44190. 'ж' => 'Ж',
  44191. 'з' => 'З',
  44192. 'и' => 'И',
  44193. 'й' => 'Й',
  44194. 'к' => 'К',
  44195. 'л' => 'Л',
  44196. 'м' => 'М',
  44197. 'н' => '�',
  44198. 'о' => 'О',
  44199. 'п' => 'П',
  44200. 'р' => 'Р',
  44201. '�' => 'С',
  44202. 'т' => 'Т',
  44203. 'у' => 'У',
  44204. 'ф' => 'Ф',
  44205. 'Ñ…' => 'Ð¥',
  44206. 'ц' => 'Ц',
  44207. 'ч' => 'Ч',
  44208. 'ш' => 'Ш',
  44209. 'щ' => 'Щ',
  44210. 'ъ' => 'Ъ',
  44211. 'ы' => 'Ы',
  44212. 'ь' => 'Ь',
  44213. '�' => 'Э',
  44214. 'ю' => 'Ю',
  44215. '�' => 'Я',
  44216. '�' => 'Ѐ',
  44217. 'ё' => '�',
  44218. 'ђ' => 'Ђ',
  44219. 'ѓ' => 'Ѓ',
  44220. 'є' => 'Є',
  44221. 'Ñ•' => 'Ð…',
  44222. 'і' => 'І',
  44223. 'ї' => 'Ї',
  44224. 'ј' => 'Ј',
  44225. 'љ' => 'Љ',
  44226. 'њ' => 'Њ',
  44227. 'ћ' => 'Ћ',
  44228. 'ќ' => 'Ќ',
  44229. '�' => '�',
  44230. 'Ñž' => 'ÐŽ',
  44231. 'џ' => '�',
  44232. 'Ñ¡' => 'Ñ ',
  44233. 'Ñ£' => 'Ñ¢',
  44234. 'ѥ' => 'Ѥ',
  44235. 'ѧ' => 'Ѧ',
  44236. 'ѩ' => 'Ѩ',
  44237. 'ѫ' => 'Ѫ',
  44238. 'ѭ' => 'Ѭ',
  44239. 'ѯ' => 'Ѯ',
  44240. 'ѱ' => 'Ѱ',
  44241. 'ѳ' => 'Ѳ',
  44242. 'ѵ' => 'Ѵ',
  44243. 'ѷ' => 'Ѷ',
  44244. 'ѹ' => 'Ѹ',
  44245. 'ѻ' => 'Ѻ',
  44246. 'ѽ' => 'Ѽ',
  44247. 'ѿ' => 'Ѿ',
  44248. 'Ò�' => 'Ò€',
  44249. 'Ò‹' => 'ÒŠ',
  44250. '�' => 'Ҍ',
  44251. 'Ò�' => 'ÒŽ',
  44252. 'Ò‘' => 'Ò�',
  44253. 'Ò“' => 'Ò’',
  44254. 'Ò•' => 'Ò”',
  44255. 'Ò—' => 'Ò–',
  44256. 'Ò™' => 'Ò˜',
  44257. 'Ò›' => 'Òš',
  44258. '�' => 'Ҝ',
  44259. 'ÒŸ' => 'Òž',
  44260. 'Ò¡' => 'Ò ',
  44261. 'Ò£' => 'Ò¢',
  44262. 'Ò¥' => 'Ò¤',
  44263. 'Ò§' => 'Ò¦',
  44264. 'Ò©' => 'Ò¨',
  44265. 'Ò«' => 'Òª',
  44266. 'Ò­' => 'Ò¬',
  44267. 'Ò¯' => 'Ò®',
  44268. 'Ò±' => 'Ò°',
  44269. 'Ò³' => 'Ò²',
  44270. 'Òµ' => 'Ò´',
  44271. 'Ò·' => 'Ò¶',
  44272. 'Ò¹' => 'Ò¸',
  44273. 'Ò»' => 'Òº',
  44274. 'Ò½' => 'Ò¼',
  44275. 'Ò¿' => 'Ò¾',
  44276. 'Ó‚' => 'Ó�',
  44277. 'Ó„' => 'Óƒ',
  44278. 'Ó†' => 'Ó…',
  44279. 'Óˆ' => 'Ó‡',
  44280. 'ÓŠ' => 'Ó‰',
  44281. 'ӌ' => 'Ӌ',
  44282. 'ÓŽ' => 'Ó�',
  44283. 'Ó�' => 'Ó€',
  44284. 'Ó‘' => 'Ó�',
  44285. 'Ó“' => 'Ó’',
  44286. 'Ó•' => 'Ó”',
  44287. 'Ó—' => 'Ó–',
  44288. 'Ó™' => 'Ó˜',
  44289. 'Ó›' => 'Óš',
  44290. '�' => 'Ӝ',
  44291. 'ÓŸ' => 'Óž',
  44292. 'Ó¡' => 'Ó ',
  44293. 'Ó£' => 'Ó¢',
  44294. 'Ó¥' => 'Ó¤',
  44295. 'Ó§' => 'Ó¦',
  44296. 'Ó©' => 'Ó¨',
  44297. 'Ó«' => 'Óª',
  44298. 'Ó­' => 'Ó¬',
  44299. 'Ó¯' => 'Ó®',
  44300. 'Ó±' => 'Ó°',
  44301. 'Ó³' => 'Ó²',
  44302. 'Óµ' => 'Ó´',
  44303. 'Ó·' => 'Ó¶',
  44304. 'Ó¹' => 'Ó¸',
  44305. 'Ó»' => 'Óº',
  44306. 'Ó½' => 'Ó¼',
  44307. 'Ó¿' => 'Ó¾',
  44308. 'Ô�' => 'Ô€',
  44309. 'Ôƒ' => 'Ô‚',
  44310. 'Ô…' => 'Ô„',
  44311. 'Ô‡' => 'Ô†',
  44312. 'Ô‰' => 'Ôˆ',
  44313. 'Ô‹' => 'ÔŠ',
  44314. '�' => 'Ԍ',
  44315. 'Ô�' => 'ÔŽ',
  44316. 'Ô‘' => 'Ô�',
  44317. 'Ô“' => 'Ô’',
  44318. 'Ô•' => 'Ô”',
  44319. 'Ô—' => 'Ô–',
  44320. 'Ô™' => 'Ô˜',
  44321. 'Ô›' => 'Ôš',
  44322. '�' => 'Ԝ',
  44323. 'ÔŸ' => 'Ôž',
  44324. 'Ô¡' => 'Ô ',
  44325. 'Ô£' => 'Ô¢',
  44326. 'Ô¥' => 'Ô¤',
  44327. 'Ô§' => 'Ô¦',
  44328. 'Ô©' => 'Ô¨',
  44329. 'Ô«' => 'Ôª',
  44330. 'Ô­' => 'Ô¬',
  44331. 'Ô¯' => 'Ô®',
  44332. 'Õ¡' => 'Ô±',
  44333. 'Õ¢' => 'Ô²',
  44334. 'Õ£' => 'Ô³',
  44335. 'Õ¤' => 'Ô´',
  44336. 'Õ¥' => 'Ôµ',
  44337. 'Õ¦' => 'Ô¶',
  44338. 'Õ§' => 'Ô·',
  44339. 'Õ¨' => 'Ô¸',
  44340. 'Õ©' => 'Ô¹',
  44341. 'Õª' => 'Ôº',
  44342. 'Õ«' => 'Ô»',
  44343. 'Õ¬' => 'Ô¼',
  44344. 'Õ­' => 'Ô½',
  44345. 'Õ®' => 'Ô¾',
  44346. 'Õ¯' => 'Ô¿',
  44347. 'Õ°' => 'Õ€',
  44348. 'Õ±' => 'Õ�',
  44349. 'Õ²' => 'Õ‚',
  44350. 'Õ³' => 'Õƒ',
  44351. 'Õ´' => 'Õ„',
  44352. 'Õµ' => 'Õ…',
  44353. 'Õ¶' => 'Õ†',
  44354. 'Õ·' => 'Õ‡',
  44355. 'Õ¸' => 'Õˆ',
  44356. 'Õ¹' => 'Õ‰',
  44357. 'Õº' => 'ÕŠ',
  44358. 'Õ»' => 'Õ‹',
  44359. 'ռ' => 'Ռ',
  44360. 'Õ½' => 'Õ�',
  44361. 'Õ¾' => 'ÕŽ',
  44362. 'Õ¿' => 'Õ�',
  44363. 'Ö€' => 'Õ�',
  44364. 'Ö�' => 'Õ‘',
  44365. 'Ö‚' => 'Õ’',
  44366. 'Öƒ' => 'Õ“',
  44367. 'Ö„' => 'Õ”',
  44368. 'Ö…' => 'Õ•',
  44369. 'Ö†' => 'Õ–',
  44370. 'ᵹ' => '�',
  44371. 'áµ½' => 'â±£',
  44372. '�' => 'Ḁ',
  44373. 'ḃ' => 'Ḃ',
  44374. 'ḅ' => 'Ḅ',
  44375. 'ḇ' => 'Ḇ',
  44376. 'ḉ' => 'Ḉ',
  44377. 'ḋ' => 'Ḋ',
  44378. '�' => 'Ḍ',
  44379. '�' => 'Ḏ',
  44380. 'ḑ' => '�',
  44381. 'ḓ' => 'Ḓ',
  44382. 'ḕ' => 'Ḕ',
  44383. 'ḗ' => 'Ḗ',
  44384. 'ḙ' => 'Ḙ',
  44385. 'ḛ' => 'Ḛ',
  44386. '�' => 'Ḝ',
  44387. 'ḟ' => 'Ḟ',
  44388. 'ḡ' => 'Ḡ',
  44389. 'ḣ' => 'Ḣ',
  44390. 'ḥ' => 'Ḥ',
  44391. 'ḧ' => 'Ḧ',
  44392. 'ḩ' => 'Ḩ',
  44393. 'ḫ' => 'Ḫ',
  44394. 'ḭ' => 'Ḭ',
  44395. 'ḯ' => 'Ḯ',
  44396. 'ḱ' => 'Ḱ',
  44397. 'ḳ' => 'Ḳ',
  44398. 'ḵ' => 'Ḵ',
  44399. 'ḷ' => 'Ḷ',
  44400. 'ḹ' => 'Ḹ',
  44401. 'ḻ' => 'Ḻ',
  44402. 'ḽ' => 'Ḽ',
  44403. 'ḿ' => 'Ḿ',
  44404. '�' => 'Ṁ',
  44405. 'ṃ' => 'Ṃ',
  44406. 'ṅ' => 'Ṅ',
  44407. 'ṇ' => 'Ṇ',
  44408. 'ṉ' => 'Ṉ',
  44409. 'ṋ' => 'Ṋ',
  44410. '�' => 'Ṍ',
  44411. '�' => 'Ṏ',
  44412. 'ṑ' => '�',
  44413. 'ṓ' => 'Ṓ',
  44414. 'ṕ' => 'Ṕ',
  44415. 'á¹—' => 'á¹–',
  44416. 'ṙ' => 'Ṙ',
  44417. 'ṛ' => 'Ṛ',
  44418. '�' => 'Ṝ',
  44419. 'ṟ' => 'Ṟ',
  44420. 'ṡ' => 'Ṡ',
  44421. 'á¹£' => 'á¹¢',
  44422. 'ṥ' => 'Ṥ',
  44423. 'ṧ' => 'Ṧ',
  44424. 'ṩ' => 'Ṩ',
  44425. 'ṫ' => 'Ṫ',
  44426. 'ṭ' => 'Ṭ',
  44427. 'ṯ' => 'Ṯ',
  44428. 'á¹±' => 'á¹°',
  44429. 'á¹³' => 'á¹²',
  44430. 'á¹µ' => 'á¹´',
  44431. 'ṷ' => 'Ṷ',
  44432. 'ṹ' => 'Ṹ',
  44433. 'ṻ' => 'Ṻ',
  44434. 'á¹½' => 'á¹¼',
  44435. 'ṿ' => 'Ṿ',
  44436. '�' => 'Ẁ',
  44437. 'ẃ' => 'Ẃ',
  44438. 'ẅ' => 'Ẅ',
  44439. 'ẇ' => 'Ẇ',
  44440. 'ẉ' => 'Ẉ',
  44441. 'ẋ' => 'Ẋ',
  44442. '�' => 'Ẍ',
  44443. '�' => 'Ẏ',
  44444. 'ẑ' => '�',
  44445. 'ẓ' => 'Ẓ',
  44446. 'ẕ' => 'Ẕ',
  44447. 'ẛ' => 'Ṡ',
  44448. 'ạ' => 'Ạ',
  44449. 'ả' => 'Ả',
  44450. 'ấ' => 'Ấ',
  44451. 'ầ' => 'Ầ',
  44452. 'ẩ' => 'Ẩ',
  44453. 'ẫ' => 'Ẫ',
  44454. 'ậ' => 'Ậ',
  44455. 'ắ' => 'Ắ',
  44456. 'ằ' => 'Ằ',
  44457. 'ẳ' => 'Ẳ',
  44458. 'ẵ' => 'Ẵ',
  44459. 'ặ' => 'Ặ',
  44460. 'ẹ' => 'Ẹ',
  44461. 'ẻ' => 'Ẻ',
  44462. 'ẽ' => 'Ẽ',
  44463. 'ế' => 'Ế',
  44464. '�' => 'Ề',
  44465. 'ể' => 'Ể',
  44466. 'ễ' => 'Ễ',
  44467. 'ệ' => 'Ệ',
  44468. 'ỉ' => 'Ỉ',
  44469. 'ị' => 'Ị',
  44470. '�' => 'Ọ',
  44471. '�' => 'Ỏ',
  44472. 'ố' => '�',
  44473. 'ồ' => 'Ồ',
  44474. 'ổ' => 'Ổ',
  44475. 'á»—' => 'á»–',
  44476. 'ộ' => 'Ộ',
  44477. 'ớ' => 'Ớ',
  44478. '�' => 'Ờ',
  44479. 'ở' => 'Ở',
  44480. 'ỡ' => 'Ỡ',
  44481. 'ợ' => 'Ợ',
  44482. 'ụ' => 'Ụ',
  44483. 'ủ' => 'Ủ',
  44484. 'ứ' => 'Ứ',
  44485. 'ừ' => 'Ừ',
  44486. 'ử' => 'Ử',
  44487. 'ữ' => 'Ữ',
  44488. 'á»±' => 'á»°',
  44489. 'ỳ' => 'Ỳ',
  44490. 'ỵ' => 'Ỵ',
  44491. 'ỷ' => 'Ỷ',
  44492. 'ỹ' => 'Ỹ',
  44493. 'ỻ' => 'Ỻ',
  44494. 'ỽ' => 'Ỽ',
  44495. 'ỿ' => 'Ỿ',
  44496. 'ἀ' => 'Ἀ',
  44497. '�' => 'Ἁ',
  44498. 'ἂ' => 'Ἂ',
  44499. 'ἃ' => 'Ἃ',
  44500. 'ἄ' => 'Ἄ',
  44501. 'ἅ' => '�',
  44502. 'ἆ' => 'Ἆ',
  44503. 'ἇ' => '�',
  44504. '�' => 'Ἐ',
  44505. 'ἑ' => 'Ἑ',
  44506. 'ἒ' => 'Ἒ',
  44507. 'ἓ' => 'Ἓ',
  44508. 'ἔ' => 'Ἔ',
  44509. 'ἕ' => '�',
  44510. 'ἠ' => 'Ἠ',
  44511. 'ἡ' => 'Ἡ',
  44512. 'ἢ' => 'Ἢ',
  44513. 'ἣ' => 'Ἣ',
  44514. 'ἤ' => 'Ἤ',
  44515. 'á¼¥' => 'á¼­',
  44516. 'ἦ' => 'Ἦ',
  44517. 'ἧ' => 'Ἧ',
  44518. 'ἰ' => 'Ἰ',
  44519. 'á¼±' => 'á¼¹',
  44520. 'ἲ' => 'Ἲ',
  44521. 'á¼³' => 'á¼»',
  44522. 'á¼´' => 'á¼¼',
  44523. 'á¼µ' => 'á¼½',
  44524. 'ἶ' => 'Ἶ',
  44525. 'ἷ' => 'Ἷ',
  44526. 'ὀ' => 'Ὀ',
  44527. '�' => 'Ὁ',
  44528. 'ὂ' => 'Ὂ',
  44529. 'ὃ' => 'Ὃ',
  44530. 'ὄ' => 'Ὄ',
  44531. 'ὅ' => '�',
  44532. 'ὑ' => 'Ὑ',
  44533. 'ὓ' => 'Ὓ',
  44534. 'ὕ' => '�',
  44535. 'ὗ' => 'Ὗ',
  44536. 'ὠ' => 'Ὠ',
  44537. 'ὡ' => 'Ὡ',
  44538. 'ὢ' => 'Ὢ',
  44539. 'ὣ' => 'Ὣ',
  44540. 'ὤ' => 'Ὤ',
  44541. 'á½¥' => 'á½­',
  44542. 'ὦ' => 'Ὦ',
  44543. 'ὧ' => 'Ὧ',
  44544. 'ὰ' => 'Ὰ',
  44545. 'á½±' => 'á¾»',
  44546. 'ὲ' => 'Ὲ',
  44547. 'έ' => 'Έ',
  44548. 'á½´' => 'á¿Š',
  44549. 'á½µ' => 'á¿‹',
  44550. 'ὶ' => 'Ὶ',
  44551. 'á½·' => 'á¿›',
  44552. 'ὸ' => 'Ὸ',
  44553. 'ό' => 'Ό',
  44554. 'ὺ' => 'Ὺ',
  44555. 'á½»' => 'á¿«',
  44556. 'ὼ' => 'Ὼ',
  44557. 'á½½' => 'á¿»',
  44558. 'ᾀ' => 'ᾈ',
  44559. '�' => 'ᾉ',
  44560. 'ᾂ' => 'ᾊ',
  44561. 'ᾃ' => 'ᾋ',
  44562. 'ᾄ' => 'ᾌ',
  44563. 'ᾅ' => '�',
  44564. 'ᾆ' => 'ᾎ',
  44565. 'ᾇ' => '�',
  44566. '�' => 'ᾘ',
  44567. 'ᾑ' => 'ᾙ',
  44568. 'ᾒ' => 'ᾚ',
  44569. 'ᾓ' => 'ᾛ',
  44570. 'ᾔ' => 'ᾜ',
  44571. 'ᾕ' => '�',
  44572. 'ᾖ' => 'ᾞ',
  44573. 'ᾗ' => 'ᾟ',
  44574. 'ᾠ' => 'ᾨ',
  44575. 'ᾡ' => 'ᾩ',
  44576. 'ᾢ' => 'ᾪ',
  44577. 'ᾣ' => 'ᾫ',
  44578. 'ᾤ' => 'ᾬ',
  44579. 'á¾¥' => 'á¾­',
  44580. 'ᾦ' => 'ᾮ',
  44581. 'ᾧ' => 'ᾯ',
  44582. 'ᾰ' => 'Ᾰ',
  44583. 'á¾±' => 'á¾¹',
  44584. 'á¾³' => 'á¾¼',
  44585. 'ι' => 'Ι',
  44586. 'ῃ' => 'ῌ',
  44587. '�' => 'Ῐ',
  44588. 'á¿‘' => 'á¿™',
  44589. 'ῠ' => 'Ῠ',
  44590. 'á¿¡' => 'á¿©',
  44591. 'ῥ' => 'Ῥ',
  44592. 'ῳ' => 'ῼ',
  44593. 'ⅎ' => 'Ⅎ',
  44594. 'â…°' => 'â… ',
  44595. 'â…±' => 'â…¡',
  44596. 'â…²' => 'â…¢',
  44597. 'â…³' => 'â…£',
  44598. 'â…´' => 'â…¤',
  44599. 'â…µ' => 'â…¥',
  44600. 'â…¶' => 'â…¦',
  44601. 'â…·' => 'â…§',
  44602. 'â…¸' => 'â…¨',
  44603. 'â…¹' => 'â…©',
  44604. 'â…º' => 'â…ª',
  44605. 'â…»' => 'â…«',
  44606. 'â…¼' => 'â…¬',
  44607. 'â…½' => 'â…­',
  44608. 'â…¾' => 'â…®',
  44609. 'â…¿' => 'â…¯',
  44610. 'ↄ' => 'Ↄ',
  44611. '�' => 'Ⓐ',
  44612. 'â“‘' => 'â’·',
  44613. 'â“’' => 'â’¸',
  44614. 'â““' => 'â’¹',
  44615. 'â“”' => 'â’º',
  44616. 'â“•' => 'â’»',
  44617. 'â“–' => 'â’¼',
  44618. 'â“—' => 'â’½',
  44619. 'ⓘ' => 'Ⓘ',
  44620. 'â“™' => 'â’¿',
  44621. 'â“š' => 'â“€',
  44622. 'ⓛ' => '�',
  44623. 'ⓜ' => 'Ⓜ',
  44624. '�' => 'Ⓝ',
  44625. 'â“ž' => 'â“„',
  44626. 'â“Ÿ' => 'â“…',
  44627. 'ⓠ' => 'Ⓠ',
  44628. 'ⓡ' => 'Ⓡ',
  44629. 'ⓢ' => 'Ⓢ',
  44630. 'ⓣ' => 'Ⓣ',
  44631. 'ⓤ' => 'Ⓤ',
  44632. 'â“¥' => 'â“‹',
  44633. 'ⓦ' => 'Ⓦ',
  44634. 'ⓧ' => '�',
  44635. 'ⓨ' => 'Ⓨ',
  44636. 'ⓩ' => '�',
  44637. 'â°°' => 'â°€',
  44638. 'â°±' => 'â°�',
  44639. 'â°²' => 'â°‚',
  44640. 'â°³' => 'â°ƒ',
  44641. 'â°´' => 'â°„',
  44642. 'â°µ' => 'â°…',
  44643. 'â°¶' => 'â°†',
  44644. 'â°·' => 'â°‡',
  44645. 'â°¸' => 'â°ˆ',
  44646. 'â°¹' => 'â°‰',
  44647. 'â°º' => 'â°Š',
  44648. 'â°»' => 'â°‹',
  44649. 'ⰼ' => 'Ⰼ',
  44650. 'â°½' => 'â°�',
  44651. 'â°¾' => 'â°Ž',
  44652. 'â°¿' => 'â°�',
  44653. 'â±€' => 'â°�',
  44654. '�' => 'Ⱁ',
  44655. 'ⱂ' => 'Ⱂ',
  44656. 'ⱃ' => 'Ⱃ',
  44657. 'ⱄ' => 'Ⱄ',
  44658. 'â±…' => 'â°•',
  44659. 'ⱆ' => 'Ⱆ',
  44660. 'ⱇ' => 'Ⱇ',
  44661. 'ⱈ' => 'Ⱈ',
  44662. 'ⱉ' => 'Ⱉ',
  44663. 'ⱊ' => 'Ⱊ',
  44664. 'ⱋ' => 'Ⱋ',
  44665. 'ⱌ' => 'Ⱌ',
  44666. '�' => '�',
  44667. 'ⱎ' => 'Ⱎ',
  44668. '�' => 'Ⱏ',
  44669. '�' => 'Ⱐ',
  44670. 'ⱑ' => 'Ⱑ',
  44671. 'â±’' => 'â°¢',
  44672. 'ⱓ' => 'Ⱓ',
  44673. 'â±”' => 'â°¤',
  44674. 'ⱕ' => 'Ⱕ',
  44675. 'â±–' => 'â°¦',
  44676. 'â±—' => 'â°§',
  44677. 'ⱘ' => 'Ⱘ',
  44678. 'â±™' => 'â°©',
  44679. 'ⱚ' => 'Ⱚ',
  44680. 'â±›' => 'â°«',
  44681. 'ⱜ' => 'Ⱜ',
  44682. '�' => 'Ⱝ',
  44683. 'ⱞ' => 'Ⱞ',
  44684. 'ⱡ' => 'Ⱡ',
  44685. 'ⱥ' => 'Ⱥ',
  44686. 'ⱦ' => 'Ⱦ',
  44687. 'ⱨ' => 'Ⱨ',
  44688. 'ⱪ' => 'Ⱪ',
  44689. 'ⱬ' => 'Ⱬ',
  44690. 'â±³' => 'â±²',
  44691. 'ⱶ' => 'Ⱶ',
  44692. '�' => 'Ⲁ',
  44693. 'ⲃ' => 'Ⲃ',
  44694. 'ⲅ' => 'Ⲅ',
  44695. 'ⲇ' => 'Ⲇ',
  44696. 'ⲉ' => 'Ⲉ',
  44697. 'ⲋ' => 'Ⲋ',
  44698. '�' => 'Ⲍ',
  44699. '�' => 'Ⲏ',
  44700. 'ⲑ' => '�',
  44701. 'ⲓ' => 'Ⲓ',
  44702. 'ⲕ' => 'Ⲕ',
  44703. 'â²—' => 'â²–',
  44704. 'ⲙ' => 'Ⲙ',
  44705. 'ⲛ' => 'Ⲛ',
  44706. '�' => 'Ⲝ',
  44707. 'ⲟ' => 'Ⲟ',
  44708. 'ⲡ' => 'Ⲡ',
  44709. 'â²£' => 'â²¢',
  44710. 'ⲥ' => 'Ⲥ',
  44711. 'ⲧ' => 'Ⲧ',
  44712. 'ⲩ' => 'Ⲩ',
  44713. 'ⲫ' => 'Ⲫ',
  44714. 'ⲭ' => 'Ⲭ',
  44715. 'ⲯ' => 'Ⲯ',
  44716. 'â²±' => 'â²°',
  44717. 'â²³' => 'â²²',
  44718. 'â²µ' => 'â²´',
  44719. 'ⲷ' => 'Ⲷ',
  44720. 'ⲹ' => 'Ⲹ',
  44721. 'ⲻ' => 'Ⲻ',
  44722. 'â²½' => 'â²¼',
  44723. 'ⲿ' => 'Ⲿ',
  44724. '�' => 'Ⳁ',
  44725. 'ⳃ' => 'Ⳃ',
  44726. 'ⳅ' => 'Ⳅ',
  44727. 'ⳇ' => 'Ⳇ',
  44728. 'ⳉ' => 'Ⳉ',
  44729. 'ⳋ' => 'Ⳋ',
  44730. '�' => 'Ⳍ',
  44731. '�' => 'Ⳏ',
  44732. 'ⳑ' => '�',
  44733. 'ⳓ' => 'Ⳓ',
  44734. 'ⳕ' => 'Ⳕ',
  44735. 'â³—' => 'â³–',
  44736. 'ⳙ' => 'Ⳙ',
  44737. 'ⳛ' => 'Ⳛ',
  44738. '�' => 'Ⳝ',
  44739. 'ⳟ' => 'Ⳟ',
  44740. 'ⳡ' => 'Ⳡ',
  44741. 'â³£' => 'â³¢',
  44742. 'ⳬ' => 'Ⳬ',
  44743. 'â³®' => 'â³­',
  44744. 'â³³' => 'â³²',
  44745. 'â´€' => 'á‚ ',
  44746. 'â´�' => 'á‚¡',
  44747. 'â´‚' => 'á‚¢',
  44748. 'â´ƒ' => 'á‚£',
  44749. 'ⴄ' => 'Ⴄ',
  44750. 'â´…' => 'á‚¥',
  44751. 'ⴆ' => 'Ⴆ',
  44752. 'ⴇ' => 'Ⴇ',
  44753. 'ⴈ' => 'Ⴈ',
  44754. 'â´‰' => 'á‚©',
  44755. 'ⴊ' => 'Ⴊ',
  44756. 'â´‹' => 'á‚«',
  44757. 'ⴌ' => 'Ⴌ',
  44758. 'â´�' => 'á‚­',
  44759. 'â´Ž' => 'á‚®',
  44760. '�' => 'Ⴏ',
  44761. 'â´�' => 'á‚°',
  44762. 'ⴑ' => 'Ⴑ',
  44763. 'ⴒ' => 'Ⴒ',
  44764. 'ⴓ' => 'Ⴓ',
  44765. 'â´”' => 'á‚´',
  44766. 'ⴕ' => 'Ⴕ',
  44767. 'ⴖ' => 'Ⴖ',
  44768. 'â´—' => 'á‚·',
  44769. 'ⴘ' => 'Ⴘ',
  44770. 'ⴙ' => 'Ⴙ',
  44771. 'ⴚ' => 'Ⴚ',
  44772. 'â´›' => 'á‚»',
  44773. 'ⴜ' => 'Ⴜ',
  44774. '�' => 'Ⴝ',
  44775. 'ⴞ' => 'Ⴞ',
  44776. 'â´Ÿ' => 'á‚¿',
  44777. 'ⴠ' => 'Ⴠ',
  44778. 'ⴡ' => '�',
  44779. 'ⴢ' => 'Ⴢ',
  44780. 'ⴣ' => 'Ⴣ',
  44781. 'ⴤ' => 'Ⴤ',
  44782. 'ⴥ' => 'Ⴥ',
  44783. 'ⴧ' => 'Ⴧ',
  44784. 'ⴭ' => '�',
  44785. '�' => 'Ꙁ',
  44786. 'ꙃ' => 'Ꙃ',
  44787. 'ꙅ' => 'Ꙅ',
  44788. 'ꙇ' => 'Ꙇ',
  44789. 'ꙉ' => 'Ꙉ',
  44790. 'ꙋ' => 'Ꙋ',
  44791. '�' => 'Ꙍ',
  44792. '�' => 'Ꙏ',
  44793. 'ꙑ' => '�',
  44794. 'ꙓ' => 'Ꙓ',
  44795. 'ꙕ' => 'Ꙕ',
  44796. 'ê™—' => 'ê™–',
  44797. 'ꙙ' => 'Ꙙ',
  44798. 'ꙛ' => 'Ꙛ',
  44799. '�' => 'Ꙝ',
  44800. 'ꙟ' => 'Ꙟ',
  44801. 'ꙡ' => 'Ꙡ',
  44802. 'ꙣ' => 'Ꙣ',
  44803. 'ꙥ' => 'Ꙥ',
  44804. 'ꙧ' => 'Ꙧ',
  44805. 'ꙩ' => 'Ꙩ',
  44806. 'ꙫ' => 'Ꙫ',
  44807. 'ꙭ' => 'Ꙭ',
  44808. '�' => 'Ꚁ',
  44809. 'ꚃ' => 'Ꚃ',
  44810. 'êš…' => 'êš„',
  44811. 'ꚇ' => 'Ꚇ',
  44812. 'ꚉ' => 'Ꚉ',
  44813. 'ꚋ' => 'Ꚋ',
  44814. '�' => 'Ꚍ',
  44815. '�' => 'Ꚏ',
  44816. 'ꚑ' => '�',
  44817. 'êš“' => 'êš’',
  44818. 'êš•' => 'êš”',
  44819. 'êš—' => 'êš–',
  44820. 'ꚙ' => 'Ꚙ',
  44821. 'êš›' => 'êšš',
  44822. 'ꜣ' => 'Ꜣ',
  44823. 'ꜥ' => 'Ꜥ',
  44824. 'ꜧ' => 'Ꜧ',
  44825. 'ꜩ' => 'Ꜩ',
  44826. 'ꜫ' => 'Ꜫ',
  44827. 'ꜭ' => 'Ꜭ',
  44828. 'ꜯ' => 'Ꜯ',
  44829. 'ꜳ' => 'Ꜳ',
  44830. 'ꜵ' => 'Ꜵ',
  44831. 'ꜷ' => 'Ꜷ',
  44832. 'ꜹ' => 'Ꜹ',
  44833. 'ꜻ' => 'Ꜻ',
  44834. 'ꜽ' => 'Ꜽ',
  44835. 'ꜿ' => 'Ꜿ',
  44836. '�' => '�',
  44837. '�' => '�',
  44838. '�' => '�',
  44839. '�' => '�',
  44840. '�' => '�',
  44841. '�' => '�',
  44842. '�' => '�',
  44843. '�' => '�',
  44844. '�' => '�',
  44845. '�' => '�',
  44846. '�' => '�',
  44847. '�' => '�',
  44848. '�' => '�',
  44849. '�' => '�',
  44850. '�' => '�',
  44851. '�' => '�',
  44852. '�' => '�',
  44853. '�' => '�',
  44854. '�' => '�',
  44855. '�' => '�',
  44856. '�' => '�',
  44857. '�' => '�',
  44858. '�' => '�',
  44859. '�' => '�',
  44860. '�' => '�',
  44861. '�' => '�',
  44862. '�' => '�',
  44863. '�' => 'Ꞁ',
  44864. 'ꞃ' => 'Ꞃ',
  44865. 'êž…' => 'êž„',
  44866. 'ꞇ' => 'Ꞇ',
  44867. 'ꞌ' => 'Ꞌ',
  44868. 'ꞑ' => '�',
  44869. 'êž“' => 'êž’',
  44870. 'êž—' => 'êž–',
  44871. 'ꞙ' => 'Ꞙ',
  44872. 'êž›' => 'êžš',
  44873. '�' => 'Ꞝ',
  44874. 'ꞟ' => 'Ꞟ',
  44875. 'êž¡' => 'êž ',
  44876. 'ꞣ' => 'Ꞣ',
  44877. 'ꞥ' => 'Ꞥ',
  44878. 'ꞧ' => 'Ꞧ',
  44879. 'ꞩ' => 'Ꞩ',
  44880. '�' => 'A',
  44881. 'b' => 'B',
  44882. 'c' => 'C',
  44883. 'd' => 'D',
  44884. 'ï½…' => 'ï¼¥',
  44885. 'f' => 'F',
  44886. 'g' => 'G',
  44887. 'h' => 'H',
  44888. 'i' => 'I',
  44889. 'j' => 'J',
  44890. 'k' => 'K',
  44891. 'l' => 'L',
  44892. '�' => 'M',
  44893. 'n' => 'N',
  44894. '�' => 'O',
  44895. '�' => 'P',
  44896. 'q' => 'Q',
  44897. 'ï½’' => 'ï¼²',
  44898. 's' => 'S',
  44899. 'ï½”' => 'ï¼´',
  44900. 'u' => 'U',
  44901. 'v' => 'V',
  44902. 'ï½—' => 'ï¼·',
  44903. 'x' => 'X',
  44904. 'ï½™' => 'ï¼¹',
  44905. 'z' => 'Z',
  44906. '�' => '�',
  44907. '�' => '�',
  44908. '�' => '�',
  44909. '�' => '�',
  44910. '�' => '�',
  44911. '�' => '�',
  44912. '�' => '�',
  44913. '�' => '�',
  44914. '�' => '�',
  44915. '�' => '�',
  44916. '�' => '�',
  44917. '�' => '�',
  44918. '�' => '�',
  44919. '�' => '�',
  44920. '�' => '�',
  44921. '�' => '�',
  44922. '�' => '�',
  44923. '�' => '�',
  44924. '�' => '�',
  44925. '�' => '�',
  44926. '�' => '�',
  44927. '�' => '�',
  44928. '�' => '�',
  44929. '�' => '�',
  44930. '�' => '�',
  44931. '�' => '�',
  44932. '�' => '�',
  44933. '�' => '�',
  44934. '�' => '�',
  44935. '�' => '�',
  44936. '�' => '�',
  44937. '�' => '�',
  44938. '�' => '�',
  44939. '�' => '�',
  44940. '�' => '�',
  44941. '�' => '�',
  44942. '�' => '�',
  44943. '�' => '�',
  44944. '�' => '�',
  44945. '�' => '�',
  44946. 'ð‘£€' => 'ð‘¢ ',
  44947. '�' => '𑢡',
  44948. '𑣂' => '𑢢',
  44949. '𑣃' => '𑢣',
  44950. '𑣄' => '𑢤',
  44951. 'ð‘£…' => 'ð‘¢¥',
  44952. '𑣆' => '𑢦',
  44953. '𑣇' => '𑢧',
  44954. '𑣈' => '𑢨',
  44955. '𑣉' => '𑢩',
  44956. '𑣊' => '𑢪',
  44957. '𑣋' => '𑢫',
  44958. '𑣌' => '𑢬',
  44959. '�' => '𑢭',
  44960. '𑣎' => '𑢮',
  44961. '�' => '𑢯',
  44962. '�' => '𑢰',
  44963. '𑣑' => '𑢱',
  44964. 'ð‘£’' => 'ð‘¢²',
  44965. '𑣓' => '𑢳',
  44966. 'ð‘£”' => 'ð‘¢´',
  44967. '𑣕' => '𑢵',
  44968. '𑣖' => '𑢶',
  44969. 'ð‘£—' => 'ð‘¢·',
  44970. '𑣘' => '𑢸',
  44971. 'ð‘£™' => 'ð‘¢¹',
  44972. '𑣚' => '𑢺',
  44973. 'ð‘£›' => 'ð‘¢»',
  44974. '𑣜' => '𑢼',
  44975. '�' => '𑢽',
  44976. '𑣞' => '𑢾',
  44977. '𑣟' => '𑢿',
  44978. );
  44979. $result =& $data;
  44980. unset($data);
  44981. return $result;
  44982. <?php
  44983. use Symfony\Polyfill\Mbstring as p;
  44984. if (!function_exists('mb_strlen')) {
  44985. define('MB_CASE_UPPER', 0);
  44986. define('MB_CASE_LOWER', 1);
  44987. define('MB_CASE_TITLE', 2);
  44988. function mb_convert_encoding($s, $to, $from = null) { return p\Mbstring::mb_convert_encoding($s, $to, $from); }
  44989. function mb_decode_mimeheader($s) { return p\Mbstring::mb_decode_mimeheader($s); }
  44990. function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) { return p\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); }
  44991. function mb_decode_numericentity($s, $convmap, $enc = null) { return p\Mbstring::mb_decode_numericentity($s, $convmap, $enc); }
  44992. function mb_encode_numericentity($s, $convmap, $enc = null, $is_hex = false) { return p\Mbstring::mb_encode_numericentity($s, $convmap, $enc, $is_hex); }
  44993. function mb_convert_case($s, $mode, $enc = null) { return p\Mbstring::mb_convert_case($s, $mode, $enc); }
  44994. function mb_internal_encoding($enc = null) { return p\Mbstring::mb_internal_encoding($enc); }
  44995. function mb_language($lang = null) { return p\Mbstring::mb_language($lang); }
  44996. function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); }
  44997. function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); }
  44998. function mb_check_encoding($var = null, $encoding = null) { return p\Mbstring::mb_check_encoding($var, $encoding); }
  44999. function mb_detect_encoding($str, $encodingList = null, $strict = false) { return p\Mbstring::mb_detect_encoding($str, $encodingList, $strict); }
  45000. function mb_detect_order($encodingList = null) { return p\Mbstring::mb_detect_order($encodingList); }
  45001. function mb_parse_str($s, &$result = array()) { parse_str($s, $result); }
  45002. function mb_strlen($s, $enc = null) { return p\Mbstring::mb_strlen($s, $enc); }
  45003. function mb_strpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strpos($s, $needle, $offset, $enc); }
  45004. function mb_strtolower($s, $enc = null) { return p\Mbstring::mb_strtolower($s, $enc); }
  45005. function mb_strtoupper($s, $enc = null) { return p\Mbstring::mb_strtoupper($s, $enc); }
  45006. function mb_substitute_character($char = null) { return p\Mbstring::mb_substitute_character($char); }
  45007. function mb_substr($s, $start, $length = 2147483647, $enc = null) { return p\Mbstring::mb_substr($s, $start, $length, $enc); }
  45008. function mb_stripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_stripos($s, $needle, $offset, $enc); }
  45009. function mb_stristr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_stristr($s, $needle, $part, $enc); }
  45010. function mb_strrchr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrchr($s, $needle, $part, $enc); }
  45011. function mb_strrichr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrichr($s, $needle, $part, $enc); }
  45012. function mb_strripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strripos($s, $needle, $offset, $enc); }
  45013. function mb_strrpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strrpos($s, $needle, $offset, $enc); }
  45014. function mb_strstr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strstr($s, $needle, $part, $enc); }
  45015. function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); }
  45016. function mb_http_output($enc = null) { return p\Mbstring::mb_http_output($enc); }
  45017. function mb_strwidth($s, $enc = null) { return p\Mbstring::mb_strwidth($s, $enc); }
  45018. function mb_substr_count($haystack, $needle, $enc = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $enc); }
  45019. function mb_output_handler($contents, $status) { return p\Mbstring::mb_output_handler($contents, $status); }
  45020. function mb_http_input($type = '') { return p\Mbstring::mb_http_input($type); }
  45021. function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null) { return p\Mbstring::mb_convert_variables($toEncoding, $fromEncoding, $a, $b, $c, $d, $e, $f); }
  45022. }
  45023. if (!function_exists('mb_chr')) {
  45024. function mb_ord($s, $enc = null) { return p\Mbstring::mb_ord($s, $enc); }
  45025. function mb_chr($code, $enc = null) { return p\Mbstring::mb_chr($code, $enc); }
  45026. function mb_scrub($s, $enc = null) { $enc = null === $enc ? mb_internal_encoding() : $enc; return mb_convert_encoding($s, $enc, $enc); }
  45027. }
  45028. <?php
  45029. namespace Symfony\Component\Process\Exception;
  45030. interface ExceptionInterface
  45031. {
  45032. }
  45033. <?php
  45034. namespace Symfony\Component\Process\Exception;
  45035. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  45036. {
  45037. }
  45038. <?php
  45039. namespace Symfony\Component\Process\Exception;
  45040. class LogicException extends \LogicException implements ExceptionInterface
  45041. {
  45042. }
  45043. <?php
  45044. namespace Symfony\Component\Process\Exception;
  45045. use Symfony\Component\Process\Process;
  45046. class ProcessFailedException extends RuntimeException
  45047. {
  45048. private $process;
  45049. public function __construct(Process $process)
  45050. {
  45051. if ($process->isSuccessful()) {
  45052. throw new InvalidArgumentException('Expected a failed process, but the given process was successful.');
  45053. }
  45054. $error = sprintf('The command "%s" failed.'."\n\nExit Code: %s(%s)\n\nWorking directory: %s",
  45055. $process->getCommandLine(),
  45056. $process->getExitCode(),
  45057. $process->getExitCodeText(),
  45058. $process->getWorkingDirectory()
  45059. );
  45060. if (!$process->isOutputDisabled()) {
  45061. $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s",
  45062. $process->getOutput(),
  45063. $process->getErrorOutput()
  45064. );
  45065. }
  45066. parent::__construct($error);
  45067. $this->process = $process;
  45068. }
  45069. public function getProcess()
  45070. {
  45071. return $this->process;
  45072. }
  45073. }
  45074. <?php
  45075. namespace Symfony\Component\Process\Exception;
  45076. use Symfony\Component\Process\Process;
  45077. class ProcessTimedOutException extends RuntimeException
  45078. {
  45079. const TYPE_GENERAL = 1;
  45080. const TYPE_IDLE = 2;
  45081. private $process;
  45082. private $timeoutType;
  45083. public function __construct(Process $process, $timeoutType)
  45084. {
  45085. $this->process = $process;
  45086. $this->timeoutType = $timeoutType;
  45087. parent::__construct(sprintf(
  45088. 'The process "%s" exceeded the timeout of %s seconds.',
  45089. $process->getCommandLine(),
  45090. $this->getExceededTimeout()
  45091. ));
  45092. }
  45093. public function getProcess()
  45094. {
  45095. return $this->process;
  45096. }
  45097. public function isGeneralTimeout()
  45098. {
  45099. return self::TYPE_GENERAL === $this->timeoutType;
  45100. }
  45101. public function isIdleTimeout()
  45102. {
  45103. return self::TYPE_IDLE === $this->timeoutType;
  45104. }
  45105. public function getExceededTimeout()
  45106. {
  45107. switch ($this->timeoutType) {
  45108. case self::TYPE_GENERAL:
  45109. return $this->process->getTimeout();
  45110. case self::TYPE_IDLE:
  45111. return $this->process->getIdleTimeout();
  45112. default:
  45113. throw new \LogicException(sprintf('Unknown timeout type "%d".', $this->timeoutType));
  45114. }
  45115. }
  45116. }
  45117. <?php
  45118. namespace Symfony\Component\Process\Exception;
  45119. class RuntimeException extends \RuntimeException implements ExceptionInterface
  45120. {
  45121. }
  45122. <?php
  45123. namespace Symfony\Component\Process;
  45124. class ExecutableFinder
  45125. {
  45126. private $suffixes = array('.exe', '.bat', '.cmd', '.com');
  45127. public function setSuffixes(array $suffixes)
  45128. {
  45129. $this->suffixes = $suffixes;
  45130. }
  45131. public function addSuffix($suffix)
  45132. {
  45133. $this->suffixes[] = $suffix;
  45134. }
  45135. public function find($name, $default = null, array $extraDirs = array())
  45136. {
  45137. if (ini_get('open_basedir')) {
  45138. $searchPath = explode(PATH_SEPARATOR, ini_get('open_basedir'));
  45139. $dirs = array();
  45140. foreach ($searchPath as $path) {
  45141. if (@is_dir($path)) {
  45142. $dirs[] = $path;
  45143. } else {
  45144. if (basename($path) == $name && @is_executable($path)) {
  45145. return $path;
  45146. }
  45147. }
  45148. }
  45149. } else {
  45150. $dirs = array_merge(
  45151. explode(PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),
  45152. $extraDirs
  45153. );
  45154. }
  45155. $suffixes = array('');
  45156. if ('\\' === DIRECTORY_SEPARATOR) {
  45157. $pathExt = getenv('PATHEXT');
  45158. $suffixes = array_merge($pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes, $suffixes);
  45159. }
  45160. foreach ($suffixes as $suffix) {
  45161. foreach ($dirs as $dir) {
  45162. if (@is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === DIRECTORY_SEPARATOR || @is_executable($file))) {
  45163. return $file;
  45164. }
  45165. }
  45166. }
  45167. return $default;
  45168. }
  45169. }
  45170. Copyright (c) 2004-2018 Fabien Potencier
  45171. Permission is hereby granted, free of charge, to any person obtaining a copy
  45172. of this software and associated documentation files (the "Software"), to deal
  45173. in the Software without restriction, including without limitation the rights
  45174. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  45175. copies of the Software, and to permit persons to whom the Software is furnished
  45176. to do so, subject to the following conditions:
  45177. The above copyright notice and this permission notice shall be included in all
  45178. copies or substantial portions of the Software.
  45179. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  45180. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  45181. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  45182. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  45183. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  45184. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  45185. THE SOFTWARE.
  45186. <?php
  45187. namespace Symfony\Component\Process;
  45188. class PhpExecutableFinder
  45189. {
  45190. private $executableFinder;
  45191. public function __construct()
  45192. {
  45193. $this->executableFinder = new ExecutableFinder();
  45194. }
  45195. public function find($includeArgs = true)
  45196. {
  45197. $args = $this->findArguments();
  45198. $args = $includeArgs && $args ? ' '.implode(' ', $args) : '';
  45199. if (defined('HHVM_VERSION')) {
  45200. return (getenv('PHP_BINARY') ?: PHP_BINARY).$args;
  45201. }
  45202. if (defined('PHP_BINARY') && PHP_BINARY && \in_array(PHP_SAPI, array('cli', 'cli-server', 'phpdbg'), true)) {
  45203. return PHP_BINARY.$args;
  45204. }
  45205. if ($php = getenv('PHP_PATH')) {
  45206. if (!@is_executable($php)) {
  45207. return false;
  45208. }
  45209. return $php;
  45210. }
  45211. if ($php = getenv('PHP_PEAR_PHP_BIN')) {
  45212. if (@is_executable($php)) {
  45213. return $php;
  45214. }
  45215. }
  45216. if (@is_executable($php = PHP_BINDIR.('\\' === DIRECTORY_SEPARATOR ? '\\php.exe' : '/php'))) {
  45217. return $php;
  45218. }
  45219. $dirs = array(PHP_BINDIR);
  45220. if ('\\' === DIRECTORY_SEPARATOR) {
  45221. $dirs[] = 'C:\xampp\php\\';
  45222. }
  45223. return $this->executableFinder->find('php', false, $dirs);
  45224. }
  45225. public function findArguments()
  45226. {
  45227. $arguments = array();
  45228. if (defined('HHVM_VERSION')) {
  45229. $arguments[] = '--php';
  45230. } elseif ('phpdbg' === PHP_SAPI) {
  45231. $arguments[] = '-qrr';
  45232. }
  45233. return $arguments;
  45234. }
  45235. }
  45236. <?php
  45237. namespace Symfony\Component\Process;
  45238. use Symfony\Component\Process\Exception\RuntimeException;
  45239. class PhpProcess extends Process
  45240. {
  45241. public function __construct($script, $cwd = null, array $env = null, $timeout = 60, array $options = array())
  45242. {
  45243. $executableFinder = new PhpExecutableFinder();
  45244. if (false === $php = $executableFinder->find()) {
  45245. $php = null;
  45246. }
  45247. if ('phpdbg' === PHP_SAPI) {
  45248. $file = tempnam(sys_get_temp_dir(), 'dbg');
  45249. file_put_contents($file, $script);
  45250. register_shutdown_function('unlink', $file);
  45251. $php .= ' '.ProcessUtils::escapeArgument($file);
  45252. $script = null;
  45253. }
  45254. if ('\\' !== DIRECTORY_SEPARATOR && null !== $php) {
  45255. $php = 'exec '.$php;
  45256. }
  45257. parent::__construct($php, $cwd, $env, $script, $timeout, $options);
  45258. }
  45259. public function setPhpBinary($php)
  45260. {
  45261. $this->setCommandLine($php);
  45262. }
  45263. public function start($callback = null)
  45264. {
  45265. if (null === $this->getCommandLine()) {
  45266. throw new RuntimeException('Unable to find the PHP executable.');
  45267. }
  45268. parent::start($callback);
  45269. }
  45270. }
  45271. <?php
  45272. namespace Symfony\Component\Process\Pipes;
  45273. abstract class AbstractPipes implements PipesInterface
  45274. {
  45275. public $pipes = array();
  45276. private $inputBuffer = '';
  45277. private $input;
  45278. private $blocked = true;
  45279. private $lastError;
  45280. public function __construct($input)
  45281. {
  45282. if (is_resource($input)) {
  45283. $this->input = $input;
  45284. } elseif (is_string($input)) {
  45285. $this->inputBuffer = $input;
  45286. } else {
  45287. $this->inputBuffer = (string) $input;
  45288. }
  45289. }
  45290. public function close()
  45291. {
  45292. foreach ($this->pipes as $pipe) {
  45293. fclose($pipe);
  45294. }
  45295. $this->pipes = array();
  45296. }
  45297. protected function hasSystemCallBeenInterrupted()
  45298. {
  45299. $lastError = $this->lastError;
  45300. $this->lastError = null;
  45301. return null !== $lastError && false !== stripos($lastError, 'interrupted system call');
  45302. }
  45303. protected function unblock()
  45304. {
  45305. if (!$this->blocked) {
  45306. return;
  45307. }
  45308. foreach ($this->pipes as $pipe) {
  45309. stream_set_blocking($pipe, 0);
  45310. }
  45311. if (null !== $this->input) {
  45312. stream_set_blocking($this->input, 0);
  45313. }
  45314. $this->blocked = false;
  45315. }
  45316. protected function write()
  45317. {
  45318. if (!isset($this->pipes[0])) {
  45319. return;
  45320. }
  45321. $input = $this->input;
  45322. $r = $e = array();
  45323. $w = array($this->pipes[0]);
  45324. if (false === @stream_select($r, $w, $e, 0, 0)) {
  45325. return;
  45326. }
  45327. foreach ($w as $stdin) {
  45328. if (isset($this->inputBuffer[0])) {
  45329. $written = fwrite($stdin, $this->inputBuffer);
  45330. $this->inputBuffer = substr($this->inputBuffer, $written);
  45331. if (isset($this->inputBuffer[0])) {
  45332. return array($this->pipes[0]);
  45333. }
  45334. }
  45335. if ($input) {
  45336. for (;;) {
  45337. $data = fread($input, self::CHUNK_SIZE);
  45338. if (!isset($data[0])) {
  45339. break;
  45340. }
  45341. $written = fwrite($stdin, $data);
  45342. $data = substr($data, $written);
  45343. if (isset($data[0])) {
  45344. $this->inputBuffer = $data;
  45345. return array($this->pipes[0]);
  45346. }
  45347. }
  45348. if (feof($input)) {
  45349. $this->input = null;
  45350. }
  45351. }
  45352. }
  45353. if (null === $this->input && !isset($this->inputBuffer[0])) {
  45354. fclose($this->pipes[0]);
  45355. unset($this->pipes[0]);
  45356. } elseif (!$w) {
  45357. return array($this->pipes[0]);
  45358. }
  45359. }
  45360. public function handleError($type, $msg)
  45361. {
  45362. $this->lastError = $msg;
  45363. }
  45364. }
  45365. <?php
  45366. namespace Symfony\Component\Process\Pipes;
  45367. interface PipesInterface
  45368. {
  45369. const CHUNK_SIZE = 16384;
  45370. public function getDescriptors();
  45371. public function getFiles();
  45372. public function readAndWrite($blocking, $close = false);
  45373. public function areOpen();
  45374. public function close();
  45375. }
  45376. <?php
  45377. namespace Symfony\Component\Process\Pipes;
  45378. use Symfony\Component\Process\Process;
  45379. class UnixPipes extends AbstractPipes
  45380. {
  45381. private $ttyMode;
  45382. private $ptyMode;
  45383. private $disableOutput;
  45384. public function __construct($ttyMode, $ptyMode, $input, $disableOutput)
  45385. {
  45386. $this->ttyMode = (bool) $ttyMode;
  45387. $this->ptyMode = (bool) $ptyMode;
  45388. $this->disableOutput = (bool) $disableOutput;
  45389. parent::__construct($input);
  45390. }
  45391. public function __destruct()
  45392. {
  45393. $this->close();
  45394. }
  45395. public function getDescriptors()
  45396. {
  45397. if ($this->disableOutput) {
  45398. $nullstream = fopen('/dev/null', 'c');
  45399. return array(
  45400. array('pipe', 'r'),
  45401. $nullstream,
  45402. $nullstream,
  45403. );
  45404. }
  45405. if ($this->ttyMode) {
  45406. return array(
  45407. array('file', '/dev/tty', 'r'),
  45408. array('file', '/dev/tty', 'w'),
  45409. array('file', '/dev/tty', 'w'),
  45410. );
  45411. }
  45412. if ($this->ptyMode && Process::isPtySupported()) {
  45413. return array(
  45414. array('pty'),
  45415. array('pty'),
  45416. array('pty'),
  45417. );
  45418. }
  45419. return array(
  45420. array('pipe', 'r'),
  45421. array('pipe', 'w'),
  45422. array('pipe', 'w'),
  45423. );
  45424. }
  45425. public function getFiles()
  45426. {
  45427. return array();
  45428. }
  45429. public function readAndWrite($blocking, $close = false)
  45430. {
  45431. $this->unblock();
  45432. $w = $this->write();
  45433. $read = $e = array();
  45434. $r = $this->pipes;
  45435. unset($r[0]);
  45436. set_error_handler(array($this, 'handleError'));
  45437. if (($r || $w) && false === stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) {
  45438. restore_error_handler();
  45439. if (!$this->hasSystemCallBeenInterrupted()) {
  45440. $this->pipes = array();
  45441. }
  45442. return $read;
  45443. }
  45444. restore_error_handler();
  45445. foreach ($r as $pipe) {
  45446. $read[$type = array_search($pipe, $this->pipes, true)] = '';
  45447. do {
  45448. $data = fread($pipe, self::CHUNK_SIZE);
  45449. $read[$type] .= $data;
  45450. } while (isset($data[0]) && ($close || isset($data[self::CHUNK_SIZE - 1])));
  45451. if (!isset($read[$type][0])) {
  45452. unset($read[$type]);
  45453. }
  45454. if ($close && feof($pipe)) {
  45455. fclose($pipe);
  45456. unset($this->pipes[$type]);
  45457. }
  45458. }
  45459. return $read;
  45460. }
  45461. public function areOpen()
  45462. {
  45463. return (bool) $this->pipes;
  45464. }
  45465. public static function create(Process $process, $input)
  45466. {
  45467. return new static($process->isTty(), $process->isPty(), $input, $process->isOutputDisabled());
  45468. }
  45469. }
  45470. <?php
  45471. namespace Symfony\Component\Process\Pipes;
  45472. use Symfony\Component\Process\Process;
  45473. use Symfony\Component\Process\Exception\RuntimeException;
  45474. class WindowsPipes extends AbstractPipes
  45475. {
  45476. private $files = array();
  45477. private $fileHandles = array();
  45478. private $readBytes = array(
  45479. Process::STDOUT => 0,
  45480. Process::STDERR => 0,
  45481. );
  45482. private $disableOutput;
  45483. public function __construct($disableOutput, $input)
  45484. {
  45485. $this->disableOutput = (bool) $disableOutput;
  45486. if (!$this->disableOutput) {
  45487. $pipes = array(
  45488. Process::STDOUT => Process::OUT,
  45489. Process::STDERR => Process::ERR,
  45490. );
  45491. $tmpCheck = false;
  45492. $tmpDir = sys_get_temp_dir();
  45493. $lastError = 'unknown reason';
  45494. set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; });
  45495. for ($i = 0;; ++$i) {
  45496. foreach ($pipes as $pipe => $name) {
  45497. $file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name);
  45498. if (file_exists($file) && !unlink($file)) {
  45499. continue 2;
  45500. }
  45501. $h = fopen($file, 'xb');
  45502. if (!$h) {
  45503. $error = $lastError;
  45504. if ($tmpCheck || $tmpCheck = unlink(tempnam(false, 'sf_check_'))) {
  45505. continue;
  45506. }
  45507. restore_error_handler();
  45508. throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s', $error));
  45509. }
  45510. if (!$h || !$this->fileHandles[$pipe] = fopen($file, 'rb')) {
  45511. continue 2;
  45512. }
  45513. if (isset($this->files[$pipe])) {
  45514. unlink($this->files[$pipe]);
  45515. }
  45516. $this->files[$pipe] = $file;
  45517. }
  45518. break;
  45519. }
  45520. restore_error_handler();
  45521. }
  45522. parent::__construct($input);
  45523. }
  45524. public function __destruct()
  45525. {
  45526. $this->close();
  45527. $this->removeFiles();
  45528. }
  45529. public function getDescriptors()
  45530. {
  45531. if ($this->disableOutput) {
  45532. $nullstream = fopen('NUL', 'c');
  45533. return array(
  45534. array('pipe', 'r'),
  45535. $nullstream,
  45536. $nullstream,
  45537. );
  45538. }
  45539. return array(
  45540. array('pipe', 'r'),
  45541. array('file', 'NUL', 'w'),
  45542. array('file', 'NUL', 'w'),
  45543. );
  45544. }
  45545. public function getFiles()
  45546. {
  45547. return $this->files;
  45548. }
  45549. public function readAndWrite($blocking, $close = false)
  45550. {
  45551. $this->unblock();
  45552. $w = $this->write();
  45553. $read = $r = $e = array();
  45554. if ($blocking) {
  45555. if ($w) {
  45556. @stream_select($r, $w, $e, 0, Process::TIMEOUT_PRECISION * 1E6);
  45557. } elseif ($this->fileHandles) {
  45558. usleep(Process::TIMEOUT_PRECISION * 1E6);
  45559. }
  45560. }
  45561. foreach ($this->fileHandles as $type => $fileHandle) {
  45562. $data = stream_get_contents($fileHandle, -1, $this->readBytes[$type]);
  45563. if (isset($data[0])) {
  45564. $this->readBytes[$type] += strlen($data);
  45565. $read[$type] = $data;
  45566. }
  45567. if ($close) {
  45568. fclose($fileHandle);
  45569. unset($this->fileHandles[$type]);
  45570. }
  45571. }
  45572. return $read;
  45573. }
  45574. public function areOpen()
  45575. {
  45576. return $this->pipes && $this->fileHandles;
  45577. }
  45578. public function close()
  45579. {
  45580. parent::close();
  45581. foreach ($this->fileHandles as $handle) {
  45582. fclose($handle);
  45583. }
  45584. $this->fileHandles = array();
  45585. }
  45586. public static function create(Process $process, $input)
  45587. {
  45588. return new static($process->isOutputDisabled(), $input);
  45589. }
  45590. private function removeFiles()
  45591. {
  45592. foreach ($this->files as $filename) {
  45593. if (file_exists($filename)) {
  45594. @unlink($filename);
  45595. }
  45596. }
  45597. $this->files = array();
  45598. }
  45599. }
  45600. <?php
  45601. namespace Symfony\Component\Process;
  45602. use Symfony\Component\Process\Exception\InvalidArgumentException;
  45603. use Symfony\Component\Process\Exception\LogicException;
  45604. use Symfony\Component\Process\Exception\ProcessFailedException;
  45605. use Symfony\Component\Process\Exception\ProcessTimedOutException;
  45606. use Symfony\Component\Process\Exception\RuntimeException;
  45607. use Symfony\Component\Process\Pipes\PipesInterface;
  45608. use Symfony\Component\Process\Pipes\UnixPipes;
  45609. use Symfony\Component\Process\Pipes\WindowsPipes;
  45610. class Process
  45611. {
  45612. const ERR = 'err';
  45613. const OUT = 'out';
  45614. const STATUS_READY = 'ready';
  45615. const STATUS_STARTED = 'started';
  45616. const STATUS_TERMINATED = 'terminated';
  45617. const STDIN = 0;
  45618. const STDOUT = 1;
  45619. const STDERR = 2;
  45620. const TIMEOUT_PRECISION = 0.2;
  45621. private $callback;
  45622. private $commandline;
  45623. private $cwd;
  45624. private $env;
  45625. private $input;
  45626. private $starttime;
  45627. private $lastOutputTime;
  45628. private $timeout;
  45629. private $idleTimeout;
  45630. private $options;
  45631. private $exitcode;
  45632. private $fallbackStatus = array();
  45633. private $processInformation;
  45634. private $outputDisabled = false;
  45635. private $stdout;
  45636. private $stderr;
  45637. private $enhanceWindowsCompatibility = true;
  45638. private $enhanceSigchildCompatibility;
  45639. private $process;
  45640. private $status = self::STATUS_READY;
  45641. private $incrementalOutputOffset = 0;
  45642. private $incrementalErrorOutputOffset = 0;
  45643. private $tty;
  45644. private $pty;
  45645. private $useFileHandles = false;
  45646. private $processPipes;
  45647. private $latestSignal;
  45648. private static $sigchild;
  45649. public static $exitCodes = array(
  45650. 0 => 'OK',
  45651. 1 => 'General error',
  45652. 2 => 'Misuse of shell builtins',
  45653. 126 => 'Invoked command cannot execute',
  45654. 127 => 'Command not found',
  45655. 128 => 'Invalid exit argument',
  45656. 129 => 'Hangup',
  45657. 130 => 'Interrupt',
  45658. 131 => 'Quit and dump core',
  45659. 132 => 'Illegal instruction',
  45660. 133 => 'Trace/breakpoint trap',
  45661. 134 => 'Process aborted',
  45662. 135 => 'Bus error: "access to undefined portion of memory object"',
  45663. 136 => 'Floating point exception: "erroneous arithmetic operation"',
  45664. 137 => 'Kill (terminate immediately)',
  45665. 138 => 'User-defined 1',
  45666. 139 => 'Segmentation violation',
  45667. 140 => 'User-defined 2',
  45668. 141 => 'Write to pipe with no one reading',
  45669. 142 => 'Signal raised by alarm',
  45670. 143 => 'Termination (request to terminate)',
  45671. 145 => 'Child process terminated, stopped (or continued*)',
  45672. 146 => 'Continue if stopped',
  45673. 147 => 'Stop executing temporarily',
  45674. 148 => 'Terminal stop signal',
  45675. 149 => 'Background process attempting to read from tty ("in")',
  45676. 150 => 'Background process attempting to write to tty ("out")',
  45677. 151 => 'Urgent data available on socket',
  45678. 152 => 'CPU time limit exceeded',
  45679. 153 => 'File size limit exceeded',
  45680. 154 => 'Signal raised by timer counting virtual time: "virtual timer expired"',
  45681. 155 => 'Profiling timer expired',
  45682. 157 => 'Pollable event',
  45683. 159 => 'Bad syscall',
  45684. );
  45685. public function __construct($commandline, $cwd = null, array $env = null, $input = null, $timeout = 60, array $options = array())
  45686. {
  45687. if (!function_exists('proc_open')) {
  45688. throw new RuntimeException('The Process class relies on proc_open, which is not available on your PHP installation.');
  45689. }
  45690. $this->commandline = $commandline;
  45691. $this->cwd = $cwd;
  45692. if (null === $this->cwd && (defined('ZEND_THREAD_SAFE') || '\\' === DIRECTORY_SEPARATOR)) {
  45693. $this->cwd = getcwd();
  45694. }
  45695. if (null !== $env) {
  45696. $this->setEnv($env);
  45697. }
  45698. $this->setInput($input);
  45699. $this->setTimeout($timeout);
  45700. $this->useFileHandles = '\\' === DIRECTORY_SEPARATOR;
  45701. $this->pty = false;
  45702. $this->enhanceSigchildCompatibility = '\\' !== DIRECTORY_SEPARATOR && $this->isSigchildEnabled();
  45703. $this->options = array_replace(array('suppress_errors' => true, 'binary_pipes' => true), $options);
  45704. }
  45705. public function __destruct()
  45706. {
  45707. $this->stop(0);
  45708. }
  45709. public function __clone()
  45710. {
  45711. $this->resetProcessData();
  45712. }
  45713. public function run($callback = null)
  45714. {
  45715. $this->start($callback);
  45716. return $this->wait();
  45717. }
  45718. public function mustRun($callback = null)
  45719. {
  45720. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  45721. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  45722. }
  45723. if (0 !== $this->run($callback)) {
  45724. throw new ProcessFailedException($this);
  45725. }
  45726. return $this;
  45727. }
  45728. public function start($callback = null)
  45729. {
  45730. if ($this->isRunning()) {
  45731. throw new RuntimeException('Process is already running');
  45732. }
  45733. if ($this->outputDisabled && null !== $callback) {
  45734. throw new LogicException('Output has been disabled, enable it to allow the use of a callback.');
  45735. }
  45736. $this->resetProcessData();
  45737. $this->starttime = $this->lastOutputTime = microtime(true);
  45738. $this->callback = $this->buildCallback($callback);
  45739. $descriptors = $this->getDescriptors();
  45740. $commandline = $this->commandline;
  45741. if ('\\' === DIRECTORY_SEPARATOR && $this->enhanceWindowsCompatibility) {
  45742. $commandline = 'cmd /V:ON /E:ON /D /C "('.$commandline.')';
  45743. foreach ($this->processPipes->getFiles() as $offset => $filename) {
  45744. $commandline .= ' '.$offset.'>'.ProcessUtils::escapeArgument($filename);
  45745. }
  45746. $commandline .= '"';
  45747. if (!isset($this->options['bypass_shell'])) {
  45748. $this->options['bypass_shell'] = true;
  45749. }
  45750. } elseif (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  45751. $descriptors[3] = array('pipe', 'w');
  45752. $commandline = '{ ('.$this->commandline.') <&3 3<&- 3>/dev/null & } 3<&0;';
  45753. $commandline .= 'pid=$!; echo $pid >&3; wait $pid; code=$?; echo $code >&3; exit $code';
  45754. $ptsWorkaround = fopen(__FILE__, 'r');
  45755. }
  45756. $this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $this->env, $this->options);
  45757. if (!is_resource($this->process)) {
  45758. throw new RuntimeException('Unable to launch a new process.');
  45759. }
  45760. $this->status = self::STATUS_STARTED;
  45761. if (isset($descriptors[3])) {
  45762. $this->fallbackStatus['pid'] = (int) fgets($this->processPipes->pipes[3]);
  45763. }
  45764. if ($this->tty) {
  45765. return;
  45766. }
  45767. $this->updateStatus(false);
  45768. $this->checkTimeout();
  45769. }
  45770. public function restart($callback = null)
  45771. {
  45772. if ($this->isRunning()) {
  45773. throw new RuntimeException('Process is already running');
  45774. }
  45775. $process = clone $this;
  45776. $process->start($callback);
  45777. return $process;
  45778. }
  45779. public function wait($callback = null)
  45780. {
  45781. $this->requireProcessIsStarted(__FUNCTION__);
  45782. $this->updateStatus(false);
  45783. if (null !== $callback) {
  45784. $this->callback = $this->buildCallback($callback);
  45785. }
  45786. do {
  45787. $this->checkTimeout();
  45788. $running = '\\' === DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
  45789. $this->readPipes($running, '\\' !== DIRECTORY_SEPARATOR || !$running);
  45790. } while ($running);
  45791. while ($this->isRunning()) {
  45792. usleep(1000);
  45793. }
  45794. if ($this->processInformation['signaled'] && $this->processInformation['termsig'] !== $this->latestSignal) {
  45795. throw new RuntimeException(sprintf('The process has been signaled with signal "%s".', $this->processInformation['termsig']));
  45796. }
  45797. return $this->exitcode;
  45798. }
  45799. public function getPid()
  45800. {
  45801. return $this->isRunning() ? $this->processInformation['pid'] : null;
  45802. }
  45803. public function signal($signal)
  45804. {
  45805. $this->doSignal($signal, true);
  45806. return $this;
  45807. }
  45808. public function disableOutput()
  45809. {
  45810. if ($this->isRunning()) {
  45811. throw new RuntimeException('Disabling output while the process is running is not possible.');
  45812. }
  45813. if (null !== $this->idleTimeout) {
  45814. throw new LogicException('Output can not be disabled while an idle timeout is set.');
  45815. }
  45816. $this->outputDisabled = true;
  45817. return $this;
  45818. }
  45819. public function enableOutput()
  45820. {
  45821. if ($this->isRunning()) {
  45822. throw new RuntimeException('Enabling output while the process is running is not possible.');
  45823. }
  45824. $this->outputDisabled = false;
  45825. return $this;
  45826. }
  45827. public function isOutputDisabled()
  45828. {
  45829. return $this->outputDisabled;
  45830. }
  45831. public function getOutput()
  45832. {
  45833. $this->readPipesForOutput(__FUNCTION__);
  45834. if (false === $ret = stream_get_contents($this->stdout, -1, 0)) {
  45835. return '';
  45836. }
  45837. return $ret;
  45838. }
  45839. public function getIncrementalOutput()
  45840. {
  45841. $this->readPipesForOutput(__FUNCTION__);
  45842. $latest = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset);
  45843. $this->incrementalOutputOffset = ftell($this->stdout);
  45844. if (false === $latest) {
  45845. return '';
  45846. }
  45847. return $latest;
  45848. }
  45849. public function clearOutput()
  45850. {
  45851. ftruncate($this->stdout, 0);
  45852. fseek($this->stdout, 0);
  45853. $this->incrementalOutputOffset = 0;
  45854. return $this;
  45855. }
  45856. public function getErrorOutput()
  45857. {
  45858. $this->readPipesForOutput(__FUNCTION__);
  45859. if (false === $ret = stream_get_contents($this->stderr, -1, 0)) {
  45860. return '';
  45861. }
  45862. return $ret;
  45863. }
  45864. public function getIncrementalErrorOutput()
  45865. {
  45866. $this->readPipesForOutput(__FUNCTION__);
  45867. $latest = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);
  45868. $this->incrementalErrorOutputOffset = ftell($this->stderr);
  45869. if (false === $latest) {
  45870. return '';
  45871. }
  45872. return $latest;
  45873. }
  45874. public function clearErrorOutput()
  45875. {
  45876. ftruncate($this->stderr, 0);
  45877. fseek($this->stderr, 0);
  45878. $this->incrementalErrorOutputOffset = 0;
  45879. return $this;
  45880. }
  45881. public function getExitCode()
  45882. {
  45883. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  45884. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  45885. }
  45886. $this->updateStatus(false);
  45887. return $this->exitcode;
  45888. }
  45889. public function getExitCodeText()
  45890. {
  45891. if (null === $exitcode = $this->getExitCode()) {
  45892. return;
  45893. }
  45894. return isset(self::$exitCodes[$exitcode]) ? self::$exitCodes[$exitcode] : 'Unknown error';
  45895. }
  45896. public function isSuccessful()
  45897. {
  45898. return 0 === $this->getExitCode();
  45899. }
  45900. public function hasBeenSignaled()
  45901. {
  45902. $this->requireProcessIsTerminated(__FUNCTION__);
  45903. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  45904. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  45905. }
  45906. return $this->processInformation['signaled'];
  45907. }
  45908. public function getTermSignal()
  45909. {
  45910. $this->requireProcessIsTerminated(__FUNCTION__);
  45911. if ($this->isSigchildEnabled() && (!$this->enhanceSigchildCompatibility || -1 === $this->processInformation['termsig'])) {
  45912. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  45913. }
  45914. return $this->processInformation['termsig'];
  45915. }
  45916. public function hasBeenStopped()
  45917. {
  45918. $this->requireProcessIsTerminated(__FUNCTION__);
  45919. return $this->processInformation['stopped'];
  45920. }
  45921. public function getStopSignal()
  45922. {
  45923. $this->requireProcessIsTerminated(__FUNCTION__);
  45924. return $this->processInformation['stopsig'];
  45925. }
  45926. public function isRunning()
  45927. {
  45928. if (self::STATUS_STARTED !== $this->status) {
  45929. return false;
  45930. }
  45931. $this->updateStatus(false);
  45932. return $this->processInformation['running'];
  45933. }
  45934. public function isStarted()
  45935. {
  45936. return self::STATUS_READY != $this->status;
  45937. }
  45938. public function isTerminated()
  45939. {
  45940. $this->updateStatus(false);
  45941. return self::STATUS_TERMINATED == $this->status;
  45942. }
  45943. public function getStatus()
  45944. {
  45945. $this->updateStatus(false);
  45946. return $this->status;
  45947. }
  45948. public function stop($timeout = 10, $signal = null)
  45949. {
  45950. $timeoutMicro = microtime(true) + $timeout;
  45951. if ($this->isRunning()) {
  45952. $this->doSignal(15, false);
  45953. do {
  45954. usleep(1000);
  45955. } while ($this->isRunning() && microtime(true) < $timeoutMicro);
  45956. if ($this->isRunning()) {
  45957. $this->doSignal($signal ?: 9, false);
  45958. }
  45959. }
  45960. if ($this->isRunning()) {
  45961. if (isset($this->fallbackStatus['pid'])) {
  45962. unset($this->fallbackStatus['pid']);
  45963. return $this->stop(0, $signal);
  45964. }
  45965. $this->close();
  45966. }
  45967. return $this->exitcode;
  45968. }
  45969. public function addOutput($line)
  45970. {
  45971. $this->lastOutputTime = microtime(true);
  45972. fseek($this->stdout, 0, SEEK_END);
  45973. fwrite($this->stdout, $line);
  45974. fseek($this->stdout, $this->incrementalOutputOffset);
  45975. }
  45976. public function addErrorOutput($line)
  45977. {
  45978. $this->lastOutputTime = microtime(true);
  45979. fseek($this->stderr, 0, SEEK_END);
  45980. fwrite($this->stderr, $line);
  45981. fseek($this->stderr, $this->incrementalErrorOutputOffset);
  45982. }
  45983. public function getCommandLine()
  45984. {
  45985. return $this->commandline;
  45986. }
  45987. public function setCommandLine($commandline)
  45988. {
  45989. $this->commandline = $commandline;
  45990. return $this;
  45991. }
  45992. public function getTimeout()
  45993. {
  45994. return $this->timeout;
  45995. }
  45996. public function getIdleTimeout()
  45997. {
  45998. return $this->idleTimeout;
  45999. }
  46000. public function setTimeout($timeout)
  46001. {
  46002. $this->timeout = $this->validateTimeout($timeout);
  46003. return $this;
  46004. }
  46005. public function setIdleTimeout($timeout)
  46006. {
  46007. if (null !== $timeout && $this->outputDisabled) {
  46008. throw new LogicException('Idle timeout can not be set while the output is disabled.');
  46009. }
  46010. $this->idleTimeout = $this->validateTimeout($timeout);
  46011. return $this;
  46012. }
  46013. public function setTty($tty)
  46014. {
  46015. if ('\\' === DIRECTORY_SEPARATOR && $tty) {
  46016. throw new RuntimeException('TTY mode is not supported on Windows platform.');
  46017. }
  46018. if ($tty) {
  46019. static $isTtySupported;
  46020. if (null === $isTtySupported) {
  46021. $isTtySupported = (bool) @proc_open('echo 1 >/dev/null', array(array('file', '/dev/tty', 'r'), array('file', '/dev/tty', 'w'), array('file', '/dev/tty', 'w')), $pipes);
  46022. }
  46023. if (!$isTtySupported) {
  46024. throw new RuntimeException('TTY mode requires /dev/tty to be read/writable.');
  46025. }
  46026. }
  46027. $this->tty = (bool) $tty;
  46028. return $this;
  46029. }
  46030. public function isTty()
  46031. {
  46032. return $this->tty;
  46033. }
  46034. public function setPty($bool)
  46035. {
  46036. $this->pty = (bool) $bool;
  46037. return $this;
  46038. }
  46039. public function isPty()
  46040. {
  46041. return $this->pty;
  46042. }
  46043. public function getWorkingDirectory()
  46044. {
  46045. if (null === $this->cwd) {
  46046. return getcwd() ?: null;
  46047. }
  46048. return $this->cwd;
  46049. }
  46050. public function setWorkingDirectory($cwd)
  46051. {
  46052. $this->cwd = $cwd;
  46053. return $this;
  46054. }
  46055. public function getEnv()
  46056. {
  46057. return $this->env;
  46058. }
  46059. public function setEnv(array $env)
  46060. {
  46061. $env = array_filter($env, function ($value) {
  46062. return !is_array($value);
  46063. });
  46064. $this->env = array();
  46065. foreach ($env as $key => $value) {
  46066. $this->env[$key] = (string) $value;
  46067. }
  46068. return $this;
  46069. }
  46070. public function getStdin()
  46071. {
  46072. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.5 and will be removed in 3.0. Use the getInput() method instead.', E_USER_DEPRECATED);
  46073. return $this->getInput();
  46074. }
  46075. public function getInput()
  46076. {
  46077. return $this->input;
  46078. }
  46079. public function setStdin($stdin)
  46080. {
  46081. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.5 and will be removed in 3.0. Use the setInput() method instead.', E_USER_DEPRECATED);
  46082. return $this->setInput($stdin);
  46083. }
  46084. public function setInput($input)
  46085. {
  46086. if ($this->isRunning()) {
  46087. throw new LogicException('Input can not be set while the process is running.');
  46088. }
  46089. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  46090. return $this;
  46091. }
  46092. public function getOptions()
  46093. {
  46094. return $this->options;
  46095. }
  46096. public function setOptions(array $options)
  46097. {
  46098. $this->options = $options;
  46099. return $this;
  46100. }
  46101. public function getEnhanceWindowsCompatibility()
  46102. {
  46103. return $this->enhanceWindowsCompatibility;
  46104. }
  46105. public function setEnhanceWindowsCompatibility($enhance)
  46106. {
  46107. $this->enhanceWindowsCompatibility = (bool) $enhance;
  46108. return $this;
  46109. }
  46110. public function getEnhanceSigchildCompatibility()
  46111. {
  46112. return $this->enhanceSigchildCompatibility;
  46113. }
  46114. public function setEnhanceSigchildCompatibility($enhance)
  46115. {
  46116. $this->enhanceSigchildCompatibility = (bool) $enhance;
  46117. return $this;
  46118. }
  46119. public function checkTimeout()
  46120. {
  46121. if (self::STATUS_STARTED !== $this->status) {
  46122. return;
  46123. }
  46124. if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) {
  46125. $this->stop(0);
  46126. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_GENERAL);
  46127. }
  46128. if (null !== $this->idleTimeout && $this->idleTimeout < microtime(true) - $this->lastOutputTime) {
  46129. $this->stop(0);
  46130. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_IDLE);
  46131. }
  46132. }
  46133. public static function isPtySupported()
  46134. {
  46135. static $result;
  46136. if (null !== $result) {
  46137. return $result;
  46138. }
  46139. if ('\\' === DIRECTORY_SEPARATOR) {
  46140. return $result = false;
  46141. }
  46142. return $result = (bool) @proc_open('echo 1 >/dev/null', array(array('pty'), array('pty'), array('pty')), $pipes);
  46143. }
  46144. private function getDescriptors()
  46145. {
  46146. if ('\\' === DIRECTORY_SEPARATOR) {
  46147. $this->processPipes = WindowsPipes::create($this, $this->input);
  46148. } else {
  46149. $this->processPipes = UnixPipes::create($this, $this->input);
  46150. }
  46151. return $this->processPipes->getDescriptors();
  46152. }
  46153. protected function buildCallback($callback)
  46154. {
  46155. $that = $this;
  46156. $out = self::OUT;
  46157. $callback = function ($type, $data) use ($that, $callback, $out) {
  46158. if ($out == $type) {
  46159. $that->addOutput($data);
  46160. } else {
  46161. $that->addErrorOutput($data);
  46162. }
  46163. if (null !== $callback) {
  46164. call_user_func($callback, $type, $data);
  46165. }
  46166. };
  46167. return $callback;
  46168. }
  46169. protected function updateStatus($blocking)
  46170. {
  46171. if (self::STATUS_STARTED !== $this->status) {
  46172. return;
  46173. }
  46174. $this->processInformation = proc_get_status($this->process);
  46175. $running = $this->processInformation['running'];
  46176. $this->readPipes($running && $blocking, '\\' !== DIRECTORY_SEPARATOR || !$running);
  46177. if ($this->fallbackStatus && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  46178. $this->processInformation = $this->fallbackStatus + $this->processInformation;
  46179. }
  46180. if (!$running) {
  46181. $this->close();
  46182. }
  46183. }
  46184. protected function isSigchildEnabled()
  46185. {
  46186. if (null !== self::$sigchild) {
  46187. return self::$sigchild;
  46188. }
  46189. if (!function_exists('phpinfo') || defined('HHVM_VERSION')) {
  46190. return self::$sigchild = false;
  46191. }
  46192. ob_start();
  46193. phpinfo(INFO_GENERAL);
  46194. return self::$sigchild = false !== strpos(ob_get_clean(), '--enable-sigchild');
  46195. }
  46196. private function readPipesForOutput($caller)
  46197. {
  46198. if ($this->outputDisabled) {
  46199. throw new LogicException('Output has been disabled.');
  46200. }
  46201. $this->requireProcessIsStarted($caller);
  46202. $this->updateStatus(false);
  46203. }
  46204. private function validateTimeout($timeout)
  46205. {
  46206. $timeout = (float) $timeout;
  46207. if (0.0 === $timeout) {
  46208. $timeout = null;
  46209. } elseif ($timeout < 0) {
  46210. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  46211. }
  46212. return $timeout;
  46213. }
  46214. private function readPipes($blocking, $close)
  46215. {
  46216. $result = $this->processPipes->readAndWrite($blocking, $close);
  46217. $callback = $this->callback;
  46218. foreach ($result as $type => $data) {
  46219. if (3 !== $type) {
  46220. $callback(self::STDOUT === $type ? self::OUT : self::ERR, $data);
  46221. } elseif (!isset($this->fallbackStatus['signaled'])) {
  46222. $this->fallbackStatus['exitcode'] = (int) $data;
  46223. }
  46224. }
  46225. }
  46226. private function close()
  46227. {
  46228. $this->processPipes->close();
  46229. if (is_resource($this->process)) {
  46230. proc_close($this->process);
  46231. }
  46232. $this->exitcode = $this->processInformation['exitcode'];
  46233. $this->status = self::STATUS_TERMINATED;
  46234. if (-1 === $this->exitcode) {
  46235. if ($this->processInformation['signaled'] && 0 < $this->processInformation['termsig']) {
  46236. $this->exitcode = 128 + $this->processInformation['termsig'];
  46237. } elseif ($this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  46238. $this->processInformation['signaled'] = true;
  46239. $this->processInformation['termsig'] = -1;
  46240. }
  46241. }
  46242. $this->callback = null;
  46243. return $this->exitcode;
  46244. }
  46245. private function resetProcessData()
  46246. {
  46247. $this->starttime = null;
  46248. $this->callback = null;
  46249. $this->exitcode = null;
  46250. $this->fallbackStatus = array();
  46251. $this->processInformation = null;
  46252. $this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'wb+');
  46253. $this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'wb+');
  46254. $this->process = null;
  46255. $this->latestSignal = null;
  46256. $this->status = self::STATUS_READY;
  46257. $this->incrementalOutputOffset = 0;
  46258. $this->incrementalErrorOutputOffset = 0;
  46259. }
  46260. private function doSignal($signal, $throwException)
  46261. {
  46262. if (null === $pid = $this->getPid()) {
  46263. if ($throwException) {
  46264. throw new LogicException('Can not send signal on a non running process.');
  46265. }
  46266. return false;
  46267. }
  46268. if ('\\' === DIRECTORY_SEPARATOR) {
  46269. exec(sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode);
  46270. if ($exitCode && $this->isRunning()) {
  46271. if ($throwException) {
  46272. throw new RuntimeException(sprintf('Unable to kill the process (%s).', implode(' ', $output)));
  46273. }
  46274. return false;
  46275. }
  46276. } else {
  46277. if (!$this->enhanceSigchildCompatibility || !$this->isSigchildEnabled()) {
  46278. $ok = @proc_terminate($this->process, $signal);
  46279. } elseif (function_exists('posix_kill')) {
  46280. $ok = @posix_kill($pid, $signal);
  46281. } elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), array(2 => array('pipe', 'w')), $pipes)) {
  46282. $ok = false === fgets($pipes[2]);
  46283. }
  46284. if (!$ok) {
  46285. if ($throwException) {
  46286. throw new RuntimeException(sprintf('Error while sending signal `%s`.', $signal));
  46287. }
  46288. return false;
  46289. }
  46290. }
  46291. $this->latestSignal = (int) $signal;
  46292. $this->fallbackStatus['signaled'] = true;
  46293. $this->fallbackStatus['exitcode'] = -1;
  46294. $this->fallbackStatus['termsig'] = $this->latestSignal;
  46295. return true;
  46296. }
  46297. private function requireProcessIsStarted($functionName)
  46298. {
  46299. if (!$this->isStarted()) {
  46300. throw new LogicException(sprintf('Process must be started before calling %s.', $functionName));
  46301. }
  46302. }
  46303. private function requireProcessIsTerminated($functionName)
  46304. {
  46305. if (!$this->isTerminated()) {
  46306. throw new LogicException(sprintf('Process must be terminated before calling %s.', $functionName));
  46307. }
  46308. }
  46309. }
  46310. <?php
  46311. namespace Symfony\Component\Process;
  46312. use Symfony\Component\Process\Exception\InvalidArgumentException;
  46313. use Symfony\Component\Process\Exception\LogicException;
  46314. class ProcessBuilder
  46315. {
  46316. private $arguments;
  46317. private $cwd;
  46318. private $env = array();
  46319. private $input;
  46320. private $timeout = 60;
  46321. private $options = array();
  46322. private $inheritEnv = true;
  46323. private $prefix = array();
  46324. private $outputDisabled = false;
  46325. public function __construct(array $arguments = array())
  46326. {
  46327. $this->arguments = $arguments;
  46328. }
  46329. public static function create(array $arguments = array())
  46330. {
  46331. return new static($arguments);
  46332. }
  46333. public function add($argument)
  46334. {
  46335. $this->arguments[] = $argument;
  46336. return $this;
  46337. }
  46338. public function setPrefix($prefix)
  46339. {
  46340. $this->prefix = is_array($prefix) ? $prefix : array($prefix);
  46341. return $this;
  46342. }
  46343. public function setArguments(array $arguments)
  46344. {
  46345. $this->arguments = $arguments;
  46346. return $this;
  46347. }
  46348. public function setWorkingDirectory($cwd)
  46349. {
  46350. $this->cwd = $cwd;
  46351. return $this;
  46352. }
  46353. public function inheritEnvironmentVariables($inheritEnv = true)
  46354. {
  46355. $this->inheritEnv = $inheritEnv;
  46356. return $this;
  46357. }
  46358. public function setEnv($name, $value)
  46359. {
  46360. $this->env[$name] = $value;
  46361. return $this;
  46362. }
  46363. public function addEnvironmentVariables(array $variables)
  46364. {
  46365. $this->env = array_replace($this->env, $variables);
  46366. return $this;
  46367. }
  46368. public function setInput($input)
  46369. {
  46370. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  46371. return $this;
  46372. }
  46373. public function setTimeout($timeout)
  46374. {
  46375. if (null === $timeout) {
  46376. $this->timeout = null;
  46377. return $this;
  46378. }
  46379. $timeout = (float) $timeout;
  46380. if ($timeout < 0) {
  46381. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  46382. }
  46383. $this->timeout = $timeout;
  46384. return $this;
  46385. }
  46386. public function setOption($name, $value)
  46387. {
  46388. $this->options[$name] = $value;
  46389. return $this;
  46390. }
  46391. public function disableOutput()
  46392. {
  46393. $this->outputDisabled = true;
  46394. return $this;
  46395. }
  46396. public function enableOutput()
  46397. {
  46398. $this->outputDisabled = false;
  46399. return $this;
  46400. }
  46401. public function getProcess()
  46402. {
  46403. if (0 === count($this->prefix) && 0 === count($this->arguments)) {
  46404. throw new LogicException('You must add() command arguments before calling getProcess().');
  46405. }
  46406. $options = $this->options;
  46407. $arguments = array_merge($this->prefix, $this->arguments);
  46408. $script = implode(' ', array_map(array(__NAMESPACE__.'\\ProcessUtils', 'escapeArgument'), $arguments));
  46409. if ($this->inheritEnv) {
  46410. $env = array_replace($_ENV, $_SERVER, $this->env);
  46411. } else {
  46412. $env = $this->env;
  46413. }
  46414. $process = new Process($script, $this->cwd, $env, $this->input, $this->timeout, $options);
  46415. if ($this->outputDisabled) {
  46416. $process->disableOutput();
  46417. }
  46418. return $process;
  46419. }
  46420. }
  46421. <?php
  46422. namespace Symfony\Component\Process;
  46423. use Symfony\Component\Process\Exception\InvalidArgumentException;
  46424. class ProcessUtils
  46425. {
  46426. private function __construct()
  46427. {
  46428. }
  46429. public static function escapeArgument($argument)
  46430. {
  46431. if ('\\' === DIRECTORY_SEPARATOR) {
  46432. if ('' === $argument) {
  46433. return escapeshellarg($argument);
  46434. }
  46435. $escapedArgument = '';
  46436. $quote = false;
  46437. foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
  46438. if ('"' === $part) {
  46439. $escapedArgument .= '\\"';
  46440. } elseif (self::isSurroundedBy($part, '%')) {
  46441. $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%';
  46442. } else {
  46443. if ('\\' === substr($part, -1)) {
  46444. $part .= '\\';
  46445. }
  46446. $quote = true;
  46447. $escapedArgument .= $part;
  46448. }
  46449. }
  46450. if ($quote) {
  46451. $escapedArgument = '"'.$escapedArgument.'"';
  46452. }
  46453. return $escapedArgument;
  46454. }
  46455. return "'".str_replace("'", "'\\''", $argument)."'";
  46456. }
  46457. public static function validateInput($caller, $input)
  46458. {
  46459. if (null !== $input) {
  46460. if (is_resource($input)) {
  46461. return $input;
  46462. }
  46463. if (is_string($input)) {
  46464. return $input;
  46465. }
  46466. if (is_scalar($input)) {
  46467. return (string) $input;
  46468. }
  46469. if (is_object($input) && method_exists($input, '__toString')) {
  46470. @trigger_error('Passing an object as an input is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  46471. return (string) $input;
  46472. }
  46473. throw new InvalidArgumentException(sprintf('%s only accepts strings or stream resources.', $caller));
  46474. }
  46475. return $input;
  46476. }
  46477. private static function isSurroundedBy($arg, $char)
  46478. {
  46479. return 2 < strlen($arg) && $char === $arg[0] && $char === $arg[strlen($arg) - 1];
  46480. }
  46481. }
  46482. Copyright (c) 2011 Jordi Boggiano
  46483. Permission is hereby granted, free of charge, to any person obtaining a copy
  46484. of this software and associated documentation files (the "Software"), to deal
  46485. in the Software without restriction, including without limitation the rights
  46486. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  46487. copies of the Software, and to permit persons to whom the Software is furnished
  46488. to do so, subject to the following conditions:
  46489. The above copyright notice and this permission notice shall be included in all
  46490. copies or substantial portions of the Software.
  46491. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  46492. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  46493. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  46494. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  46495. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  46496. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  46497. THE SOFTWARE.
  46498. <?php
  46499. namespace Seld\JsonLint;
  46500. class DuplicateKeyException extends ParsingException
  46501. {
  46502. public function __construct($message, $key, array $details = array())
  46503. {
  46504. $details['key'] = $key;
  46505. parent::__construct($message, $details);
  46506. }
  46507. public function getKey()
  46508. {
  46509. return $this->details['key'];
  46510. }
  46511. }
  46512. <?php
  46513. namespace Seld\JsonLint;
  46514. use stdClass;
  46515. class JsonParser
  46516. {
  46517. const DETECT_KEY_CONFLICTS = 1;
  46518. const ALLOW_DUPLICATE_KEYS = 2;
  46519. const PARSE_TO_ASSOC = 4;
  46520. private $lexer;
  46521. private $flags;
  46522. private $stack;
  46523. private $vstack;
  46524. private $lstack;
  46525. private $symbols = array(
  46526. 'error' => 2,
  46527. 'JSONString' => 3,
  46528. 'STRING' => 4,
  46529. 'JSONNumber' => 5,
  46530. 'NUMBER' => 6,
  46531. 'JSONNullLiteral' => 7,
  46532. 'NULL' => 8,
  46533. 'JSONBooleanLiteral' => 9,
  46534. 'TRUE' => 10,
  46535. 'FALSE' => 11,
  46536. 'JSONText' => 12,
  46537. 'JSONValue' => 13,
  46538. 'EOF' => 14,
  46539. 'JSONObject' => 15,
  46540. 'JSONArray' => 16,
  46541. '{' => 17,
  46542. '}' => 18,
  46543. 'JSONMemberList' => 19,
  46544. 'JSONMember' => 20,
  46545. ':' => 21,
  46546. ',' => 22,
  46547. '[' => 23,
  46548. ']' => 24,
  46549. 'JSONElementList' => 25,
  46550. '$accept' => 0,
  46551. '$end' => 1,
  46552. );
  46553. private $terminals_ = array(
  46554. 2 => "error",
  46555. 4 => "STRING",
  46556. 6 => "NUMBER",
  46557. 8 => "NULL",
  46558. 10 => "TRUE",
  46559. 11 => "FALSE",
  46560. 14 => "EOF",
  46561. 17 => "{",
  46562. 18 => "}",
  46563. 21 => ":",
  46564. 22 => ",",
  46565. 23 => "[",
  46566. 24 => "]",
  46567. );
  46568. private $productions_ = array(
  46569. 0,
  46570. array(3, 1),
  46571. array(5, 1),
  46572. array(7, 1),
  46573. array(9, 1),
  46574. array(9, 1),
  46575. array(12, 2),
  46576. array(13, 1),
  46577. array(13, 1),
  46578. array(13, 1),
  46579. array(13, 1),
  46580. array(13, 1),
  46581. array(13, 1),
  46582. array(15, 2),
  46583. array(15, 3),
  46584. array(20, 3),
  46585. array(19, 1),
  46586. array(19, 3),
  46587. array(16, 2),
  46588. array(16, 3),
  46589. array(25, 1),
  46590. array(25, 3)
  46591. );
  46592. private $table = array(array(3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 12 => 1, 13 => 2, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)), array( 1 => array(3)), array( 14 => array(1,16)), array( 14 => array(2,7), 18 => array(2,7), 22 => array(2,7), 24 => array(2,7)), array( 14 => array(2,8), 18 => array(2,8), 22 => array(2,8), 24 => array(2,8)), array( 14 => array(2,9), 18 => array(2,9), 22 => array(2,9), 24 => array(2,9)), array( 14 => array(2,10), 18 => array(2,10), 22 => array(2,10), 24 => array(2,10)), array( 14 => array(2,11), 18 => array(2,11), 22 => array(2,11), 24 => array(2,11)), array( 14 => array(2,12), 18 => array(2,12), 22 => array(2,12), 24 => array(2,12)), array( 14 => array(2,3), 18 => array(2,3), 22 => array(2,3), 24 => array(2,3)), array( 14 => array(2,4), 18 => array(2,4), 22 => array(2,4), 24 => array(2,4)), array( 14 => array(2,5), 18 => array(2,5), 22 => array(2,5), 24 => array(2,5)), array( 14 => array(2,1), 18 => array(2,1), 21 => array(2,1), 22 => array(2,1), 24 => array(2,1)), array( 14 => array(2,2), 18 => array(2,2), 22 => array(2,2), 24 => array(2,2)), array( 3 => 20, 4 => array(1,12), 18 => array(1,17), 19 => 18, 20 => 19 ), array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 23, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15), 24 => array(1,21), 25 => 22 ), array( 1 => array(2,6)), array( 14 => array(2,13), 18 => array(2,13), 22 => array(2,13), 24 => array(2,13)), array( 18 => array(1,24), 22 => array(1,25)), array( 18 => array(2,16), 22 => array(2,16)), array( 21 => array(1,26)), array( 14 => array(2,18), 18 => array(2,18), 22 => array(2,18), 24 => array(2,18)), array( 22 => array(1,28), 24 => array(1,27)), array( 22 => array(2,20), 24 => array(2,20)), array( 14 => array(2,14), 18 => array(2,14), 22 => array(2,14), 24 => array(2,14)), array( 3 => 20, 4 => array(1,12), 20 => 29 ), array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 30, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)), array( 14 => array(2,19), 18 => array(2,19), 22 => array(2,19), 24 => array(2,19)), array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 31, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)), array( 18 => array(2,17), 22 => array(2,17)), array( 18 => array(2,15), 22 => array(2,15)), array( 22 => array(2,21), 24 => array(2,21)),
  46593. );
  46594. private $defaultActions = array(
  46595. 16 => array(2, 6)
  46596. );
  46597. public function lint($input, $flags = 0)
  46598. {
  46599. try {
  46600. $this->parse($input, $flags);
  46601. } catch (ParsingException $e) {
  46602. return $e;
  46603. }
  46604. }
  46605. public function parse($input, $flags = 0)
  46606. {
  46607. $this->failOnBOM($input);
  46608. $this->flags = $flags;
  46609. $this->stack = array(0);
  46610. $this->vstack = array(null);
  46611. $this->lstack = array();
  46612. $yytext = '';
  46613. $yylineno = 0;
  46614. $yyleng = 0;
  46615. $recovering = 0;
  46616. $TERROR = 2;
  46617. $EOF = 1;
  46618. $this->lexer = new Lexer();
  46619. $this->lexer->setInput($input);
  46620. $yyloc = $this->lexer->yylloc;
  46621. $this->lstack[] = $yyloc;
  46622. $symbol = null;
  46623. $preErrorSymbol = null;
  46624. $state = null;
  46625. $action = null;
  46626. $a = null;
  46627. $r = null;
  46628. $yyval = new stdClass;
  46629. $p = null;
  46630. $len = null;
  46631. $newState = null;
  46632. $expected = null;
  46633. $errStr = null;
  46634. while (true) {
  46635. $state = $this->stack[count($this->stack)-1];
  46636. if (isset($this->defaultActions[$state])) {
  46637. $action = $this->defaultActions[$state];
  46638. } else {
  46639. if ($symbol == null) {
  46640. $symbol = $this->lex();
  46641. }
  46642. $action = isset($this->table[$state][$symbol]) ? $this->table[$state][$symbol] : false;
  46643. }
  46644. if (!$action || !$action[0]) {
  46645. if (!$recovering) {
  46646. $expected = array();
  46647. foreach ($this->table[$state] as $p => $ignore) {
  46648. if (isset($this->terminals_[$p]) && $p > 2) {
  46649. $expected[] = "'" . $this->terminals_[$p] . "'";
  46650. }
  46651. }
  46652. $message = null;
  46653. if (in_array("'STRING'", $expected) && in_array(substr($this->lexer->match, 0, 1), array('"', "'"))) {
  46654. $message = "Invalid string";
  46655. if ("'" === substr($this->lexer->match, 0, 1)) {
  46656. $message .= ", it appears you used single quotes instead of double quotes";
  46657. } elseif (preg_match('{".+?(\\\\[^"bfnrt/\\\\u])}', $this->lexer->getUpcomingInput(), $match)) {
  46658. $message .= ", it appears you have an unescaped backslash at: ".$match[1];
  46659. } elseif (preg_match('{"(?:[^"]+|\\\\")*$}m', $this->lexer->getUpcomingInput())) {
  46660. $message .= ", it appears you forgot to terminate a string, or attempted to write a multiline string which is invalid";
  46661. }
  46662. }
  46663. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  46664. $errStr .= $this->lexer->showPosition() . "\n";
  46665. if ($message) {
  46666. $errStr .= $message;
  46667. } else {
  46668. $errStr .= (count($expected) > 1) ? "Expected one of: " : "Expected: ";
  46669. $errStr .= implode(', ', $expected);
  46670. }
  46671. if (',' === substr(trim($this->lexer->getPastInput()), -1)) {
  46672. $errStr .= " - It appears you have an extra trailing comma";
  46673. }
  46674. $this->parseError($errStr, array(
  46675. 'text' => $this->lexer->match,
  46676. 'token' => !empty($this->terminals_[$symbol]) ? $this->terminals_[$symbol] : $symbol,
  46677. 'line' => $this->lexer->yylineno,
  46678. 'loc' => $yyloc,
  46679. 'expected' => $expected,
  46680. ));
  46681. }
  46682. if ($recovering == 3) {
  46683. if ($symbol == $EOF) {
  46684. throw new ParsingException($errStr ?: 'Parsing halted.');
  46685. }
  46686. $yyleng = $this->lexer->yyleng;
  46687. $yytext = $this->lexer->yytext;
  46688. $yylineno = $this->lexer->yylineno;
  46689. $yyloc = $this->lexer->yylloc;
  46690. $symbol = $this->lex();
  46691. }
  46692. while (true) {
  46693. if (array_key_exists($TERROR, $this->table[$state])) {
  46694. break;
  46695. }
  46696. if ($state == 0) {
  46697. throw new ParsingException($errStr ?: 'Parsing halted.');
  46698. }
  46699. $this->popStack(1);
  46700. $state = $this->stack[count($this->stack)-1];
  46701. }
  46702. $preErrorSymbol = $symbol;
  46703. $symbol = $TERROR;
  46704. $state = $this->stack[count($this->stack)-1];
  46705. $action = isset($this->table[$state][$TERROR]) ? $this->table[$state][$TERROR] : false;
  46706. $recovering = 3;
  46707. }
  46708. if (is_array($action[0]) && count($action) > 1) {
  46709. throw new ParsingException('Parse Error: multiple actions possible at state: ' . $state . ', token: ' . $symbol);
  46710. }
  46711. switch ($action[0]) {
  46712. case 1:
  46713. $this->stack[] = $symbol;
  46714. $this->vstack[] = $this->lexer->yytext;
  46715. $this->lstack[] = $this->lexer->yylloc;
  46716. $this->stack[] = $action[1];
  46717. $symbol = null;
  46718. if (!$preErrorSymbol) {
  46719. $yyleng = $this->lexer->yyleng;
  46720. $yytext = $this->lexer->yytext;
  46721. $yylineno = $this->lexer->yylineno;
  46722. $yyloc = $this->lexer->yylloc;
  46723. if ($recovering > 0) {
  46724. $recovering--;
  46725. }
  46726. } else {
  46727. $symbol = $preErrorSymbol;
  46728. $preErrorSymbol = null;
  46729. }
  46730. break;
  46731. case 2:
  46732. $len = $this->productions_[$action[1]][1];
  46733. $yyval->token = $this->vstack[count($this->vstack) - $len];
  46734. $yyval->store = array(
  46735. 'first_line' => $this->lstack[count($this->lstack) - ($len ?: 1)]['first_line'],
  46736. 'last_line' => $this->lstack[count($this->lstack) - 1]['last_line'],
  46737. 'first_column' => $this->lstack[count($this->lstack) - ($len ?: 1)]['first_column'],
  46738. 'last_column' => $this->lstack[count($this->lstack) - 1]['last_column'],
  46739. );
  46740. $r = $this->performAction($yyval, $yytext, $yyleng, $yylineno, $action[1], $this->vstack, $this->lstack);
  46741. if (!$r instanceof Undefined) {
  46742. return $r;
  46743. }
  46744. if ($len) {
  46745. $this->popStack($len);
  46746. }
  46747. $this->stack[] = $this->productions_[$action[1]][0];
  46748. $this->vstack[] = $yyval->token;
  46749. $this->lstack[] = $yyval->store;
  46750. $newState = $this->table[$this->stack[count($this->stack)-2]][$this->stack[count($this->stack)-1]];
  46751. $this->stack[] = $newState;
  46752. break;
  46753. case 3:
  46754. return true;
  46755. }
  46756. }
  46757. return true;
  46758. }
  46759. protected function parseError($str, $hash)
  46760. {
  46761. throw new ParsingException($str, $hash);
  46762. }
  46763. private function performAction(stdClass $yyval, $yytext, $yyleng, $yylineno, $yystate, &$tokens)
  46764. {
  46765. $len = count($tokens) - 1;
  46766. switch ($yystate) {
  46767. case 1:
  46768. $yytext = preg_replace_callback('{(?:\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4})}', array($this, 'stringInterpolation'), $yytext);
  46769. $yyval->token = $yytext;
  46770. break;
  46771. case 2:
  46772. if (strpos($yytext, 'e') !== false || strpos($yytext, 'E') !== false) {
  46773. $yyval->token = floatval($yytext);
  46774. } else {
  46775. $yyval->token = strpos($yytext, '.') === false ? intval($yytext) : floatval($yytext);
  46776. }
  46777. break;
  46778. case 3:
  46779. $yyval->token = null;
  46780. break;
  46781. case 4:
  46782. $yyval->token = true;
  46783. break;
  46784. case 5:
  46785. $yyval->token = false;
  46786. break;
  46787. case 6:
  46788. return $yyval->token = $tokens[$len-1];
  46789. case 13:
  46790. if ($this->flags & self::PARSE_TO_ASSOC) {
  46791. $yyval->token = array();
  46792. } else {
  46793. $yyval->token = new stdClass;
  46794. }
  46795. break;
  46796. case 14:
  46797. $yyval->token = $tokens[$len-1];
  46798. break;
  46799. case 15:
  46800. $yyval->token = array($tokens[$len-2], $tokens[$len]);
  46801. break;
  46802. case 16:
  46803. if (PHP_VERSION_ID < 70100) {
  46804. $property = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  46805. } else {
  46806. $property = $tokens[$len][0];
  46807. }
  46808. if ($this->flags & self::PARSE_TO_ASSOC) {
  46809. $yyval->token = array();
  46810. $yyval->token[$property] = $tokens[$len][1];
  46811. } else {
  46812. $yyval->token = new stdClass;
  46813. $yyval->token->$property = $tokens[$len][1];
  46814. }
  46815. break;
  46816. case 17:
  46817. if ($this->flags & self::PARSE_TO_ASSOC) {
  46818. $yyval->token =& $tokens[$len-2];
  46819. $key = $tokens[$len][0];
  46820. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2][$key])) {
  46821. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  46822. $errStr .= $this->lexer->showPosition() . "\n";
  46823. $errStr .= "Duplicate key: ".$tokens[$len][0];
  46824. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  46825. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2][$key])) {
  46826. $duplicateCount = 1;
  46827. do {
  46828. $duplicateKey = $key . '.' . $duplicateCount++;
  46829. } while (isset($tokens[$len-2][$duplicateKey]));
  46830. $key = $duplicateKey;
  46831. }
  46832. $tokens[$len-2][$key] = $tokens[$len][1];
  46833. } else {
  46834. $yyval->token = $tokens[$len-2];
  46835. if (PHP_VERSION_ID < 70100) {
  46836. $key = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  46837. } else {
  46838. $key = $tokens[$len][0];
  46839. }
  46840. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2]->{$key})) {
  46841. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  46842. $errStr .= $this->lexer->showPosition() . "\n";
  46843. $errStr .= "Duplicate key: ".$tokens[$len][0];
  46844. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  46845. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2]->{$key})) {
  46846. $duplicateCount = 1;
  46847. do {
  46848. $duplicateKey = $key . '.' . $duplicateCount++;
  46849. } while (isset($tokens[$len-2]->$duplicateKey));
  46850. $key = $duplicateKey;
  46851. }
  46852. $tokens[$len-2]->$key = $tokens[$len][1];
  46853. }
  46854. break;
  46855. case 18:
  46856. $yyval->token = array();
  46857. break;
  46858. case 19:
  46859. $yyval->token = $tokens[$len-1];
  46860. break;
  46861. case 20:
  46862. $yyval->token = array($tokens[$len]);
  46863. break;
  46864. case 21:
  46865. $tokens[$len-2][] = $tokens[$len];
  46866. $yyval->token = $tokens[$len-2];
  46867. break;
  46868. }
  46869. return new Undefined();
  46870. }
  46871. private function stringInterpolation($match)
  46872. {
  46873. switch ($match[0]) {
  46874. case '\\\\':
  46875. return '\\';
  46876. case '\"':
  46877. return '"';
  46878. case '\b':
  46879. return chr(8);
  46880. case '\f':
  46881. return chr(12);
  46882. case '\n':
  46883. return "\n";
  46884. case '\r':
  46885. return "\r";
  46886. case '\t':
  46887. return "\t";
  46888. case '\/':
  46889. return "/";
  46890. default:
  46891. return html_entity_decode('&#x'.ltrim(substr($match[0], 2), '0').';', 0, 'UTF-8');
  46892. }
  46893. }
  46894. private function popStack($n)
  46895. {
  46896. $this->stack = array_slice($this->stack, 0, - (2 * $n));
  46897. $this->vstack = array_slice($this->vstack, 0, - $n);
  46898. $this->lstack = array_slice($this->lstack, 0, - $n);
  46899. }
  46900. private function lex()
  46901. {
  46902. $token = $this->lexer->lex() ?: 1;
  46903. if (!is_numeric($token)) {
  46904. $token = isset($this->symbols[$token]) ? $this->symbols[$token] : $token;
  46905. }
  46906. return $token;
  46907. }
  46908. private function failOnBOM($input)
  46909. {
  46910. $bom = "\xEF\xBB\xBF";
  46911. if (substr($input, 0, 3) === $bom) {
  46912. $this->parseError("BOM detected, make sure your input does not include a Unicode Byte-Order-Mark", array());
  46913. }
  46914. }
  46915. }
  46916. <?php
  46917. namespace Seld\JsonLint;
  46918. class Lexer
  46919. {
  46920. private $EOF = 1;
  46921. private $rules = array(
  46922. 0 => '/^\s+/',
  46923. 1 => '/^-?([0-9]|[1-9][0-9]+)(\.[0-9]+)?([eE][+-]?[0-9]+)?\b/',
  46924. 2 => '{^"(?>\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4}|[^\0-\x1f\\\\"]++)*+"}',
  46925. 3 => '/^\{/',
  46926. 4 => '/^\}/',
  46927. 5 => '/^\[/',
  46928. 6 => '/^\]/',
  46929. 7 => '/^,/',
  46930. 8 => '/^:/',
  46931. 9 => '/^true\b/',
  46932. 10 => '/^false\b/',
  46933. 11 => '/^null\b/',
  46934. 12 => '/^$/',
  46935. 13 => '/^./',
  46936. );
  46937. private $conditions = array(
  46938. "INITIAL" => array(
  46939. "rules" => array(0,1,2,3,4,5,6,7,8,9,10,11,12,13),
  46940. "inclusive" => true,
  46941. ),
  46942. );
  46943. private $conditionStack;
  46944. private $input;
  46945. private $more;
  46946. private $done;
  46947. private $matched;
  46948. public $match;
  46949. public $yylineno;
  46950. public $yyleng;
  46951. public $yytext;
  46952. public $yylloc;
  46953. public function lex()
  46954. {
  46955. $r = $this->next();
  46956. if (!$r instanceof Undefined) {
  46957. return $r;
  46958. }
  46959. return $this->lex();
  46960. }
  46961. public function setInput($input)
  46962. {
  46963. $this->input = $input;
  46964. $this->more = false;
  46965. $this->done = false;
  46966. $this->yylineno = $this->yyleng = 0;
  46967. $this->yytext = $this->matched = $this->match = '';
  46968. $this->conditionStack = array('INITIAL');
  46969. $this->yylloc = array('first_line' => 1, 'first_column' => 0, 'last_line' => 1, 'last_column' => 0);
  46970. return $this;
  46971. }
  46972. public function showPosition()
  46973. {
  46974. $pre = str_replace("\n", '', $this->getPastInput());
  46975. $c = str_repeat('-', max(0, strlen($pre) - 1));
  46976. return $pre . str_replace("\n", '', $this->getUpcomingInput()) . "\n" . $c . "^";
  46977. }
  46978. public function getPastInput()
  46979. {
  46980. $past = substr($this->matched, 0, strlen($this->matched) - strlen($this->match));
  46981. return (strlen($past) > 20 ? '...' : '') . substr($past, -20);
  46982. }
  46983. public function getUpcomingInput()
  46984. {
  46985. $next = $this->match;
  46986. if (strlen($next) < 20) {
  46987. $next .= substr($this->input, 0, 20 - strlen($next));
  46988. }
  46989. return substr($next, 0, 20) . (strlen($next) > 20 ? '...' : '');
  46990. }
  46991. protected function parseError($str, $hash)
  46992. {
  46993. throw new \Exception($str);
  46994. }
  46995. private function next()
  46996. {
  46997. if ($this->done) {
  46998. return $this->EOF;
  46999. }
  47000. if ($this->input === '') {
  47001. $this->done = true;
  47002. }
  47003. $token = null;
  47004. $match = null;
  47005. $col = null;
  47006. $lines = null;
  47007. if (!$this->more) {
  47008. $this->yytext = '';
  47009. $this->match = '';
  47010. }
  47011. $rules = $this->getCurrentRules();
  47012. $rulesLen = count($rules);
  47013. for ($i=0; $i < $rulesLen; $i++) {
  47014. if (preg_match($this->rules[$rules[$i]], $this->input, $match)) {
  47015. preg_match_all('/\n.*/', $match[0], $lines);
  47016. $lines = $lines[0];
  47017. if ($lines) {
  47018. $this->yylineno += count($lines);
  47019. }
  47020. $this->yylloc = array(
  47021. 'first_line' => $this->yylloc['last_line'],
  47022. 'last_line' => $this->yylineno+1,
  47023. 'first_column' => $this->yylloc['last_column'],
  47024. 'last_column' => $lines ? strlen($lines[count($lines) - 1]) - 1 : $this->yylloc['last_column'] + strlen($match[0]),
  47025. );
  47026. $this->yytext .= $match[0];
  47027. $this->match .= $match[0];
  47028. $this->yyleng = strlen($this->yytext);
  47029. $this->more = false;
  47030. $this->input = substr($this->input, strlen($match[0]));
  47031. $this->matched .= $match[0];
  47032. $token = $this->performAction($rules[$i], $this->conditionStack[count($this->conditionStack)-1]);
  47033. if ($token) {
  47034. return $token;
  47035. }
  47036. return new Undefined();
  47037. }
  47038. }
  47039. if ($this->input === "") {
  47040. return $this->EOF;
  47041. }
  47042. $this->parseError(
  47043. 'Lexical error on line ' . ($this->yylineno+1) . ". Unrecognized text.\n" . $this->showPosition(),
  47044. array(
  47045. 'text' => "",
  47046. 'token' => null,
  47047. 'line' => $this->yylineno,
  47048. )
  47049. );
  47050. }
  47051. private function getCurrentRules()
  47052. {
  47053. return $this->conditions[$this->conditionStack[count($this->conditionStack)-1]]['rules'];
  47054. }
  47055. private function performAction($avoiding_name_collisions, $YY_START)
  47056. {
  47057. switch ($avoiding_name_collisions) {
  47058. case 0:
  47059. break;
  47060. case 1:
  47061. return 6;
  47062. break;
  47063. case 2:
  47064. $this->yytext = substr($this->yytext, 1, $this->yyleng-2);
  47065. return 4;
  47066. case 3:
  47067. return 17;
  47068. case 4:
  47069. return 18;
  47070. case 5:
  47071. return 23;
  47072. case 6:
  47073. return 24;
  47074. case 7:
  47075. return 22;
  47076. case 8:
  47077. return 21;
  47078. case 9:
  47079. return 10;
  47080. case 10:
  47081. return 11;
  47082. case 11:
  47083. return 8;
  47084. case 12:
  47085. return 14;
  47086. case 13:
  47087. return 'INVALID';
  47088. }
  47089. }
  47090. }
  47091. <?php
  47092. namespace Seld\JsonLint;
  47093. class ParsingException extends \Exception
  47094. {
  47095. protected $details;
  47096. public function __construct($message, $details = array())
  47097. {
  47098. $this->details = $details;
  47099. parent::__construct($message);
  47100. }
  47101. public function getDetails()
  47102. {
  47103. return $this->details;
  47104. }
  47105. }
  47106. <?php
  47107. namespace Seld\JsonLint;
  47108. class Undefined
  47109. {
  47110. }
  47111. MIT License
  47112. Copyright (c) 2016
  47113. Permission is hereby granted, free of charge, to any person obtaining a copy
  47114. of this software and associated documentation files (the "Software"), to deal
  47115. in the Software without restriction, including without limitation the rights
  47116. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  47117. copies of the Software, and to permit persons to whom the Software is
  47118. furnished to do so, subject to the following conditions:
  47119. The above copyright notice and this permission notice shall be included in all
  47120. copies or substantial portions of the Software.
  47121. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  47122. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  47123. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  47124. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  47125. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  47126. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  47127. SOFTWARE.
  47128. <?php
  47129. require __DIR__ . '/../vendor/autoload.php';
  47130. $data = json_decode(file_get_contents('data.json'));
  47131. $validator = new JsonSchema\Validator();
  47132. $validator->check($data, (object) array('$ref' => 'file://' . realpath('schema.json')));
  47133. if ($validator->isValid()) {
  47134. echo "The supplied JSON validates against the schema.\n";
  47135. } else {
  47136. echo "JSON does not validate. Violations:\n";
  47137. foreach ($validator->getErrors() as $error) {
  47138. echo sprintf("[%s] %s\n", $error['property'], $error['message']);
  47139. }
  47140. }
  47141. <?php
  47142. namespace JsonSchema\Constraints;
  47143. use JsonSchema\Entity\JsonPointer;
  47144. use JsonSchema\Exception\InvalidArgumentException;
  47145. use JsonSchema\Exception\ValidationException;
  47146. use JsonSchema\Validator;
  47147. class BaseConstraint
  47148. {
  47149. protected $errors = array();
  47150. protected $errorMask = Validator::ERROR_NONE;
  47151. protected $factory;
  47152. public function __construct(Factory $factory = null)
  47153. {
  47154. $this->factory = $factory ?: new Factory();
  47155. }
  47156. public function addError(JsonPointer $path = null, $message, $constraint = '', array $more = null)
  47157. {
  47158. $error = array(
  47159. 'property' => $this->convertJsonPointerIntoPropertyPath($path ?: new JsonPointer('')),
  47160. 'pointer' => ltrim(strval($path ?: new JsonPointer('')), '#'),
  47161. 'message' => $message,
  47162. 'constraint' => $constraint,
  47163. 'context' => $this->factory->getErrorContext(),
  47164. );
  47165. if ($this->factory->getConfig(Constraint::CHECK_MODE_EXCEPTIONS)) {
  47166. throw new ValidationException(sprintf('Error validating %s: %s', $error['pointer'], $error['message']));
  47167. }
  47168. if (is_array($more) && count($more) > 0) {
  47169. $error += $more;
  47170. }
  47171. $this->errors[] = $error;
  47172. $this->errorMask |= $error['context'];
  47173. }
  47174. public function addErrors(array $errors)
  47175. {
  47176. if ($errors) {
  47177. $this->errors = array_merge($this->errors, $errors);
  47178. $errorMask = &$this->errorMask;
  47179. array_walk($errors, function ($error) use (&$errorMask) {
  47180. if (isset($error['context'])) {
  47181. $errorMask |= $error['context'];
  47182. }
  47183. });
  47184. }
  47185. }
  47186. public function getErrors($errorContext = Validator::ERROR_ALL)
  47187. {
  47188. if ($errorContext === Validator::ERROR_ALL) {
  47189. return $this->errors;
  47190. }
  47191. return array_filter($this->errors, function ($error) use ($errorContext) {
  47192. if ($errorContext & $error['context']) {
  47193. return true;
  47194. }
  47195. });
  47196. }
  47197. public function numErrors($errorContext = Validator::ERROR_ALL)
  47198. {
  47199. if ($errorContext === Validator::ERROR_ALL) {
  47200. return count($this->errors);
  47201. }
  47202. return count($this->getErrors($errorContext));
  47203. }
  47204. public function isValid()
  47205. {
  47206. return !$this->getErrors();
  47207. }
  47208. public function reset()
  47209. {
  47210. $this->errors = array();
  47211. $this->errorMask = Validator::ERROR_NONE;
  47212. }
  47213. public function getErrorMask()
  47214. {
  47215. return $this->errorMask;
  47216. }
  47217. public static function arrayToObjectRecursive($array)
  47218. {
  47219. $json = json_encode($array);
  47220. if (json_last_error() !== \JSON_ERROR_NONE) {
  47221. $message = 'Unable to encode schema array as JSON';
  47222. if (function_exists('json_last_error_msg')) {
  47223. $message .= ': ' . json_last_error_msg();
  47224. }
  47225. throw new InvalidArgumentException($message);
  47226. }
  47227. return (object) json_decode($json);
  47228. }
  47229. }
  47230. <?php
  47231. namespace JsonSchema\Constraints;
  47232. use JsonSchema\Entity\JsonPointer;
  47233. class CollectionConstraint extends Constraint
  47234. {
  47235. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null)
  47236. {
  47237. if (isset($schema->minItems) && count($value) < $schema->minItems) {
  47238. $this->addError($path, 'There must be a minimum of ' . $schema->minItems . ' items in the array', 'minItems', array('minItems' => $schema->minItems));
  47239. }
  47240. if (isset($schema->maxItems) && count($value) > $schema->maxItems) {
  47241. $this->addError($path, 'There must be a maximum of ' . $schema->maxItems . ' items in the array', 'maxItems', array('maxItems' => $schema->maxItems));
  47242. }
  47243. if (isset($schema->uniqueItems) && $schema->uniqueItems) {
  47244. $unique = $value;
  47245. if (is_array($value) && count($value)) {
  47246. $unique = array_map(function ($e) {
  47247. return var_export($e, true);
  47248. }, $value);
  47249. }
  47250. if (count(array_unique($unique)) != count($value)) {
  47251. $this->addError($path, 'There are no duplicates allowed in the array', 'uniqueItems');
  47252. }
  47253. }
  47254. if (isset($schema->items)) {
  47255. $this->validateItems($value, $schema, $path, $i);
  47256. }
  47257. }
  47258. protected function validateItems(&$value, $schema = null, JsonPointer $path = null, $i = null)
  47259. {
  47260. if (is_object($schema->items)) {
  47261. if (isset($schema->items->type)
  47262. && (
  47263. $schema->items->type == 'string'
  47264. || $schema->items->type == 'number'
  47265. || $schema->items->type == 'integer'
  47266. )
  47267. && !isset($schema->additionalItems)
  47268. ) {
  47269. $type = $schema->items->type;
  47270. $typeValidator = $this->factory->createInstanceFor('type');
  47271. $validator = $this->factory->createInstanceFor($type === 'integer' ? 'number' : $type);
  47272. foreach ($value as $k => &$v) {
  47273. $k_path = $this->incrementPath($path, $k);
  47274. $typeValidator->check($v, $schema->items, $k_path, $i);
  47275. $validator->check($v, $schema->items, $k_path, $i);
  47276. }
  47277. unset($v);
  47278. $this->addErrors($typeValidator->getErrors());
  47279. $this->addErrors($validator->getErrors());
  47280. } else {
  47281. foreach ($value as $k => &$v) {
  47282. $initErrors = $this->getErrors();
  47283. $this->checkUndefined($v, $schema->items, $path, $k);
  47284. if (count($initErrors) < count($this->getErrors()) && (isset($schema->additionalItems) && $schema->additionalItems !== false)) {
  47285. $secondErrors = $this->getErrors();
  47286. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  47287. }
  47288. if (isset($secondErrors) && count($secondErrors) < count($this->getErrors())) {
  47289. $this->errors = $secondErrors;
  47290. } elseif (isset($secondErrors) && count($secondErrors) === count($this->getErrors())) {
  47291. $this->errors = $initErrors;
  47292. }
  47293. }
  47294. unset($v);
  47295. }
  47296. } else {
  47297. foreach ($value as $k => &$v) {
  47298. if (array_key_exists($k, $schema->items)) {
  47299. $this->checkUndefined($v, $schema->items[$k], $path, $k);
  47300. } else {
  47301. if (property_exists($schema, 'additionalItems')) {
  47302. if ($schema->additionalItems !== false) {
  47303. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  47304. } else {
  47305. $this->addError(
  47306. $path, 'The item ' . $i . '[' . $k . '] is not defined and the definition does not allow additional items', 'additionalItems', array('additionalItems' => $schema->additionalItems));
  47307. }
  47308. } else {
  47309. $this->checkUndefined($v, new \stdClass(), $path, $k);
  47310. }
  47311. }
  47312. }
  47313. unset($v);
  47314. if (count($value) > 0) {
  47315. for ($k = count($value); $k < count($schema->items); $k++) {
  47316. $undefinedInstance = $this->factory->createInstanceFor('undefined');
  47317. $this->checkUndefined($undefinedInstance, $schema->items[$k], $path, $k);
  47318. }
  47319. }
  47320. }
  47321. }
  47322. }
  47323. <?php
  47324. namespace JsonSchema\Constraints;
  47325. use JsonSchema\Entity\JsonPointer;
  47326. abstract class Constraint extends BaseConstraint implements ConstraintInterface
  47327. {
  47328. protected $inlineSchemaProperty = '$schema';
  47329. const CHECK_MODE_NONE = 0x00000000;
  47330. const CHECK_MODE_NORMAL = 0x00000001;
  47331. const CHECK_MODE_TYPE_CAST = 0x00000002;
  47332. const CHECK_MODE_COERCE_TYPES = 0x00000004;
  47333. const CHECK_MODE_APPLY_DEFAULTS = 0x00000008;
  47334. const CHECK_MODE_EXCEPTIONS = 0x00000010;
  47335. const CHECK_MODE_DISABLE_FORMAT = 0x00000020;
  47336. const CHECK_MODE_ONLY_REQUIRED_DEFAULTS = 0x00000080;
  47337. const CHECK_MODE_VALIDATE_SCHEMA = 0x00000100;
  47338. protected function incrementPath(JsonPointer $path = null, $i)
  47339. {
  47340. $path = $path ?: new JsonPointer('');
  47341. $path = $path->withPropertyPaths(
  47342. array_merge(
  47343. $path->getPropertyPaths(),
  47344. array_filter(array($i), 'strlen')
  47345. )
  47346. );
  47347. return $path;
  47348. }
  47349. protected function checkArray(&$value, $schema = null, JsonPointer $path = null, $i = null)
  47350. {
  47351. $validator = $this->factory->createInstanceFor('collection');
  47352. $validator->check($value, $schema, $path, $i);
  47353. $this->addErrors($validator->getErrors());
  47354. }
  47355. protected function checkObject(&$value, $schema = null, JsonPointer $path = null, $properties = null,
  47356. $additionalProperties = null, $patternProperties = null, $appliedDefaults = array())
  47357. {
  47358. $validator = $this->factory->createInstanceFor('object');
  47359. $validator->check($value, $schema, $path, $properties, $additionalProperties, $patternProperties, $appliedDefaults);
  47360. $this->addErrors($validator->getErrors());
  47361. }
  47362. protected function checkType(&$value, $schema = null, JsonPointer $path = null, $i = null)
  47363. {
  47364. $validator = $this->factory->createInstanceFor('type');
  47365. $validator->check($value, $schema, $path, $i);
  47366. $this->addErrors($validator->getErrors());
  47367. }
  47368. protected function checkUndefined(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
  47369. {
  47370. $validator = $this->factory->createInstanceFor('undefined');
  47371. $validator->check($value, $this->factory->getSchemaStorage()->resolveRefSchema($schema), $path, $i, $fromDefault);
  47372. $this->addErrors($validator->getErrors());
  47373. }
  47374. protected function checkString($value, $schema = null, JsonPointer $path = null, $i = null)
  47375. {
  47376. $validator = $this->factory->createInstanceFor('string');
  47377. $validator->check($value, $schema, $path, $i);
  47378. $this->addErrors($validator->getErrors());
  47379. }
  47380. protected function checkNumber($value, $schema = null, JsonPointer $path = null, $i = null)
  47381. {
  47382. $validator = $this->factory->createInstanceFor('number');
  47383. $validator->check($value, $schema, $path, $i);
  47384. $this->addErrors($validator->getErrors());
  47385. }
  47386. protected function checkEnum($value, $schema = null, JsonPointer $path = null, $i = null)
  47387. {
  47388. $validator = $this->factory->createInstanceFor('enum');
  47389. $validator->check($value, $schema, $path, $i);
  47390. $this->addErrors($validator->getErrors());
  47391. }
  47392. protected function checkFormat($value, $schema = null, JsonPointer $path = null, $i = null)
  47393. {
  47394. $validator = $this->factory->createInstanceFor('format');
  47395. $validator->check($value, $schema, $path, $i);
  47396. $this->addErrors($validator->getErrors());
  47397. }
  47398. protected function getTypeCheck()
  47399. {
  47400. return $this->factory->getTypeCheck();
  47401. }
  47402. protected function convertJsonPointerIntoPropertyPath(JsonPointer $pointer)
  47403. {
  47404. $result = array_map(
  47405. function ($path) {
  47406. return sprintf(is_numeric($path) ? '[%d]' : '.%s', $path);
  47407. },
  47408. $pointer->getPropertyPaths()
  47409. );
  47410. return trim(implode('', $result), '.');
  47411. }
  47412. }
  47413. <?php
  47414. namespace JsonSchema\Constraints;
  47415. use JsonSchema\Entity\JsonPointer;
  47416. interface ConstraintInterface
  47417. {
  47418. public function getErrors();
  47419. public function addErrors(array $errors);
  47420. public function addError(JsonPointer $path = null, $message, $constraint='', array $more = null);
  47421. public function isValid();
  47422. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null);
  47423. }
  47424. <?php
  47425. namespace JsonSchema\Constraints;
  47426. use JsonSchema\Entity\JsonPointer;
  47427. class EnumConstraint extends Constraint
  47428. {
  47429. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  47430. {
  47431. if ($element instanceof UndefinedConstraint && (!isset($schema->required) || !$schema->required)) {
  47432. return;
  47433. }
  47434. $type = gettype($element);
  47435. foreach ($schema->enum as $enum) {
  47436. $enumType = gettype($enum);
  47437. if ($this->factory->getConfig(self::CHECK_MODE_TYPE_CAST) && $type == 'array' && $enumType == 'object') {
  47438. if ((object) $element == $enum) {
  47439. return;
  47440. }
  47441. }
  47442. if ($type === gettype($enum)) {
  47443. if ($type == 'object') {
  47444. if ($element == $enum) {
  47445. return;
  47446. }
  47447. } elseif ($element === $enum) {
  47448. return;
  47449. }
  47450. }
  47451. }
  47452. $this->addError($path, 'Does not have a value in the enumeration ' . json_encode($schema->enum), 'enum', array('enum' => $schema->enum));
  47453. }
  47454. }
  47455. <?php
  47456. namespace JsonSchema\Constraints;
  47457. use JsonSchema\Exception\InvalidArgumentException;
  47458. use JsonSchema\SchemaStorage;
  47459. use JsonSchema\SchemaStorageInterface;
  47460. use JsonSchema\Uri\UriRetriever;
  47461. use JsonSchema\UriRetrieverInterface;
  47462. use JsonSchema\Validator;
  47463. class Factory
  47464. {
  47465. protected $schemaStorage;
  47466. protected $uriRetriever;
  47467. private $checkMode = Constraint::CHECK_MODE_NORMAL;
  47468. private $typeCheck = array();
  47469. protected $errorContext = Validator::ERROR_DOCUMENT_VALIDATION;
  47470. protected $constraintMap = array(
  47471. 'array' => 'JsonSchema\Constraints\CollectionConstraint',
  47472. 'collection' => 'JsonSchema\Constraints\CollectionConstraint',
  47473. 'object' => 'JsonSchema\Constraints\ObjectConstraint',
  47474. 'type' => 'JsonSchema\Constraints\TypeConstraint',
  47475. 'undefined' => 'JsonSchema\Constraints\UndefinedConstraint',
  47476. 'string' => 'JsonSchema\Constraints\StringConstraint',
  47477. 'number' => 'JsonSchema\Constraints\NumberConstraint',
  47478. 'enum' => 'JsonSchema\Constraints\EnumConstraint',
  47479. 'format' => 'JsonSchema\Constraints\FormatConstraint',
  47480. 'schema' => 'JsonSchema\Constraints\SchemaConstraint',
  47481. 'validator' => 'JsonSchema\Validator'
  47482. );
  47483. private $instanceCache = array();
  47484. public function __construct(
  47485. SchemaStorageInterface $schemaStorage = null,
  47486. UriRetrieverInterface $uriRetriever = null,
  47487. $checkMode = Constraint::CHECK_MODE_NORMAL
  47488. ) {
  47489. $this->setConfig($checkMode);
  47490. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  47491. $this->schemaStorage = $schemaStorage ?: new SchemaStorage($this->uriRetriever);
  47492. }
  47493. public function setConfig($checkMode = Constraint::CHECK_MODE_NORMAL)
  47494. {
  47495. $this->checkMode = $checkMode;
  47496. }
  47497. public function addConfig($options)
  47498. {
  47499. $this->checkMode |= $options;
  47500. }
  47501. public function removeConfig($options)
  47502. {
  47503. $this->checkMode &= ~$options;
  47504. }
  47505. public function getConfig($options = null)
  47506. {
  47507. if ($options === null) {
  47508. return $this->checkMode;
  47509. }
  47510. return $this->checkMode & $options;
  47511. }
  47512. public function getUriRetriever()
  47513. {
  47514. return $this->uriRetriever;
  47515. }
  47516. public function getSchemaStorage()
  47517. {
  47518. return $this->schemaStorage;
  47519. }
  47520. public function getTypeCheck()
  47521. {
  47522. if (!isset($this->typeCheck[$this->checkMode])) {
  47523. $this->typeCheck[$this->checkMode] = ($this->checkMode & Constraint::CHECK_MODE_TYPE_CAST)
  47524. ? new TypeCheck\LooseTypeCheck()
  47525. : new TypeCheck\StrictTypeCheck();
  47526. }
  47527. return $this->typeCheck[$this->checkMode];
  47528. }
  47529. public function setConstraintClass($name, $class)
  47530. {
  47531. if (!class_exists($class)) {
  47532. throw new InvalidArgumentException('Unknown constraint ' . $name);
  47533. }
  47534. if (!in_array('JsonSchema\Constraints\ConstraintInterface', class_implements($class))) {
  47535. throw new InvalidArgumentException('Invalid class ' . $name);
  47536. }
  47537. $this->constraintMap[$name] = $class;
  47538. return $this;
  47539. }
  47540. public function createInstanceFor($constraintName)
  47541. {
  47542. if (!isset($this->constraintMap[$constraintName])) {
  47543. throw new InvalidArgumentException('Unknown constraint ' . $constraintName);
  47544. }
  47545. if (!isset($this->instanceCache[$constraintName])) {
  47546. $this->instanceCache[$constraintName] = new $this->constraintMap[$constraintName]($this);
  47547. }
  47548. return clone $this->instanceCache[$constraintName];
  47549. }
  47550. public function getErrorContext()
  47551. {
  47552. return $this->errorContext;
  47553. }
  47554. public function setErrorContext($errorContext)
  47555. {
  47556. $this->errorContext = $errorContext;
  47557. }
  47558. }
  47559. <?php
  47560. namespace JsonSchema\Constraints;
  47561. use JsonSchema\Entity\JsonPointer;
  47562. use JsonSchema\Rfc3339;
  47563. class FormatConstraint extends Constraint
  47564. {
  47565. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  47566. {
  47567. if (!isset($schema->format) || $this->factory->getConfig(self::CHECK_MODE_DISABLE_FORMAT)) {
  47568. return;
  47569. }
  47570. switch ($schema->format) {
  47571. case 'date':
  47572. if (!$date = $this->validateDateTime($element, 'Y-m-d')) {
  47573. $this->addError($path, sprintf('Invalid date %s, expected format YYYY-MM-DD', json_encode($element)), 'format', array('format' => $schema->format));
  47574. }
  47575. break;
  47576. case 'time':
  47577. if (!$this->validateDateTime($element, 'H:i:s')) {
  47578. $this->addError($path, sprintf('Invalid time %s, expected format hh:mm:ss', json_encode($element)), 'format', array('format' => $schema->format));
  47579. }
  47580. break;
  47581. case 'date-time':
  47582. if (null === Rfc3339::createFromString($element)) {
  47583. $this->addError($path, sprintf('Invalid date-time %s, expected format YYYY-MM-DDThh:mm:ssZ or YYYY-MM-DDThh:mm:ss+hh:mm', json_encode($element)), 'format', array('format' => $schema->format));
  47584. }
  47585. break;
  47586. case 'utc-millisec':
  47587. if (!$this->validateDateTime($element, 'U')) {
  47588. $this->addError($path, sprintf('Invalid time %s, expected integer of milliseconds since Epoch', json_encode($element)), 'format', array('format' => $schema->format));
  47589. }
  47590. break;
  47591. case 'regex':
  47592. if (!$this->validateRegex($element)) {
  47593. $this->addError($path, 'Invalid regex format ' . $element, 'format', array('format' => $schema->format));
  47594. }
  47595. break;
  47596. case 'color':
  47597. if (!$this->validateColor($element)) {
  47598. $this->addError($path, 'Invalid color', 'format', array('format' => $schema->format));
  47599. }
  47600. break;
  47601. case 'style':
  47602. if (!$this->validateStyle($element)) {
  47603. $this->addError($path, 'Invalid style', 'format', array('format' => $schema->format));
  47604. }
  47605. break;
  47606. case 'phone':
  47607. if (!$this->validatePhone($element)) {
  47608. $this->addError($path, 'Invalid phone number', 'format', array('format' => $schema->format));
  47609. }
  47610. break;
  47611. case 'uri':
  47612. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  47613. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  47614. }
  47615. break;
  47616. case 'uriref':
  47617. case 'uri-reference':
  47618. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  47619. if (substr($element, 0, 2) === '//') {
  47620. $validURL = filter_var('scheme:' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  47621. } elseif (substr($element, 0, 1) === '/') {
  47622. $validURL = filter_var('scheme://host' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  47623. } elseif (strlen($element)) {
  47624. $pathParts = explode('/', $element, 2);
  47625. if (strpos($pathParts[0], ':') !== false) {
  47626. $validURL = null;
  47627. } else {
  47628. $validURL = filter_var('scheme://host/' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  47629. }
  47630. } else {
  47631. $validURL = null;
  47632. }
  47633. if ($validURL === null) {
  47634. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  47635. }
  47636. }
  47637. break;
  47638. case 'email':
  47639. $filterFlags = FILTER_NULL_ON_FAILURE;
  47640. if (defined('FILTER_FLAG_EMAIL_UNICODE')) {
  47641. $filterFlags |= constant('FILTER_FLAG_EMAIL_UNICODE');
  47642. }
  47643. if (null === filter_var($element, FILTER_VALIDATE_EMAIL, $filterFlags)) {
  47644. $this->addError($path, 'Invalid email', 'format', array('format' => $schema->format));
  47645. }
  47646. break;
  47647. case 'ip-address':
  47648. case 'ipv4':
  47649. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV4)) {
  47650. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  47651. }
  47652. break;
  47653. case 'ipv6':
  47654. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV6)) {
  47655. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  47656. }
  47657. break;
  47658. case 'host-name':
  47659. case 'hostname':
  47660. if (!$this->validateHostname($element)) {
  47661. $this->addError($path, 'Invalid hostname', 'format', array('format' => $schema->format));
  47662. }
  47663. break;
  47664. default:
  47665. break;
  47666. }
  47667. }
  47668. protected function validateDateTime($datetime, $format)
  47669. {
  47670. $dt = \DateTime::createFromFormat($format, $datetime);
  47671. if (!$dt) {
  47672. return false;
  47673. }
  47674. if ($datetime === $dt->format($format)) {
  47675. return true;
  47676. }
  47677. if ((strpos('u', $format) !== -1) && (preg_match('/\.\d+Z$/', $datetime))) {
  47678. return true;
  47679. }
  47680. return false;
  47681. }
  47682. protected function validateRegex($regex)
  47683. {
  47684. return false !== @preg_match('/' . $regex . '/u', '');
  47685. }
  47686. protected function validateColor($color)
  47687. {
  47688. if (in_array(strtolower($color), array('aqua', 'black', 'blue', 'fuchsia',
  47689. 'gray', 'green', 'lime', 'maroon', 'navy', 'olive', 'orange', 'purple',
  47690. 'red', 'silver', 'teal', 'white', 'yellow'))) {
  47691. return true;
  47692. }
  47693. return preg_match('/^#([a-f0-9]{3}|[a-f0-9]{6})$/i', $color);
  47694. }
  47695. protected function validateStyle($style)
  47696. {
  47697. $properties = explode(';', rtrim($style, ';'));
  47698. $invalidEntries = preg_grep('/^\s*[-a-z]+\s*:\s*.+$/i', $properties, PREG_GREP_INVERT);
  47699. return empty($invalidEntries);
  47700. }
  47701. protected function validatePhone($phone)
  47702. {
  47703. return preg_match('/^\+?(\(\d{3}\)|\d{3}) \d{3} \d{4}$/', $phone);
  47704. }
  47705. protected function validateHostname($host)
  47706. {
  47707. $hostnameRegex = '/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/i';
  47708. return preg_match($hostnameRegex, $host);
  47709. }
  47710. }
  47711. <?php
  47712. namespace JsonSchema\Constraints;
  47713. use JsonSchema\Entity\JsonPointer;
  47714. class NumberConstraint extends Constraint
  47715. {
  47716. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  47717. {
  47718. if (isset($schema->exclusiveMinimum)) {
  47719. if (isset($schema->minimum)) {
  47720. if ($schema->exclusiveMinimum && $element <= $schema->minimum) {
  47721. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'exclusiveMinimum', array('minimum' => $schema->minimum));
  47722. } elseif ($element < $schema->minimum) {
  47723. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  47724. }
  47725. } else {
  47726. $this->addError($path, 'Use of exclusiveMinimum requires presence of minimum', 'missingMinimum');
  47727. }
  47728. } elseif (isset($schema->minimum) && $element < $schema->minimum) {
  47729. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  47730. }
  47731. if (isset($schema->exclusiveMaximum)) {
  47732. if (isset($schema->maximum)) {
  47733. if ($schema->exclusiveMaximum && $element >= $schema->maximum) {
  47734. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'exclusiveMaximum', array('maximum' => $schema->maximum));
  47735. } elseif ($element > $schema->maximum) {
  47736. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  47737. }
  47738. } else {
  47739. $this->addError($path, 'Use of exclusiveMaximum requires presence of maximum', 'missingMaximum');
  47740. }
  47741. } elseif (isset($schema->maximum) && $element > $schema->maximum) {
  47742. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  47743. }
  47744. if (isset($schema->divisibleBy) && $this->fmod($element, $schema->divisibleBy) != 0) {
  47745. $this->addError($path, 'Is not divisible by ' . $schema->divisibleBy, 'divisibleBy', array('divisibleBy' => $schema->divisibleBy));
  47746. }
  47747. if (isset($schema->multipleOf) && $this->fmod($element, $schema->multipleOf) != 0) {
  47748. $this->addError($path, 'Must be a multiple of ' . $schema->multipleOf, 'multipleOf', array('multipleOf' => $schema->multipleOf));
  47749. }
  47750. $this->checkFormat($element, $schema, $path, $i);
  47751. }
  47752. private function fmod($number1, $number2)
  47753. {
  47754. $number1 = abs($number1);
  47755. $modulus = fmod($number1, $number2);
  47756. $precision = abs(0.0000000001);
  47757. $diff = (float) ($modulus - $number2);
  47758. if (-$precision < $diff && $diff < $precision) {
  47759. return 0.0;
  47760. }
  47761. $decimals1 = mb_strpos($number1, '.') ? mb_strlen($number1) - mb_strpos($number1, '.') - 1 : 0;
  47762. $decimals2 = mb_strpos($number2, '.') ? mb_strlen($number2) - mb_strpos($number2, '.') - 1 : 0;
  47763. return (float) round($modulus, max($decimals1, $decimals2));
  47764. }
  47765. }
  47766. <?php
  47767. namespace JsonSchema\Constraints;
  47768. use JsonSchema\Entity\JsonPointer;
  47769. class ObjectConstraint extends Constraint
  47770. {
  47771. protected $appliedDefaults = array();
  47772. public function check(&$element, $schema = null, JsonPointer $path = null, $properties = null,
  47773. $additionalProp = null, $patternProperties = null, $appliedDefaults = array())
  47774. {
  47775. if ($element instanceof UndefinedConstraint) {
  47776. return;
  47777. }
  47778. $this->appliedDefaults = $appliedDefaults;
  47779. $matches = array();
  47780. if ($patternProperties) {
  47781. $matches = $this->validatePatternProperties($element, $path, $patternProperties);
  47782. }
  47783. if ($properties) {
  47784. $this->validateProperties($element, $properties, $path);
  47785. }
  47786. $this->validateElement($element, $matches, $schema, $path, $properties, $additionalProp);
  47787. }
  47788. public function validatePatternProperties($element, JsonPointer $path = null, $patternProperties)
  47789. {
  47790. $try = array('/', '#', '+', '~', '%');
  47791. $matches = array();
  47792. foreach ($patternProperties as $pregex => $schema) {
  47793. $delimiter = '/';
  47794. foreach ($try as $delimiter) {
  47795. if (strpos($pregex, $delimiter) === false) {
  47796. break;
  47797. }
  47798. }
  47799. if (@preg_match($delimiter . $pregex . $delimiter . 'u', '') === false) {
  47800. $this->addError($path, 'The pattern "' . $pregex . '" is invalid', 'pregex', array('pregex' => $pregex));
  47801. continue;
  47802. }
  47803. foreach ($element as $i => $value) {
  47804. if (preg_match($delimiter . $pregex . $delimiter . 'u', $i)) {
  47805. $matches[] = $i;
  47806. $this->checkUndefined($value, $schema ?: new \stdClass(), $path, $i, in_array($i, $this->appliedDefaults));
  47807. }
  47808. }
  47809. }
  47810. return $matches;
  47811. }
  47812. public function validateElement($element, $matches, $schema = null, JsonPointer $path = null,
  47813. $properties = null, $additionalProp = null)
  47814. {
  47815. $this->validateMinMaxConstraint($element, $schema, $path);
  47816. foreach ($element as $i => $value) {
  47817. $definition = $this->getProperty($properties, $i);
  47818. if (!in_array($i, $matches) && $additionalProp === false && $this->inlineSchemaProperty !== $i && !$definition) {
  47819. $this->addError($path, 'The property ' . $i . ' is not defined and the definition does not allow additional properties', 'additionalProp');
  47820. }
  47821. if (!in_array($i, $matches) && $additionalProp && !$definition) {
  47822. if ($additionalProp === true) {
  47823. $this->checkUndefined($value, null, $path, $i, in_array($i, $this->appliedDefaults));
  47824. } else {
  47825. $this->checkUndefined($value, $additionalProp, $path, $i, in_array($i, $this->appliedDefaults));
  47826. }
  47827. }
  47828. $require = $this->getProperty($definition, 'requires');
  47829. if ($require && !$this->getProperty($element, $require)) {
  47830. $this->addError($path, 'The presence of the property ' . $i . ' requires that ' . $require . ' also be present', 'requires');
  47831. }
  47832. $property = $this->getProperty($element, $i, $this->factory->createInstanceFor('undefined'));
  47833. if (is_object($property)) {
  47834. $this->validateMinMaxConstraint(!($property instanceof UndefinedConstraint) ? $property : $element, $definition, $path);
  47835. }
  47836. }
  47837. }
  47838. public function validateProperties(&$element, $properties = null, JsonPointer $path = null)
  47839. {
  47840. $undefinedConstraint = $this->factory->createInstanceFor('undefined');
  47841. foreach ($properties as $i => $value) {
  47842. $property = &$this->getProperty($element, $i, $undefinedConstraint);
  47843. $definition = $this->getProperty($properties, $i);
  47844. if (is_object($definition)) {
  47845. $this->checkUndefined($property, $definition, $path, $i, in_array($i, $this->appliedDefaults));
  47846. }
  47847. }
  47848. }
  47849. protected function &getProperty(&$element, $property, $fallback = null)
  47850. {
  47851. if (is_array($element) && (isset($element[$property]) || array_key_exists($property, $element)) ) {
  47852. return $element[$property];
  47853. } elseif (is_object($element) && property_exists($element, $property)) {
  47854. return $element->$property;
  47855. }
  47856. return $fallback;
  47857. }
  47858. protected function validateMinMaxConstraint($element, $objectDefinition, JsonPointer $path = null)
  47859. {
  47860. if (isset($objectDefinition->minProperties) && !is_object($objectDefinition->minProperties)) {
  47861. if ($this->getTypeCheck()->propertyCount($element) < $objectDefinition->minProperties) {
  47862. $this->addError($path, 'Must contain a minimum of ' . $objectDefinition->minProperties . ' properties', 'minProperties', array('minProperties' => $objectDefinition->minProperties));
  47863. }
  47864. }
  47865. if (isset($objectDefinition->maxProperties) && !is_object($objectDefinition->maxProperties)) {
  47866. if ($this->getTypeCheck()->propertyCount($element) > $objectDefinition->maxProperties) {
  47867. $this->addError($path, 'Must contain no more than ' . $objectDefinition->maxProperties . ' properties', 'maxProperties', array('maxProperties' => $objectDefinition->maxProperties));
  47868. }
  47869. }
  47870. }
  47871. }
  47872. <?php
  47873. namespace JsonSchema\Constraints;
  47874. use JsonSchema\Entity\JsonPointer;
  47875. use JsonSchema\Exception\InvalidArgumentException;
  47876. use JsonSchema\Exception\InvalidSchemaException;
  47877. use JsonSchema\Exception\RuntimeException;
  47878. use JsonSchema\Validator;
  47879. class SchemaConstraint extends Constraint
  47880. {
  47881. const DEFAULT_SCHEMA_SPEC = 'http://json-schema.org/draft-04/schema#';
  47882. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  47883. {
  47884. if ($schema !== null) {
  47885. $validationSchema = $schema;
  47886. } elseif ($this->getTypeCheck()->propertyExists($element, $this->inlineSchemaProperty)) {
  47887. $validationSchema = $this->getTypeCheck()->propertyGet($element, $this->inlineSchemaProperty);
  47888. } else {
  47889. throw new InvalidArgumentException('no schema found to verify against');
  47890. }
  47891. if (is_array($validationSchema)) {
  47892. $validationSchema = BaseConstraint::arrayToObjectRecursive($validationSchema);
  47893. }
  47894. if ($this->factory->getConfig(self::CHECK_MODE_VALIDATE_SCHEMA)) {
  47895. if (!$this->getTypeCheck()->isObject($validationSchema)) {
  47896. throw new RuntimeException('Cannot validate the schema of a non-object');
  47897. }
  47898. if ($this->getTypeCheck()->propertyExists($validationSchema, '$schema')) {
  47899. $schemaSpec = $this->getTypeCheck()->propertyGet($validationSchema, '$schema');
  47900. } else {
  47901. $schemaSpec = self::DEFAULT_SCHEMA_SPEC;
  47902. }
  47903. $schemaStorage = $this->factory->getSchemaStorage();
  47904. if (!$this->getTypeCheck()->isObject($schemaSpec)) {
  47905. $schemaSpec = $schemaStorage->getSchema($schemaSpec);
  47906. }
  47907. $initialErrorCount = $this->numErrors();
  47908. $initialConfig = $this->factory->getConfig();
  47909. $initialContext = $this->factory->getErrorContext();
  47910. $this->factory->removeConfig(self::CHECK_MODE_VALIDATE_SCHEMA | self::CHECK_MODE_APPLY_DEFAULTS);
  47911. $this->factory->addConfig(self::CHECK_MODE_TYPE_CAST);
  47912. $this->factory->setErrorContext(Validator::ERROR_SCHEMA_VALIDATION);
  47913. try {
  47914. $this->check($validationSchema, $schemaSpec);
  47915. } catch (\Exception $e) {
  47916. if ($this->factory->getConfig(self::CHECK_MODE_EXCEPTIONS)) {
  47917. throw new InvalidSchemaException('Schema did not pass validation', 0, $e);
  47918. }
  47919. }
  47920. if ($this->numErrors() > $initialErrorCount) {
  47921. $this->addError($path, 'Schema is not valid', 'schema');
  47922. }
  47923. $this->factory->setConfig($initialConfig);
  47924. $this->factory->setErrorContext($initialContext);
  47925. }
  47926. $this->checkUndefined($element, $validationSchema, $path, $i);
  47927. }
  47928. }
  47929. <?php
  47930. namespace JsonSchema\Constraints;
  47931. use JsonSchema\Entity\JsonPointer;
  47932. class StringConstraint extends Constraint
  47933. {
  47934. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  47935. {
  47936. if (isset($schema->maxLength) && $this->strlen($element) > $schema->maxLength) {
  47937. $this->addError($path, 'Must be at most ' . $schema->maxLength . ' characters long', 'maxLength', array(
  47938. 'maxLength' => $schema->maxLength,
  47939. ));
  47940. }
  47941. if (isset($schema->minLength) && $this->strlen($element) < $schema->minLength) {
  47942. $this->addError($path, 'Must be at least ' . $schema->minLength . ' characters long', 'minLength', array(
  47943. 'minLength' => $schema->minLength,
  47944. ));
  47945. }
  47946. if (isset($schema->pattern) && !preg_match('#' . str_replace('#', '\\#', $schema->pattern) . '#u', $element)) {
  47947. $this->addError($path, 'Does not match the regex pattern ' . $schema->pattern, 'pattern', array(
  47948. 'pattern' => $schema->pattern,
  47949. ));
  47950. }
  47951. $this->checkFormat($element, $schema, $path, $i);
  47952. }
  47953. private function strlen($string)
  47954. {
  47955. if (extension_loaded('mbstring')) {
  47956. return mb_strlen($string, mb_detect_encoding($string));
  47957. }
  47958. return strlen($string);
  47959. }
  47960. }
  47961. <?php
  47962. namespace JsonSchema\Constraints\TypeCheck;
  47963. class LooseTypeCheck implements TypeCheckInterface
  47964. {
  47965. public static function isObject($value)
  47966. {
  47967. return
  47968. is_object($value) ||
  47969. (is_array($value) && (count($value) == 0 || self::isAssociativeArray($value)));
  47970. }
  47971. public static function isArray($value)
  47972. {
  47973. return
  47974. is_array($value) &&
  47975. (count($value) == 0 || !self::isAssociativeArray($value));
  47976. }
  47977. public static function propertyGet($value, $property)
  47978. {
  47979. if (is_object($value)) {
  47980. return $value->{$property};
  47981. }
  47982. return $value[$property];
  47983. }
  47984. public static function propertySet(&$value, $property, $data)
  47985. {
  47986. if (is_object($value)) {
  47987. $value->{$property} = $data;
  47988. } else {
  47989. $value[$property] = $data;
  47990. }
  47991. }
  47992. public static function propertyExists($value, $property)
  47993. {
  47994. if (is_object($value)) {
  47995. return property_exists($value, $property);
  47996. }
  47997. return array_key_exists($property, $value);
  47998. }
  47999. public static function propertyCount($value)
  48000. {
  48001. if (is_object($value)) {
  48002. return count(get_object_vars($value));
  48003. }
  48004. return count($value);
  48005. }
  48006. private static function isAssociativeArray($arr)
  48007. {
  48008. return array_keys($arr) !== range(0, count($arr) - 1);
  48009. }
  48010. }
  48011. <?php
  48012. namespace JsonSchema\Constraints\TypeCheck;
  48013. class StrictTypeCheck implements TypeCheckInterface
  48014. {
  48015. public static function isObject($value)
  48016. {
  48017. return is_object($value);
  48018. }
  48019. public static function isArray($value)
  48020. {
  48021. return is_array($value);
  48022. }
  48023. public static function propertyGet($value, $property)
  48024. {
  48025. return $value->{$property};
  48026. }
  48027. public static function propertySet(&$value, $property, $data)
  48028. {
  48029. $value->{$property} = $data;
  48030. }
  48031. public static function propertyExists($value, $property)
  48032. {
  48033. return property_exists($value, $property);
  48034. }
  48035. public static function propertyCount($value)
  48036. {
  48037. return count(get_object_vars($value));
  48038. }
  48039. }
  48040. <?php
  48041. namespace JsonSchema\Constraints\TypeCheck;
  48042. interface TypeCheckInterface
  48043. {
  48044. public static function isObject($value);
  48045. public static function isArray($value);
  48046. public static function propertyGet($value, $property);
  48047. public static function propertySet(&$value, $property, $data);
  48048. public static function propertyExists($value, $property);
  48049. public static function propertyCount($value);
  48050. }
  48051. <?php
  48052. namespace JsonSchema\Constraints;
  48053. use JsonSchema\Entity\JsonPointer;
  48054. use JsonSchema\Exception\InvalidArgumentException;
  48055. use UnexpectedValueException as StandardUnexpectedValueException;
  48056. class TypeConstraint extends Constraint
  48057. {
  48058. public static $wording = array(
  48059. 'integer' => 'an integer',
  48060. 'number' => 'a number',
  48061. 'boolean' => 'a boolean',
  48062. 'object' => 'an object',
  48063. 'array' => 'an array',
  48064. 'string' => 'a string',
  48065. 'null' => 'a null',
  48066. 'any' => null,
  48067. 0 => null,
  48068. );
  48069. public function check(&$value = null, $schema = null, JsonPointer $path = null, $i = null)
  48070. {
  48071. $type = isset($schema->type) ? $schema->type : null;
  48072. $isValid = false;
  48073. $wording = array();
  48074. if (is_array($type)) {
  48075. $this->validateTypesArray($value, $type, $wording, $isValid, $path);
  48076. } elseif (is_object($type)) {
  48077. $this->checkUndefined($value, $type, $path);
  48078. return;
  48079. } else {
  48080. $isValid = $this->validateType($value, $type);
  48081. }
  48082. if ($isValid === false) {
  48083. if (!is_array($type)) {
  48084. $this->validateTypeNameWording($type);
  48085. $wording[] = self::$wording[$type];
  48086. }
  48087. $this->addError($path, ucwords(gettype($value)) . ' value found, but ' .
  48088. $this->implodeWith($wording, ', ', 'or') . ' is required', 'type');
  48089. }
  48090. }
  48091. protected function validateTypesArray(&$value, array $type, &$validTypesWording, &$isValid, $path)
  48092. {
  48093. foreach ($type as $tp) {
  48094. if (is_object($tp)) {
  48095. if (!$isValid) {
  48096. $validator = $this->factory->createInstanceFor('type');
  48097. $subSchema = new \stdClass();
  48098. $subSchema->type = $tp;
  48099. $validator->check($value, $subSchema, $path, null);
  48100. $error = $validator->getErrors();
  48101. $isValid = !(bool) $error;
  48102. $validTypesWording[] = self::$wording['object'];
  48103. }
  48104. } else {
  48105. $this->validateTypeNameWording($tp);
  48106. $validTypesWording[] = self::$wording[$tp];
  48107. if (!$isValid) {
  48108. $isValid = $this->validateType($value, $tp);
  48109. }
  48110. }
  48111. }
  48112. }
  48113. protected function implodeWith(array $elements, $delimiter = ', ', $listEnd = false)
  48114. {
  48115. if ($listEnd === false || !isset($elements[1])) {
  48116. return implode($delimiter, $elements);
  48117. }
  48118. $lastElement = array_slice($elements, -1);
  48119. $firsElements = join($delimiter, array_slice($elements, 0, -1));
  48120. $implodedElements = array_merge(array($firsElements), $lastElement);
  48121. return join(" $listEnd ", $implodedElements);
  48122. }
  48123. protected function validateTypeNameWording($type)
  48124. {
  48125. if (!isset(self::$wording[$type])) {
  48126. throw new StandardUnexpectedValueException(
  48127. sprintf(
  48128. 'No wording for %s available, expected wordings are: [%s]',
  48129. var_export($type, true),
  48130. implode(', ', array_filter(self::$wording)))
  48131. );
  48132. }
  48133. }
  48134. protected function validateType(&$value, $type)
  48135. {
  48136. if (!$type) {
  48137. return true;
  48138. }
  48139. if ('any' === $type) {
  48140. return true;
  48141. }
  48142. if ('object' === $type) {
  48143. return $this->getTypeCheck()->isObject($value);
  48144. }
  48145. if ('array' === $type) {
  48146. return $this->getTypeCheck()->isArray($value);
  48147. }
  48148. $coerce = $this->factory->getConfig(Constraint::CHECK_MODE_COERCE_TYPES);
  48149. if ('integer' === $type) {
  48150. if ($coerce) {
  48151. $value = $this->toInteger($value);
  48152. }
  48153. return is_int($value);
  48154. }
  48155. if ('number' === $type) {
  48156. if ($coerce) {
  48157. $value = $this->toNumber($value);
  48158. }
  48159. return is_numeric($value) && !is_string($value);
  48160. }
  48161. if ('boolean' === $type) {
  48162. if ($coerce) {
  48163. $value = $this->toBoolean($value);
  48164. }
  48165. return is_bool($value);
  48166. }
  48167. if ('string' === $type) {
  48168. return is_string($value);
  48169. }
  48170. if ('email' === $type) {
  48171. return is_string($value);
  48172. }
  48173. if ('null' === $type) {
  48174. return is_null($value);
  48175. }
  48176. throw new InvalidArgumentException((is_object($value) ? 'object' : $value) . ' is an invalid type for ' . $type);
  48177. }
  48178. protected function toBoolean($value)
  48179. {
  48180. if ($value === 'true') {
  48181. return true;
  48182. }
  48183. if ($value === 'false') {
  48184. return false;
  48185. }
  48186. return $value;
  48187. }
  48188. protected function toNumber($value)
  48189. {
  48190. if (is_numeric($value)) {
  48191. return $value + 0;
  48192. }
  48193. return $value;
  48194. }
  48195. protected function toInteger($value)
  48196. {
  48197. if (is_numeric($value) && (int) $value == $value) {
  48198. return (int) $value;
  48199. }
  48200. return $value;
  48201. }
  48202. }
  48203. <?php
  48204. namespace JsonSchema\Constraints;
  48205. use JsonSchema\Constraints\TypeCheck\LooseTypeCheck;
  48206. use JsonSchema\Entity\JsonPointer;
  48207. use JsonSchema\Exception\ValidationException;
  48208. use JsonSchema\Uri\UriResolver;
  48209. class UndefinedConstraint extends Constraint
  48210. {
  48211. protected $appliedDefaults = array();
  48212. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
  48213. {
  48214. if (is_null($schema) || !is_object($schema)) {
  48215. return;
  48216. }
  48217. $path = $this->incrementPath($path ?: new JsonPointer(''), $i);
  48218. if ($fromDefault) {
  48219. $path->setFromDefault();
  48220. }
  48221. $this->validateCommonProperties($value, $schema, $path, $i);
  48222. $this->validateOfProperties($value, $schema, $path, '');
  48223. $this->validateTypes($value, $schema, $path, $i);
  48224. }
  48225. public function validateTypes(&$value, $schema = null, JsonPointer $path, $i = null)
  48226. {
  48227. if ($this->getTypeCheck()->isArray($value)) {
  48228. $this->checkArray($value, $schema, $path, $i);
  48229. }
  48230. if (LooseTypeCheck::isObject($value)) {
  48231. $this->checkObject(
  48232. $value,
  48233. $schema,
  48234. $path,
  48235. isset($schema->properties) ? $schema->properties : null,
  48236. isset($schema->additionalProperties) ? $schema->additionalProperties : null,
  48237. isset($schema->patternProperties) ? $schema->patternProperties : null,
  48238. $this->appliedDefaults
  48239. );
  48240. }
  48241. if (is_string($value)) {
  48242. $this->checkString($value, $schema, $path, $i);
  48243. }
  48244. if (is_numeric($value)) {
  48245. $this->checkNumber($value, $schema, $path, $i);
  48246. }
  48247. if (isset($schema->enum)) {
  48248. $this->checkEnum($value, $schema, $path, $i);
  48249. }
  48250. }
  48251. protected function validateCommonProperties(&$value, $schema = null, JsonPointer $path, $i = '')
  48252. {
  48253. if (isset($schema->extends)) {
  48254. if (is_string($schema->extends)) {
  48255. $schema->extends = $this->validateUri($schema, $schema->extends);
  48256. }
  48257. if (is_array($schema->extends)) {
  48258. foreach ($schema->extends as $extends) {
  48259. $this->checkUndefined($value, $extends, $path, $i);
  48260. }
  48261. } else {
  48262. $this->checkUndefined($value, $schema->extends, $path, $i);
  48263. }
  48264. }
  48265. if (!$path->fromDefault()) {
  48266. $this->applyDefaultValues($value, $schema, $path);
  48267. }
  48268. if ($this->getTypeCheck()->isObject($value)) {
  48269. if (!($value instanceof self) && isset($schema->required) && is_array($schema->required)) {
  48270. foreach ($schema->required as $required) {
  48271. if (!$this->getTypeCheck()->propertyExists($value, $required)) {
  48272. $this->addError(
  48273. $this->incrementPath($path ?: new JsonPointer(''), $required),
  48274. 'The property ' . $required . ' is required',
  48275. 'required'
  48276. );
  48277. }
  48278. }
  48279. } elseif (isset($schema->required) && !is_array($schema->required)) {
  48280. if ($schema->required && $value instanceof self) {
  48281. $propertyPaths = $path->getPropertyPaths();
  48282. $propertyName = end($propertyPaths);
  48283. $this->addError(
  48284. $path,
  48285. 'The property ' . $propertyName . ' is required',
  48286. 'required'
  48287. );
  48288. }
  48289. }
  48290. }
  48291. if (!($value instanceof self)) {
  48292. $this->checkType($value, $schema, $path, $i);
  48293. }
  48294. if (isset($schema->disallow)) {
  48295. $initErrors = $this->getErrors();
  48296. $typeSchema = new \stdClass();
  48297. $typeSchema->type = $schema->disallow;
  48298. $this->checkType($value, $typeSchema, $path);
  48299. if (count($this->getErrors()) == count($initErrors)) {
  48300. $this->addError($path, 'Disallowed value was matched', 'disallow');
  48301. } else {
  48302. $this->errors = $initErrors;
  48303. }
  48304. }
  48305. if (isset($schema->not)) {
  48306. $initErrors = $this->getErrors();
  48307. $this->checkUndefined($value, $schema->not, $path, $i);
  48308. if (count($this->getErrors()) == count($initErrors)) {
  48309. $this->addError($path, 'Matched a schema which it should not', 'not');
  48310. } else {
  48311. $this->errors = $initErrors;
  48312. }
  48313. }
  48314. if (isset($schema->dependencies) && $this->getTypeCheck()->isObject($value)) {
  48315. $this->validateDependencies($value, $schema->dependencies, $path);
  48316. }
  48317. }
  48318. private function shouldApplyDefaultValue($requiredOnly, $schema, $name = null, $parentSchema = null)
  48319. {
  48320. if (!$requiredOnly) {
  48321. return true;
  48322. }
  48323. if (
  48324. $name !== null
  48325. && isset($parentSchema->required)
  48326. && is_array($parentSchema->required)
  48327. && in_array($name, $parentSchema->required)
  48328. ) {
  48329. return true;
  48330. }
  48331. if (isset($schema->required) && !is_array($schema->required) && $schema->required) {
  48332. return true;
  48333. }
  48334. return false;
  48335. }
  48336. protected function applyDefaultValues(&$value, $schema, $path)
  48337. {
  48338. if (!$this->factory->getConfig(self::CHECK_MODE_APPLY_DEFAULTS)) {
  48339. return;
  48340. }
  48341. $requiredOnly = $this->factory->getConfig(self::CHECK_MODE_ONLY_REQUIRED_DEFAULTS);
  48342. if (isset($schema->properties) && LooseTypeCheck::isObject($value)) {
  48343. foreach ($schema->properties as $currentProperty => $propertyDefinition) {
  48344. $propertyDefinition = $this->factory->getSchemaStorage()->resolveRefSchema($propertyDefinition);
  48345. if (
  48346. !LooseTypeCheck::propertyExists($value, $currentProperty)
  48347. && property_exists($propertyDefinition, 'default')
  48348. && $this->shouldApplyDefaultValue($requiredOnly, $propertyDefinition, $currentProperty, $schema)
  48349. ) {
  48350. if (is_object($propertyDefinition->default)) {
  48351. LooseTypeCheck::propertySet($value, $currentProperty, clone $propertyDefinition->default);
  48352. } else {
  48353. LooseTypeCheck::propertySet($value, $currentProperty, $propertyDefinition->default);
  48354. }
  48355. $this->appliedDefaults[] = $currentProperty;
  48356. }
  48357. }
  48358. } elseif (isset($schema->items) && LooseTypeCheck::isArray($value)) {
  48359. $items = array();
  48360. if (LooseTypeCheck::isArray($schema->items)) {
  48361. $items = $schema->items;
  48362. } elseif (isset($schema->minItems) && count($value) < $schema->minItems) {
  48363. $items = array_fill(count($value), $schema->minItems - count($value), $schema->items);
  48364. }
  48365. foreach ($items as $currentItem => $itemDefinition) {
  48366. $itemDefinition = $this->factory->getSchemaStorage()->resolveRefSchema($itemDefinition);
  48367. if (
  48368. !array_key_exists($currentItem, $value)
  48369. && property_exists($itemDefinition, 'default')
  48370. && $this->shouldApplyDefaultValue($requiredOnly, $itemDefinition)) {
  48371. if (is_object($itemDefinition->default)) {
  48372. $value[$currentItem] = clone $itemDefinition->default;
  48373. } else {
  48374. $value[$currentItem] = $itemDefinition->default;
  48375. }
  48376. }
  48377. $path->setFromDefault();
  48378. }
  48379. } elseif (
  48380. $value instanceof self
  48381. && property_exists($schema, 'default')
  48382. && $this->shouldApplyDefaultValue($requiredOnly, $schema)) {
  48383. $value = is_object($schema->default) ? clone $schema->default : $schema->default;
  48384. $path->setFromDefault();
  48385. }
  48386. }
  48387. protected function validateOfProperties(&$value, $schema, JsonPointer $path, $i = '')
  48388. {
  48389. if ($value instanceof self) {
  48390. return;
  48391. }
  48392. if (isset($schema->allOf)) {
  48393. $isValid = true;
  48394. foreach ($schema->allOf as $allOf) {
  48395. $initErrors = $this->getErrors();
  48396. $this->checkUndefined($value, $allOf, $path, $i);
  48397. $isValid = $isValid && (count($this->getErrors()) == count($initErrors));
  48398. }
  48399. if (!$isValid) {
  48400. $this->addError($path, 'Failed to match all schemas', 'allOf');
  48401. }
  48402. }
  48403. if (isset($schema->anyOf)) {
  48404. $isValid = false;
  48405. $startErrors = $this->getErrors();
  48406. $caughtException = null;
  48407. foreach ($schema->anyOf as $anyOf) {
  48408. $initErrors = $this->getErrors();
  48409. try {
  48410. $this->checkUndefined($value, $anyOf, $path, $i);
  48411. if ($isValid = (count($this->getErrors()) == count($initErrors))) {
  48412. break;
  48413. }
  48414. } catch (ValidationException $e) {
  48415. $isValid = false;
  48416. }
  48417. }
  48418. if (!$isValid) {
  48419. $this->addError($path, 'Failed to match at least one schema', 'anyOf');
  48420. } else {
  48421. $this->errors = $startErrors;
  48422. }
  48423. }
  48424. if (isset($schema->oneOf)) {
  48425. $allErrors = array();
  48426. $matchedSchemas = 0;
  48427. $startErrors = $this->getErrors();
  48428. foreach ($schema->oneOf as $oneOf) {
  48429. try {
  48430. $this->errors = array();
  48431. $this->checkUndefined($value, $oneOf, $path, $i);
  48432. if (count($this->getErrors()) == 0) {
  48433. $matchedSchemas++;
  48434. }
  48435. $allErrors = array_merge($allErrors, array_values($this->getErrors()));
  48436. } catch (ValidationException $e) {
  48437. }
  48438. }
  48439. if ($matchedSchemas !== 1) {
  48440. $this->addErrors(array_merge($allErrors, $startErrors));
  48441. $this->addError($path, 'Failed to match exactly one schema', 'oneOf');
  48442. } else {
  48443. $this->errors = $startErrors;
  48444. }
  48445. }
  48446. }
  48447. protected function validateDependencies($value, $dependencies, JsonPointer $path, $i = '')
  48448. {
  48449. foreach ($dependencies as $key => $dependency) {
  48450. if ($this->getTypeCheck()->propertyExists($value, $key)) {
  48451. if (is_string($dependency)) {
  48452. if (!$this->getTypeCheck()->propertyExists($value, $dependency)) {
  48453. $this->addError($path, "$key depends on $dependency and $dependency is missing", 'dependencies');
  48454. }
  48455. } elseif (is_array($dependency)) {
  48456. foreach ($dependency as $d) {
  48457. if (!$this->getTypeCheck()->propertyExists($value, $d)) {
  48458. $this->addError($path, "$key depends on $d and $d is missing", 'dependencies');
  48459. }
  48460. }
  48461. } elseif (is_object($dependency)) {
  48462. $this->checkUndefined($value, $dependency, $path, $i);
  48463. }
  48464. }
  48465. }
  48466. }
  48467. protected function validateUri($schema, $schemaUri = null)
  48468. {
  48469. $resolver = new UriResolver();
  48470. $retriever = $this->factory->getUriRetriever();
  48471. $jsonSchema = null;
  48472. if ($resolver->isValid($schemaUri)) {
  48473. $schemaId = property_exists($schema, 'id') ? $schema->id : null;
  48474. $jsonSchema = $retriever->retrieve($schemaId, $schemaUri);
  48475. }
  48476. return $jsonSchema;
  48477. }
  48478. }
  48479. <?php
  48480. namespace JsonSchema\Entity;
  48481. use JsonSchema\Exception\InvalidArgumentException;
  48482. class JsonPointer
  48483. {
  48484. private $filename;
  48485. private $propertyPaths = array();
  48486. private $fromDefault = false;
  48487. public function __construct($value)
  48488. {
  48489. if (!is_string($value)) {
  48490. throw new InvalidArgumentException('Ref value must be a string');
  48491. }
  48492. $splitRef = explode('#', $value, 2);
  48493. $this->filename = $splitRef[0];
  48494. if (array_key_exists(1, $splitRef)) {
  48495. $this->propertyPaths = $this->decodePropertyPaths($splitRef[1]);
  48496. }
  48497. }
  48498. private function decodePropertyPaths($propertyPathString)
  48499. {
  48500. $paths = array();
  48501. foreach (explode('/', trim($propertyPathString, '/')) as $path) {
  48502. $path = $this->decodePath($path);
  48503. if (is_string($path) && '' !== $path) {
  48504. $paths[] = $path;
  48505. }
  48506. }
  48507. return $paths;
  48508. }
  48509. private function encodePropertyPaths()
  48510. {
  48511. return array_map(
  48512. array($this, 'encodePath'),
  48513. $this->getPropertyPaths()
  48514. );
  48515. }
  48516. private function decodePath($path)
  48517. {
  48518. return strtr($path, array('~1' => '/', '~0' => '~', '%25' => '%'));
  48519. }
  48520. private function encodePath($path)
  48521. {
  48522. return strtr($path, array('/' => '~1', '~' => '~0', '%' => '%25'));
  48523. }
  48524. public function getFilename()
  48525. {
  48526. return $this->filename;
  48527. }
  48528. public function getPropertyPaths()
  48529. {
  48530. return $this->propertyPaths;
  48531. }
  48532. public function withPropertyPaths(array $propertyPaths)
  48533. {
  48534. $new = clone $this;
  48535. $new->propertyPaths = $propertyPaths;
  48536. return $new;
  48537. }
  48538. public function getPropertyPathAsString()
  48539. {
  48540. return rtrim('#/' . implode('/', $this->encodePropertyPaths()), '/');
  48541. }
  48542. public function __toString()
  48543. {
  48544. return $this->getFilename() . $this->getPropertyPathAsString();
  48545. }
  48546. public function setFromDefault()
  48547. {
  48548. $this->fromDefault = true;
  48549. }
  48550. public function fromDefault()
  48551. {
  48552. return $this->fromDefault;
  48553. }
  48554. }
  48555. <?php
  48556. namespace JsonSchema\Exception;
  48557. interface ExceptionInterface
  48558. {
  48559. }
  48560. <?php
  48561. namespace JsonSchema\Exception;
  48562. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  48563. {
  48564. }
  48565. <?php
  48566. namespace JsonSchema\Exception;
  48567. class InvalidConfigException extends RuntimeException
  48568. {
  48569. }
  48570. <?php
  48571. namespace JsonSchema\Exception;
  48572. class InvalidSchemaException extends RuntimeException
  48573. {
  48574. }
  48575. <?php
  48576. namespace JsonSchema\Exception;
  48577. class InvalidSchemaMediaTypeException extends RuntimeException
  48578. {
  48579. }
  48580. <?php
  48581. namespace JsonSchema\Exception;
  48582. class InvalidSourceUriException extends InvalidArgumentException
  48583. {
  48584. }
  48585. <?php
  48586. namespace JsonSchema\Exception;
  48587. class JsonDecodingException extends RuntimeException
  48588. {
  48589. public function __construct($code = JSON_ERROR_NONE, \Exception $previous = null)
  48590. {
  48591. switch ($code) {
  48592. case JSON_ERROR_DEPTH:
  48593. $message = 'The maximum stack depth has been exceeded';
  48594. break;
  48595. case JSON_ERROR_STATE_MISMATCH:
  48596. $message = 'Invalid or malformed JSON';
  48597. break;
  48598. case JSON_ERROR_CTRL_CHAR:
  48599. $message = 'Control character error, possibly incorrectly encoded';
  48600. break;
  48601. case JSON_ERROR_UTF8:
  48602. $message = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  48603. break;
  48604. case JSON_ERROR_SYNTAX:
  48605. $message = 'JSON syntax is malformed';
  48606. break;
  48607. default:
  48608. $message = 'Syntax error';
  48609. }
  48610. parent::__construct($message, $code, $previous);
  48611. }
  48612. }
  48613. <?php
  48614. namespace JsonSchema\Exception;
  48615. class ResourceNotFoundException extends RuntimeException
  48616. {
  48617. }
  48618. <?php
  48619. namespace JsonSchema\Exception;
  48620. class RuntimeException extends \RuntimeException implements ExceptionInterface
  48621. {
  48622. }
  48623. <?php
  48624. namespace JsonSchema\Exception;
  48625. class UnresolvableJsonPointerException extends InvalidArgumentException
  48626. {
  48627. }
  48628. <?php
  48629. namespace JsonSchema\Exception;
  48630. class UriResolverException extends RuntimeException
  48631. {
  48632. }
  48633. <?php
  48634. namespace JsonSchema\Exception;
  48635. class ValidationException extends RuntimeException
  48636. {
  48637. }
  48638. <?php
  48639. namespace JsonSchema\Iterator;
  48640. class ObjectIterator implements \Iterator, \Countable
  48641. {
  48642. private $object;
  48643. private $position = 0;
  48644. private $data = array();
  48645. private $initialized = false;
  48646. public function __construct($object)
  48647. {
  48648. $this->object = $object;
  48649. }
  48650. public function current()
  48651. {
  48652. $this->initialize();
  48653. return $this->data[$this->position];
  48654. }
  48655. public function next()
  48656. {
  48657. $this->initialize();
  48658. $this->position++;
  48659. }
  48660. public function key()
  48661. {
  48662. $this->initialize();
  48663. return $this->position;
  48664. }
  48665. public function valid()
  48666. {
  48667. $this->initialize();
  48668. return isset($this->data[$this->position]);
  48669. }
  48670. public function rewind()
  48671. {
  48672. $this->initialize();
  48673. $this->position = 0;
  48674. }
  48675. public function count()
  48676. {
  48677. $this->initialize();
  48678. return count($this->data);
  48679. }
  48680. private function initialize()
  48681. {
  48682. if (!$this->initialized) {
  48683. $this->data = $this->buildDataFromObject($this->object);
  48684. $this->initialized = true;
  48685. }
  48686. }
  48687. private function buildDataFromObject($object)
  48688. {
  48689. $result = array();
  48690. $stack = new \SplStack();
  48691. $stack->push($object);
  48692. while (!$stack->isEmpty()) {
  48693. $current = $stack->pop();
  48694. if (is_object($current)) {
  48695. array_push($result, $current);
  48696. }
  48697. foreach ($this->getDataFromItem($current) as $propertyName => $propertyValue) {
  48698. if (is_object($propertyValue) || is_array($propertyValue)) {
  48699. $stack->push($propertyValue);
  48700. }
  48701. }
  48702. }
  48703. return $result;
  48704. }
  48705. private function getDataFromItem($item)
  48706. {
  48707. if (!is_object($item) && !is_array($item)) {
  48708. return array();
  48709. }
  48710. return is_object($item) ? get_object_vars($item) : $item;
  48711. }
  48712. }
  48713. <?php
  48714. namespace JsonSchema;
  48715. class Rfc3339
  48716. {
  48717. const REGEX = '/^(\d{4}-\d{2}-\d{2}[T ]{1}\d{2}:\d{2}:\d{2})(\.\d+)?(Z|([+-]\d{2}):?(\d{2}))$/';
  48718. public static function createFromString($string)
  48719. {
  48720. if (!preg_match(self::REGEX, strtoupper($string), $matches)) {
  48721. return null;
  48722. }
  48723. $dateAndTime = $matches[1];
  48724. $microseconds = $matches[2] ?: '.000000';
  48725. $timeZone = 'Z' !== $matches[3] ? $matches[4] . ':' . $matches[5] : '+00:00';
  48726. $dateFormat = strpos($dateAndTime, 'T') === false ? 'Y-m-d H:i:s.uP' : 'Y-m-d\TH:i:s.uP';
  48727. $dateTime = \DateTime::createFromFormat($dateFormat, $dateAndTime . $microseconds . $timeZone, new \DateTimeZone('UTC'));
  48728. return $dateTime ?: null;
  48729. }
  48730. }
  48731. <?php
  48732. namespace JsonSchema;
  48733. use JsonSchema\Constraints\BaseConstraint;
  48734. use JsonSchema\Entity\JsonPointer;
  48735. use JsonSchema\Exception\UnresolvableJsonPointerException;
  48736. use JsonSchema\Uri\UriResolver;
  48737. use JsonSchema\Uri\UriRetriever;
  48738. class SchemaStorage implements SchemaStorageInterface
  48739. {
  48740. const INTERNAL_PROVIDED_SCHEMA_URI = 'internal://provided-schema/';
  48741. protected $uriRetriever;
  48742. protected $uriResolver;
  48743. protected $schemas = array();
  48744. public function __construct(
  48745. UriRetrieverInterface $uriRetriever = null,
  48746. UriResolverInterface $uriResolver = null
  48747. ) {
  48748. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  48749. $this->uriResolver = $uriResolver ?: new UriResolver();
  48750. }
  48751. public function getUriRetriever()
  48752. {
  48753. return $this->uriRetriever;
  48754. }
  48755. public function getUriResolver()
  48756. {
  48757. return $this->uriResolver;
  48758. }
  48759. public function addSchema($id, $schema = null)
  48760. {
  48761. if (is_null($schema) && $id !== self::INTERNAL_PROVIDED_SCHEMA_URI) {
  48762. $schema = $this->uriRetriever->retrieve($id);
  48763. }
  48764. if (is_array($schema)) {
  48765. $schema = BaseConstraint::arrayToObjectRecursive($schema);
  48766. }
  48767. if (is_object($schema) && property_exists($schema, 'id')) {
  48768. if ($schema->id == 'http://json-schema.org/draft-04/schema#') {
  48769. $schema->properties->id->format = 'uri-reference';
  48770. } elseif ($schema->id == 'http://json-schema.org/draft-03/schema#') {
  48771. $schema->properties->id->format = 'uri-reference';
  48772. $schema->properties->{'$ref'}->format = 'uri-reference';
  48773. }
  48774. }
  48775. $this->expandRefs($schema, $id);
  48776. $this->schemas[$id] = $schema;
  48777. }
  48778. private function expandRefs(&$schema, $base = null)
  48779. {
  48780. if (!is_object($schema)) {
  48781. if (is_array($schema)) {
  48782. foreach ($schema as &$member) {
  48783. $this->expandRefs($member, $base);
  48784. }
  48785. }
  48786. return;
  48787. }
  48788. if (property_exists($schema, 'id') && is_string($schema->id) && $base != $schema->id) {
  48789. $base = $this->uriResolver->resolve($schema->id, $base);
  48790. }
  48791. if (property_exists($schema, '$ref') && is_string($schema->{'$ref'})) {
  48792. $refPointer = new JsonPointer($this->uriResolver->resolve($schema->{'$ref'}, $base));
  48793. $schema->{'$ref'} = (string) $refPointer;
  48794. }
  48795. foreach ($schema as &$member) {
  48796. $this->expandRefs($member, $base);
  48797. }
  48798. }
  48799. public function getSchema($id)
  48800. {
  48801. if (!array_key_exists($id, $this->schemas)) {
  48802. $this->addSchema($id);
  48803. }
  48804. return $this->schemas[$id];
  48805. }
  48806. public function resolveRef($ref)
  48807. {
  48808. $jsonPointer = new JsonPointer($ref);
  48809. $fileName = $jsonPointer->getFilename();
  48810. if (!strlen($fileName)) {
  48811. throw new UnresolvableJsonPointerException(sprintf(
  48812. "Could not resolve fragment '%s': no file is defined",
  48813. $jsonPointer->getPropertyPathAsString()
  48814. ));
  48815. }
  48816. $refSchema = $this->getSchema($fileName);
  48817. foreach ($jsonPointer->getPropertyPaths() as $path) {
  48818. if (is_object($refSchema) && property_exists($refSchema, $path)) {
  48819. $refSchema = $this->resolveRefSchema($refSchema->{$path});
  48820. } elseif (is_array($refSchema) && array_key_exists($path, $refSchema)) {
  48821. $refSchema = $this->resolveRefSchema($refSchema[$path]);
  48822. } else {
  48823. throw new UnresolvableJsonPointerException(sprintf(
  48824. 'File: %s is found, but could not resolve fragment: %s',
  48825. $jsonPointer->getFilename(),
  48826. $jsonPointer->getPropertyPathAsString()
  48827. ));
  48828. }
  48829. }
  48830. return $refSchema;
  48831. }
  48832. public function resolveRefSchema($refSchema)
  48833. {
  48834. if (is_object($refSchema) && property_exists($refSchema, '$ref') && is_string($refSchema->{'$ref'})) {
  48835. $newSchema = $this->resolveRef($refSchema->{'$ref'});
  48836. $refSchema = (object) (get_object_vars($refSchema) + get_object_vars($newSchema));
  48837. unset($refSchema->{'$ref'});
  48838. }
  48839. return $refSchema;
  48840. }
  48841. }
  48842. <?php
  48843. namespace JsonSchema;
  48844. interface SchemaStorageInterface
  48845. {
  48846. public function addSchema($id, $schema = null);
  48847. public function getSchema($id);
  48848. public function resolveRef($ref);
  48849. public function resolveRefSchema($refSchema);
  48850. }
  48851. <?php
  48852. namespace JsonSchema\Uri\Retrievers;
  48853. abstract class AbstractRetriever implements UriRetrieverInterface
  48854. {
  48855. protected $contentType;
  48856. public function getContentType()
  48857. {
  48858. return $this->contentType;
  48859. }
  48860. }
  48861. <?php
  48862. namespace JsonSchema\Uri\Retrievers;
  48863. use JsonSchema\Exception\RuntimeException;
  48864. use JsonSchema\Validator;
  48865. class Curl extends AbstractRetriever
  48866. {
  48867. protected $messageBody;
  48868. public function __construct()
  48869. {
  48870. if (!function_exists('curl_init')) {
  48871. throw new RuntimeException('cURL not installed');
  48872. }
  48873. }
  48874. public function retrieve($uri)
  48875. {
  48876. $ch = curl_init();
  48877. curl_setopt($ch, CURLOPT_URL, $uri);
  48878. curl_setopt($ch, CURLOPT_HEADER, true);
  48879. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  48880. curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: ' . Validator::SCHEMA_MEDIA_TYPE));
  48881. $response = curl_exec($ch);
  48882. if (false === $response) {
  48883. throw new \JsonSchema\Exception\ResourceNotFoundException('JSON schema not found');
  48884. }
  48885. $this->fetchMessageBody($response);
  48886. $this->fetchContentType($response);
  48887. curl_close($ch);
  48888. return $this->messageBody;
  48889. }
  48890. private function fetchMessageBody($response)
  48891. {
  48892. preg_match("/(?:\r\n){2}(.*)$/ms", $response, $match);
  48893. $this->messageBody = $match[1];
  48894. }
  48895. protected function fetchContentType($response)
  48896. {
  48897. if (0 < preg_match("/Content-Type:(\V*)/ims", $response, $match)) {
  48898. $this->contentType = trim($match[1]);
  48899. return true;
  48900. }
  48901. return false;
  48902. }
  48903. }
  48904. <?php
  48905. namespace JsonSchema\Uri\Retrievers;
  48906. use JsonSchema\Exception\ResourceNotFoundException;
  48907. class FileGetContents extends AbstractRetriever
  48908. {
  48909. protected $messageBody;
  48910. public function retrieve($uri)
  48911. {
  48912. $errorMessage = null;
  48913. set_error_handler(function ($errno, $errstr) use (&$errorMessage) {
  48914. $errorMessage = $errstr;
  48915. });
  48916. $response = file_get_contents($uri);
  48917. restore_error_handler();
  48918. if ($errorMessage) {
  48919. throw new ResourceNotFoundException($errorMessage);
  48920. }
  48921. if (false === $response) {
  48922. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  48923. }
  48924. if ($response == ''
  48925. && substr($uri, 0, 7) == 'file://' && substr($uri, -1) == '/'
  48926. ) {
  48927. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  48928. }
  48929. $this->messageBody = $response;
  48930. if (!empty($http_response_header)) {
  48931. $this->fetchContentType($http_response_header);
  48932. } else {
  48933. $this->contentType = null;
  48934. }
  48935. return $this->messageBody;
  48936. }
  48937. private function fetchContentType(array $headers)
  48938. {
  48939. foreach ($headers as $header) {
  48940. if ($this->contentType = self::getContentTypeMatchInHeader($header)) {
  48941. return true;
  48942. }
  48943. }
  48944. return false;
  48945. }
  48946. protected static function getContentTypeMatchInHeader($header)
  48947. {
  48948. if (0 < preg_match("/Content-Type:(\V*)/ims", $header, $match)) {
  48949. return trim($match[1]);
  48950. }
  48951. return null;
  48952. }
  48953. }
  48954. <?php
  48955. namespace JsonSchema\Uri\Retrievers;
  48956. use JsonSchema\Validator;
  48957. class PredefinedArray extends AbstractRetriever
  48958. {
  48959. private $schemas;
  48960. public function __construct(array $schemas, $contentType = Validator::SCHEMA_MEDIA_TYPE)
  48961. {
  48962. $this->schemas = $schemas;
  48963. $this->contentType = $contentType;
  48964. }
  48965. public function retrieve($uri)
  48966. {
  48967. if (!array_key_exists($uri, $this->schemas)) {
  48968. throw new \JsonSchema\Exception\ResourceNotFoundException(sprintf(
  48969. 'The JSON schema "%s" was not found.',
  48970. $uri
  48971. ));
  48972. }
  48973. return $this->schemas[$uri];
  48974. }
  48975. }
  48976. <?php
  48977. namespace JsonSchema\Uri\Retrievers;
  48978. interface UriRetrieverInterface
  48979. {
  48980. public function retrieve($uri);
  48981. public function getContentType();
  48982. }
  48983. <?php
  48984. namespace JsonSchema\Uri;
  48985. use JsonSchema\Exception\UriResolverException;
  48986. use JsonSchema\UriResolverInterface;
  48987. class UriResolver implements UriResolverInterface
  48988. {
  48989. public function parse($uri)
  48990. {
  48991. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  48992. $components = array();
  48993. if (5 < count($match)) {
  48994. $components = array(
  48995. 'scheme' => $match[2],
  48996. 'authority' => $match[4],
  48997. 'path' => $match[5]
  48998. );
  48999. }
  49000. if (7 < count($match)) {
  49001. $components['query'] = $match[7];
  49002. }
  49003. if (9 < count($match)) {
  49004. $components['fragment'] = $match[9];
  49005. }
  49006. return $components;
  49007. }
  49008. public function generate(array $components)
  49009. {
  49010. $uri = $components['scheme'] . '://'
  49011. . $components['authority']
  49012. . $components['path'];
  49013. if (array_key_exists('query', $components) && strlen($components['query'])) {
  49014. $uri .= '?' . $components['query'];
  49015. }
  49016. if (array_key_exists('fragment', $components)) {
  49017. $uri .= '#' . $components['fragment'];
  49018. }
  49019. return $uri;
  49020. }
  49021. public function resolve($uri, $baseUri = null)
  49022. {
  49023. if (
  49024. !is_null($baseUri) &&
  49025. !filter_var($baseUri, \FILTER_VALIDATE_URL) &&
  49026. !preg_match('|^[^/]+://|u', $baseUri)
  49027. ) {
  49028. if (is_file($baseUri)) {
  49029. $baseUri = 'file://' . realpath($baseUri);
  49030. } elseif (is_dir($baseUri)) {
  49031. $baseUri = 'file://' . realpath($baseUri) . '/';
  49032. } else {
  49033. $baseUri = 'file://' . getcwd() . '/' . $baseUri;
  49034. }
  49035. }
  49036. if ($uri == '') {
  49037. return $baseUri;
  49038. }
  49039. $components = $this->parse($uri);
  49040. $path = $components['path'];
  49041. if (!empty($components['scheme'])) {
  49042. return $uri;
  49043. }
  49044. $baseComponents = $this->parse($baseUri);
  49045. $basePath = $baseComponents['path'];
  49046. $baseComponents['path'] = self::combineRelativePathWithBasePath($path, $basePath);
  49047. if (isset($components['fragment'])) {
  49048. $baseComponents['fragment'] = $components['fragment'];
  49049. }
  49050. return $this->generate($baseComponents);
  49051. }
  49052. public static function combineRelativePathWithBasePath($relativePath, $basePath)
  49053. {
  49054. $relativePath = self::normalizePath($relativePath);
  49055. if ($relativePath == '') {
  49056. return $basePath;
  49057. }
  49058. if ($relativePath[0] == '/') {
  49059. return $relativePath;
  49060. }
  49061. $basePathSegments = explode('/', $basePath);
  49062. preg_match('|^/?(\.\./(?:\./)*)*|', $relativePath, $match);
  49063. $numLevelUp = strlen($match[0]) /3 + 1;
  49064. if ($numLevelUp >= count($basePathSegments)) {
  49065. throw new UriResolverException(sprintf("Unable to resolve URI '%s' from base '%s'", $relativePath, $basePath));
  49066. }
  49067. $basePathSegments = array_slice($basePathSegments, 0, -$numLevelUp);
  49068. $path = preg_replace('|^/?(\.\./(\./)*)*|', '', $relativePath);
  49069. return implode('/', $basePathSegments) . '/' . $path;
  49070. }
  49071. private static function normalizePath($path)
  49072. {
  49073. $path = preg_replace('|((?<!\.)\./)*|', '', $path);
  49074. $path = preg_replace('|//|', '/', $path);
  49075. return $path;
  49076. }
  49077. public function isValid($uri)
  49078. {
  49079. $components = $this->parse($uri);
  49080. return !empty($components);
  49081. }
  49082. }
  49083. <?php
  49084. namespace JsonSchema\Uri;
  49085. use JsonSchema\Exception\InvalidSchemaMediaTypeException;
  49086. use JsonSchema\Exception\JsonDecodingException;
  49087. use JsonSchema\Exception\ResourceNotFoundException;
  49088. use JsonSchema\Uri\Retrievers\FileGetContents;
  49089. use JsonSchema\Uri\Retrievers\UriRetrieverInterface;
  49090. use JsonSchema\UriRetrieverInterface as BaseUriRetrieverInterface;
  49091. use JsonSchema\Validator;
  49092. class UriRetriever implements BaseUriRetrieverInterface
  49093. {
  49094. protected $translationMap = array(
  49095. '|^https?://json-schema.org/draft-(0[34])/schema#?|' => 'package://dist/schema/json-schema-draft-$1.json'
  49096. );
  49097. protected $uriRetriever = null;
  49098. private $schemaCache = array();
  49099. public function confirmMediaType($uriRetriever, $uri)
  49100. {
  49101. $contentType = $uriRetriever->getContentType();
  49102. if (is_null($contentType)) {
  49103. return;
  49104. }
  49105. if (in_array($contentType, array(Validator::SCHEMA_MEDIA_TYPE, 'application/json'))) {
  49106. return;
  49107. }
  49108. if (substr($uri, 0, 23) == 'http://json-schema.org/') {
  49109. return true;
  49110. }
  49111. throw new InvalidSchemaMediaTypeException(sprintf('Media type %s expected', Validator::SCHEMA_MEDIA_TYPE));
  49112. }
  49113. public function getUriRetriever()
  49114. {
  49115. if (is_null($this->uriRetriever)) {
  49116. $this->setUriRetriever(new FileGetContents());
  49117. }
  49118. return $this->uriRetriever;
  49119. }
  49120. public function resolvePointer($jsonSchema, $uri)
  49121. {
  49122. $resolver = new UriResolver();
  49123. $parsed = $resolver->parse($uri);
  49124. if (empty($parsed['fragment'])) {
  49125. return $jsonSchema;
  49126. }
  49127. $path = explode('/', $parsed['fragment']);
  49128. while ($path) {
  49129. $pathElement = array_shift($path);
  49130. if (!empty($pathElement)) {
  49131. $pathElement = str_replace('~1', '/', $pathElement);
  49132. $pathElement = str_replace('~0', '~', $pathElement);
  49133. if (!empty($jsonSchema->$pathElement)) {
  49134. $jsonSchema = $jsonSchema->$pathElement;
  49135. } else {
  49136. throw new ResourceNotFoundException(
  49137. 'Fragment "' . $parsed['fragment'] . '" not found'
  49138. . ' in ' . $uri
  49139. );
  49140. }
  49141. if (!is_object($jsonSchema)) {
  49142. throw new ResourceNotFoundException(
  49143. 'Fragment part "' . $pathElement . '" is no object '
  49144. . ' in ' . $uri
  49145. );
  49146. }
  49147. }
  49148. }
  49149. return $jsonSchema;
  49150. }
  49151. public function retrieve($uri, $baseUri = null, $translate = true)
  49152. {
  49153. $resolver = new UriResolver();
  49154. $resolvedUri = $fetchUri = $resolver->resolve($uri, $baseUri);
  49155. $arParts = $resolver->parse($resolvedUri);
  49156. if (isset($arParts['fragment'])) {
  49157. unset($arParts['fragment']);
  49158. $fetchUri = $resolver->generate($arParts);
  49159. }
  49160. if ($translate) {
  49161. $fetchUri = $this->translate($fetchUri);
  49162. }
  49163. $jsonSchema = $this->loadSchema($fetchUri);
  49164. $jsonSchema = $this->resolvePointer($jsonSchema, $resolvedUri);
  49165. if ($jsonSchema instanceof \stdClass) {
  49166. $jsonSchema->id = $resolvedUri;
  49167. }
  49168. return $jsonSchema;
  49169. }
  49170. protected function loadSchema($fetchUri)
  49171. {
  49172. if (isset($this->schemaCache[$fetchUri])) {
  49173. return $this->schemaCache[$fetchUri];
  49174. }
  49175. $uriRetriever = $this->getUriRetriever();
  49176. $contents = $this->uriRetriever->retrieve($fetchUri);
  49177. $this->confirmMediaType($uriRetriever, $fetchUri);
  49178. $jsonSchema = json_decode($contents);
  49179. if (JSON_ERROR_NONE < $error = json_last_error()) {
  49180. throw new JsonDecodingException($error);
  49181. }
  49182. $this->schemaCache[$fetchUri] = $jsonSchema;
  49183. return $jsonSchema;
  49184. }
  49185. public function setUriRetriever(UriRetrieverInterface $uriRetriever)
  49186. {
  49187. $this->uriRetriever = $uriRetriever;
  49188. return $this;
  49189. }
  49190. public function parse($uri)
  49191. {
  49192. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  49193. $components = array();
  49194. if (5 < count($match)) {
  49195. $components = array(
  49196. 'scheme' => $match[2],
  49197. 'authority' => $match[4],
  49198. 'path' => $match[5]
  49199. );
  49200. }
  49201. if (7 < count($match)) {
  49202. $components['query'] = $match[7];
  49203. }
  49204. if (9 < count($match)) {
  49205. $components['fragment'] = $match[9];
  49206. }
  49207. return $components;
  49208. }
  49209. public function generate(array $components)
  49210. {
  49211. $uri = $components['scheme'] . '://'
  49212. . $components['authority']
  49213. . $components['path'];
  49214. if (array_key_exists('query', $components)) {
  49215. $uri .= $components['query'];
  49216. }
  49217. if (array_key_exists('fragment', $components)) {
  49218. $uri .= $components['fragment'];
  49219. }
  49220. return $uri;
  49221. }
  49222. public function resolve($uri, $baseUri = null)
  49223. {
  49224. $components = $this->parse($uri);
  49225. $path = $components['path'];
  49226. if ((array_key_exists('scheme', $components)) && ('http' === $components['scheme'])) {
  49227. return $uri;
  49228. }
  49229. $baseComponents = $this->parse($baseUri);
  49230. $basePath = $baseComponents['path'];
  49231. $baseComponents['path'] = UriResolver::combineRelativePathWithBasePath($path, $basePath);
  49232. return $this->generate($baseComponents);
  49233. }
  49234. public function isValid($uri)
  49235. {
  49236. $components = $this->parse($uri);
  49237. return !empty($components);
  49238. }
  49239. public function setTranslation($from, $to)
  49240. {
  49241. $this->translationMap[$from] = $to;
  49242. }
  49243. public function translate($uri)
  49244. {
  49245. foreach ($this->translationMap as $from => $to) {
  49246. $uri = preg_replace($from, $to, $uri);
  49247. }
  49248. $uri = preg_replace('|^package://|', sprintf('file://%s/', realpath(__DIR__ . '/../../..')), $uri);
  49249. return $uri;
  49250. }
  49251. }
  49252. <?php
  49253. namespace JsonSchema;
  49254. interface UriResolverInterface
  49255. {
  49256. public function resolve($uri, $baseUri = null);
  49257. }
  49258. <?php
  49259. namespace JsonSchema;
  49260. interface UriRetrieverInterface
  49261. {
  49262. public function retrieve($uri, $baseUri = null);
  49263. }
  49264. <?php
  49265. namespace JsonSchema;
  49266. use JsonSchema\Constraints\BaseConstraint;
  49267. use JsonSchema\Constraints\Constraint;
  49268. class Validator extends BaseConstraint
  49269. {
  49270. const SCHEMA_MEDIA_TYPE = 'application/schema+json';
  49271. const ERROR_NONE = 0x00000000;
  49272. const ERROR_ALL = 0xFFFFFFFF;
  49273. const ERROR_DOCUMENT_VALIDATION = 0x00000001;
  49274. const ERROR_SCHEMA_VALIDATION = 0x00000002;
  49275. public function validate(&$value, $schema = null, $checkMode = null)
  49276. {
  49277. if (is_array($schema)) {
  49278. $schema = self::arrayToObjectRecursive($schema);
  49279. }
  49280. $initialCheckMode = $this->factory->getConfig();
  49281. if ($checkMode !== null) {
  49282. $this->factory->setConfig($checkMode);
  49283. }
  49284. if (is_object($schema) && property_exists($schema, 'id')) {
  49285. $schemaURI = $schema->id;
  49286. } else {
  49287. $schemaURI = SchemaStorage::INTERNAL_PROVIDED_SCHEMA_URI;
  49288. }
  49289. $this->factory->getSchemaStorage()->addSchema($schemaURI, $schema);
  49290. $validator = $this->factory->createInstanceFor('schema');
  49291. $validator->check(
  49292. $value,
  49293. $this->factory->getSchemaStorage()->getSchema($schemaURI)
  49294. );
  49295. $this->factory->setConfig($initialCheckMode);
  49296. $this->addErrors(array_unique($validator->getErrors(), SORT_REGULAR));
  49297. return $validator->getErrorMask();
  49298. }
  49299. public function check($value, $schema)
  49300. {
  49301. return $this->validate($value, $schema);
  49302. }
  49303. public function coerce(&$value, $schema)
  49304. {
  49305. return $this->validate($value, $schema, Constraint::CHECK_MODE_COERCE_TYPES);
  49306. }
  49307. }
  49308. Copyright (C) 2015 Composer
  49309. Permission is hereby granted, free of charge, to any person obtaining a copy of
  49310. this software and associated documentation files (the "Software"), to deal in
  49311. the Software without restriction, including without limitation the rights to
  49312. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  49313. of the Software, and to permit persons to whom the Software is furnished to do
  49314. so, subject to the following conditions:
  49315. The above copyright notice and this permission notice shall be included in all
  49316. copies or substantial portions of the Software.
  49317. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  49318. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  49319. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  49320. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  49321. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  49322. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  49323. SOFTWARE.
  49324. <?php
  49325. namespace Composer\Spdx;
  49326. class SpdxLicenses
  49327. {
  49328. const LICENSES_FILE = 'spdx-licenses.json';
  49329. const EXCEPTIONS_FILE = 'spdx-exceptions.json';
  49330. private $licenses;
  49331. private $licensesExpression;
  49332. private $exceptions;
  49333. private $exceptionsExpression;
  49334. public function __construct()
  49335. {
  49336. $this->loadLicenses();
  49337. $this->loadExceptions();
  49338. }
  49339. public function getLicenseByIdentifier($identifier)
  49340. {
  49341. $key = strtolower($identifier);
  49342. if (!isset($this->licenses[$key])) {
  49343. return;
  49344. }
  49345. list($identifier, $name, $isOsiApproved, $isDeprecatedLicenseId) = $this->licenses[$key];
  49346. return array(
  49347. $name,
  49348. $isOsiApproved,
  49349. 'https://spdx.org/licenses/' . $identifier . '.html#licenseText',
  49350. $isDeprecatedLicenseId,
  49351. );
  49352. }
  49353. public function getLicenses()
  49354. {
  49355. return $this->licenses;
  49356. }
  49357. public function getExceptionByIdentifier($identifier)
  49358. {
  49359. $key = strtolower($identifier);
  49360. if (!isset($this->exceptions[$key])) {
  49361. return;
  49362. }
  49363. list($identifier, $name) = $this->exceptions[$key];
  49364. return array(
  49365. $name,
  49366. 'https://spdx.org/licenses/' . $identifier . '.html#licenseExceptionText',
  49367. );
  49368. }
  49369. public function getIdentifierByName($name)
  49370. {
  49371. foreach ($this->licenses as $licenseData) {
  49372. if ($licenseData[1] === $name) {
  49373. return $licenseData[0];
  49374. }
  49375. }
  49376. foreach ($this->exceptions as $licenseData) {
  49377. if ($licenseData[1] === $name) {
  49378. return $licenseData[0];
  49379. }
  49380. }
  49381. }
  49382. public function isOsiApprovedByIdentifier($identifier)
  49383. {
  49384. return $this->licenses[strtolower($identifier)][2];
  49385. }
  49386. public function isDeprecatedByIdentifier($identifier)
  49387. {
  49388. return $this->licenses[strtolower($identifier)][3];
  49389. }
  49390. public function validate($license)
  49391. {
  49392. if (is_array($license)) {
  49393. $count = count($license);
  49394. if ($count !== count(array_filter($license, 'is_string'))) {
  49395. throw new \InvalidArgumentException('Array of strings expected.');
  49396. }
  49397. $license = $count > 1 ? '(' . implode(' OR ', $license) . ')' : (string) reset($license);
  49398. }
  49399. if (!is_string($license)) {
  49400. throw new \InvalidArgumentException(sprintf(
  49401. 'Array or String expected, %s given.',
  49402. gettype($license)
  49403. ));
  49404. }
  49405. return $this->isValidLicenseString($license);
  49406. }
  49407. public static function getResourcesDir()
  49408. {
  49409. return dirname(__DIR__) . '/res';
  49410. }
  49411. private function loadLicenses()
  49412. {
  49413. if (null !== $this->licenses) {
  49414. return;
  49415. }
  49416. $json = file_get_contents(self::getResourcesDir() . '/' . self::LICENSES_FILE);
  49417. $this->licenses = array();
  49418. foreach (json_decode($json, true) as $identifier => $license) {
  49419. $this->licenses[strtolower($identifier)] = array($identifier, $license[0], $license[1], $license[2]);
  49420. }
  49421. }
  49422. private function loadExceptions()
  49423. {
  49424. if (null !== $this->exceptions) {
  49425. return;
  49426. }
  49427. $json = file_get_contents(self::getResourcesDir() . '/' . self::EXCEPTIONS_FILE);
  49428. $this->exceptions = array();
  49429. foreach (json_decode($json, true) as $identifier => $exception) {
  49430. $this->exceptions[strtolower($identifier)] = array($identifier, $exception[0]);
  49431. }
  49432. }
  49433. private function getLicensesExpression()
  49434. {
  49435. if (null === $this->licensesExpression) {
  49436. $licenses = array_map('preg_quote', array_keys($this->licenses));
  49437. rsort($licenses);
  49438. $licenses = implode('|', $licenses);
  49439. $this->licensesExpression = $licenses;
  49440. }
  49441. return $this->licensesExpression;
  49442. }
  49443. private function getExceptionsExpression()
  49444. {
  49445. if (null === $this->exceptionsExpression) {
  49446. $exceptions = array_map('preg_quote', array_keys($this->exceptions));
  49447. rsort($exceptions);
  49448. $exceptions = implode('|', $exceptions);
  49449. $this->exceptionsExpression = $exceptions;
  49450. }
  49451. return $this->exceptionsExpression;
  49452. }
  49453. private function isValidLicenseString($license)
  49454. {
  49455. if (isset($this->licenses[strtolower($license)])) {
  49456. return true;
  49457. }
  49458. $licenses = $this->getLicensesExpression();
  49459. $exceptions = $this->getExceptionsExpression();
  49460. $regex = <<<REGEX
  49461. {
  49462. (?(DEFINE)
  49463. # idstring: 1*( ALPHA / DIGIT / - / . )
  49464. (?<idstring>[\pL\pN.-]{1,})
  49465. # license-id: taken from list
  49466. (?<licenseid>${licenses})
  49467. # license-exception-id: taken from list
  49468. (?<licenseexceptionid>${exceptions})
  49469. # license-ref: [DocumentRef-1*(idstring):]LicenseRef-1*(idstring)
  49470. (?<licenseref>(?:DocumentRef-(?&idstring):)?LicenseRef-(?&idstring))
  49471. # simple-expresssion: license-id / license-id+ / license-ref
  49472. (?<simple_expression>(?&licenseid)\+? | (?&licenseid) | (?&licenseref))
  49473. # compound-expression: 1*(
  49474. # simple-expression /
  49475. # simple-expression WITH license-exception-id /
  49476. # compound-expression AND compound-expression /
  49477. # compound-expression OR compound-expression
  49478. # ) / ( compound-expression ) )
  49479. (?<compound_head>
  49480. (?&simple_expression) ( \s+ WITH \s+ (?&licenseexceptionid))?
  49481. | \( \s* (?&compound_expression) \s* \)
  49482. )
  49483. (?<compound_expression>
  49484. (?&compound_head) (?: \s+ (?:AND|OR) \s+ (?&compound_expression))?
  49485. )
  49486. # license-expression: 1*1(simple-expression / compound-expression)
  49487. (?<license_expression>(?&compound_expression) | (?&simple_expression))
  49488. ) # end of define
  49489. ^(NONE | NOASSERTION | (?&license_expression))$
  49490. }xi
  49491. REGEX;
  49492. $match = preg_match($regex, $license);
  49493. if (0 === $match) {
  49494. return false;
  49495. }
  49496. if (false === $match) {
  49497. throw new \RuntimeException('Regex failed to compile/run.');
  49498. }
  49499. return true;
  49500. }
  49501. }
  49502. Copyright (C) 2015 Composer
  49503. Permission is hereby granted, free of charge, to any person obtaining a copy of
  49504. this software and associated documentation files (the "Software"), to deal in
  49505. the Software without restriction, including without limitation the rights to
  49506. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  49507. of the Software, and to permit persons to whom the Software is furnished to do
  49508. so, subject to the following conditions:
  49509. The above copyright notice and this permission notice shall be included in all
  49510. copies or substantial portions of the Software.
  49511. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  49512. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  49513. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  49514. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  49515. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  49516. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  49517. SOFTWARE.
  49518. <?php
  49519. namespace Composer\Semver;
  49520. use Composer\Semver\Constraint\Constraint;
  49521. class Comparator
  49522. {
  49523. public static function greaterThan($version1, $version2)
  49524. {
  49525. return self::compare($version1, '>', $version2);
  49526. }
  49527. public static function greaterThanOrEqualTo($version1, $version2)
  49528. {
  49529. return self::compare($version1, '>=', $version2);
  49530. }
  49531. public static function lessThan($version1, $version2)
  49532. {
  49533. return self::compare($version1, '<', $version2);
  49534. }
  49535. public static function lessThanOrEqualTo($version1, $version2)
  49536. {
  49537. return self::compare($version1, '<=', $version2);
  49538. }
  49539. public static function equalTo($version1, $version2)
  49540. {
  49541. return self::compare($version1, '==', $version2);
  49542. }
  49543. public static function notEqualTo($version1, $version2)
  49544. {
  49545. return self::compare($version1, '!=', $version2);
  49546. }
  49547. public static function compare($version1, $operator, $version2)
  49548. {
  49549. $constraint = new Constraint($operator, $version2);
  49550. return $constraint->matches(new Constraint('==', $version1));
  49551. }
  49552. }
  49553. <?php
  49554. namespace Composer\Semver\Constraint;
  49555. trigger_error('The ' . __CLASS__ . ' abstract class is deprecated, there is no replacement for it, it will be removed in the next major version.', E_USER_DEPRECATED);
  49556. abstract class AbstractConstraint implements ConstraintInterface
  49557. {
  49558. protected $prettyString;
  49559. public function matches(ConstraintInterface $provider)
  49560. {
  49561. if ($provider instanceof $this) {
  49562. return $this->matchSpecific($provider);
  49563. }
  49564. return $provider->matches($this);
  49565. }
  49566. public function setPrettyString($prettyString)
  49567. {
  49568. $this->prettyString = $prettyString;
  49569. }
  49570. public function getPrettyString()
  49571. {
  49572. if ($this->prettyString) {
  49573. return $this->prettyString;
  49574. }
  49575. return $this->__toString();
  49576. }
  49577. }
  49578. <?php
  49579. namespace Composer\Semver\Constraint;
  49580. class Constraint implements ConstraintInterface
  49581. {
  49582. const OP_EQ = 0;
  49583. const OP_LT = 1;
  49584. const OP_LE = 2;
  49585. const OP_GT = 3;
  49586. const OP_GE = 4;
  49587. const OP_NE = 5;
  49588. private static $transOpStr = array(
  49589. '=' => self::OP_EQ,
  49590. '==' => self::OP_EQ,
  49591. '<' => self::OP_LT,
  49592. '<=' => self::OP_LE,
  49593. '>' => self::OP_GT,
  49594. '>=' => self::OP_GE,
  49595. '<>' => self::OP_NE,
  49596. '!=' => self::OP_NE,
  49597. );
  49598. private static $transOpInt = array(
  49599. self::OP_EQ => '==',
  49600. self::OP_LT => '<',
  49601. self::OP_LE => '<=',
  49602. self::OP_GT => '>',
  49603. self::OP_GE => '>=',
  49604. self::OP_NE => '!=',
  49605. );
  49606. protected $operator;
  49607. protected $version;
  49608. protected $prettyString;
  49609. public function matches(ConstraintInterface $provider)
  49610. {
  49611. if ($provider instanceof $this) {
  49612. return $this->matchSpecific($provider);
  49613. }
  49614. return $provider->matches($this);
  49615. }
  49616. public function setPrettyString($prettyString)
  49617. {
  49618. $this->prettyString = $prettyString;
  49619. }
  49620. public function getPrettyString()
  49621. {
  49622. if ($this->prettyString) {
  49623. return $this->prettyString;
  49624. }
  49625. return $this->__toString();
  49626. }
  49627. public static function getSupportedOperators()
  49628. {
  49629. return array_keys(self::$transOpStr);
  49630. }
  49631. public function __construct($operator, $version)
  49632. {
  49633. if (!isset(self::$transOpStr[$operator])) {
  49634. throw new \InvalidArgumentException(sprintf(
  49635. 'Invalid operator "%s" given, expected one of: %s',
  49636. $operator,
  49637. implode(', ', self::getSupportedOperators())
  49638. ));
  49639. }
  49640. $this->operator = self::$transOpStr[$operator];
  49641. $this->version = $version;
  49642. }
  49643. public function versionCompare($a, $b, $operator, $compareBranches = false)
  49644. {
  49645. if (!isset(self::$transOpStr[$operator])) {
  49646. throw new \InvalidArgumentException(sprintf(
  49647. 'Invalid operator "%s" given, expected one of: %s',
  49648. $operator,
  49649. implode(', ', self::getSupportedOperators())
  49650. ));
  49651. }
  49652. $aIsBranch = 'dev-' === substr($a, 0, 4);
  49653. $bIsBranch = 'dev-' === substr($b, 0, 4);
  49654. if ($aIsBranch && $bIsBranch) {
  49655. return $operator === '==' && $a === $b;
  49656. }
  49657. if (!$compareBranches && ($aIsBranch || $bIsBranch)) {
  49658. return false;
  49659. }
  49660. return version_compare($a, $b, $operator);
  49661. }
  49662. public function matchSpecific(Constraint $provider, $compareBranches = false)
  49663. {
  49664. $noEqualOp = str_replace('=', '', self::$transOpInt[$this->operator]);
  49665. $providerNoEqualOp = str_replace('=', '', self::$transOpInt[$provider->operator]);
  49666. $isEqualOp = self::OP_EQ === $this->operator;
  49667. $isNonEqualOp = self::OP_NE === $this->operator;
  49668. $isProviderEqualOp = self::OP_EQ === $provider->operator;
  49669. $isProviderNonEqualOp = self::OP_NE === $provider->operator;
  49670. if ($isNonEqualOp || $isProviderNonEqualOp) {
  49671. return !$isEqualOp && !$isProviderEqualOp
  49672. || $this->versionCompare($provider->version, $this->version, '!=', $compareBranches);
  49673. }
  49674. if ($this->operator !== self::OP_EQ && $noEqualOp === $providerNoEqualOp) {
  49675. return true;
  49676. }
  49677. if ($this->versionCompare($provider->version, $this->version, self::$transOpInt[$this->operator], $compareBranches)) {
  49678. if ($provider->version === $this->version
  49679. && self::$transOpInt[$provider->operator] === $providerNoEqualOp
  49680. && self::$transOpInt[$this->operator] !== $noEqualOp) {
  49681. return false;
  49682. }
  49683. return true;
  49684. }
  49685. return false;
  49686. }
  49687. public function __toString()
  49688. {
  49689. return self::$transOpInt[$this->operator] . ' ' . $this->version;
  49690. }
  49691. }
  49692. <?php
  49693. namespace Composer\Semver\Constraint;
  49694. interface ConstraintInterface
  49695. {
  49696. public function matches(ConstraintInterface $provider);
  49697. public function getPrettyString();
  49698. public function __toString();
  49699. }
  49700. <?php
  49701. namespace Composer\Semver\Constraint;
  49702. class EmptyConstraint implements ConstraintInterface
  49703. {
  49704. protected $prettyString;
  49705. public function matches(ConstraintInterface $provider)
  49706. {
  49707. return true;
  49708. }
  49709. public function setPrettyString($prettyString)
  49710. {
  49711. $this->prettyString = $prettyString;
  49712. }
  49713. public function getPrettyString()
  49714. {
  49715. if ($this->prettyString) {
  49716. return $this->prettyString;
  49717. }
  49718. return $this->__toString();
  49719. }
  49720. public function __toString()
  49721. {
  49722. return '[]';
  49723. }
  49724. }
  49725. <?php
  49726. namespace Composer\Semver\Constraint;
  49727. class MultiConstraint implements ConstraintInterface
  49728. {
  49729. protected $constraints;
  49730. protected $prettyString;
  49731. protected $conjunctive;
  49732. public function __construct(array $constraints, $conjunctive = true)
  49733. {
  49734. $this->constraints = $constraints;
  49735. $this->conjunctive = $conjunctive;
  49736. }
  49737. public function getConstraints()
  49738. {
  49739. return $this->constraints;
  49740. }
  49741. public function isConjunctive()
  49742. {
  49743. return $this->conjunctive;
  49744. }
  49745. public function isDisjunctive()
  49746. {
  49747. return !$this->conjunctive;
  49748. }
  49749. public function matches(ConstraintInterface $provider)
  49750. {
  49751. if (false === $this->conjunctive) {
  49752. foreach ($this->constraints as $constraint) {
  49753. if ($constraint->matches($provider)) {
  49754. return true;
  49755. }
  49756. }
  49757. return false;
  49758. }
  49759. foreach ($this->constraints as $constraint) {
  49760. if (!$constraint->matches($provider)) {
  49761. return false;
  49762. }
  49763. }
  49764. return true;
  49765. }
  49766. public function setPrettyString($prettyString)
  49767. {
  49768. $this->prettyString = $prettyString;
  49769. }
  49770. public function getPrettyString()
  49771. {
  49772. if ($this->prettyString) {
  49773. return $this->prettyString;
  49774. }
  49775. return $this->__toString();
  49776. }
  49777. public function __toString()
  49778. {
  49779. $constraints = array();
  49780. foreach ($this->constraints as $constraint) {
  49781. $constraints[] = (string) $constraint;
  49782. }
  49783. return '[' . implode($this->conjunctive ? ' ' : ' || ', $constraints) . ']';
  49784. }
  49785. }
  49786. <?php
  49787. namespace Composer\Semver;
  49788. use Composer\Semver\Constraint\Constraint;
  49789. class Semver
  49790. {
  49791. const SORT_ASC = 1;
  49792. const SORT_DESC = -1;
  49793. private static $versionParser;
  49794. public static function satisfies($version, $constraints)
  49795. {
  49796. if (null === self::$versionParser) {
  49797. self::$versionParser = new VersionParser();
  49798. }
  49799. $versionParser = self::$versionParser;
  49800. $provider = new Constraint('==', $versionParser->normalize($version));
  49801. $constraints = $versionParser->parseConstraints($constraints);
  49802. return $constraints->matches($provider);
  49803. }
  49804. public static function satisfiedBy(array $versions, $constraints)
  49805. {
  49806. $versions = array_filter($versions, function ($version) use ($constraints) {
  49807. return Semver::satisfies($version, $constraints);
  49808. });
  49809. return array_values($versions);
  49810. }
  49811. public static function sort(array $versions)
  49812. {
  49813. return self::usort($versions, self::SORT_ASC);
  49814. }
  49815. public static function rsort(array $versions)
  49816. {
  49817. return self::usort($versions, self::SORT_DESC);
  49818. }
  49819. private static function usort(array $versions, $direction)
  49820. {
  49821. if (null === self::$versionParser) {
  49822. self::$versionParser = new VersionParser();
  49823. }
  49824. $versionParser = self::$versionParser;
  49825. $normalized = array();
  49826. foreach ($versions as $key => $version) {
  49827. $normalized[] = array($versionParser->normalize($version), $key);
  49828. }
  49829. usort($normalized, function (array $left, array $right) use ($direction) {
  49830. if ($left[0] === $right[0]) {
  49831. return 0;
  49832. }
  49833. if (Comparator::lessThan($left[0], $right[0])) {
  49834. return -$direction;
  49835. }
  49836. return $direction;
  49837. });
  49838. $sorted = array();
  49839. foreach ($normalized as $item) {
  49840. $sorted[] = $versions[$item[1]];
  49841. }
  49842. return $sorted;
  49843. }
  49844. }
  49845. <?php
  49846. namespace Composer\Semver;
  49847. use Composer\Semver\Constraint\ConstraintInterface;
  49848. use Composer\Semver\Constraint\EmptyConstraint;
  49849. use Composer\Semver\Constraint\MultiConstraint;
  49850. use Composer\Semver\Constraint\Constraint;
  49851. class VersionParser
  49852. {
  49853. private static $modifierRegex = '[._-]?(?:(stable|beta|b|RC|alpha|a|patch|pl|p)((?:[.-]?\d+)*+)?)?([.-]?dev)?';
  49854. private static $stabilities = array('stable', 'RC', 'beta', 'alpha', 'dev');
  49855. public static function parseStability($version)
  49856. {
  49857. $version = preg_replace('{#.+$}i', '', $version);
  49858. if ('dev-' === substr($version, 0, 4) || '-dev' === substr($version, -4)) {
  49859. return 'dev';
  49860. }
  49861. preg_match('{' . self::$modifierRegex . '(?:\+.*)?$}i', strtolower($version), $match);
  49862. if (!empty($match[3])) {
  49863. return 'dev';
  49864. }
  49865. if (!empty($match[1])) {
  49866. if ('beta' === $match[1] || 'b' === $match[1]) {
  49867. return 'beta';
  49868. }
  49869. if ('alpha' === $match[1] || 'a' === $match[1]) {
  49870. return 'alpha';
  49871. }
  49872. if ('rc' === $match[1]) {
  49873. return 'RC';
  49874. }
  49875. }
  49876. return 'stable';
  49877. }
  49878. public static function normalizeStability($stability)
  49879. {
  49880. $stability = strtolower($stability);
  49881. return $stability === 'rc' ? 'RC' : $stability;
  49882. }
  49883. public function normalize($version, $fullVersion = null)
  49884. {
  49885. $version = trim($version);
  49886. if (null === $fullVersion) {
  49887. $fullVersion = $version;
  49888. }
  49889. if (preg_match('{^([^,\s]++) ++as ++([^,\s]++)$}', $version, $match)) {
  49890. $version = $match[1];
  49891. }
  49892. if (preg_match('{^(?:dev-)?(?:master|trunk|default)$}i', $version)) {
  49893. return '9999999-dev';
  49894. }
  49895. if ('dev-' === strtolower(substr($version, 0, 4))) {
  49896. return 'dev-' . substr($version, 4);
  49897. }
  49898. if (preg_match('{^([^,\s+]++)\+[^\s]++$}', $version, $match)) {
  49899. $version = $match[1];
  49900. }
  49901. if (preg_match('{^v?(\d{1,5})(\.\d++)?(\.\d++)?(\.\d++)?' . self::$modifierRegex . '$}i', $version, $matches)) {
  49902. $version = $matches[1]
  49903. . (!empty($matches[2]) ? $matches[2] : '.0')
  49904. . (!empty($matches[3]) ? $matches[3] : '.0')
  49905. . (!empty($matches[4]) ? $matches[4] : '.0');
  49906. $index = 5;
  49907. } elseif (preg_match('{^v?(\d{4}(?:[.:-]?\d{2}){1,6}(?:[.:-]?\d{1,3})?)' . self::$modifierRegex . '$}i', $version, $matches)) {
  49908. $version = preg_replace('{\D}', '.', $matches[1]);
  49909. $index = 2;
  49910. }
  49911. if (isset($index)) {
  49912. if (!empty($matches[$index])) {
  49913. if ('stable' === $matches[$index]) {
  49914. return $version;
  49915. }
  49916. $version .= '-' . $this->expandStability($matches[$index]) . (!empty($matches[$index + 1]) ? ltrim($matches[$index + 1], '.-') : '');
  49917. }
  49918. if (!empty($matches[$index + 2])) {
  49919. $version .= '-dev';
  49920. }
  49921. return $version;
  49922. }
  49923. if (preg_match('{(.*?)[.-]?dev$}i', $version, $match)) {
  49924. try {
  49925. return $this->normalizeBranch($match[1]);
  49926. } catch (\Exception $e) {
  49927. }
  49928. }
  49929. $extraMessage = '';
  49930. if (preg_match('{ +as +' . preg_quote($version) . '$}', $fullVersion)) {
  49931. $extraMessage = ' in "' . $fullVersion . '", the alias must be an exact version';
  49932. } elseif (preg_match('{^' . preg_quote($version) . ' +as +}', $fullVersion)) {
  49933. $extraMessage = ' in "' . $fullVersion . '", the alias source must be an exact version, if it is a branch name you should prefix it with dev-';
  49934. }
  49935. throw new \UnexpectedValueException('Invalid version string "' . $version . '"' . $extraMessage);
  49936. }
  49937. public function parseNumericAliasPrefix($branch)
  49938. {
  49939. if (preg_match('{^(?P<version>(\d++\\.)*\d++)(?:\.x)?-dev$}i', $branch, $matches)) {
  49940. return $matches['version'] . '.';
  49941. }
  49942. return false;
  49943. }
  49944. public function normalizeBranch($name)
  49945. {
  49946. $name = trim($name);
  49947. if (in_array($name, array('master', 'trunk', 'default'))) {
  49948. return $this->normalize($name);
  49949. }
  49950. if (preg_match('{^v?(\d++)(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?$}i', $name, $matches)) {
  49951. $version = '';
  49952. for ($i = 1; $i < 5; ++$i) {
  49953. $version .= isset($matches[$i]) ? str_replace(array('*', 'X'), 'x', $matches[$i]) : '.x';
  49954. }
  49955. return str_replace('x', '9999999', $version) . '-dev';
  49956. }
  49957. return 'dev-' . $name;
  49958. }
  49959. public function parseConstraints($constraints)
  49960. {
  49961. $prettyConstraint = $constraints;
  49962. if (preg_match('{^([^,\s]*?)@(' . implode('|', self::$stabilities) . ')$}i', $constraints, $match)) {
  49963. $constraints = empty($match[1]) ? '*' : $match[1];
  49964. }
  49965. if (preg_match('{^(dev-[^,\s@]+?|[^,\s@]+?\.x-dev)#.+$}i', $constraints, $match)) {
  49966. $constraints = $match[1];
  49967. }
  49968. $orConstraints = preg_split('{\s*\|\|?\s*}', trim($constraints));
  49969. $orGroups = array();
  49970. foreach ($orConstraints as $constraints) {
  49971. $andConstraints = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $constraints);
  49972. if (count($andConstraints) > 1) {
  49973. $constraintObjects = array();
  49974. foreach ($andConstraints as $constraint) {
  49975. foreach ($this->parseConstraint($constraint) as $parsedConstraint) {
  49976. $constraintObjects[] = $parsedConstraint;
  49977. }
  49978. }
  49979. } else {
  49980. $constraintObjects = $this->parseConstraint($andConstraints[0]);
  49981. }
  49982. if (1 === count($constraintObjects)) {
  49983. $constraint = $constraintObjects[0];
  49984. } else {
  49985. $constraint = new MultiConstraint($constraintObjects);
  49986. }
  49987. $orGroups[] = $constraint;
  49988. }
  49989. if (1 === count($orGroups)) {
  49990. $constraint = $orGroups[0];
  49991. } elseif (2 === count($orGroups)
  49992. && $orGroups[0] instanceof MultiConstraint
  49993. && $orGroups[1] instanceof MultiConstraint
  49994. && 2 === count($orGroups[0]->getConstraints())
  49995. && 2 === count($orGroups[1]->getConstraints())
  49996. && ($a = (string) $orGroups[0])
  49997. && substr($a, 0, 3) === '[>=' && (false !== ($posA = strpos($a, '<', 4)))
  49998. && ($b = (string) $orGroups[1])
  49999. && substr($b, 0, 3) === '[>=' && (false !== ($posB = strpos($b, '<', 4)))
  50000. && substr($a, $posA + 2, -1) === substr($b, 4, $posB - 5)
  50001. ) {
  50002. $constraint = new MultiConstraint(array(
  50003. new Constraint('>=', substr($a, 4, $posA - 5)),
  50004. new Constraint('<', substr($b, $posB + 2, -1)),
  50005. ));
  50006. } else {
  50007. $constraint = new MultiConstraint($orGroups, false);
  50008. }
  50009. $constraint->setPrettyString($prettyConstraint);
  50010. return $constraint;
  50011. }
  50012. private function parseConstraint($constraint)
  50013. {
  50014. if (preg_match('{^([^,\s]+?)@(' . implode('|', self::$stabilities) . ')$}i', $constraint, $match)) {
  50015. $constraint = $match[1];
  50016. if ($match[2] !== 'stable') {
  50017. $stabilityModifier = $match[2];
  50018. }
  50019. }
  50020. if (preg_match('{^v?[xX*](\.[xX*])*$}i', $constraint)) {
  50021. return array(new EmptyConstraint());
  50022. }
  50023. $versionRegex = 'v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.(\d++))?' . self::$modifierRegex . '(?:\+[^\s]+)?';
  50024. if (preg_match('{^~>?' . $versionRegex . '$}i', $constraint, $matches)) {
  50025. if (substr($constraint, 0, 2) === '~>') {
  50026. throw new \UnexpectedValueException(
  50027. 'Could not parse version constraint ' . $constraint . ': ' .
  50028. 'Invalid operator "~>", you probably meant to use the "~" operator'
  50029. );
  50030. }
  50031. if (isset($matches[4]) && '' !== $matches[4]) {
  50032. $position = 4;
  50033. } elseif (isset($matches[3]) && '' !== $matches[3]) {
  50034. $position = 3;
  50035. } elseif (isset($matches[2]) && '' !== $matches[2]) {
  50036. $position = 2;
  50037. } else {
  50038. $position = 1;
  50039. }
  50040. $stabilitySuffix = '';
  50041. if (!empty($matches[5])) {
  50042. $stabilitySuffix .= '-' . $this->expandStability($matches[5]) . (!empty($matches[6]) ? $matches[6] : '');
  50043. }
  50044. if (!empty($matches[7])) {
  50045. $stabilitySuffix .= '-dev';
  50046. }
  50047. if (!$stabilitySuffix) {
  50048. $stabilitySuffix = '-dev';
  50049. }
  50050. $lowVersion = $this->manipulateVersionString($matches, $position, 0) . $stabilitySuffix;
  50051. $lowerBound = new Constraint('>=', $lowVersion);
  50052. $highPosition = max(1, $position - 1);
  50053. $highVersion = $this->manipulateVersionString($matches, $highPosition, 1) . '-dev';
  50054. $upperBound = new Constraint('<', $highVersion);
  50055. return array(
  50056. $lowerBound,
  50057. $upperBound,
  50058. );
  50059. }
  50060. if (preg_match('{^\^' . $versionRegex . '($)}i', $constraint, $matches)) {
  50061. if ('0' !== $matches[1] || '' === $matches[2]) {
  50062. $position = 1;
  50063. } elseif ('0' !== $matches[2] || '' === $matches[3]) {
  50064. $position = 2;
  50065. } else {
  50066. $position = 3;
  50067. }
  50068. $stabilitySuffix = '';
  50069. if (empty($matches[5]) && empty($matches[7])) {
  50070. $stabilitySuffix .= '-dev';
  50071. }
  50072. $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
  50073. $lowerBound = new Constraint('>=', $lowVersion);
  50074. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  50075. $upperBound = new Constraint('<', $highVersion);
  50076. return array(
  50077. $lowerBound,
  50078. $upperBound,
  50079. );
  50080. }
  50081. if (preg_match('{^v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.[xX*])++$}', $constraint, $matches)) {
  50082. if (isset($matches[3]) && '' !== $matches[3]) {
  50083. $position = 3;
  50084. } elseif (isset($matches[2]) && '' !== $matches[2]) {
  50085. $position = 2;
  50086. } else {
  50087. $position = 1;
  50088. }
  50089. $lowVersion = $this->manipulateVersionString($matches, $position) . '-dev';
  50090. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  50091. if ($lowVersion === '0.0.0.0-dev') {
  50092. return array(new Constraint('<', $highVersion));
  50093. }
  50094. return array(
  50095. new Constraint('>=', $lowVersion),
  50096. new Constraint('<', $highVersion),
  50097. );
  50098. }
  50099. if (preg_match('{^(?P<from>' . $versionRegex . ') +- +(?P<to>' . $versionRegex . ')($)}i', $constraint, $matches)) {
  50100. $lowStabilitySuffix = '';
  50101. if (empty($matches[6]) && empty($matches[8])) {
  50102. $lowStabilitySuffix = '-dev';
  50103. }
  50104. $lowVersion = $this->normalize($matches['from']);
  50105. $lowerBound = new Constraint('>=', $lowVersion . $lowStabilitySuffix);
  50106. $empty = function ($x) {
  50107. return ($x === 0 || $x === '0') ? false : empty($x);
  50108. };
  50109. if ((!$empty($matches[11]) && !$empty($matches[12])) || !empty($matches[14]) || !empty($matches[16])) {
  50110. $highVersion = $this->normalize($matches['to']);
  50111. $upperBound = new Constraint('<=', $highVersion);
  50112. } else {
  50113. $highMatch = array('', $matches[10], $matches[11], $matches[12], $matches[13]);
  50114. $highVersion = $this->manipulateVersionString($highMatch, $empty($matches[11]) ? 1 : 2, 1) . '-dev';
  50115. $upperBound = new Constraint('<', $highVersion);
  50116. }
  50117. return array(
  50118. $lowerBound,
  50119. $upperBound,
  50120. );
  50121. }
  50122. if (preg_match('{^(<>|!=|>=?|<=?|==?)?\s*(.*)}', $constraint, $matches)) {
  50123. try {
  50124. $version = $this->normalize($matches[2]);
  50125. if (!empty($stabilityModifier) && $this->parseStability($version) === 'stable') {
  50126. $version .= '-' . $stabilityModifier;
  50127. } elseif ('<' === $matches[1] || '>=' === $matches[1]) {
  50128. if (!preg_match('/-' . self::$modifierRegex . '$/', strtolower($matches[2]))) {
  50129. if (substr($matches[2], 0, 4) !== 'dev-') {
  50130. $version .= '-dev';
  50131. }
  50132. }
  50133. }
  50134. return array(new Constraint($matches[1] ?: '=', $version));
  50135. } catch (\Exception $e) {
  50136. }
  50137. }
  50138. $message = 'Could not parse version constraint ' . $constraint;
  50139. if (isset($e)) {
  50140. $message .= ': ' . $e->getMessage();
  50141. }
  50142. throw new \UnexpectedValueException($message);
  50143. }
  50144. private function manipulateVersionString($matches, $position, $increment = 0, $pad = '0')
  50145. {
  50146. for ($i = 4; $i > 0; --$i) {
  50147. if ($i > $position) {
  50148. $matches[$i] = $pad;
  50149. } elseif ($i === $position && $increment) {
  50150. $matches[$i] += $increment;
  50151. if ($matches[$i] < 0) {
  50152. $matches[$i] = $pad;
  50153. --$position;
  50154. if ($i === 1) {
  50155. return;
  50156. }
  50157. }
  50158. }
  50159. }
  50160. return $matches[1] . '.' . $matches[2] . '.' . $matches[3] . '.' . $matches[4];
  50161. }
  50162. private function expandStability($stability)
  50163. {
  50164. $stability = strtolower($stability);
  50165. switch ($stability) {
  50166. case 'a':
  50167. return 'alpha';
  50168. case 'b':
  50169. return 'beta';
  50170. case 'p':
  50171. case 'pl':
  50172. return 'patch';
  50173. case 'rc':
  50174. return 'RC';
  50175. default:
  50176. return $stability;
  50177. }
  50178. }
  50179. }
  50180. Copyright (C) 2016 Composer
  50181. Permission is hereby granted, free of charge, to any person obtaining a copy of
  50182. this software and associated documentation files (the "Software"), to deal in
  50183. the Software without restriction, including without limitation the rights to
  50184. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  50185. of the Software, and to permit persons to whom the Software is furnished to do
  50186. so, subject to the following conditions:
  50187. The above copyright notice and this permission notice shall be included in all
  50188. copies or substantial portions of the Software.
  50189. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  50190. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  50191. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  50192. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  50193. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  50194. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  50195. SOFTWARE.
  50196. <?php
  50197. namespace Composer\CaBundle;
  50198. use Psr\Log\LoggerInterface;
  50199. use Symfony\Component\Process\PhpProcess;
  50200. class CaBundle
  50201. {
  50202. private static $caPath;
  50203. private static $caFileValidity = array();
  50204. private static $useOpensslParse;
  50205. public static function getSystemCaRootBundlePath(LoggerInterface $logger = null)
  50206. {
  50207. if (self::$caPath !== null) {
  50208. return self::$caPath;
  50209. }
  50210. $envCertFile = getenv('SSL_CERT_FILE');
  50211. if ($envCertFile && is_readable($envCertFile) && static::validateCaFile($envCertFile, $logger)) {
  50212. return self::$caPath = $envCertFile;
  50213. }
  50214. $envCertDir = getenv('SSL_CERT_DIR');
  50215. if ($envCertDir && is_dir($envCertDir) && is_readable($envCertDir)) {
  50216. return self::$caPath = $envCertDir;
  50217. }
  50218. $configured = ini_get('openssl.cafile');
  50219. if ($configured && strlen($configured) > 0 && is_readable($configured) && static::validateCaFile($configured, $logger)) {
  50220. return self::$caPath = $configured;
  50221. }
  50222. $configured = ini_get('openssl.capath');
  50223. if ($configured && is_dir($configured) && is_readable($configured)) {
  50224. return self::$caPath = $configured;
  50225. }
  50226. $caBundlePaths = array(
  50227. '/etc/pki/tls/certs/ca-bundle.crt',
  50228. '/etc/ssl/certs/ca-certificates.crt',
  50229. '/etc/ssl/ca-bundle.pem',
  50230. '/usr/local/share/certs/ca-root-nss.crt',
  50231. '/usr/ssl/certs/ca-bundle.crt',
  50232. '/opt/local/share/curl/curl-ca-bundle.crt',
  50233. '/usr/local/share/curl/curl-ca-bundle.crt',
  50234. '/usr/share/ssl/certs/ca-bundle.crt',
  50235. '/etc/ssl/cert.pem',
  50236. '/usr/local/etc/ssl/cert.pem',
  50237. '/usr/local/etc/openssl/cert.pem',
  50238. );
  50239. foreach ($caBundlePaths as $caBundle) {
  50240. if (@is_readable($caBundle) && static::validateCaFile($caBundle, $logger)) {
  50241. return self::$caPath = $caBundle;
  50242. }
  50243. }
  50244. foreach ($caBundlePaths as $caBundle) {
  50245. $caBundle = dirname($caBundle);
  50246. if (@is_dir($caBundle) && glob($caBundle.'/*')) {
  50247. return self::$caPath = $caBundle;
  50248. }
  50249. }
  50250. return self::$caPath = static::getBundledCaBundlePath();
  50251. }
  50252. public static function getBundledCaBundlePath()
  50253. {
  50254. $caBundleFile = __DIR__.'/../res/cacert.pem';
  50255. if (0 === strpos($caBundleFile, 'phar://')) {
  50256. file_put_contents(
  50257. $tempCaBundleFile = tempnam(sys_get_temp_dir(), 'openssl-ca-bundle-'),
  50258. file_get_contents($caBundleFile)
  50259. );
  50260. register_shutdown_function(function() use ($tempCaBundleFile) {
  50261. @unlink($tempCaBundleFile);
  50262. });
  50263. $caBundleFile = $tempCaBundleFile;
  50264. }
  50265. return $caBundleFile;
  50266. }
  50267. public static function validateCaFile($filename, LoggerInterface $logger = null)
  50268. {
  50269. static $warned = false;
  50270. if (isset(self::$caFileValidity[$filename])) {
  50271. return self::$caFileValidity[$filename];
  50272. }
  50273. $contents = file_get_contents($filename);
  50274. if (!static::isOpensslParseSafe()) {
  50275. if (!$warned && $logger) {
  50276. $logger->warning(sprintf(
  50277. 'Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.',
  50278. PHP_VERSION
  50279. ));
  50280. $warned = true;
  50281. }
  50282. $isValid = !empty($contents);
  50283. } else {
  50284. $isValid = (bool) openssl_x509_parse($contents);
  50285. }
  50286. if ($logger) {
  50287. $logger->debug('Checked CA file '.realpath($filename).': '.($isValid ? 'valid' : 'invalid'));
  50288. }
  50289. return self::$caFileValidity[$filename] = $isValid;
  50290. }
  50291. public static function isOpensslParseSafe()
  50292. {
  50293. if (null !== self::$useOpensslParse) {
  50294. return self::$useOpensslParse;
  50295. }
  50296. if (PHP_VERSION_ID >= 50600) {
  50297. return self::$useOpensslParse = true;
  50298. }
  50299. if (
  50300. (PHP_VERSION_ID < 50400 && PHP_VERSION_ID >= 50328)
  50301. || (PHP_VERSION_ID < 50500 && PHP_VERSION_ID >= 50423)
  50302. || (PHP_VERSION_ID < 50600 && PHP_VERSION_ID >= 50507)
  50303. ) {
  50304. return self::$useOpensslParse = true;
  50305. }
  50306. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  50307. return self::$useOpensslParse = false;
  50308. }
  50309. $compareDistroVersionPrefix = function ($prefix, $fixedVersion) {
  50310. $regex = '{^'.preg_quote($prefix).'([0-9]+)$}';
  50311. if (preg_match($regex, PHP_VERSION, $m)) {
  50312. return ((int) $m[1]) >= $fixedVersion;
  50313. }
  50314. return false;
  50315. };
  50316. if (
  50317. $compareDistroVersionPrefix('5.3.3-7+squeeze', 18)
  50318. || $compareDistroVersionPrefix('5.4.4-14+deb7u', 7)
  50319. || $compareDistroVersionPrefix('5.3.10-1ubuntu3.', 9)
  50320. ) {
  50321. return self::$useOpensslParse = true;
  50322. }
  50323. if (!class_exists('Symfony\Component\Process\PhpProcess')) {
  50324. return self::$useOpensslParse = false;
  50325. }
  50326. $cert = 'LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUVwRENDQTR5Z0F3SUJBZ0lKQUp6dThyNnU2ZUJjTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUhETVFzd0NRWUQKVlFRR0V3SkVSVEVjTUJvR0ExVUVDQXdUVG05eVpISm9aV2x1TFZkbGMzUm1ZV3hsYmpFUU1BNEdBMVVFQnd3SApTOE9Ed3Jac2JqRVVNQklHQTFVRUNnd0xVMlZyZEdsdmJrVnBibk14SHpBZEJnTlZCQXNNRmsxaGJHbGphVzkxCmN5QkRaWEowSUZObFkzUnBiMjR4SVRBZkJnTlZCQU1NR0cxaGJHbGphVzkxY3k1elpXdDBhVzl1WldsdWN5NWsKWlRFcU1DZ0dDU3FHU0liM0RRRUpBUlliYzNSbFptRnVMbVZ6YzJWeVFITmxhM1JwYjI1bGFXNXpMbVJsTUhVWQpaREU1TnpBd01UQXhNREF3TURBd1dnQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBCkFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUEKQUFBQUFBQVhEVEUwTVRFeU9ERXhNemt6TlZvd2djTXhDekFKQmdOVkJBWVRBa1JGTVJ3d0dnWURWUVFJREJOTwpiM0prY21obGFXNHRWMlZ6ZEdaaGJHVnVNUkF3RGdZRFZRUUhEQWRMdzRQQ3RteHVNUlF3RWdZRFZRUUtEQXRUClpXdDBhVzl1UldsdWN6RWZNQjBHQTFVRUN3d1dUV0ZzYVdOcGIzVnpJRU5sY25RZ1UyVmpkR2x2YmpFaE1COEcKQTFVRUF3d1liV0ZzYVdOcGIzVnpMbk5sYTNScGIyNWxhVzV6TG1SbE1Tb3dLQVlKS29aSWh2Y05BUWtCRmh0egpkR1ZtWVc0dVpYTnpaWEpBYzJWcmRHbHZibVZwYm5NdVpHVXdnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCCkR3QXdnZ0VLQW9JQkFRRERBZjNobDdKWTBYY0ZuaXlFSnBTU0RxbjBPcUJyNlFQNjV1c0pQUnQvOFBhRG9xQnUKd0VZVC9OYSs2ZnNnUGpDMHVLOURaZ1dnMnRIV1dvYW5TYmxBTW96NVBINlorUzRTSFJaN2UyZERJalBqZGhqaAowbUxnMlVNTzV5cDBWNzk3R2dzOWxOdDZKUmZIODFNTjJvYlhXczROdHp0TE11RDZlZ3FwcjhkRGJyMzRhT3M4CnBrZHVpNVVhd1Raa3N5NXBMUEhxNWNNaEZHbTA2djY1Q0xvMFYyUGQ5K0tBb2tQclBjTjVLTEtlYno3bUxwazYKU01lRVhPS1A0aWRFcXh5UTdPN2ZCdUhNZWRzUWh1K3ByWTNzaTNCVXlLZlF0UDVDWm5YMmJwMHdLSHhYMTJEWAoxbmZGSXQ5RGJHdkhUY3lPdU4rblpMUEJtM3ZXeG50eUlJdlZBZ01CQUFHalFqQkFNQWtHQTFVZEV3UUNNQUF3CkVRWUpZSVpJQVliNFFnRUJCQVFEQWdlQU1Bc0dBMVVkRHdRRUF3SUZvREFUQmdOVkhTVUVEREFLQmdnckJnRUYKQlFjREFqQU5CZ2txaGtpRzl3MEJBUVVGQUFPQ0FRRUFHMGZaWVlDVGJkajFYWWMrMVNub2FQUit2SThDOENhRAo4KzBVWWhkbnlVNGdnYTBCQWNEclk5ZTk0ZUVBdTZacXljRjZGakxxWFhkQWJvcHBXb2NyNlQ2R0QxeDMzQ2tsClZBcnpHL0t4UW9oR0QySmVxa2hJTWxEb214SE83a2EzOStPYThpMnZXTFZ5alU4QVp2V01BcnVIYTRFRU55RzcKbFcyQWFnYUZLRkNyOVRuWFRmcmR4R1ZFYnY3S1ZRNmJkaGc1cDVTanBXSDErTXEwM3VSM1pYUEJZZHlWODMxOQpvMGxWajFLRkkyRENML2xpV2lzSlJvb2YrMWNSMzVDdGQwd1lCY3BCNlRac2xNY09QbDc2ZHdLd0pnZUpvMlFnClpzZm1jMnZDMS9xT2xOdU5xLzBUenprVkd2OEVUVDNDZ2FVK1VYZTRYT1Z2a2NjZWJKbjJkZz09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K';
  50327. $script = <<<'EOT'
  50328. error_reporting(-1);
  50329. $info = openssl_x509_parse(base64_decode('%s'));
  50330. var_dump(PHP_VERSION, $info['issuer']['emailAddress'], $info['validFrom_time_t']);
  50331. EOT;
  50332. $script = '<'."?php\n".sprintf($script, $cert);
  50333. try {
  50334. $process = new PhpProcess($script);
  50335. $process->mustRun();
  50336. } catch (\Exception $e) {
  50337. return self::$useOpensslParse = false;
  50338. }
  50339. $output = preg_split('{\r?\n}', trim($process->getOutput()));
  50340. $errorOutput = trim($process->getErrorOutput());
  50341. if (
  50342. count($output) === 3
  50343. && $output[0] === sprintf('string(%d) "%s"', strlen(PHP_VERSION), PHP_VERSION)
  50344. && $output[1] === 'string(27) "stefan.esser@sektioneins.de"'
  50345. && $output[2] === 'int(-1)'
  50346. && preg_match('{openssl_x509_parse\(\): illegal (?:ASN1 data type for|length in) timestamp in - on line \d+}', $errorOutput)
  50347. ) {
  50348. return self::$useOpensslParse = true;
  50349. }
  50350. return self::$useOpensslParse = false;
  50351. }
  50352. public static function reset()
  50353. {
  50354. self::$caFileValidity = array();
  50355. self::$caPath = null;
  50356. self::$useOpensslParse = null;
  50357. }
  50358. }
  50359. MIT License
  50360. Copyright (c) 2017 Composer
  50361. Permission is hereby granted, free of charge, to any person obtaining a copy
  50362. of this software and associated documentation files (the "Software"), to deal
  50363. in the Software without restriction, including without limitation the rights
  50364. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  50365. copies of the Software, and to permit persons to whom the Software is
  50366. furnished to do so, subject to the following conditions:
  50367. The above copyright notice and this permission notice shall be included in all
  50368. copies or substantial portions of the Software.
  50369. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  50370. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  50371. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  50372. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  50373. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  50374. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  50375. SOFTWARE.
  50376. <?php
  50377. namespace Composer\XdebugHandler;
  50378. class PhpConfig
  50379. {
  50380. public function useOriginal()
  50381. {
  50382. $this->getDataAndReset();
  50383. return array();
  50384. }
  50385. public function useStandard()
  50386. {
  50387. if ($data = $this->getDataAndReset()) {
  50388. return array('-n', '-c', $data['tmpIni']);
  50389. }
  50390. return array();
  50391. }
  50392. public function usePersistent()
  50393. {
  50394. if ($data = $this->getDataAndReset()) {
  50395. Process::setEnv('PHPRC', $data['tmpIni']);
  50396. Process::setEnv('PHP_INI_SCAN_DIR', '');
  50397. }
  50398. return array();
  50399. }
  50400. private function getDataAndReset()
  50401. {
  50402. if ($data = XdebugHandler::getRestartSettings()) {
  50403. Process::setEnv('PHPRC', $data['phprc']);
  50404. Process::setEnv('PHP_INI_SCAN_DIR', $data['scanDir']);
  50405. }
  50406. return $data;
  50407. }
  50408. }
  50409. <?php
  50410. namespace Composer\XdebugHandler;
  50411. class Process
  50412. {
  50413. public static function addColorOption(array $args, $colorOption)
  50414. {
  50415. if (!$colorOption
  50416. || in_array($colorOption, $args)
  50417. || !preg_match('/^--([a-z]+$)|(^--[a-z]+=)/', $colorOption, $matches)) {
  50418. return $args;
  50419. }
  50420. if (isset($matches[2])) {
  50421. if (false !== ($index = array_search($matches[2].'auto', $args))) {
  50422. $args[$index] = $colorOption;
  50423. return $args;
  50424. } elseif (preg_grep('/^'.$matches[2].'/', $args)) {
  50425. return $args;
  50426. }
  50427. } elseif (in_array('--no-'.$matches[1], $args)) {
  50428. return $args;
  50429. }
  50430. if (false !== ($index = array_search('--', $args))) {
  50431. array_splice($args, $index, 0, $colorOption);
  50432. } else {
  50433. $args[] = $colorOption;
  50434. }
  50435. return $args;
  50436. }
  50437. public static function escape($arg, $meta = true, $module = false)
  50438. {
  50439. if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
  50440. return "'".str_replace("'", "'\\''", $arg)."'";
  50441. }
  50442. $quote = strpbrk($arg, " \t") !== false || $arg === '';
  50443. $arg = preg_replace('/(\\\\*)"/', '$1$1\\"', $arg, -1, $dquotes);
  50444. if ($meta) {
  50445. $meta = $dquotes || preg_match('/%[^%]+%/', $arg);
  50446. if (!$meta) {
  50447. $quote = $quote || strpbrk($arg, '^&|<>()') !== false;
  50448. } elseif ($module && !$dquotes && $quote) {
  50449. $meta = false;
  50450. }
  50451. }
  50452. if ($quote) {
  50453. $arg = '"'.preg_replace('/(\\\\*)$/', '$1$1', $arg).'"';
  50454. }
  50455. if ($meta) {
  50456. $arg = preg_replace('/(["^&|<>()%])/', '^$1', $arg);
  50457. }
  50458. return $arg;
  50459. }
  50460. public static function supportsColor($output)
  50461. {
  50462. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  50463. return (function_exists('sapi_windows_vt100_support')
  50464. && sapi_windows_vt100_support($output))
  50465. || false !== getenv('ANSICON')
  50466. || 'ON' === getenv('ConEmuANSI')
  50467. || 'xterm' === getenv('TERM');
  50468. }
  50469. if (function_exists('stream_isatty')) {
  50470. return stream_isatty($output);
  50471. } elseif (function_exists('posix_isatty')) {
  50472. return posix_isatty($output);
  50473. }
  50474. $stat = fstat($output);
  50475. return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
  50476. }
  50477. public static function setEnv($name, $value = false)
  50478. {
  50479. $unset = false === $value;
  50480. if (!putenv($unset ? $name : $name.'='.$value)) {
  50481. return false;
  50482. }
  50483. if ($unset) {
  50484. unset($_SERVER[$name]);
  50485. } else {
  50486. $_SERVER[$name] = $value;
  50487. }
  50488. return true;
  50489. }
  50490. }
  50491. <?php
  50492. namespace Composer\XdebugHandler;
  50493. use Psr\Log\LoggerInterface;
  50494. use Psr\Log\LogLevel;
  50495. class Status
  50496. {
  50497. const ENV_RESTART = 'XDEBUG_HANDLER_RESTART';
  50498. const CHECK = 'Check';
  50499. const ERROR = 'Error';
  50500. const INFO = 'Info';
  50501. const NORESTART = 'NoRestart';
  50502. const RESTART = 'Restart';
  50503. const RESTARTING = 'Restarting';
  50504. const RESTARTED = 'Restarted';
  50505. private $debug;
  50506. private $envAllowXdebug;
  50507. private $loaded;
  50508. private $logger;
  50509. private $time;
  50510. public function __construct($envAllowXdebug, $debug)
  50511. {
  50512. $start = getenv(self::ENV_RESTART);
  50513. Process::setEnv(self::ENV_RESTART);
  50514. $this->time = $start ? round((microtime(true) - $start) * 1000) : 0;
  50515. $this->envAllowXdebug = $envAllowXdebug;
  50516. $this->debug = $debug && defined('STDERR');
  50517. }
  50518. public function setLogger(LoggerInterface $logger)
  50519. {
  50520. $this->logger = $logger;
  50521. }
  50522. public function report($op, $data)
  50523. {
  50524. if ($this->logger || $this->debug) {
  50525. call_user_func(array($this, 'report'.$op), $data);
  50526. }
  50527. }
  50528. private function output($text, $level = null)
  50529. {
  50530. if ($this->logger) {
  50531. $this->logger->log($level ?: LogLevel::DEBUG, $text);
  50532. }
  50533. if ($this->debug) {
  50534. fwrite(STDERR, sprintf('xdebug-handler[%d] %s', getmypid(), $text.PHP_EOL));
  50535. }
  50536. }
  50537. private function reportCheck($loaded)
  50538. {
  50539. $this->loaded = $loaded;
  50540. $this->output('Checking '.$this->envAllowXdebug);
  50541. }
  50542. private function reportError($error)
  50543. {
  50544. $this->output(sprintf('No restart (%s)', $error), LogLevel::WARNING);
  50545. }
  50546. private function reportInfo($info)
  50547. {
  50548. $this->output($info);
  50549. }
  50550. private function reportNoRestart()
  50551. {
  50552. $this->output($this->getLoadedMessage());
  50553. if ($this->loaded) {
  50554. $text = sprintf('No restart (%s)', $this->getEnvAllow());
  50555. if (!getenv($this->envAllowXdebug)) {
  50556. $text .= ' Allowed by application';
  50557. }
  50558. $this->output($text);
  50559. }
  50560. }
  50561. private function reportRestart()
  50562. {
  50563. $this->output($this->getLoadedMessage());
  50564. Process::setEnv(self::ENV_RESTART, (string) microtime(true));
  50565. }
  50566. private function reportRestarted()
  50567. {
  50568. $loaded = $this->getLoadedMessage();
  50569. $text = sprintf('Restarted (%d ms). %s', $this->time, $loaded);
  50570. $level = $this->loaded ? LogLevel::WARNING : null;
  50571. $this->output($text, $level);
  50572. }
  50573. private function reportRestarting($command)
  50574. {
  50575. $text = sprintf('Process restarting (%s)', $this->getEnvAllow());
  50576. $this->output($text);
  50577. $text = 'Running '.$command;
  50578. $this->output($text);
  50579. }
  50580. private function getEnvAllow()
  50581. {
  50582. return $this->envAllowXdebug.'='.getenv($this->envAllowXdebug);
  50583. }
  50584. private function getLoadedMessage()
  50585. {
  50586. $loaded = $this->loaded ? sprintf('loaded (%s)', $this->loaded) : 'not loaded';
  50587. return 'The xdebug extension is '.$loaded;
  50588. }
  50589. }
  50590. <?php
  50591. namespace Composer\XdebugHandler;
  50592. use Psr\Log\LoggerInterface;
  50593. class XdebugHandler
  50594. {
  50595. const SUFFIX_ALLOW = '_ALLOW_XDEBUG';
  50596. const SUFFIX_INIS = '_ORIGINAL_INIS';
  50597. const RESTART_ID = 'internal';
  50598. const RESTART_SETTINGS = 'XDEBUG_HANDLER_SETTINGS';
  50599. const DEBUG = 'XDEBUG_HANDLER_DEBUG';
  50600. protected $tmpIni;
  50601. private static $inRestart;
  50602. private static $name;
  50603. private static $skipped;
  50604. private $cli;
  50605. private $colorOption;
  50606. private $debug;
  50607. private $envAllowXdebug;
  50608. private $envOriginalInis;
  50609. private $loaded;
  50610. private $persistent;
  50611. private $script;
  50612. private $statusWriter;
  50613. public function __construct($envPrefix, $colorOption = '')
  50614. {
  50615. if (!is_string($envPrefix) || empty($envPrefix) || !is_string($colorOption)) {
  50616. throw new \RuntimeException('Invalid constructor parameter');
  50617. }
  50618. self::$name = strtoupper($envPrefix);
  50619. $this->envAllowXdebug = self::$name.self::SUFFIX_ALLOW;
  50620. $this->envOriginalInis = self::$name.self::SUFFIX_INIS;
  50621. $this->colorOption = $colorOption;
  50622. if (extension_loaded('xdebug')) {
  50623. $ext = new \ReflectionExtension('xdebug');
  50624. $this->loaded = $ext->getVersion() ?: 'unknown';
  50625. }
  50626. if ($this->cli = PHP_SAPI === 'cli') {
  50627. $this->debug = getenv(self::DEBUG);
  50628. }
  50629. $this->statusWriter = new Status($this->envAllowXdebug, (bool) $this->debug);
  50630. }
  50631. public function setLogger(LoggerInterface $logger)
  50632. {
  50633. $this->statusWriter->setLogger($logger);
  50634. return $this;
  50635. }
  50636. public function setMainScript($script)
  50637. {
  50638. $this->script = $script;
  50639. return $this;
  50640. }
  50641. public function setPersistent()
  50642. {
  50643. $this->persistent = true;
  50644. return $this;
  50645. }
  50646. public function check()
  50647. {
  50648. $this->notify(Status::CHECK, $this->loaded);
  50649. $envArgs = explode('|', (string) getenv($this->envAllowXdebug));
  50650. if (empty($envArgs[0]) && $this->requiresRestart((bool) $this->loaded)) {
  50651. $this->notify(Status::RESTART);
  50652. if ($this->prepareRestart()) {
  50653. $command = $this->getCommand();
  50654. $this->notify(Status::RESTARTING, $command);
  50655. $this->restart($command);
  50656. }
  50657. return;
  50658. }
  50659. if (self::RESTART_ID === $envArgs[0] && count($envArgs) === 5) {
  50660. $this->notify(Status::RESTARTED);
  50661. Process::setEnv($this->envAllowXdebug);
  50662. self::$inRestart = true;
  50663. if (!$this->loaded) {
  50664. self::$skipped = $envArgs[1];
  50665. }
  50666. $this->setEnvRestartSettings($envArgs);
  50667. return;
  50668. }
  50669. $this->notify(Status::NORESTART);
  50670. if ($settings = self::getRestartSettings()) {
  50671. $this->syncSettings($settings);
  50672. }
  50673. }
  50674. public static function getAllIniFiles()
  50675. {
  50676. if (!empty(self::$name)) {
  50677. $env = getenv(self::$name.self::SUFFIX_INIS);
  50678. if (false !== $env) {
  50679. return explode(PATH_SEPARATOR, $env);
  50680. }
  50681. }
  50682. $paths = array((string) php_ini_loaded_file());
  50683. if ($scanned = php_ini_scanned_files()) {
  50684. $paths = array_merge($paths, array_map('trim', explode(',', $scanned)));
  50685. }
  50686. return $paths;
  50687. }
  50688. public static function getRestartSettings()
  50689. {
  50690. $envArgs = explode('|', (string) getenv(self::RESTART_SETTINGS));
  50691. if (count($envArgs) !== 6
  50692. || (!self::$inRestart && php_ini_loaded_file() !== $envArgs[0])) {
  50693. return;
  50694. }
  50695. return array(
  50696. 'tmpIni' => $envArgs[0],
  50697. 'scannedInis' => (bool) $envArgs[1],
  50698. 'scanDir' => '*' === $envArgs[2] ? false : $envArgs[2],
  50699. 'phprc' => '*' === $envArgs[3] ? false : $envArgs[3],
  50700. 'inis' => explode(PATH_SEPARATOR, $envArgs[4]),
  50701. 'skipped' => $envArgs[5],
  50702. );
  50703. }
  50704. public static function getSkippedVersion()
  50705. {
  50706. return (string) self::$skipped;
  50707. }
  50708. protected function requiresRestart($isLoaded)
  50709. {
  50710. return $isLoaded;
  50711. }
  50712. protected function restart($command)
  50713. {
  50714. $this->doRestart($command);
  50715. }
  50716. private function doRestart($command)
  50717. {
  50718. passthru($command, $exitCode);
  50719. $this->notify(Status::INFO, 'Restarted process exited '.$exitCode);
  50720. if ($this->debug === '2') {
  50721. $this->notify(Status::INFO, 'Temp ini saved: '.$this->tmpIni);
  50722. } else {
  50723. @unlink($this->tmpIni);
  50724. }
  50725. exit($exitCode);
  50726. }
  50727. private function prepareRestart()
  50728. {
  50729. $error = '';
  50730. $iniFiles = self::getAllIniFiles();
  50731. $scannedInis = count($iniFiles) > 1;
  50732. if (!$this->cli) {
  50733. $error = 'Unsupported SAPI: '.PHP_SAPI;
  50734. } elseif (!defined('PHP_BINARY')) {
  50735. $error = 'PHP version is too old: '.PHP_VERSION;
  50736. } elseif (!$this->checkScanDirConfig()) {
  50737. $error = 'PHP version does not report scanned inis: '.PHP_VERSION;
  50738. } elseif (!$this->checkMainScript()) {
  50739. $error = 'Unable to access main script: '.$this->script;
  50740. } elseif (!$this->writeTmpIni($iniFiles)) {
  50741. $error = 'Unable to create temporary ini file';
  50742. } elseif (!$this->setEnvironment($scannedInis, $iniFiles)) {
  50743. $error = 'Unable to set environment variables';
  50744. }
  50745. if ($error) {
  50746. $this->notify(Status::ERROR, $error);
  50747. }
  50748. return empty($error);
  50749. }
  50750. private function writeTmpIni(array $iniFiles)
  50751. {
  50752. if (!$this->tmpIni = tempnam(sys_get_temp_dir(), '')) {
  50753. return false;
  50754. }
  50755. if (empty($iniFiles[0])) {
  50756. array_shift($iniFiles);
  50757. }
  50758. $content = '';
  50759. $regex = '/^\s*(zend_extension\s*=.*xdebug.*)$/mi';
  50760. foreach ($iniFiles as $file) {
  50761. $data = preg_replace($regex, ';$1', file_get_contents($file));
  50762. $content .= $data.PHP_EOL;
  50763. }
  50764. if ($config = parse_ini_string($content)) {
  50765. $loaded = ini_get_all(null, false);
  50766. $content .= $this->mergeLoadedConfig($loaded, $config);
  50767. }
  50768. $content .= 'opcache.enable_cli=0'.PHP_EOL;
  50769. return @file_put_contents($this->tmpIni, $content);
  50770. }
  50771. private function getCommand()
  50772. {
  50773. $php = array(PHP_BINARY);
  50774. $args = array_slice($_SERVER['argv'], 1);
  50775. if (!$this->persistent) {
  50776. array_push($php, '-n', '-c', $this->tmpIni);
  50777. }
  50778. if (defined('STDOUT') && Process::supportsColor(STDOUT)) {
  50779. $args = Process::addColorOption($args, $this->colorOption);
  50780. }
  50781. $args = array_merge($php, array($this->script), $args);
  50782. $cmd = Process::escape(array_shift($args), true, true);
  50783. foreach ($args as $arg) {
  50784. $cmd .= ' '.Process::escape($arg);
  50785. }
  50786. return $cmd;
  50787. }
  50788. private function setEnvironment($scannedInis, array $iniFiles)
  50789. {
  50790. $scanDir = getenv('PHP_INI_SCAN_DIR');
  50791. $phprc = getenv('PHPRC');
  50792. if (!putenv($this->envOriginalInis.'='.implode(PATH_SEPARATOR, $iniFiles))) {
  50793. return false;
  50794. }
  50795. if ($this->persistent) {
  50796. if (!putenv('PHP_INI_SCAN_DIR=') || !putenv('PHPRC='.$this->tmpIni)) {
  50797. return false;
  50798. }
  50799. }
  50800. $envArgs = array(
  50801. self::RESTART_ID,
  50802. $this->loaded,
  50803. (int) $scannedInis,
  50804. false === $scanDir ? '*' : $scanDir,
  50805. false === $phprc ? '*' : $phprc,
  50806. );
  50807. return putenv($this->envAllowXdebug.'='.implode('|', $envArgs));
  50808. }
  50809. private function notify($op, $data = null)
  50810. {
  50811. $this->statusWriter->report($op, $data);
  50812. }
  50813. private function mergeLoadedConfig(array $loadedConfig, array $iniConfig)
  50814. {
  50815. $content = '';
  50816. foreach ($loadedConfig as $name => $value) {
  50817. if (!is_string($value)
  50818. || strpos($name, 'xdebug') === 0
  50819. || $name === 'apc.mmap_file_mask') {
  50820. continue;
  50821. }
  50822. if (!isset($iniConfig[$name]) || $iniConfig[$name] !== $value) {
  50823. $content .= $name.'="'.addcslashes($value, '\\"').'"'.PHP_EOL;
  50824. }
  50825. }
  50826. return $content;
  50827. }
  50828. private function checkMainScript()
  50829. {
  50830. if (null !== $this->script) {
  50831. return file_exists($this->script) || '--' === $this->script;
  50832. }
  50833. if (file_exists($this->script = $_SERVER['argv'][0])) {
  50834. return true;
  50835. }
  50836. $options = PHP_VERSION_ID >= 50306 ? DEBUG_BACKTRACE_IGNORE_ARGS : false;
  50837. $trace = debug_backtrace($options);
  50838. if (($main = end($trace)) && isset($main['file'])) {
  50839. return file_exists($this->script = $main['file']);
  50840. }
  50841. return false;
  50842. }
  50843. private function setEnvRestartSettings($envArgs)
  50844. {
  50845. $settings = array(
  50846. php_ini_loaded_file(),
  50847. $envArgs[2],
  50848. $envArgs[3],
  50849. $envArgs[4],
  50850. getenv($this->envOriginalInis),
  50851. self::$skipped,
  50852. );
  50853. Process::setEnv(self::RESTART_SETTINGS, implode('|', $settings));
  50854. }
  50855. private function syncSettings(array $settings)
  50856. {
  50857. if (false === getenv($this->envOriginalInis)) {
  50858. Process::setEnv($this->envOriginalInis, implode(PATH_SEPARATOR, $settings['inis']));
  50859. }
  50860. self::$skipped = $settings['skipped'];
  50861. $this->notify(Status::INFO, 'Process called with existing restart settings');
  50862. }
  50863. private function checkScanDirConfig()
  50864. {
  50865. return !(getenv('PHP_INI_SCAN_DIR')
  50866. && !PHP_CONFIG_FILE_SCAN_DIR
  50867. && (PHP_VERSION_ID < 70113
  50868. || PHP_VERSION_ID === 70200));
  50869. }
  50870. }
  50871. Copyright (c) 2012 PHP Framework Interoperability Group
  50872. Permission is hereby granted, free of charge, to any person obtaining a copy
  50873. of this software and associated documentation files (the "Software"), to deal
  50874. in the Software without restriction, including without limitation the rights
  50875. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  50876. copies of the Software, and to permit persons to whom the Software is
  50877. furnished to do so, subject to the following conditions:
  50878. The above copyright notice and this permission notice shall be included in
  50879. all copies or substantial portions of the Software.
  50880. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  50881. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  50882. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  50883. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  50884. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  50885. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  50886. THE SOFTWARE.
  50887. <?php
  50888. namespace Psr\Log;
  50889. abstract class AbstractLogger implements LoggerInterface
  50890. {
  50891. public function emergency($message, array $context = array())
  50892. {
  50893. $this->log(LogLevel::EMERGENCY, $message, $context);
  50894. }
  50895. public function alert($message, array $context = array())
  50896. {
  50897. $this->log(LogLevel::ALERT, $message, $context);
  50898. }
  50899. public function critical($message, array $context = array())
  50900. {
  50901. $this->log(LogLevel::CRITICAL, $message, $context);
  50902. }
  50903. public function error($message, array $context = array())
  50904. {
  50905. $this->log(LogLevel::ERROR, $message, $context);
  50906. }
  50907. public function warning($message, array $context = array())
  50908. {
  50909. $this->log(LogLevel::WARNING, $message, $context);
  50910. }
  50911. public function notice($message, array $context = array())
  50912. {
  50913. $this->log(LogLevel::NOTICE, $message, $context);
  50914. }
  50915. public function info($message, array $context = array())
  50916. {
  50917. $this->log(LogLevel::INFO, $message, $context);
  50918. }
  50919. public function debug($message, array $context = array())
  50920. {
  50921. $this->log(LogLevel::DEBUG, $message, $context);
  50922. }
  50923. }
  50924. <?php
  50925. namespace Psr\Log;
  50926. class InvalidArgumentException extends \InvalidArgumentException
  50927. {
  50928. }
  50929. <?php
  50930. namespace Psr\Log;
  50931. class LogLevel
  50932. {
  50933. const EMERGENCY = 'emergency';
  50934. const ALERT = 'alert';
  50935. const CRITICAL = 'critical';
  50936. const ERROR = 'error';
  50937. const WARNING = 'warning';
  50938. const NOTICE = 'notice';
  50939. const INFO = 'info';
  50940. const DEBUG = 'debug';
  50941. }
  50942. <?php
  50943. namespace Psr\Log;
  50944. interface LoggerAwareInterface
  50945. {
  50946. public function setLogger(LoggerInterface $logger);
  50947. }
  50948. <?php
  50949. namespace Psr\Log;
  50950. trait LoggerAwareTrait
  50951. {
  50952. protected $logger;
  50953. public function setLogger(LoggerInterface $logger)
  50954. {
  50955. $this->logger = $logger;
  50956. }
  50957. }
  50958. <?php
  50959. namespace Psr\Log;
  50960. interface LoggerInterface
  50961. {
  50962. public function emergency($message, array $context = array());
  50963. public function alert($message, array $context = array());
  50964. public function critical($message, array $context = array());
  50965. public function error($message, array $context = array());
  50966. public function warning($message, array $context = array());
  50967. public function notice($message, array $context = array());
  50968. public function info($message, array $context = array());
  50969. public function debug($message, array $context = array());
  50970. public function log($level, $message, array $context = array());
  50971. }
  50972. <?php
  50973. namespace Psr\Log;
  50974. trait LoggerTrait
  50975. {
  50976. public function emergency($message, array $context = array())
  50977. {
  50978. $this->log(LogLevel::EMERGENCY, $message, $context);
  50979. }
  50980. public function alert($message, array $context = array())
  50981. {
  50982. $this->log(LogLevel::ALERT, $message, $context);
  50983. }
  50984. public function critical($message, array $context = array())
  50985. {
  50986. $this->log(LogLevel::CRITICAL, $message, $context);
  50987. }
  50988. public function error($message, array $context = array())
  50989. {
  50990. $this->log(LogLevel::ERROR, $message, $context);
  50991. }
  50992. public function warning($message, array $context = array())
  50993. {
  50994. $this->log(LogLevel::WARNING, $message, $context);
  50995. }
  50996. public function notice($message, array $context = array())
  50997. {
  50998. $this->log(LogLevel::NOTICE, $message, $context);
  50999. }
  51000. public function info($message, array $context = array())
  51001. {
  51002. $this->log(LogLevel::INFO, $message, $context);
  51003. }
  51004. public function debug($message, array $context = array())
  51005. {
  51006. $this->log(LogLevel::DEBUG, $message, $context);
  51007. }
  51008. abstract public function log($level, $message, array $context = array());
  51009. }
  51010. <?php
  51011. namespace Psr\Log;
  51012. class NullLogger extends AbstractLogger
  51013. {
  51014. public function log($level, $message, array $context = array())
  51015. {
  51016. }
  51017. }
  51018. <?php
  51019. namespace Psr\Log\Test;
  51020. use Psr\Log\LoggerInterface;
  51021. use Psr\Log\LogLevel;
  51022. abstract class LoggerInterfaceTest extends \PHPUnit_Framework_TestCase
  51023. {
  51024. abstract public function getLogger();
  51025. abstract public function getLogs();
  51026. public function testImplements()
  51027. {
  51028. $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger());
  51029. }
  51030. public function testLogsAtAllLevels($level, $message)
  51031. {
  51032. $logger = $this->getLogger();
  51033. $logger->{$level}($message, array('user' => 'Bob'));
  51034. $logger->log($level, $message, array('user' => 'Bob'));
  51035. $expected = array(
  51036. $level.' message of level '.$level.' with context: Bob',
  51037. $level.' message of level '.$level.' with context: Bob',
  51038. );
  51039. $this->assertEquals($expected, $this->getLogs());
  51040. }
  51041. public function provideLevelsAndMessages()
  51042. {
  51043. return array(
  51044. LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'),
  51045. LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'),
  51046. LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'),
  51047. LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'),
  51048. LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'),
  51049. LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'),
  51050. LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'),
  51051. LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'),
  51052. );
  51053. }
  51054. public function testThrowsOnInvalidLevel()
  51055. {
  51056. $logger = $this->getLogger();
  51057. $logger->log('invalid level', 'Foo');
  51058. }
  51059. public function testContextReplacement()
  51060. {
  51061. $logger = $this->getLogger();
  51062. $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar'));
  51063. $expected = array('info {Message {nothing} Bob Bar a}');
  51064. $this->assertEquals($expected, $this->getLogs());
  51065. }
  51066. public function testObjectCastToString()
  51067. {
  51068. if (method_exists($this, 'createPartialMock')) {
  51069. $dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString'));
  51070. } else {
  51071. $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString'));
  51072. }
  51073. $dummy->expects($this->once())
  51074. ->method('__toString')
  51075. ->will($this->returnValue('DUMMY'));
  51076. $this->getLogger()->warning($dummy);
  51077. $expected = array('warning DUMMY');
  51078. $this->assertEquals($expected, $this->getLogs());
  51079. }
  51080. public function testContextCanContainAnything()
  51081. {
  51082. $context = array(
  51083. 'bool' => true,
  51084. 'null' => null,
  51085. 'string' => 'Foo',
  51086. 'int' => 0,
  51087. 'float' => 0.5,
  51088. 'nested' => array('with object' => new DummyTest),
  51089. 'object' => new \DateTime,
  51090. 'resource' => fopen('php://memory', 'r'),
  51091. );
  51092. $this->getLogger()->warning('Crazy context data', $context);
  51093. $expected = array('warning Crazy context data');
  51094. $this->assertEquals($expected, $this->getLogs());
  51095. }
  51096. public function testContextExceptionKeyCanBeExceptionOrOtherValues()
  51097. {
  51098. $logger = $this->getLogger();
  51099. $logger->warning('Random message', array('exception' => 'oops'));
  51100. $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail')));
  51101. $expected = array(
  51102. 'warning Random message',
  51103. 'critical Uncaught Exception!'
  51104. );
  51105. $this->assertEquals($expected, $this->getLogs());
  51106. }
  51107. }
  51108. class DummyTest
  51109. {
  51110. public function __toString()
  51111. {
  51112. }
  51113. }
  51114. <?php
  51115. require_once __DIR__ . '/composer/autoload_real.php';
  51116. return ComposerAutoloaderInitComposerPhar1541063106::getLoader();
  51117. <?php
  51118. $vendorDir = dirname(dirname(__FILE__));
  51119. $baseDir = dirname($vendorDir);
  51120. return array(
  51121. );
  51122. <?php
  51123. $vendorDir = dirname(dirname(__FILE__));
  51124. $baseDir = dirname($vendorDir);
  51125. return array(
  51126. 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
  51127. 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'),
  51128. 'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
  51129. 'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
  51130. 'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'),
  51131. 'Symfony\\Component\\Debug\\' => array($vendorDir . '/symfony/debug'),
  51132. 'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
  51133. 'Seld\\PharUtils\\' => array($vendorDir . '/seld/phar-utils/src'),
  51134. 'Seld\\JsonLint\\' => array($vendorDir . '/seld/jsonlint/src/Seld/JsonLint'),
  51135. 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
  51136. 'JsonSchema\\' => array($vendorDir . '/justinrainbow/json-schema/src/JsonSchema'),
  51137. 'Composer\\XdebugHandler\\' => array($vendorDir . '/composer/xdebug-handler/src'),
  51138. 'Composer\\Spdx\\' => array($vendorDir . '/composer/spdx-licenses/src'),
  51139. 'Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'),
  51140. 'Composer\\CaBundle\\' => array($vendorDir . '/composer/ca-bundle/src'),
  51141. 'Composer\\' => array($baseDir . '/src/Composer'),
  51142. );
  51143. <?php
  51144. $vendorDir = dirname(dirname(__FILE__));
  51145. $baseDir = dirname($vendorDir);
  51146. return array(
  51147. );
  51148. <?php
  51149. $vendorDir = dirname(dirname(__FILE__));
  51150. $baseDir = dirname($vendorDir);
  51151. return array(
  51152. '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
  51153. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
  51154. );
  51155. <?php
  51156. class ComposerAutoloaderInitComposerPhar1541063106
  51157. {
  51158. private static $loader;
  51159. public static function loadClassLoader($class)
  51160. {
  51161. if ('Composer\Autoload\ClassLoader' === $class) {
  51162. require __DIR__ . '/ClassLoader.php';
  51163. }
  51164. }
  51165. public static function getLoader()
  51166. {
  51167. if (null !== self::$loader) {
  51168. return self::$loader;
  51169. }
  51170. spl_autoload_register(array('ComposerAutoloaderInitComposerPhar1541063106', 'loadClassLoader'), true, true);
  51171. self::$loader = $loader = new \Composer\Autoload\ClassLoader();
  51172. spl_autoload_unregister(array('ComposerAutoloaderInitComposerPhar1541063106', 'loadClassLoader'));
  51173. $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
  51174. if ($useStaticLoader) {
  51175. require_once __DIR__ . '/autoload_static.php';
  51176. call_user_func(\Composer\Autoload\ComposerStaticInitComposerPhar1541063106::getInitializer($loader));
  51177. } else {
  51178. $map = require __DIR__ . '/autoload_namespaces.php';
  51179. foreach ($map as $namespace => $path) {
  51180. $loader->set($namespace, $path);
  51181. }
  51182. $map = require __DIR__ . '/autoload_psr4.php';
  51183. foreach ($map as $namespace => $path) {
  51184. $loader->setPsr4($namespace, $path);
  51185. }
  51186. $classMap = require __DIR__ . '/autoload_classmap.php';
  51187. if ($classMap) {
  51188. $loader->addClassMap($classMap);
  51189. }
  51190. }
  51191. $loader->register(true);
  51192. if ($useStaticLoader) {
  51193. $includeFiles = Composer\Autoload\ComposerStaticInitComposerPhar1541063106::$files;
  51194. } else {
  51195. $includeFiles = require __DIR__ . '/autoload_files.php';
  51196. }
  51197. foreach ($includeFiles as $fileIdentifier => $file) {
  51198. composerRequireComposerPhar1541063106($fileIdentifier, $file);
  51199. }
  51200. return $loader;
  51201. }
  51202. }
  51203. function composerRequireComposerPhar1541063106($fileIdentifier, $file)
  51204. {
  51205. if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  51206. require $file;
  51207. $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
  51208. }
  51209. }
  51210. <?php
  51211. namespace Composer\Autoload;
  51212. class ComposerStaticInitComposerPhar1541063106
  51213. {
  51214. public static $files = array (
  51215. '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
  51216. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
  51217. );
  51218. public static $prefixLengthsPsr4 = array (
  51219. 'S' =>
  51220. array (
  51221. 'Symfony\\Polyfill\\Mbstring\\' => 26,
  51222. 'Symfony\\Polyfill\\Ctype\\' => 23,
  51223. 'Symfony\\Component\\Process\\' => 26,
  51224. 'Symfony\\Component\\Finder\\' => 25,
  51225. 'Symfony\\Component\\Filesystem\\' => 29,
  51226. 'Symfony\\Component\\Debug\\' => 24,
  51227. 'Symfony\\Component\\Console\\' => 26,
  51228. 'Seld\\PharUtils\\' => 15,
  51229. 'Seld\\JsonLint\\' => 14,
  51230. ),
  51231. 'P' =>
  51232. array (
  51233. 'Psr\\Log\\' => 8,
  51234. ),
  51235. 'J' =>
  51236. array (
  51237. 'JsonSchema\\' => 11,
  51238. ),
  51239. 'C' =>
  51240. array (
  51241. 'Composer\\XdebugHandler\\' => 23,
  51242. 'Composer\\Spdx\\' => 14,
  51243. 'Composer\\Semver\\' => 16,
  51244. 'Composer\\CaBundle\\' => 18,
  51245. 'Composer\\' => 9,
  51246. ),
  51247. );
  51248. public static $prefixDirsPsr4 = array (
  51249. 'Symfony\\Polyfill\\Mbstring\\' =>
  51250. array (
  51251. 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
  51252. ),
  51253. 'Symfony\\Polyfill\\Ctype\\' =>
  51254. array (
  51255. 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype',
  51256. ),
  51257. 'Symfony\\Component\\Process\\' =>
  51258. array (
  51259. 0 => __DIR__ . '/..' . '/symfony/process',
  51260. ),
  51261. 'Symfony\\Component\\Finder\\' =>
  51262. array (
  51263. 0 => __DIR__ . '/..' . '/symfony/finder',
  51264. ),
  51265. 'Symfony\\Component\\Filesystem\\' =>
  51266. array (
  51267. 0 => __DIR__ . '/..' . '/symfony/filesystem',
  51268. ),
  51269. 'Symfony\\Component\\Debug\\' =>
  51270. array (
  51271. 0 => __DIR__ . '/..' . '/symfony/debug',
  51272. ),
  51273. 'Symfony\\Component\\Console\\' =>
  51274. array (
  51275. 0 => __DIR__ . '/..' . '/symfony/console',
  51276. ),
  51277. 'Seld\\PharUtils\\' =>
  51278. array (
  51279. 0 => __DIR__ . '/..' . '/seld/phar-utils/src',
  51280. ),
  51281. 'Seld\\JsonLint\\' =>
  51282. array (
  51283. 0 => __DIR__ . '/..' . '/seld/jsonlint/src/Seld/JsonLint',
  51284. ),
  51285. 'Psr\\Log\\' =>
  51286. array (
  51287. 0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
  51288. ),
  51289. 'JsonSchema\\' =>
  51290. array (
  51291. 0 => __DIR__ . '/..' . '/justinrainbow/json-schema/src/JsonSchema',
  51292. ),
  51293. 'Composer\\XdebugHandler\\' =>
  51294. array (
  51295. 0 => __DIR__ . '/..' . '/composer/xdebug-handler/src',
  51296. ),
  51297. 'Composer\\Spdx\\' =>
  51298. array (
  51299. 0 => __DIR__ . '/..' . '/composer/spdx-licenses/src',
  51300. ),
  51301. 'Composer\\Semver\\' =>
  51302. array (
  51303. 0 => __DIR__ . '/..' . '/composer/semver/src',
  51304. ),
  51305. 'Composer\\CaBundle\\' =>
  51306. array (
  51307. 0 => __DIR__ . '/..' . '/composer/ca-bundle/src',
  51308. ),
  51309. 'Composer\\' =>
  51310. array (
  51311. 0 => __DIR__ . '/../..' . '/src/Composer',
  51312. ),
  51313. );
  51314. public static function getInitializer(ClassLoader $loader)
  51315. {
  51316. return \Closure::bind(function () use ($loader) {
  51317. $loader->prefixLengthsPsr4 = ComposerStaticInitComposerPhar1541063106::$prefixLengthsPsr4;
  51318. $loader->prefixDirsPsr4 = ComposerStaticInitComposerPhar1541063106::$prefixDirsPsr4;
  51319. }, null, ClassLoader::class);
  51320. }
  51321. }
  51322. <?php
  51323. namespace Composer\Autoload;
  51324. class ClassLoader
  51325. {
  51326. private $prefixLengthsPsr4 = array();
  51327. private $prefixDirsPsr4 = array();
  51328. private $fallbackDirsPsr4 = array();
  51329. private $prefixesPsr0 = array();
  51330. private $fallbackDirsPsr0 = array();
  51331. private $useIncludePath = false;
  51332. private $classMap = array();
  51333. private $classMapAuthoritative = false;
  51334. private $missingClasses = array();
  51335. private $apcuPrefix;
  51336. public function getPrefixes()
  51337. {
  51338. if (!empty($this->prefixesPsr0)) {
  51339. return call_user_func_array('array_merge', $this->prefixesPsr0);
  51340. }
  51341. return array();
  51342. }
  51343. public function getPrefixesPsr4()
  51344. {
  51345. return $this->prefixDirsPsr4;
  51346. }
  51347. public function getFallbackDirs()
  51348. {
  51349. return $this->fallbackDirsPsr0;
  51350. }
  51351. public function getFallbackDirsPsr4()
  51352. {
  51353. return $this->fallbackDirsPsr4;
  51354. }
  51355. public function getClassMap()
  51356. {
  51357. return $this->classMap;
  51358. }
  51359. public function addClassMap(array $classMap)
  51360. {
  51361. if ($this->classMap) {
  51362. $this->classMap = array_merge($this->classMap, $classMap);
  51363. } else {
  51364. $this->classMap = $classMap;
  51365. }
  51366. }
  51367. public function add($prefix, $paths, $prepend = false)
  51368. {
  51369. if (!$prefix) {
  51370. if ($prepend) {
  51371. $this->fallbackDirsPsr0 = array_merge(
  51372. (array) $paths,
  51373. $this->fallbackDirsPsr0
  51374. );
  51375. } else {
  51376. $this->fallbackDirsPsr0 = array_merge(
  51377. $this->fallbackDirsPsr0,
  51378. (array) $paths
  51379. );
  51380. }
  51381. return;
  51382. }
  51383. $first = $prefix[0];
  51384. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  51385. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  51386. return;
  51387. }
  51388. if ($prepend) {
  51389. $this->prefixesPsr0[$first][$prefix] = array_merge(
  51390. (array) $paths,
  51391. $this->prefixesPsr0[$first][$prefix]
  51392. );
  51393. } else {
  51394. $this->prefixesPsr0[$first][$prefix] = array_merge(
  51395. $this->prefixesPsr0[$first][$prefix],
  51396. (array) $paths
  51397. );
  51398. }
  51399. }
  51400. public function addPsr4($prefix, $paths, $prepend = false)
  51401. {
  51402. if (!$prefix) {
  51403. if ($prepend) {
  51404. $this->fallbackDirsPsr4 = array_merge(
  51405. (array) $paths,
  51406. $this->fallbackDirsPsr4
  51407. );
  51408. } else {
  51409. $this->fallbackDirsPsr4 = array_merge(
  51410. $this->fallbackDirsPsr4,
  51411. (array) $paths
  51412. );
  51413. }
  51414. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  51415. $length = strlen($prefix);
  51416. if ('\\' !== $prefix[$length - 1]) {
  51417. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  51418. }
  51419. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  51420. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  51421. } elseif ($prepend) {
  51422. $this->prefixDirsPsr4[$prefix] = array_merge(
  51423. (array) $paths,
  51424. $this->prefixDirsPsr4[$prefix]
  51425. );
  51426. } else {
  51427. $this->prefixDirsPsr4[$prefix] = array_merge(
  51428. $this->prefixDirsPsr4[$prefix],
  51429. (array) $paths
  51430. );
  51431. }
  51432. }
  51433. public function set($prefix, $paths)
  51434. {
  51435. if (!$prefix) {
  51436. $this->fallbackDirsPsr0 = (array) $paths;
  51437. } else {
  51438. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  51439. }
  51440. }
  51441. public function setPsr4($prefix, $paths)
  51442. {
  51443. if (!$prefix) {
  51444. $this->fallbackDirsPsr4 = (array) $paths;
  51445. } else {
  51446. $length = strlen($prefix);
  51447. if ('\\' !== $prefix[$length - 1]) {
  51448. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  51449. }
  51450. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  51451. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  51452. }
  51453. }
  51454. public function setUseIncludePath($useIncludePath)
  51455. {
  51456. $this->useIncludePath = $useIncludePath;
  51457. }
  51458. public function getUseIncludePath()
  51459. {
  51460. return $this->useIncludePath;
  51461. }
  51462. public function setClassMapAuthoritative($classMapAuthoritative)
  51463. {
  51464. $this->classMapAuthoritative = $classMapAuthoritative;
  51465. }
  51466. public function isClassMapAuthoritative()
  51467. {
  51468. return $this->classMapAuthoritative;
  51469. }
  51470. public function setApcuPrefix($apcuPrefix)
  51471. {
  51472. $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
  51473. }
  51474. public function getApcuPrefix()
  51475. {
  51476. return $this->apcuPrefix;
  51477. }
  51478. public function register($prepend = false)
  51479. {
  51480. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  51481. }
  51482. public function unregister()
  51483. {
  51484. spl_autoload_unregister(array($this, 'loadClass'));
  51485. }
  51486. public function loadClass($class)
  51487. {
  51488. if ($file = $this->findFile($class)) {
  51489. includeFile($file);
  51490. return true;
  51491. }
  51492. }
  51493. public function findFile($class)
  51494. {
  51495. if (isset($this->classMap[$class])) {
  51496. return $this->classMap[$class];
  51497. }
  51498. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  51499. return false;
  51500. }
  51501. if (null !== $this->apcuPrefix) {
  51502. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  51503. if ($hit) {
  51504. return $file;
  51505. }
  51506. }
  51507. $file = $this->findFileWithExtension($class, '.php');
  51508. if (false === $file && defined('HHVM_VERSION')) {
  51509. $file = $this->findFileWithExtension($class, '.hh');
  51510. }
  51511. if (null !== $this->apcuPrefix) {
  51512. apcu_add($this->apcuPrefix.$class, $file);
  51513. }
  51514. if (false === $file) {
  51515. $this->missingClasses[$class] = true;
  51516. }
  51517. return $file;
  51518. }
  51519. private function findFileWithExtension($class, $ext)
  51520. {
  51521. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  51522. $first = $class[0];
  51523. if (isset($this->prefixLengthsPsr4[$first])) {
  51524. $subPath = $class;
  51525. while (false !== $lastPos = strrpos($subPath, '\\')) {
  51526. $subPath = substr($subPath, 0, $lastPos);
  51527. $search = $subPath . '\\';
  51528. if (isset($this->prefixDirsPsr4[$search])) {
  51529. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  51530. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  51531. if (file_exists($file = $dir . $pathEnd)) {
  51532. return $file;
  51533. }
  51534. }
  51535. }
  51536. }
  51537. }
  51538. foreach ($this->fallbackDirsPsr4 as $dir) {
  51539. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  51540. return $file;
  51541. }
  51542. }
  51543. if (false !== $pos = strrpos($class, '\\')) {
  51544. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  51545. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  51546. } else {
  51547. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  51548. }
  51549. if (isset($this->prefixesPsr0[$first])) {
  51550. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  51551. if (0 === strpos($class, $prefix)) {
  51552. foreach ($dirs as $dir) {
  51553. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  51554. return $file;
  51555. }
  51556. }
  51557. }
  51558. }
  51559. }
  51560. foreach ($this->fallbackDirsPsr0 as $dir) {
  51561. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  51562. return $file;
  51563. }
  51564. }
  51565. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  51566. return $file;
  51567. }
  51568. return false;
  51569. }
  51570. }
  51571. function includeFile($file)
  51572. {
  51573. include $file;
  51574. }
  51575. ##
  51576. ## Bundle of CA Root Certificates
  51577. ##
  51578. ## Certificate data from Mozilla as of: Wed Oct 17 03:12:10 2018 GMT
  51579. ##
  51580. ## This is a bundle of X.509 certificates of public Certificate Authorities
  51581. ## (CA). These were automatically extracted from Mozilla's root certificates
  51582. ## file (certdata.txt). This file can be found in the mozilla source tree:
  51583. ## https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt
  51584. ##
  51585. ## It contains the certificates in PEM format and therefore
  51586. ## can be directly used with curl / libcurl / php_curl, or with
  51587. ## an Apache+mod_ssl webserver for SSL client authentication.
  51588. ## Just configure this file as the SSLCACertificateFile.
  51589. ##
  51590. ## Conversion done with mk-ca-bundle.pl version 1.27.
  51591. ## SHA256: 3f875d87fee4ce3d966c69f1d6c111aa95c0143ade59e4fa24882c582bb5f0ca
  51592. ##
  51593. GlobalSign Root CA
  51594. ==================
  51595. -----BEGIN CERTIFICATE-----
  51596. MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkGA1UEBhMCQkUx
  51597. GTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jvb3QgQ0ExGzAZBgNVBAMTEkds
  51598. b2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAwMDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNV
  51599. BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYD
  51600. VQQDExJHbG9iYWxTaWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDa
  51601. DuaZjc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavpxy0Sy6sc
  51602. THAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp1Wrjsok6Vjk4bwY8iGlb
  51603. Kk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdGsnUOhugZitVtbNV4FpWi6cgKOOvyJBNP
  51604. c1STE4U6G7weNLWLBYy5d4ux2x8gkasJU26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrX
  51605. gzT/LCrBbBlDSgeF59N89iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
  51606. HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0BAQUF
  51607. AAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOzyj1hTdNGCbM+w6Dj
  51608. Y1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE38NflNUVyRRBnMRddWQVDf9VMOyG
  51609. j/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymPAbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhH
  51610. hm4qxFYxldBniYUr+WymXUadDKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveC
  51611. X4XSQRjbgbMEHMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
  51612. -----END CERTIFICATE-----
  51613. GlobalSign Root CA - R2
  51614. =======================
  51615. -----BEGIN CERTIFICATE-----
  51616. MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4GA1UECxMXR2xv
  51617. YmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  51618. bFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  51619. aWduIFJvb3QgQ0EgLSBSMjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  51620. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6
  51621. ErPLv4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8eoLrvozp
  51622. s6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklqtTleiDTsvHgMCJiEbKjN
  51623. S7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzdC9XZzPnqJworc5HGnRusyMvo4KD0L5CL
  51624. TfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pazq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6C
  51625. ygPCm48CAwEAAaOBnDCBmTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E
  51626. FgQUm+IHV2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5nbG9i
  51627. YWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG3lm0mi3f3BmGLjAN
  51628. BgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4GsJ0/WwbgcQ3izDJr86iw8bmEbTUsp
  51629. 9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu
  51630. 01yiPqFbQfXf5WRDLenVOavSot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG7
  51631. 9G+dwfCMNYxdAfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7
  51632. TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg==
  51633. -----END CERTIFICATE-----
  51634. Verisign Class 3 Public Primary Certification Authority - G3
  51635. ============================================================
  51636. -----BEGIN CERTIFICATE-----
  51637. MIIEGjCCAwICEQCbfgZJoz5iudXukEhxKe9XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQGEwJV
  51638. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  51639. cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  51640. IG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNh
  51641. dGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQsw
  51642. CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy
  51643. dXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv
  51644. cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkg
  51645. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  51646. ggEBAMu6nFL8eB8aHm8bN3O9+MlrlBIwT/A2R/XQkQr1F8ilYcEWQE37imGQ5XYgwREGfassbqb1
  51647. EUGO+i2tKmFZpGcmTNDovFJbcCAEWNF6yaRpvIMXZK0Fi7zQWM6NjPXr8EJJC52XJ2cybuGukxUc
  51648. cLwgTS8Y3pKI6GyFVxEa6X7jJhFUokWWVYPKMIno3Nij7SqAP395ZVc+FSBmCC+Vk7+qRy+oRpfw
  51649. EuL+wgorUeZ25rdGt+INpsyow0xZVYnm6FNcHOqd8GIWC6fJXwzw3sJ2zq/3avL6QaaiMxTJ5Xpj
  51650. 055iN9WFZZ4O5lMkdBteHRJTW8cs54NJOxWuimi5V5cCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA
  51651. ERSWwauSCPc/L8my/uRan2Te2yFPhpk0djZX3dAVL8WtfxUfN2JzPtTnX84XA9s1+ivbrmAJXx5f
  51652. j267Cz3qWhMeDGBvtcC1IyIuBwvLqXTLR7sdwdela8wv0kL9Sd2nic9TutoAWii/gt/4uhMdUIaC
  51653. /Y4wjylGsB49Ndo4YhYYSq3mtlFs3q9i6wHQHiT+eo8SGhJouPtmmRQURVyu565pF4ErWjfJXir0
  51654. xuKhXFSbplQAz/DxwceYMBo7Nhbbo27q/a2ywtrvAkcTisDxszGtTxzhT5yvDwyd93gN2PQ1VoDa
  51655. t20Xj50egWTh/sVFuq1ruQp6Tk9LhO5L8X3dEQ==
  51656. -----END CERTIFICATE-----
  51657. Entrust.net Premium 2048 Secure Server CA
  51658. =========================================
  51659. -----BEGIN CERTIFICATE-----
  51660. MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChMLRW50cnVzdC5u
  51661. ZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBpbmNvcnAuIGJ5IHJlZi4gKGxp
  51662. bWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNV
  51663. BAMTKkVudHJ1c3QubmV0IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQx
  51664. NzUwNTFaFw0yOTA3MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3
  51665. d3d3LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTEl
  51666. MCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEGA1UEAxMqRW50cnVzdC5u
  51667. ZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  51668. MIIBCgKCAQEArU1LqRKGsuqjIAcVFmQqK0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOL
  51669. Gp18EzoOH1u3Hs/lJBQesYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSr
  51670. hRSGlVuXMlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVTXTzW
  51671. nLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/HoZdenoVve8AjhUi
  51672. VBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH4QIDAQABo0IwQDAOBgNVHQ8BAf8E
  51673. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJ
  51674. KoZIhvcNAQEFBQADggEBADubj1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPy
  51675. T/4xmf3IDExoU8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf
  51676. zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5bu/8j72gZyxKT
  51677. J1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+bYQLCIt+jerXmCHG8+c8eS9e
  51678. nNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/ErfF6adulZkMV8gzURZVE=
  51679. -----END CERTIFICATE-----
  51680. Baltimore CyberTrust Root
  51681. =========================
  51682. -----BEGIN CERTIFICATE-----
  51683. MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJRTESMBAGA1UE
  51684. ChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYDVQQDExlCYWx0aW1vcmUgQ3li
  51685. ZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoXDTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMC
  51686. SUUxEjAQBgNVBAoTCUJhbHRpbW9yZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFs
  51687. dGltb3JlIEN5YmVyVHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKME
  51688. uyKrmD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjrIZ3AQSsB
  51689. UnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeKmpYcqWe4PwzV9/lSEy/C
  51690. G9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSuXmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9
  51691. XbIGevOF6uvUA65ehD5f/xXtabz5OTZydc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjpr
  51692. l3RjM71oGDHweI12v/yejl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoI
  51693. VDaGezq1BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEB
  51694. BQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT929hkTI7gQCvlYpNRh
  51695. cL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3WgxjkzSswF07r51XgdIGn9w/xZchMB5
  51696. hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsa
  51697. Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H
  51698. RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp
  51699. -----END CERTIFICATE-----
  51700. AddTrust External Root
  51701. ======================
  51702. -----BEGIN CERTIFICATE-----
  51703. MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
  51704. QWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYD
  51705. VQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEw
  51706. NDgzOFowbzELMAkGA1UEBhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRU
  51707. cnVzdCBFeHRlcm5hbCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0Eg
  51708. Um9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvtH7xsD821
  51709. +iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9uMq/NzgtHj6RQa1wVsfw
  51710. Tz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzXmk6vBbOmcZSccbNQYArHE504B4YCqOmo
  51711. aSYYkKtMsE8jqzpPhNjfzp/haW+710LXa0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy
  51712. 2xSoRcRdKn23tNbE7qzNE0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv7
  51713. 7+ldU9U0WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYDVR0P
  51714. BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0Jvf6xCZU7wO94CTL
  51715. VBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEmMCQGA1UECxMdQWRk
  51716. VHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsxIjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENB
  51717. IFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZl
  51718. j7DYd7usQWxHYINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5
  51719. 6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvCNr4TDea9Y355
  51720. e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEXc4g/VhsxOBi0cQ+azcgOno4u
  51721. G+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5amnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ=
  51722. -----END CERTIFICATE-----
  51723. Entrust Root Certification Authority
  51724. ====================================
  51725. -----BEGIN CERTIFICATE-----
  51726. MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMCVVMxFjAUBgNV
  51727. BAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0Lm5ldC9DUFMgaXMgaW5jb3Jw
  51728. b3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMWKGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsG
  51729. A1UEAxMkRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0
  51730. MloXDTI2MTEyNzIwNTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMu
  51731. MTkwNwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSByZWZlcmVu
  51732. Y2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNVBAMTJEVudHJ1c3QgUm9v
  51733. dCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  51734. ALaVtkNC+sZtKm9I35RMOVcF7sN5EUFoNu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYsz
  51735. A9u3g3s+IIRe7bJWKKf44LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOww
  51736. Cj0Yzfv9KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGIrb68
  51737. j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi94DkZfs0Nw4pgHBN
  51738. rziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOBsDCBrTAOBgNVHQ8BAf8EBAMCAQYw
  51739. DwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAigA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1
  51740. MzQyWjAfBgNVHSMEGDAWgBRokORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DH
  51741. hmak8fdLQ/uEvW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA
  51742. A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9tO1KzKtvn1ISM
  51743. Y/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6ZuaAGAT/3B+XxFNSRuzFVJ7yVTa
  51744. v52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTS
  51745. W3iDVuycNsMm4hH2Z0kdkquM++v/eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0
  51746. tHuu2guQOHXvgR1m0vdXcDazv/wor3ElhVsT/h5/WrQ8
  51747. -----END CERTIFICATE-----
  51748. GeoTrust Global CA
  51749. ==================
  51750. -----BEGIN CERTIFICATE-----
  51751. MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVTMRYwFAYDVQQK
  51752. Ew1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9iYWwgQ0EwHhcNMDIwNTIxMDQw
  51753. MDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5j
  51754. LjEbMBkGA1UEAxMSR2VvVHJ1c3QgR2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  51755. CgKCAQEA2swYYzD99BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjo
  51756. BbdqfnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDviS2Aelet
  51757. 8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU1XupGc1V3sjs0l44U+Vc
  51758. T4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+bw8HHa8sHo9gOeL6NlMTOdReJivbPagU
  51759. vTLrGAMoUgRx5aszPeE4uwc2hGKceeoWMPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTAD
  51760. AQH/MB0GA1UdDgQWBBTAephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVk
  51761. DBF9qn1luMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKInZ57Q
  51762. zxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfStQWVYrmm3ok9Nns4
  51763. d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcFPseKUgzbFbS9bZvlxrFUaKnjaZC2
  51764. mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Unhw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6p
  51765. XE0zX5IJL4hmXXeXxx12E6nV5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvm
  51766. Mw==
  51767. -----END CERTIFICATE-----
  51768. GeoTrust Universal CA
  51769. =====================
  51770. -----BEGIN CERTIFICATE-----
  51771. MIIFaDCCA1CgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  51772. R2VvVHJ1c3QgSW5jLjEeMBwGA1UEAxMVR2VvVHJ1c3QgVW5pdmVyc2FsIENBMB4XDTA0MDMwNDA1
  51773. MDAwMFoXDTI5MDMwNDA1MDAwMFowRTELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IElu
  51774. Yy4xHjAcBgNVBAMTFUdlb1RydXN0IFVuaXZlcnNhbCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIP
  51775. ADCCAgoCggIBAKYVVaCjxuAfjJ0hUNfBvitbtaSeodlyWL0AG0y/YckUHUWCq8YdgNY96xCcOq9t
  51776. JPi8cQGeBvV8Xx7BDlXKg5pZMK4ZyzBIle0iN430SppyZj6tlcDgFgDgEB8rMQ7XlFTTQjOgNB0e
  51777. RXbdT8oYN+yFFXoZCPzVx5zw8qkuEKmS5j1YPakWaDwvdSEYfyh3peFhF7em6fgemdtzbvQKoiFs
  51778. 7tqqhZJmr/Z6a4LauiIINQ/PQvE1+mrufislzDoR5G2vc7J2Ha3QsnhnGqQ5HFELZ1aD/ThdDc7d
  51779. 8Lsrlh/eezJS/R27tQahsiFepdaVaH/wmZ7cRQg+59IJDTWU3YBOU5fXtQlEIGQWFwMCTFMNaN7V
  51780. qnJNk22CDtucvc+081xdVHppCZbW2xHBjXWotM85yM48vCR85mLK4b19p71XZQvk/iXttmkQ3Cga
  51781. Rr0BHdCXteGYO8A3ZNY9lO4L4fUorgtWv3GLIylBjobFS1J72HGrH4oVpjuDWtdYAVHGTEHZf9hB
  51782. Z3KiKN9gg6meyHv8U3NyWfWTehd2Ds735VzZC1U0oqpbtWpU5xPKV+yXbfReBi9Fi1jUIxaS5BZu
  51783. KGNZMN9QAZxjiRqf2xeUgnA3wySemkfWWspOqGmJch+RbNt+nhutxx9z3SxPGWX9f5NAEC7S8O08
  51784. ni4oPmkmM8V7AgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNq7LqqwDLiIJlF0
  51785. XG0D08DYj3rWMB8GA1UdIwQYMBaAFNq7LqqwDLiIJlF0XG0D08DYj3rWMA4GA1UdDwEB/wQEAwIB
  51786. hjANBgkqhkiG9w0BAQUFAAOCAgEAMXjmx7XfuJRAyXHEqDXsRh3ChfMoWIawC/yOsjmPRFWrZIRc
  51787. aanQmjg8+uUfNeVE44B5lGiku8SfPeE0zTBGi1QrlaXv9z+ZhP015s8xxtxqv6fXIwjhmF7DWgh2
  51788. qaavdy+3YL1ERmrvl/9zlcGO6JP7/TG37FcREUWbMPEaiDnBTzynANXH/KttgCJwpQzgXQQpAvvL
  51789. oJHRfNbDflDVnVi+QTjruXU8FdmbyUqDWcDaU/0zuzYYm4UPFd3uLax2k7nZAY1IEKj79TiG8dsK
  51790. xr2EoyNB3tZ3b4XUhRxQ4K5RirqNPnbiucon8l+f725ZDQbYKxek0nxru18UGkiPGkzns0ccjkxF
  51791. KyDuSN/n3QmOGKjaQI2SJhFTYXNd673nxE0pN2HrrDktZy4W1vUAg4WhzH92xH3kt0tm7wNFYGm2
  51792. DFKWkoRepqO1pD4r2czYG0eq8kTaT/kD6PAUyz/zg97QwVTjt+gKN02LIFkDMBmhLMi9ER/frslK
  51793. xfMnZmaGrGiR/9nmUxwPi1xpZQomyB40w11Re9epnAahNt3ViZS82eQtDF4JbAiXfKM9fJP/P6EU
  51794. p8+1Xevb2xzEdt+Iub1FBZUbrvxGakyvSOPOrg/SfuvmbJxPgWp6ZKy7PtXny3YuxadIwVyQD8vI
  51795. P/rmMuGNG2+k5o7Y+SlIis5z/iw=
  51796. -----END CERTIFICATE-----
  51797. GeoTrust Universal CA 2
  51798. =======================
  51799. -----BEGIN CERTIFICATE-----
  51800. MIIFbDCCA1SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  51801. R2VvVHJ1c3QgSW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwHhcNMDQwMzA0
  51802. MDUwMDAwWhcNMjkwMzA0MDUwMDAwWjBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3Qg
  51803. SW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwggIiMA0GCSqGSIb3DQEBAQUA
  51804. A4ICDwAwggIKAoICAQCzVFLByT7y2dyxUxpZKeexw0Uo5dfR7cXFS6GqdHtXr0om/Nj1XqduGdt0
  51805. DE81WzILAePb63p3NeqqWuDW6KFXlPCQo3RWlEQwAx5cTiuFJnSCegx2oG9NzkEtoBUGFF+3Qs17
  51806. j1hhNNwqCPkuwwGmIkQcTAeC5lvO0Ep8BNMZcyfwqph/Lq9O64ceJHdqXbboW0W63MOhBW9Wjo8Q
  51807. JqVJwy7XQYci4E+GymC16qFjwAGXEHm9ADwSbSsVsaxLse4YuU6W3Nx2/zu+z18DwPw76L5GG//a
  51808. QMJS9/7jOvdqdzXQ2o3rXhhqMcceujwbKNZrVMaqW9eiLBsZzKIC9ptZvTdrhrVtgrrY6slWvKk2
  51809. WP0+GfPtDCapkzj4T8FdIgbQl+rhrcZV4IErKIM6+vR7IVEAvlI4zs1meaj0gVbi0IMJR1FbUGrP
  51810. 20gaXT73y/Zl92zxlfgCOzJWgjl6W70viRu/obTo/3+NjN8D8WBOWBFM66M/ECuDmgFz2ZRthAAn
  51811. ZqzwcEAJQpKtT5MNYQlRJNiS1QuUYbKHsu3/mjX/hVTK7URDrBs8FmtISgocQIgfksILAAX/8sgC
  51812. SqSqqcyZlpwvWOB94b67B9xfBHJcMTTD7F8t4D1kkCLm0ey4Lt1ZrtmhN79UNdxzMk+MBB4zsslG
  51813. 8dhcyFVQyWi9qLo2CQIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR281Xh+qQ2
  51814. +/CfXGJx7Tz0RzgQKzAfBgNVHSMEGDAWgBR281Xh+qQ2+/CfXGJx7Tz0RzgQKzAOBgNVHQ8BAf8E
  51815. BAMCAYYwDQYJKoZIhvcNAQEFBQADggIBAGbBxiPz2eAubl/oz66wsCVNK/g7WJtAJDday6sWSf+z
  51816. dXkzoS9tcBc0kf5nfo/sm+VegqlVHy/c1FEHEv6sFj4sNcZj/NwQ6w2jqtB8zNHQL1EuxBRa3ugZ
  51817. 4T7GzKQp5y6EqgYweHZUcyiYWTjgAA1i00J9IZ+uPTqM1fp3DRgrFg5fNuH8KrUwJM/gYwx7WBr+
  51818. mbpCErGR9Hxo4sjoryzqyX6uuyo9DRXcNJW2GHSoag/HtPQTxORb7QrSpJdMKu0vbBKJPfEncKpq
  51819. A1Ihn0CoZ1Dy81of398j9tx4TuaYT1U6U+Pv8vSfx3zYWK8pIpe44L2RLrB27FcRz+8pRPPphXpg
  51820. Y+RdM4kX2TGq2tbzGDVyz4crL2MjhF2EjD9XoIj8mZEoJmmZ1I+XRL6O1UixpCgp8RW04eWe3fiP
  51821. pm8m1wk8OhwRDqZsN/etRIcsKMfYdIKz0G9KV7s1KSegi+ghp4dkNl3M2Basx7InQJJVOCiNUW7d
  51822. FGdTbHFcJoRNdVq2fmBWqU2t+5sel/MN2dKXVHfaPRK34B7vCAas+YWH6aLcr34YEoP9VhdBLtUp
  51823. gn2Z9DH2canPLAEnpQW5qrJITirvn5NSUZU8UnOOVkwXQMAJKOSLakhT2+zNVVXxxvjpoixMptEm
  51824. X36vWkzaH6byHCx+rgIW0lbQL1dTR+iS
  51825. -----END CERTIFICATE-----
  51826. Visa eCommerce Root
  51827. ===================
  51828. -----BEGIN CERTIFICATE-----
  51829. MIIDojCCAoqgAwIBAgIQE4Y1TR0/BvLB+WUF1ZAcYjANBgkqhkiG9w0BAQUFADBrMQswCQYDVQQG
  51830. EwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMmVmlzYSBJbnRlcm5hdGlvbmFsIFNlcnZpY2Ug
  51831. QXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNvbW1lcmNlIFJvb3QwHhcNMDIwNjI2MDIxODM2
  51832. WhcNMjIwNjI0MDAxNjEyWjBrMQswCQYDVQQGEwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMm
  51833. VmlzYSBJbnRlcm5hdGlvbmFsIFNlcnZpY2UgQXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNv
  51834. bW1lcmNlIFJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvV95WHm6h2mCxlCfL
  51835. F9sHP4CFT8icttD0b0/Pmdjh28JIXDqsOTPHH2qLJj0rNfVIsZHBAk4ElpF7sDPwsRROEW+1QK8b
  51836. RaVK7362rPKgH1g/EkZgPI2h4H3PVz4zHvtH8aoVlwdVZqW1LS7YgFmypw23RuwhY/81q6UCzyr0
  51837. TP579ZRdhE2o8mCP2w4lPJ9zcc+U30rq299yOIzzlr3xF7zSujtFWsan9sYXiwGd/BmoKoMWuDpI
  51838. /k4+oKsGGelT84ATB+0tvz8KPFUgOSwsAGl0lUq8ILKpeeUYiZGo3BxN77t+Nwtd/jmliFKMAGzs
  51839. GHxBvfaLdXe6YJ2E5/4tAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEG
  51840. MB0GA1UdDgQWBBQVOIMPPyw/cDMezUb+B4wg4NfDtzANBgkqhkiG9w0BAQUFAAOCAQEAX/FBfXxc
  51841. CLkr4NWSR/pnXKUTwwMhmytMiUbPWU3J/qVAtmPN3XEolWcRzCSs00Rsca4BIGsDoo8Ytyk6feUW
  51842. YFN4PMCvFYP3j1IzJL1kk5fui/fbGKhtcbP3LBfQdCVp9/5rPJS+TUtBjE7ic9DjkCJzQ83z7+pz
  51843. zkWKsKZJ/0x9nXGIxHYdkFsd7v3M9+79YKWxehZx0RbQfBI8bGmX265fOZpwLwU8GUYEmSA20GBu
  51844. YQa7FkKMcPcw++DbZqMAAb3mLNqRX6BGi01qnD093QVG/na/oAo85ADmJ7f/hC3euiInlhBx6yLt
  51845. 398znM/jra6O1I7mT1GvFpLgXPYHDw==
  51846. -----END CERTIFICATE-----
  51847. Comodo AAA Services root
  51848. ========================
  51849. -----BEGIN CERTIFICATE-----
  51850. MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
  51851. R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
  51852. TGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAw
  51853. MFoXDTI4MTIzMTIzNTk1OVowezELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hl
  51854. c3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNV
  51855. BAMMGEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  51856. ggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQuaBtDFcCLNSS1UY8y2bmhG
  51857. C1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe3M/vg4aijJRPn2jymJBGhCfHdr/jzDUs
  51858. i14HZGWCwEiwqJH5YZ92IFCokcdmtet4YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszW
  51859. Y19zjNoFmag4qMsXeDZRrOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjH
  51860. Ypy+g8cmez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQUoBEK
  51861. Iz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wewYDVR0f
  51862. BHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20vQUFBQ2VydGlmaWNhdGVTZXJ2aWNl
  51863. cy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29tb2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2Vz
  51864. LmNybDANBgkqhkiG9w0BAQUFAAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm
  51865. 7l3sAg9g1o1QGE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz
  51866. Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2G9w84FoVxp7Z
  51867. 8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsil2D4kF501KKaU73yqWjgom7C
  51868. 12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg==
  51869. -----END CERTIFICATE-----
  51870. QuoVadis Root CA
  51871. ================
  51872. -----BEGIN CERTIFICATE-----
  51873. MIIF0DCCBLigAwIBAgIEOrZQizANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJCTTEZMBcGA1UE
  51874. ChMQUXVvVmFkaXMgTGltaXRlZDElMCMGA1UECxMcUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0
  51875. eTEuMCwGA1UEAxMlUXVvVmFkaXMgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMTAz
  51876. MTkxODMzMzNaFw0yMTAzMTcxODMzMzNaMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRp
  51877. cyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYDVQQD
  51878. EyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEF
  51879. AAOCAQ8AMIIBCgKCAQEAv2G1lVO6V/z68mcLOhrfEYBklbTRvM16z/Ypli4kVEAkOPcahdxYTMuk
  51880. J0KX0J+DisPkBgNbAKVRHnAEdOLB1Dqr1607BxgFjv2DrOpm2RgbaIr1VxqYuvXtdj182d6UajtL
  51881. F8HVj71lODqV0D1VNk7feVcxKh7YWWVJWCCYfqtffp/p1k3sg3Spx2zY7ilKhSoGFPlU5tPaZQeL
  51882. YzcS19Dsw3sgQUSj7cugF+FxZc4dZjH3dgEZyH0DWLaVSR2mEiboxgx24ONmy+pdpibu5cxfvWen
  51883. AScOospUxbF6lR1xHkopigPcakXBpBlebzbNw6Kwt/5cOOJSvPhEQ+aQuwIDAQABo4ICUjCCAk4w
  51884. PQYIKwYBBQUHAQEEMTAvMC0GCCsGAQUFBzABhiFodHRwczovL29jc3AucXVvdmFkaXNvZmZzaG9y
  51885. ZS5jb20wDwYDVR0TAQH/BAUwAwEB/zCCARoGA1UdIASCAREwggENMIIBCQYJKwYBBAG+WAABMIH7
  51886. MIHUBggrBgEFBQcCAjCBxxqBxFJlbGlhbmNlIG9uIHRoZSBRdW9WYWRpcyBSb290IENlcnRpZmlj
  51887. YXRlIGJ5IGFueSBwYXJ0eSBhc3N1bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJs
  51888. ZSBzdGFuZGFyZCB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGNlcnRpZmljYXRpb24gcHJh
  51889. Y3RpY2VzLCBhbmQgdGhlIFF1b1ZhZGlzIENlcnRpZmljYXRlIFBvbGljeS4wIgYIKwYBBQUHAgEW
  51890. Fmh0dHA6Ly93d3cucXVvdmFkaXMuYm0wHQYDVR0OBBYEFItLbe3TKbkGGew5Oanwl4Rqy+/fMIGu
  51891. BgNVHSMEgaYwgaOAFItLbe3TKbkGGew5Oanwl4Rqy+/foYGEpIGBMH8xCzAJBgNVBAYTAkJNMRkw
  51892. FwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0
  51893. aG9yaXR5MS4wLAYDVQQDEyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggQ6
  51894. tlCLMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAitQUtf70mpKnGdSkfnIYj9lo
  51895. fFIk3WdvOXrEql494liwTXCYhGHoG+NpGA7O+0dQoE7/8CQfvbLO9Sf87C9TqnN7Az10buYWnuul
  51896. LsS/VidQK2K6vkscPFVcQR0kvoIgR13VRH56FmjffU1RcHhXHTMe/QKZnAzNCgVPx7uOpHX6Sm2x
  51897. gI4JVrmcGmD+XcHXetwReNDWXcG31a0ymQM6isxUJTkxgXsTIlG6Rmyhu576BGxJJnSP0nPrzDCi
  51898. 5upZIof4l/UO/erMkqQWxFIY6iHOsfHmhIHluqmGKPJDWl0Snawe2ajlCmqnf6CHKc/yiU3U7MXi
  51899. 5nrQNiOKSnQ2+Q==
  51900. -----END CERTIFICATE-----
  51901. QuoVadis Root CA 2
  51902. ==================
  51903. -----BEGIN CERTIFICATE-----
  51904. MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  51905. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMjAeFw0wNjExMjQx
  51906. ODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  51907. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  51908. DwAwggIKAoICAQCaGMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6
  51909. XJxgFyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55JWpzmM+Yk
  51910. lvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bBrrcCaoF6qUWD4gXmuVbB
  51911. lDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp+ARz8un+XJiM9XOva7R+zdRcAitMOeGy
  51912. lZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt
  51913. 66/3FsvbzSUr5R/7mp/iUcw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1Jdxn
  51914. wQ5hYIizPtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og/zOh
  51915. D7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UHoycR7hYQe7xFSkyy
  51916. BNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuIyV77zGHcizN300QyNQliBJIWENie
  51917. J0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1Ud
  51918. DgQWBBQahGK8SEwzJQTU7tD2A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGU
  51919. a6FJpEcwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT
  51920. ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2fBluornFdLwUv
  51921. Z+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzng/iN/Ae42l9NLmeyhP3ZRPx3
  51922. UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2BlfF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodm
  51923. VjB3pjd4M1IQWK4/YY7yarHvGH5KWWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK
  51924. +JDSV6IZUaUtl0HaB0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrW
  51925. IozchLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPRTUIZ3Ph1
  51926. WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWDmbA4CD/pXvk1B+TJYm5X
  51927. f6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0ZohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II
  51928. 4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8
  51929. VCLAAVBpQ570su9t+Oza8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u
  51930. -----END CERTIFICATE-----
  51931. QuoVadis Root CA 3
  51932. ==================
  51933. -----BEGIN CERTIFICATE-----
  51934. MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  51935. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMzAeFw0wNjExMjQx
  51936. OTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  51937. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  51938. DwAwggIKAoICAQDMV0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNgg
  51939. DhoB4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUrH556VOij
  51940. KTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd8lyyBTNvijbO0BNO/79K
  51941. DDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9CabwvvWhDFlaJKjdhkf2mrk7AyxRllDdLkgbv
  51942. BNDInIjbC3uBr7E9KsRlOni27tyAsdLTmZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwp
  51943. p5ijJUMv7/FfJuGITfhebtfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8
  51944. nT8KKdjcT5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDtWAEX
  51945. MJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZc6tsgLjoC2SToJyM
  51946. Gf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A4iLItLRkT9a6fUg+qGkM17uGcclz
  51947. uD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYDVR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHT
  51948. BgkrBgEEAb5YAAMwgcUwgZMGCCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmlj
  51949. YXRlIGNvbnN0aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0
  51950. aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVudC4wLQYIKwYB
  51951. BQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2NwczALBgNVHQ8EBAMCAQYwHQYD
  51952. VR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4GA1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4
  51953. ywLQoUmkRzBFMQswCQYDVQQGEwJCTTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UE
  51954. AxMSUXVvVmFkaXMgUm9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZV
  51955. qyM07ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSemd1o417+s
  51956. hvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd+LJ2w/w4E6oM3kJpK27z
  51957. POuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2
  51958. Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadNt54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp
  51959. 8kokUvd0/bpO5qgdAm6xDYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBC
  51960. bjPsMZ57k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6szHXu
  51961. g/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0jWy10QJLZYxkNc91p
  51962. vGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeTmJlglFwjz1onl14LBQaTNx47aTbr
  51963. qZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK4SVhM7JZG+Ju1zdXtg2pEto=
  51964. -----END CERTIFICATE-----
  51965. Security Communication Root CA
  51966. ==============================
  51967. -----BEGIN CERTIFICATE-----
  51968. MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  51969. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  51970. HhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  51971. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  51972. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw
  51973. 8yl89f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJDKaVv0uM
  51974. DPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9Ms+k2Y7CI9eNqPPYJayX
  51975. 5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/NQV3Is00qVUarH9oe4kA92819uZKAnDfd
  51976. DJZkndwi92SL32HeFZRSFaB9UslLqCHJxrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2
  51977. JChzAgMBAAGjPzA9MB0GA1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYw
  51978. DwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vGkl3g
  51979. 0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfrUj94nK9NrvjVT8+a
  51980. mCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5Bw+SUEmK3TGXX8npN6o7WWWXlDLJ
  51981. s58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJUJRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ
  51982. 6rBK+1YWc26sTfcioU+tHXotRSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAi
  51983. FL39vmwLAw==
  51984. -----END CERTIFICATE-----
  51985. Sonera Class 2 Root CA
  51986. ======================
  51987. -----BEGIN CERTIFICATE-----
  51988. MIIDIDCCAgigAwIBAgIBHTANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJGSTEPMA0GA1UEChMG
  51989. U29uZXJhMRkwFwYDVQQDExBTb25lcmEgQ2xhc3MyIENBMB4XDTAxMDQwNjA3Mjk0MFoXDTIxMDQw
  51990. NjA3Mjk0MFowOTELMAkGA1UEBhMCRkkxDzANBgNVBAoTBlNvbmVyYTEZMBcGA1UEAxMQU29uZXJh
  51991. IENsYXNzMiBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJAXSjWdyvANlsdE+hY3
  51992. /Ei9vX+ALTU74W+oZ6m/AxxNjG8yR9VBaKQTBME1DJqEQ/xcHf+Js+gXGM2RX/uJ4+q/Tl18GybT
  51993. dXnt5oTjV+WtKcT0OijnpXuENmmz/V52vaMtmdOQTiMofRhj8VQ7Jp12W5dCsv+u8E7s3TmVToMG
  51994. f+dJQMjFAbJUWmYdPfz56TwKnoG4cPABi+QjVHzIrviQHgCWctRUz2EjvOr7nQKV0ba5cTppCD8P
  51995. tOFCx4j1P5iop7oc4HFx71hXgVB6XGt0Rg6DA5jDjqhu8nYybieDwnPz3BjotJPqdURrBGAgcVeH
  51996. nfO+oJAjPYok4doh28MCAwEAAaMzMDEwDwYDVR0TAQH/BAUwAwEB/zARBgNVHQ4ECgQISqCqWITT
  51997. XjwwCwYDVR0PBAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQBazof5FnIVV0sd2ZvnoiYw7JNn39Yt
  51998. 0jSv9zilzqsWuasvfDXLrNAPtEwr/IDva4yRXzZ299uzGxnq9LIR/WFxRL8oszodv7ND6J+/3DEI
  51999. cbCdjdY0RzKQxmUk96BKfARzjzlvF4xytb1LyHr4e4PDKE6cCepnP7JnBBvDFNr450kkkdAdavph
  52000. Oe9r5yF1BgfYErQhIHBCcYHaPJo2vqZbDWpsmh+Re/n570K6Tk6ezAyNlNzZRZxe7EJQY670XcSx
  52001. EtzKO6gunRRaBXW37Ndj4ro1tgQIkejanZz2ZrUYrAqmVCY0M9IbwdR/GjqOC6oybtv8TyWf2TLH
  52002. llpwrN9M
  52003. -----END CERTIFICATE-----
  52004. XRamp Global CA Root
  52005. ====================
  52006. -----BEGIN CERTIFICATE-----
  52007. MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCBgjELMAkGA1UE
  52008. BhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2Vj
  52009. dXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB
  52010. dXRob3JpdHkwHhcNMDQxMTAxMTcxNDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMx
  52011. HjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkg
  52012. U2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3Jp
  52013. dHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS638eMpSe2OAtp87ZOqCwu
  52014. IR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCPKZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMx
  52015. foArtYzAQDsRhtDLooY2YKTVMIJt2W7QDxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FE
  52016. zG+gSqmUsE3a56k0enI4qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqs
  52017. AxcZZPRaJSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNViPvry
  52018. xS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  52019. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASsjVy16bYbMDYGA1UdHwQvMC0wK6Ap
  52020. oCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMC
  52021. AQEwDQYJKoZIhvcNAQEFBQADggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc
  52022. /Kh4ZzXxHfARvbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt
  52023. qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLaIR9NmXmd4c8n
  52024. nxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSyi6mx5O+aGtA9aZnuqCij4Tyz
  52025. 8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQO+7ETPTsJ3xCwnR8gooJybQDJbw=
  52026. -----END CERTIFICATE-----
  52027. Go Daddy Class 2 CA
  52028. ===================
  52029. -----BEGIN CERTIFICATE-----
  52030. MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMY
  52031. VGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRp
  52032. ZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkG
  52033. A1UEBhMCVVMxITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g
  52034. RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQAD
  52035. ggENADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCAPVYYYwhv
  52036. 2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6wwdhFJ2+qN1j3hybX2C32
  52037. qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXiEqITLdiOr18SPaAIBQi2XKVlOARFmR6j
  52038. YGB0xUGlcmIbYsUfb18aQr4CUWWoriMYavx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmY
  52039. vLEHZ6IVDd2gWMZEewo+YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0O
  52040. BBYEFNLEsNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h/t2o
  52041. atTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMu
  52042. MTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwG
  52043. A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wim
  52044. PQoZ+YeAEW5p5JYXMP80kWNyOO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKt
  52045. I3lpjbi2Tc7PTMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ
  52046. HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mERdEr/VxqHD3VI
  52047. Ls9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5CufReYNnyicsbkqWletNw+vHX/b
  52048. vZ8=
  52049. -----END CERTIFICATE-----
  52050. Starfield Class 2 CA
  52051. ====================
  52052. -----BEGIN CERTIFICATE-----
  52053. MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzElMCMGA1UEChMc
  52054. U3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZpZWxkIENsYXNzIDIg
  52055. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQwNjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBo
  52056. MQswCQYDVQQGEwJVUzElMCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAG
  52057. A1UECxMpU3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqG
  52058. SIb3DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf8MOh2tTY
  52059. bitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN+lq2cwQlZut3f+dZxkqZ
  52060. JRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVm
  52061. epsZGD3/cVE8MC5fvj13c7JdBmzDI1aaK4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSN
  52062. F4Azbl5KXZnJHoe0nRrA1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HF
  52063. MIHCMB0GA1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fRzt0f
  52064. hvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNo
  52065. bm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBDbGFzcyAyIENlcnRpZmljYXRpb24g
  52066. QXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGs
  52067. afPzWdqbAYcaT1epoXkJKtv3L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLM
  52068. PUxA2IGvd56Deruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl
  52069. xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynpVSJYACPq4xJD
  52070. KVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEYWQPJIrSPnNVeKtelttQKbfi3
  52071. QBFGmh95DmK/D5fs4C8fF5Q=
  52072. -----END CERTIFICATE-----
  52073. Taiwan GRCA
  52074. ===========
  52075. -----BEGIN CERTIFICATE-----
  52076. MIIFcjCCA1qgAwIBAgIQH51ZWtcvwgZEpYAIaeNe9jANBgkqhkiG9w0BAQUFADA/MQswCQYDVQQG
  52077. EwJUVzEwMC4GA1UECgwnR292ZXJubWVudCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4X
  52078. DTAyMTIwNTEzMjMzM1oXDTMyMTIwNTEzMjMzM1owPzELMAkGA1UEBhMCVFcxMDAuBgNVBAoMJ0dv
  52079. dmVybm1lbnQgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQAD
  52080. ggIPADCCAgoCggIBAJoluOzMonWoe/fOW1mKydGGEghU7Jzy50b2iPN86aXfTEc2pBsBHH8eV4qN
  52081. w8XRIePaJD9IK/ufLqGU5ywck9G/GwGHU5nOp/UKIXZ3/6m3xnOUT0b3EEk3+qhZSV1qgQdW8or5
  52082. BtD3cCJNtLdBuTK4sfCxw5w/cP1T3YGq2GN49thTbqGsaoQkclSGxtKyyhwOeYHWtXBiCAEuTk8O
  52083. 1RGvqa/lmr/czIdtJuTJV6L7lvnM4T9TjGxMfptTCAtsF/tnyMKtsc2AtJfcdgEWFelq16TheEfO
  52084. htX7MfP6Mb40qij7cEwdScevLJ1tZqa2jWR+tSBqnTuBto9AAGdLiYa4zGX+FVPpBMHWXx1E1wov
  52085. J5pGfaENda1UhhXcSTvxls4Pm6Dso3pdvtUqdULle96ltqqvKKyskKw4t9VoNSZ63Pc78/1Fm9G7
  52086. Q3hub/FCVGqY8A2tl+lSXunVanLeavcbYBT0peS2cWeqH+riTcFCQP5nRhc4L0c/cZyu5SHKYS1t
  52087. B6iEfC3uUSXxY5Ce/eFXiGvviiNtsea9P63RPZYLhY3Naye7twWb7LuRqQoHEgKXTiCQ8P8NHuJB
  52088. O9NAOueNXdpm5AKwB1KYXA6OM5zCppX7VRluTI6uSw+9wThNXo+EHWbNxWCWtFJaBYmOlXqYwZE8
  52089. lSOyDvR5tMl8wUohAgMBAAGjajBoMB0GA1UdDgQWBBTMzO/MKWCkO7GStjz6MmKPrCUVOzAMBgNV
  52090. HRMEBTADAQH/MDkGBGcqBwAEMTAvMC0CAQAwCQYFKw4DAhoFADAHBgVnKgMAAAQUA5vwIhP/lSg2
  52091. 09yewDL7MTqKUWUwDQYJKoZIhvcNAQEFBQADggIBAECASvomyc5eMN1PhnR2WPWus4MzeKR6dBcZ
  52092. TulStbngCnRiqmjKeKBMmo4sIy7VahIkv9Ro04rQ2JyftB8M3jh+Vzj8jeJPXgyfqzvS/3WXy6Tj
  52093. Zwj/5cAWtUgBfen5Cv8b5Wppv3ghqMKnI6mGq3ZW6A4M9hPdKmaKZEk9GhiHkASfQlK3T8v+R0F2
  52094. Ne//AHY2RTKbxkaFXeIksB7jSJaYV0eUVXoPQbFEJPPB/hprv4j9wabak2BegUqZIJxIZhm1AHlU
  52095. D7gsL0u8qV1bYH+Mh6XgUmMqvtg7hUAV/h62ZT/FS9p+tXo1KaMuephgIqP0fSdOLeq0dDzpD6Qz
  52096. DxARvBMB1uUO07+1EqLhRSPAzAhuYbeJq4PjJB7mXQfnHyA+z2fI56wwbSdLaG5LKlwCCDTb+Hbk
  52097. Z6MmnD+iMsJKxYEYMRBWqoTvLQr/uB930r+lWKBi5NdLkXWNiYCYfm3LU05er/ayl4WXudpVBrkk
  52098. 7tfGOB5jGxI7leFYrPLfhNVfmS8NVVvmONsuP3LpSIXLuykTjx44VbnzssQwmSNOXfJIoRIM3BKQ
  52099. CZBUkQM8R+XVyWXgt0t97EfTsws+rZ7QdAAO671RrcDeLMDDav7v3Aun+kbfYNucpllQdSNpc5Oy
  52100. +fwC00fmcc4QAu4njIT/rEUNE1yDMuAlpYYsfPQS
  52101. -----END CERTIFICATE-----
  52102. DigiCert Assured ID Root CA
  52103. ===========================
  52104. -----BEGIN CERTIFICATE-----
  52105. MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQG
  52106. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  52107. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzEx
  52108. MTEwMDAwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  52109. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0Ew
  52110. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7cJpSIqvTO
  52111. 9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYPmDI2dsze3Tyoou9q+yHy
  52112. UmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW
  52113. /lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpy
  52114. oeb6pNnVFzF1roV9Iq4/AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whf
  52115. GHdPAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRF
  52116. 66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYunpyGd823IDzANBgkq
  52117. hkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRCdWKuh+vy1dneVrOfzM4UKLkNl2Bc
  52118. EkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTffwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38Fn
  52119. SbNd67IJKusm7Xi+fT8r87cmNW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i
  52120. 8b5QZ7dsvfPxH2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe
  52121. +o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g==
  52122. -----END CERTIFICATE-----
  52123. DigiCert Global Root CA
  52124. =======================
  52125. -----BEGIN CERTIFICATE-----
  52126. MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBhMQswCQYDVQQG
  52127. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  52128. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBDQTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAw
  52129. MDAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  52130. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkq
  52131. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsBCSDMAZOn
  52132. TjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97nh6Vfe63SKMI2tavegw5
  52133. BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt43C/dxC//AH2hdmoRBBYMql1GNXRor5H
  52134. 4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7PT19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y
  52135. 7vrTC0LUq7dBMtoM1O/4gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQAB
  52136. o2MwYTAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbRTLtm
  52137. 8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUwDQYJKoZIhvcNAQEF
  52138. BQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/EsrhMAtudXH/vTBH1jLuG2cenTnmCmr
  52139. EbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIt
  52140. tep3Sp+dWOIrWcBAI+0tKIJFPnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886
  52141. UAb3LujEV0lsYSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
  52142. CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
  52143. -----END CERTIFICATE-----
  52144. DigiCert High Assurance EV Root CA
  52145. ==================================
  52146. -----BEGIN CERTIFICATE-----
  52147. MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBsMQswCQYDVQQG
  52148. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSsw
  52149. KQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5jZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAw
  52150. MFoXDTMxMTExMDAwMDAwMFowbDELMAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZ
  52151. MBcGA1UECxMQd3d3LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFu
  52152. Y2UgRVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm+9S75S0t
  52153. Mqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTWPNt0OKRKzE0lgvdKpVMS
  52154. OO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEMxChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3
  52155. MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFBIk5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQ
  52156. NAQTXKFx01p8VdteZOE3hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUe
  52157. h10aUAsgEsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMB
  52158. Af8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaAFLE+w2kD+L9HAdSY
  52159. JhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3NecnzyIZgYIVyHbIUf4KmeqvxgydkAQ
  52160. V8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6zeM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFp
  52161. myPInngiK3BD41VHMWEZ71jFhS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkK
  52162. mNEVX58Svnw2Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
  52163. vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep+OkuE6N36B9K
  52164. -----END CERTIFICATE-----
  52165. Certplus Class 2 Primary CA
  52166. ===========================
  52167. -----BEGIN CERTIFICATE-----
  52168. MIIDkjCCAnqgAwIBAgIRAIW9S/PY2uNp9pTXX8OlRCMwDQYJKoZIhvcNAQEFBQAwPTELMAkGA1UE
  52169. BhMCRlIxETAPBgNVBAoTCENlcnRwbHVzMRswGQYDVQQDExJDbGFzcyAyIFByaW1hcnkgQ0EwHhcN
  52170. OTkwNzA3MTcwNTAwWhcNMTkwNzA2MjM1OTU5WjA9MQswCQYDVQQGEwJGUjERMA8GA1UEChMIQ2Vy
  52171. dHBsdXMxGzAZBgNVBAMTEkNsYXNzIDIgUHJpbWFyeSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEP
  52172. ADCCAQoCggEBANxQltAS+DXSCHh6tlJw/W/uz7kRy1134ezpfgSN1sxvc0NXYKwzCkTsA18cgCSR
  52173. 5aiRVhKC9+Ar9NuuYS6JEI1rbLqzAr3VNsVINyPi8Fo3UjMXEuLRYE2+L0ER4/YXJQyLkcAbmXuZ
  52174. Vg2v7tK8R1fjeUl7NIknJITesezpWE7+Tt9avkGtrAjFGA7v0lPubNCdEgETjdyAYveVqUSISnFO
  52175. YFWe2yMZeVYHDD9jC1yw4r5+FfyUM1hBOHTE4Y+L3yasH7WLO7dDWWuwJKZtkIvEcupdM5i3y95e
  52176. e++U8Rs+yskhwcWYAqqi9lt3m/V+llU0HGdpwPFC40es/CgcZlUCAwEAAaOBjDCBiTAPBgNVHRME
  52177. CDAGAQH/AgEKMAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQU43Mt38sOKAze3bOkynm4jrvoMIkwEQYJ
  52178. YIZIAYb4QgEBBAQDAgEGMDcGA1UdHwQwMC4wLKAqoCiGJmh0dHA6Ly93d3cuY2VydHBsdXMuY29t
  52179. L0NSTC9jbGFzczIuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQCnVM+IRBnL39R/AN9WM2K191EBkOvD
  52180. P9GIROkkXe/nFL0gt5o8AP5tn9uQ3Nf0YtaLcF3n5QRIqWh8yfFC82x/xXp8HVGIutIKPidd3i1R
  52181. TtMTZGnkLuPT55sJmabglZvOGtd/vjzOUrMRFcEPF80Du5wlFbqidon8BvEY0JNLDnyCt6X09l/+
  52182. 7UCmnYR0ObncHoUW2ikbhiMAybuJfm6AiB4vFLQDJKgybwOaRywwvlbGp0ICcBvqQNi6BQNwB6SW
  52183. //1IMwrh3KWBkJtN3X3n57LNXMhqlfil9o3EXXgIvnsG1knPGTZQIy4I5p4FTUcY1Rbpsda2ENW7
  52184. l7+ijrRU
  52185. -----END CERTIFICATE-----
  52186. DST Root CA X3
  52187. ==============
  52188. -----BEGIN CERTIFICATE-----
  52189. MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/MSQwIgYDVQQK
  52190. ExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMTDkRTVCBSb290IENBIFgzMB4X
  52191. DTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVowPzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1
  52192. cmUgVHJ1c3QgQ28uMRcwFQYDVQQDEw5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQAD
  52193. ggEPADCCAQoCggEBAN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmT
  52194. rE4Orz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEqOLl5CjH9
  52195. UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9bxiqKqy69cK3FCxolkHRy
  52196. xXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40d
  52197. utolucbY38EVAjqr2m7xPi71XAicPNaDaeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0T
  52198. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQ
  52199. MA0GCSqGSIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69ikug
  52200. dB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXrAvHRAosZy5Q6XkjE
  52201. GB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZzR8srzJmwN0jP41ZL9c8PDHIyh8bw
  52202. RLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubS
  52203. fZGL+T0yjWW06XyxV3bqxbYoOb8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ
  52204. -----END CERTIFICATE-----
  52205. SwissSign Gold CA - G2
  52206. ======================
  52207. -----BEGIN CERTIFICATE-----
  52208. MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNVBAYTAkNIMRUw
  52209. EwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2lnbiBHb2xkIENBIC0gRzIwHhcN
  52210. MDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBFMQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dp
  52211. c3NTaWduIEFHMR8wHQYDVQQDExZTd2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0B
  52212. AQEFAAOCAg8AMIICCgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUq
  52213. t2/876LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+bbqBHH5C
  52214. jCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c6bM8K8vzARO/Ws/BtQpg
  52215. vd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqEemA8atufK+ze3gE/bk3lUIbLtK/tREDF
  52216. ylqM2tIrfKjuvqblCqoOpd8FUrdVxyJdMmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvR
  52217. AiTysybUa9oEVeXBCsdtMDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuend
  52218. jIj3o02yMszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69yFGkO
  52219. peUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPiaG59je883WX0XaxR
  52220. 7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxMgI93e2CaHt+28kgeDrpOVG2Y4OGi
  52221. GqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUw
  52222. AwEB/zAdBgNVHQ4EFgQUWyV7lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64
  52223. OfPAeGZe6Drn8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov
  52224. L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe645R88a7A3hfm
  52225. 5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczOUYrHUDFu4Up+GC9pWbY9ZIEr
  52226. 44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOf
  52227. Mke6UiI0HTJ6CVanfCU2qT1L2sCCbwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6m
  52228. Gu6uLftIdxf+u+yvGPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxp
  52229. mo/a77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCChdiDyyJk
  52230. vC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid392qgQmwLOM7XdVAyksLf
  52231. KzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEppLd6leNcG2mqeSz53OiATIgHQv2ieY2Br
  52232. NU0LbbqhPcCT4H8js1WtciVORvnSFu+wZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6Lqj
  52233. viOvrv1vA+ACOzB2+httQc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ
  52234. -----END CERTIFICATE-----
  52235. SwissSign Silver CA - G2
  52236. ========================
  52237. -----BEGIN CERTIFICATE-----
  52238. MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCQ0gxFTAT
  52239. BgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMB4X
  52240. DTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0NlowRzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3
  52241. aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG
  52242. 9w0BAQEFAAOCAg8AMIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644
  52243. N0MvFz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7brYT7QbNHm
  52244. +/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieFnbAVlDLaYQ1HTWBCrpJH
  52245. 6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH6ATK72oxh9TAtvmUcXtnZLi2kUpCe2Uu
  52246. MGoM9ZDulebyzYLs2aFK7PayS+VFheZteJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5h
  52247. qAaEuSh6XzjZG6k4sIN/c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5
  52248. FZGkECwJMoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRHHTBs
  52249. ROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTfjNFusB3hB48IHpmc
  52250. celM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb65i/4z3GcRm25xBWNOHkDRUjvxF3X
  52251. CO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/
  52252. BAUwAwEB/zAdBgNVHQ4EFgQUF6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRB
  52253. tjpbO8tFnb0cwpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0
  52254. cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBAHPGgeAn0i0P
  52255. 4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShpWJHckRE1qTodvBqlYJ7YH39F
  52256. kWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L
  52257. 3XWgwF15kIwb4FDm3jH+mHtwX6WQ2K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx
  52258. /uNncqCxv1yL5PqZIseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFa
  52259. DGi8aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2Xem1ZqSqP
  52260. e97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQRdAtq/gsD/KNVV4n+Ssuu
  52261. WxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJ
  52262. DIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ub
  52263. DgEj8Z+7fNzcbBGXJbLytGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u
  52264. -----END CERTIFICATE-----
  52265. GeoTrust Primary Certification Authority
  52266. ========================================
  52267. -----BEGIN CERTIFICATE-----
  52268. MIIDfDCCAmSgAwIBAgIQGKy1av1pthU6Y2yv2vrEoTANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQG
  52269. EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjExMC8GA1UEAxMoR2VvVHJ1c3QgUHJpbWFyeSBD
  52270. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjExMjcwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMFgx
  52271. CzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTEwLwYDVQQDEyhHZW9UcnVzdCBQ
  52272. cmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  52273. CgKCAQEAvrgVe//UfH1nrYNke8hCUy3f9oQIIGHWAVlqnEQRr+92/ZV+zmEwu3qDXwK9AWbK7hWN
  52274. b6EwnL2hhZ6UOvNWiAAxz9juapYC2e0DjPt1befquFUWBRaa9OBesYjAZIVcFU2Ix7e64HXprQU9
  52275. nceJSOC7KMgD4TCTZF5SwFlwIjVXiIrxlQqD17wxcwE07e9GceBrAqg1cmuXm2bgyxx5X9gaBGge
  52276. RwLmnWDiNpcB3841kt++Z8dtd1k7j53WkBWUvEI0EME5+bEnPn7WinXFsq+W06Lem+SYvn3h6YGt
  52277. tm/81w7a4DSwDRp35+MImO9Y+pyEtzavwt+s0vQQBnBxNQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  52278. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQULNVQQZcVi/CPNmFbSvtr2ZnJM5IwDQYJKoZI
  52279. hvcNAQEFBQADggEBAFpwfyzdtzRP9YZRqSa+S7iq8XEN3GHHoOo0Hnp3DwQ16CePbJC/kRYkRj5K
  52280. Ts4rFtULUh38H2eiAkUxT87z+gOneZ1TatnaYzr4gNfTmeGl4b7UVXGYNTq+k+qurUKykG/g/CFN
  52281. NWMziUnWm07Kx+dOCQD32sfvmWKZd7aVIl6KoKv0uHiYyjgZmclynnjNS6yvGaBzEi38wkG6gZHa
  52282. Floxt/m0cYASSJlyc1pZU8FjUjPtp8nSOQJw+uCxQmYpqptR7TBUIhRf2asdweSU8Pj1K/fqynhG
  52283. 1riR/aYNKxoUAT6A8EKglQdebc3MS6RFjasS6LPeWuWgfOgPIh1a6Vk=
  52284. -----END CERTIFICATE-----
  52285. thawte Primary Root CA
  52286. ======================
  52287. -----BEGIN CERTIFICATE-----
  52288. MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCBqTELMAkGA1UE
  52289. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  52290. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  52291. cml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMDYxMTE3
  52292. MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCBqTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwg
  52293. SW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMv
  52294. KGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMT
  52295. FnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCs
  52296. oPD7gFnUnMekz52hWXMJEEUMDSxuaPFsW0hoSVk3/AszGcJ3f8wQLZU0HObrTQmnHNK4yZc2AreJ
  52297. 1CRfBsDMRJSUjQJib+ta3RGNKJpchJAQeg29dGYvajig4tVUROsdB58Hum/u6f1OCyn1PoSgAfGc
  52298. q/gcfomk6KHYcWUNo1F77rzSImANuVud37r8UVsLr5iy6S7pBOhih94ryNdOwUxkHt3Ph1i6Sk/K
  52299. aAcdHJ1KxtUvkcx8cXIcxcBn6zL9yZJclNqFwJu/U30rCfSMnZEfl2pSy94JNqR32HuHUETVPm4p
  52300. afs5SSYeCaWAe0At6+gnhcn+Yf1+5nyXHdWdAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYD
  52301. VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR7W0XPr87Lev0xkhpqtvNG61dIUDANBgkqhkiG9w0BAQUF
  52302. AAOCAQEAeRHAS7ORtvzw6WfUDW5FvlXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeE
  52303. uzLlQRHAd9mzYJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQaEfZYGDm/Ac9IiAX
  52304. xPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqdE8hhuvU5HIe6uL17In/2/qxAeeWsEG89
  52305. jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/LHbTY5xZ3Y+m4Q6gLkH3LpVH
  52306. z7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7jVaMaA==
  52307. -----END CERTIFICATE-----
  52308. VeriSign Class 3 Public Primary Certification Authority - G5
  52309. ============================================================
  52310. -----BEGIN CERTIFICATE-----
  52311. MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE
  52312. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  52313. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  52314. IHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRp
  52315. ZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCB
  52316. yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2ln
  52317. biBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBh
  52318. dXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmlt
  52319. YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
  52320. ggEKAoIBAQCvJAgIKXo1nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKz
  52321. j/i5Vbext0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIzSdhD
  52322. Y2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQGBO+QueQA5N06tRn/
  52323. Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+rCpSx4/VBEnkjWNHiDxpg8v+R70r
  52324. fk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/
  52325. BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2Uv
  52326. Z2lmMCEwHzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy
  52327. aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKvMzEzMA0GCSqG
  52328. SIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzEp6B4Eq1iDkVwZMXnl2YtmAl+
  52329. X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y5gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKE
  52330. KQsTb47bDN0lAtukixlE0kF6BWlKWE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiC
  52331. Km0oHw0LxOXnGiYZ4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vE
  52332. ZV8NhnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq
  52333. -----END CERTIFICATE-----
  52334. SecureTrust CA
  52335. ==============
  52336. -----BEGIN CERTIFICATE-----
  52337. MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBIMQswCQYDVQQG
  52338. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xFzAVBgNVBAMTDlNlY3VyZVRy
  52339. dXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIzMTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAe
  52340. BgNVBAoTF1NlY3VyZVRydXN0IENvcnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCC
  52341. ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQX
  52342. OZEzZum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO0gMdA+9t
  52343. DWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIaowW8xQmxSPmjL8xk037uH
  52344. GFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b
  52345. 01k/unK8RCSc43Oz969XL0Imnal0ugBS8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmH
  52346. ursCAwEAAaOBnTCBmjATBgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/
  52347. BAUwAwEB/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCegJYYj
  52348. aHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  52349. KoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt36Z3q059c4EVlew3KW+JwULKUBRSu
  52350. SceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHf
  52351. mbx8IVQr5Fiiu1cprp6poxkmD5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZ
  52352. nMUFdAvnZyPSCPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR
  52353. 3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE=
  52354. -----END CERTIFICATE-----
  52355. Secure Global CA
  52356. ================
  52357. -----BEGIN CERTIFICATE-----
  52358. MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQG
  52359. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBH
  52360. bG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkxMjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEg
  52361. MB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwg
  52362. Q0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jx
  52363. YDiJiQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa/FHtaMbQ
  52364. bqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJjnIFHovdRIWCQtBJwB1g
  52365. 8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnIHmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYV
  52366. HDGA76oYa8J719rO+TMg1fW9ajMtgQT7sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi
  52367. 0XPnj3pDAgMBAAGjgZ0wgZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  52368. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCswKaAn
  52369. oCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsGAQQBgjcVAQQDAgEA
  52370. MA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0LURYD7xh8yOOvaliTFGCRsoTciE6+
  52371. OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXOH0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cn
  52372. CDpOGR86p1hcF895P4vkp9MmI50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/5
  52373. 3CYNv6ZHdAbYiNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc
  52374. f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW
  52375. -----END CERTIFICATE-----
  52376. COMODO Certification Authority
  52377. ==============================
  52378. -----BEGIN CERTIFICATE-----
  52379. MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCBgTELMAkGA1UE
  52380. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  52381. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNVBAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1
  52382. dGhvcml0eTAeFw0wNjEyMDEwMDAwMDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEb
  52383. MBkGA1UECBMSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFD
  52384. T01PRE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  52385. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3UcEbVASY06m/weaKXTuH
  52386. +7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI2GqGd0S7WWaXUF601CxwRM/aN5VCaTww
  52387. xHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV
  52388. 4EajcNxo2f8ESIl33rXp+2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA
  52389. 1KGzqSX+DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5OnKVI
  52390. rLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW/zAOBgNVHQ8BAf8E
  52391. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6gPKA6hjhodHRwOi8vY3JsLmNvbW9k
  52392. b2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOC
  52393. AQEAPpiem/Yb6dc5t3iuHXIYSdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CP
  52394. OGEIqB6BCsAvIC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/
  52395. RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4zJVSk/BwJVmc
  52396. IGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5ddBA6+C4OmF4O5MBKgxTMVBbkN
  52397. +8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IBZQ==
  52398. -----END CERTIFICATE-----
  52399. Network Solutions Certificate Authority
  52400. =======================================
  52401. -----BEGIN CERTIFICATE-----
  52402. MIID5jCCAs6gAwIBAgIQV8szb8JcFuZHFhfjkDFo4DANBgkqhkiG9w0BAQUFADBiMQswCQYDVQQG
  52403. EwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMuMTAwLgYDVQQDEydOZXR3b3Jr
  52404. IFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDYxMjAxMDAwMDAwWhcNMjkxMjMx
  52405. MjM1OTU5WjBiMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMu
  52406. MTAwLgYDVQQDEydOZXR3b3JrIFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G
  52407. CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDkvH6SMG3G2I4rC7xGzuAnlt7e+foS0zwzc7MEL7xx
  52408. jOWftiJgPl9dzgn/ggwbmlFQGiaJ3dVhXRncEg8tCqJDXRfQNJIg6nPPOCwGJgl6cvf6UDL4wpPT
  52409. aaIjzkGxzOTVHzbRijr4jGPiFFlp7Q3Tf2vouAPlT2rlmGNpSAW+Lv8ztumXWWn4Zxmuk2GWRBXT
  52410. crA/vGp97Eh/jcOrqnErU2lBUzS1sLnFBgrEsEX1QV1uiUV7PTsmjHTC5dLRfbIR1PtYMiKagMnc
  52411. /Qzpf14Dl847ABSHJ3A4qY5usyd2mFHgBeMhqxrVhSI8KbWaFsWAqPS7azCPL0YCorEMIuDTAgMB
  52412. AAGjgZcwgZQwHQYDVR0OBBYEFCEwyfsA106Y2oeqKtCnLrFAMadMMA4GA1UdDwEB/wQEAwIBBjAP
  52413. BgNVHRMBAf8EBTADAQH/MFIGA1UdHwRLMEkwR6BFoEOGQWh0dHA6Ly9jcmwubmV0c29sc3NsLmNv
  52414. bS9OZXR3b3JrU29sdXRpb25zQ2VydGlmaWNhdGVBdXRob3JpdHkuY3JsMA0GCSqGSIb3DQEBBQUA
  52415. A4IBAQC7rkvnt1frf6ott3NHhWrB5KUd5Oc86fRZZXe1eltajSU24HqXLjjAV2CDmAaDn7l2em5Q
  52416. 4LqILPxFzBiwmZVRDuwduIj/h1AcgsLj4DKAv6ALR8jDMe+ZZzKATxcheQxpXN5eNK4CtSbqUN9/
  52417. GGUsyfJj4akH/nxxH2szJGoeBfcFaMBqEssuXmHLrijTfsK0ZpEmXzwuJF/LWA/rKOyvEZbz3Htv
  52418. wKeI8lN3s2Berq4o2jUsbzRF0ybh3uxbTydrFny9RAQYgrOJeRcQcT16ohZO9QHNpGxlaKFJdlxD
  52419. ydi8NmdspZS11My5vWo1ViHe2MPr+8ukYEywVaCge1ey
  52420. -----END CERTIFICATE-----
  52421. COMODO ECC Certification Authority
  52422. ==================================
  52423. -----BEGIN CERTIFICATE-----
  52424. MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTELMAkGA1UEBhMC
  52425. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  52426. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBB
  52427. dXRob3JpdHkwHhcNMDgwMzA2MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0Ix
  52428. GzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR
  52429. Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRo
  52430. b3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSRFtSrYpn1PlILBs5BAH+X
  52431. 4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0JcfRK9ChQtP6IHG4/bC8vCVlbpVsLM5ni
  52432. wz2J+Wos77LTBumjQjBAMB0GA1UdDgQWBBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8E
  52433. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VG
  52434. FAkK+qDmfQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdvGDeA
  52435. U/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY=
  52436. -----END CERTIFICATE-----
  52437. OISTE WISeKey Global Root GA CA
  52438. ===============================
  52439. -----BEGIN CERTIFICATE-----
  52440. MIID8TCCAtmgAwIBAgIQQT1yx/RrH4FDffHSKFTfmjANBgkqhkiG9w0BAQUFADCBijELMAkGA1UE
  52441. BhMCQ0gxEDAOBgNVBAoTB1dJU2VLZXkxGzAZBgNVBAsTEkNvcHlyaWdodCAoYykgMjAwNTEiMCAG
  52442. A1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBH
  52443. bG9iYWwgUm9vdCBHQSBDQTAeFw0wNTEyMTExNjAzNDRaFw0zNzEyMTExNjA5NTFaMIGKMQswCQYD
  52444. VQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEbMBkGA1UECxMSQ29weXJpZ2h0IChjKSAyMDA1MSIw
  52445. IAYDVQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5
  52446. IEdsb2JhbCBSb290IEdBIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy0+zAJs9
  52447. Nt350UlqaxBJH+zYK7LG+DKBKUOVTJoZIyEVRd7jyBxRVVuuk+g3/ytr6dTqvirdqFEr12bDYVxg
  52448. Asj1znJ7O7jyTmUIms2kahnBAbtzptf2w93NvKSLtZlhuAGio9RN1AU9ka34tAhxZK9w8RxrfvbD
  52449. d50kc3vkDIzh2TbhmYsFmQvtRTEJysIA2/dyoJaqlYfQjse2YXMNdmaM3Bu0Y6Kff5MTMPGhJ9vZ
  52450. /yxViJGg4E8HsChWjBgbl0SOid3gF27nKu+POQoxhILYQBRJLnpB5Kf+42TMwVlxSywhp1t94B3R
  52451. LoGbw9ho972WG6xwsRYUC9tguSYBBQIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw
  52452. AwEB/zAdBgNVHQ4EFgQUswN+rja8sHnR3JQmthG+IbJphpQwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  52453. KoZIhvcNAQEFBQADggEBAEuh/wuHbrP5wUOxSPMowB0uyQlB+pQAHKSkq0lPjz0e701vvbyk9vIm
  52454. MMkQyh2I+3QZH4VFvbBsUfk2ftv1TDI6QU9bR8/oCy22xBmddMVHxjtqD6wU2zz0c5ypBd8A3HR4
  52455. +vg1YFkCExh8vPtNsCBtQ7tgMHpnM1zFmdH4LTlSc/uMqpclXHLZCB6rTjzjgTGfA6b7wP4piFXa
  52456. hNVQA7bihKOmNqoROgHhGEvWRGizPflTdISzRpFGlgC3gCy24eMQ4tui5yiPAZZiFj4A4xylNoEY
  52457. okxSdsARo27mHbrjWr42U8U+dY+GaSlYU7Wcu2+fXMUY7N0v4ZjJ/L7fCg0=
  52458. -----END CERTIFICATE-----
  52459. Certigna
  52460. ========
  52461. -----BEGIN CERTIFICATE-----
  52462. MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNVBAYTAkZSMRIw
  52463. EAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4XDTA3MDYyOTE1MTMwNVoXDTI3
  52464. MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwI
  52465. Q2VydGlnbmEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7q
  52466. XOEm7RFHYeGifBZ4QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyH
  52467. GxnygQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbwzBfsV1/p
  52468. ogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q130yGLMLLGq/jj8UEYkg
  52469. DncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKf
  52470. Irjxwo1p3Po6WAbfAgMBAAGjgbwwgbkwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQ
  52471. tCRZvgHyUtVF9lo53BEwZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJ
  52472. BgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzjAQ/J
  52473. SP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG9w0BAQUFAAOCAQEA
  52474. hQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8hbV6lUmPOEvjvKtpv6zf+EwLHyzs+
  52475. ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFncfca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1klu
  52476. PBS1xp81HlDQwY9qcEQCYsuuHWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY
  52477. 1gkIl2PlwS6wt0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw
  52478. WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg==
  52479. -----END CERTIFICATE-----
  52480. Deutsche Telekom Root CA 2
  52481. ==========================
  52482. -----BEGIN CERTIFICATE-----
  52483. MIIDnzCCAoegAwIBAgIBJjANBgkqhkiG9w0BAQUFADBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMT
  52484. RGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0GA1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEG
  52485. A1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBSb290IENBIDIwHhcNOTkwNzA5MTIxMTAwWhcNMTkwNzA5
  52486. MjM1OTAwWjBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMTRGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0G
  52487. A1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEGA1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBS
  52488. b290IENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCrC6M14IspFLEUha88EOQ5
  52489. bzVdSq7d6mGNlUn0b2SjGmBmpKlAIoTZ1KXleJMOaAGtuU1cOs7TuKhCQN/Po7qCWWqSG6wcmtoI
  52490. KyUn+WkjR/Hg6yx6m/UTAtB+NHzCnjwAWav12gz1MjwrrFDa1sPeg5TKqAyZMg4ISFZbavva4VhY
  52491. AUlfckE8FQYBjl2tqriTtM2e66foai1SNNs671x1Udrb8zH57nGYMsRUFUQM+ZtV7a3fGAigo4aK
  52492. Se5TBY8ZTNXeWHmb0mocQqvF1afPaA+W5OFhmHZhyJF81j4A4pFQh+GdCuatl9Idxjp9y7zaAzTV
  52493. jlsB9WoHtxa2bkp/AgMBAAGjQjBAMB0GA1UdDgQWBBQxw3kbuvVT1xfgiXotF2wKsyudMzAPBgNV
  52494. HRMECDAGAQH/AgEFMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAlGRZrTlk5ynr
  52495. E/5aw4sTV8gEJPB0d8Bg42f76Ymmg7+Wgnxu1MM9756AbrsptJh6sTtU6zkXR34ajgv8HzFZMQSy
  52496. zhfzLMdiNlXiItiJVbSYSKpk+tYcNthEeFpaIzpXl/V6ME+un2pMSyuOoAPjPuCp1NJ70rOo4nI8
  52497. rZ7/gFnkm0W09juwzTkZmDLl6iFhkOQxIY40sfcvNUqFENrnijchvllj4PKFiDFT1FQUhXB59C4G
  52498. dyd1Lx+4ivn+xbrYNuSD7Odlt79jWvNGr4GUN9RBjNYj1h7P9WgbRGOiWrqnNVmh5XAFmw4jV5mU
  52499. Cm26OWMohpLzGITY+9HPBVZkVw==
  52500. -----END CERTIFICATE-----
  52501. Cybertrust Global Root
  52502. ======================
  52503. -----BEGIN CERTIFICATE-----
  52504. MIIDoTCCAomgAwIBAgILBAAAAAABD4WqLUgwDQYJKoZIhvcNAQEFBQAwOzEYMBYGA1UEChMPQ3li
  52505. ZXJ0cnVzdCwgSW5jMR8wHQYDVQQDExZDeWJlcnRydXN0IEdsb2JhbCBSb290MB4XDTA2MTIxNTA4
  52506. MDAwMFoXDTIxMTIxNTA4MDAwMFowOzEYMBYGA1UEChMPQ3liZXJ0cnVzdCwgSW5jMR8wHQYDVQQD
  52507. ExZDeWJlcnRydXN0IEdsb2JhbCBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
  52508. +Mi8vRRQZhP/8NN57CPytxrHjoXxEnOmGaoQ25yiZXRadz5RfVb23CO21O1fWLE3TdVJDm71aofW
  52509. 0ozSJ8bi/zafmGWgE07GKmSb1ZASzxQG9Dvj1Ci+6A74q05IlG2OlTEQXO2iLb3VOm2yHLtgwEZL
  52510. AfVJrn5GitB0jaEMAs7u/OePuGtm839EAL9mJRQr3RAwHQeWP032a7iPt3sMpTjr3kfb1V05/Iin
  52511. 89cqdPHoWqI7n1C6poxFNcJQZZXcY4Lv3b93TZxiyWNzFtApD0mpSPCzqrdsxacwOUBdrsTiXSZT
  52512. 8M4cIwhhqJQZugRiQOwfOHB3EgZxpzAYXSUnpQIDAQABo4GlMIGiMA4GA1UdDwEB/wQEAwIBBjAP
  52513. BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBS2CHsNesysIEyGVjJez6tuhS1wVzA/BgNVHR8EODA2
  52514. MDSgMqAwhi5odHRwOi8vd3d3Mi5wdWJsaWMtdHJ1c3QuY29tL2NybC9jdC9jdHJvb3QuY3JsMB8G
  52515. A1UdIwQYMBaAFLYIew16zKwgTIZWMl7Pq26FLXBXMA0GCSqGSIb3DQEBBQUAA4IBAQBW7wojoFRO
  52516. lZfJ+InaRcHUowAl9B8Tq7ejhVhpwjCt2BWKLePJzYFa+HMjWqd8BfP9IjsO0QbE2zZMcwSO5bAi
  52517. 5MXzLqXZI+O4Tkogp24CJJ8iYGd7ix1yCcUxXOl5n4BHPa2hCwcUPUf/A2kaDAtE52Mlp3+yybh2
  52518. hO0j9n0Hq0V+09+zv+mKts2oomcrUtW3ZfA5TGOgkXmTUg9U3YO7n9GPp1Nzw8v/MOx8BLjYRB+T
  52519. X3EJIrduPuocA06dGiBh+4E37F78CkWr1+cXVdCg6mCbpvbjjFspwgZgFJ0tl0ypkxWdYcQBX0jW
  52520. WL1WMRJOEcgh4LMRkWXbtKaIOM5V
  52521. -----END CERTIFICATE-----
  52522. ePKI Root Certification Authority
  52523. =================================
  52524. -----BEGIN CERTIFICATE-----
  52525. MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBeMQswCQYDVQQG
  52526. EwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0ZC4xKjAoBgNVBAsMIWVQS0kg
  52527. Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMx
  52528. MjdaMF4xCzAJBgNVBAYTAlRXMSMwIQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEq
  52529. MCgGA1UECwwhZVBLSSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0B
  52530. AQEFAAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAHSyZbCUNs
  52531. IZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAhijHyl3SJCRImHJ7K2RKi
  52532. lTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3XDZoTM1PRYfl61dd4s5oz9wCGzh1NlDiv
  52533. qOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX
  52534. 12ruOzjjK9SXDrkb5wdJfzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0O
  52535. WQqraffAsgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uUWH1+
  52536. ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLSnT0IFaUQAS2zMnao
  52537. lQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pHdmX2Os+PYhcZewoozRrSgx4hxyy/
  52538. vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJipNiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXi
  52539. Zo1jDiVN1Rmy5nk3pyKdVDECAwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/Qkqi
  52540. MAwGA1UdEwQFMAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH
  52541. ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGBuvl2ICO1J2B0
  52542. 1GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6YlPwZpVnPDimZI+ymBV3QGypzq
  52543. KOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkPJXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdV
  52544. xrsStZf0X4OFunHB2WyBEXYKCrC/gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEP
  52545. NXubrjlpC2JgQCA2j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+r
  52546. GNm65ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUBo2M3IUxE
  52547. xJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS/jQ6fbjpKdx2qcgw+BRx
  52548. gMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2zGp1iro2C6pSe3VkQw63d4k3jMdXH7Ojy
  52549. sP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTEW9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmOD
  52550. BCEIZ43ygknQW/2xzQ+DhNQ+IIX3Sj0rnP0qCglN6oH4EZw=
  52551. -----END CERTIFICATE-----
  52552. certSIGN ROOT CA
  52553. ================
  52554. -----BEGIN CERTIFICATE-----
  52555. MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYTAlJPMREwDwYD
  52556. VQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTAeFw0wNjA3MDQxNzIwMDRa
  52557. Fw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UE
  52558. CxMQY2VydFNJR04gUk9PVCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7I
  52559. JUqOtdu0KBuqV5Do0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHH
  52560. rfAQUySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5dRdY4zTW2
  52561. ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQOA7+j0xbm0bqQfWwCHTD
  52562. 0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwvJoIQ4uNllAoEwF73XVv4EOLQunpL+943
  52563. AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B
  52564. Af8EBAMCAcYwHQYDVR0OBBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IB
  52565. AQA+0hyJLjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecYMnQ8
  52566. SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ44gx+FkagQnIl6Z0
  52567. x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6IJd1hJyMctTEHBDa0GpC9oHRxUIlt
  52568. vBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNwi/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7Nz
  52569. TogVZ96edhBiIL5VaZVDADlN9u6wWk5JRFRYX0KD
  52570. -----END CERTIFICATE-----
  52571. GeoTrust Primary Certification Authority - G3
  52572. =============================================
  52573. -----BEGIN CERTIFICATE-----
  52574. MIID/jCCAuagAwIBAgIQFaxulBmyeUtB9iepwxgPHzANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UE
  52575. BhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA4IEdlb1RydXN0
  52576. IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFy
  52577. eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEczMB4XDTA4MDQwMjAwMDAwMFoXDTM3MTIwMTIz
  52578. NTk1OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAo
  52579. YykgMjAwOCBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMT
  52580. LUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZI
  52581. hvcNAQEBBQADggEPADCCAQoCggEBANziXmJYHTNXOTIz+uvLh4yn1ErdBojqZI4xmKU4kB6Yzy5j
  52582. K/BGvESyiaHAKAxJcCGVn2TAppMSAmUmhsalifD614SgcK9PGpc/BkTVyetyEH3kMSj7HGHmKAdE
  52583. c5IiaacDiGydY8hS2pgn5whMcD60yRLBxWeDXTPzAxHsatBT4tG6NmCUgLthY2xbF37fQJQeqw3C
  52584. IShwiP/WJmxsYAQlTlV+fe+/lEjetx3dcI0FX4ilm/LC7urRQEFtYjgdVgbFA0dRIBn8exALDmKu
  52585. dlW/X3e+PkkBUz2YJQN2JFodtNuJ6nnltrM7P7pMKEF/BqxqjsHQ9gUdfeZChuOl1UcCAwEAAaNC
  52586. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMR5yo6hTgMdHNxr
  52587. 2zFblD4/MH8tMA0GCSqGSIb3DQEBCwUAA4IBAQAtxRPPVoB7eni9n64smefv2t+UXglpp+duaIy9
  52588. cr5HqQ6XErhK8WTTOd8lNNTBzU6B8A8ExCSzNJbGpqow32hhc9f5joWJ7w5elShKKiePEI4ufIbE
  52589. Ap7aDHdlDkQNkv39sxY2+hENHYwOB4lqKVb3cvTdFZx3NWZXqxNT2I7BQMXXExZacse3aQHEerGD
  52590. AWh9jUGhlBjBJVz88P6DAod8DQ3PLghcSkANPuyBYeYk28rgDi0Hsj5W3I31QYUHSJsMC8tJP33s
  52591. t/3LjWeJGqvtux6jAAgIFyqCXDFdRootD4abdNlF+9RAsXqqaC2Gspki4cErx5z481+oghLrGREt
  52592. -----END CERTIFICATE-----
  52593. thawte Primary Root CA - G2
  52594. ===========================
  52595. -----BEGIN CERTIFICATE-----
  52596. MIICiDCCAg2gAwIBAgIQNfwmXNmET8k9Jj1Xm67XVjAKBggqhkjOPQQDAzCBhDELMAkGA1UEBhMC
  52597. VVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjE4MDYGA1UECxMvKGMpIDIwMDcgdGhhd3RlLCBJbmMu
  52598. IC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3Qg
  52599. Q0EgLSBHMjAeFw0wNzExMDUwMDAwMDBaFw0zODAxMTgyMzU5NTlaMIGEMQswCQYDVQQGEwJVUzEV
  52600. MBMGA1UEChMMdGhhd3RlLCBJbmMuMTgwNgYDVQQLEy8oYykgMjAwNyB0aGF3dGUsIEluYy4gLSBG
  52601. b3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAt
  52602. IEcyMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEotWcgnuVnfFSeIf+iha/BebfowJPDQfGAFG6DAJS
  52603. LSKkQjnE/o/qycG+1E3/n3qe4rF8mq2nhglzh9HnmuN6papu+7qzcMBniKI11KOasf2twu8x+qi5
  52604. 8/sIxpHR+ymVo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU
  52605. mtgAMADna3+FGO6Lts6KDPgR4bswCgYIKoZIzj0EAwMDaQAwZgIxAN344FdHW6fmCsO99YCKlzUN
  52606. G4k8VIZ3KMqh9HneteY4sPBlcIx/AlTCv//YoT7ZzwIxAMSNlPzcU9LcnXgWHxUzI1NS41oxXZ3K
  52607. rr0TKUQNJ1uo52icEvdYPy5yAlejj6EULg==
  52608. -----END CERTIFICATE-----
  52609. thawte Primary Root CA - G3
  52610. ===========================
  52611. -----BEGIN CERTIFICATE-----
  52612. MIIEKjCCAxKgAwIBAgIQYAGXt0an6rS0mtZLL/eQ+zANBgkqhkiG9w0BAQsFADCBrjELMAkGA1UE
  52613. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  52614. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDggdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  52615. cml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMzAeFw0w
  52616. ODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIGuMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhh
  52617. d3RlLCBJbmMuMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9uMTgwNgYD
  52618. VQQLEy8oYykgMjAwOCB0aGF3dGUsIEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIG
  52619. A1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAtIEczMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  52620. MIIBCgKCAQEAsr8nLPvb2FvdeHsbnndmgcs+vHyu86YnmjSjaDFxODNi5PNxZnmxqWWjpYvVj2At
  52621. P0LMqmsywCPLLEHd5N/8YZzic7IilRFDGF/Eth9XbAoFWCLINkw6fKXRz4aviKdEAhN0cXMKQlkC
  52622. +BsUa0Lfb1+6a4KinVvnSr0eAXLbS3ToO39/fR8EtCab4LRarEc9VbjXsCZSKAExQGbY2SS99irY
  52623. 7CFJXJv2eul/VTV+lmuNk5Mny5K76qxAwJ/C+IDPXfRa3M50hqY+bAtTyr2SzhkGcuYMXDhpxwTW
  52624. vGzOW/b3aJzcJRVIiKHpqfiYnODz1TEoYRFsZ5aNOZnLwkUkOQIDAQABo0IwQDAPBgNVHRMBAf8E
  52625. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUrWyqlGCc7eT/+j4KdCtjA/e2Wb8wDQYJ
  52626. KoZIhvcNAQELBQADggEBABpA2JVlrAmSicY59BDlqQ5mU1143vokkbvnRFHfxhY0Cu9qRFHqKweK
  52627. A3rD6z8KLFIWoCtDuSWQP3CpMyVtRRooOyfPqsMpQhvfO0zAMzRbQYi/aytlryjvsvXDqmbOe1bu
  52628. t8jLZ8HJnBoYuMTDSQPxYA5QzUbF83d597YV4Djbxy8ooAw/dyZ02SUS2jHaGh7cKUGRIjxpp7sC
  52629. 8rZcJwOJ9Abqm+RyguOhCcHpABnTPtRwa7pxpqpYrvS76Wy274fMm7v/OeZWYdMKp8RcTGB7BXcm
  52630. er/YB1IsYvdwY9k5vG8cwnncdimvzsUsZAReiDZuMdRAGmI0Nj81Aa6sY6A=
  52631. -----END CERTIFICATE-----
  52632. GeoTrust Primary Certification Authority - G2
  52633. =============================================
  52634. -----BEGIN CERTIFICATE-----
  52635. MIICrjCCAjWgAwIBAgIQPLL0SAoA4v7rJDteYD7DazAKBggqhkjOPQQDAzCBmDELMAkGA1UEBhMC
  52636. VVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA3IEdlb1RydXN0IElu
  52637. Yy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBD
  52638. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMB4XDTA3MTEwNTAwMDAwMFoXDTM4MDExODIzNTk1
  52639. OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykg
  52640. MjAwNyBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMTLUdl
  52641. b1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMjB2MBAGByqGSM49AgEG
  52642. BSuBBAAiA2IABBWx6P0DFUPlrOuHNxFi79KDNlJ9RVcLSo17VDs6bl8VAsBQps8lL33KSLjHUGMc
  52643. KiEIfJo22Av+0SbFWDEwKCXzXV2juLaltJLtbCyf691DiaI8S0iRHVDsJt/WYC69IaNCMEAwDwYD
  52644. VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBVfNVdRVfslsq0DafwBo/q+
  52645. EVXVMAoGCCqGSM49BAMDA2cAMGQCMGSWWaboCd6LuvpaiIjwH5HTRqjySkwCY/tsXzjbLkGTqQ7m
  52646. ndwxHLKgpxgceeHHNgIwOlavmnRs9vuD4DPTCF+hnMJbn0bWtsuRBmOiBuczrD6ogRLQy7rQkgu2
  52647. npaqBA+K
  52648. -----END CERTIFICATE-----
  52649. VeriSign Universal Root Certification Authority
  52650. ===============================================
  52651. -----BEGIN CERTIFICATE-----
  52652. MIIEuTCCA6GgAwIBAgIQQBrEZCGzEyEDDrvkEhrFHTANBgkqhkiG9w0BAQsFADCBvTELMAkGA1UE
  52653. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  52654. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwOCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  52655. IHVzZSBvbmx5MTgwNgYDVQQDEy9WZXJpU2lnbiBVbml2ZXJzYWwgUm9vdCBDZXJ0aWZpY2F0aW9u
  52656. IEF1dGhvcml0eTAeFw0wODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIG9MQswCQYDVQQGEwJV
  52657. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  52658. cmsxOjA4BgNVBAsTMShjKSAyMDA4IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  52659. IG9ubHkxODA2BgNVBAMTL1ZlcmlTaWduIFVuaXZlcnNhbCBSb290IENlcnRpZmljYXRpb24gQXV0
  52660. aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx2E3XrEBNNti1xWb/1hajCMj
  52661. 1mCOkdeQmIN65lgZOIzF9uVkhbSicfvtvbnazU0AtMgtc6XHaXGVHzk8skQHnOgO+k1KxCHfKWGP
  52662. MiJhgsWHH26MfF8WIFFE0XBPV+rjHOPMee5Y2A7Cs0WTwCznmhcrewA3ekEzeOEz4vMQGn+HLL72
  52663. 9fdC4uW/h2KJXwBL38Xd5HVEMkE6HnFuacsLdUYI0crSK5XQz/u5QGtkjFdN/BMReYTtXlT2NJ8I
  52664. AfMQJQYXStrxHXpma5hgZqTZ79IugvHw7wnqRMkVauIDbjPTrJ9VAMf2CGqUuV/c4DPxhGD5WycR
  52665. tPwW8rtWaoAljQIDAQABo4GyMIGvMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMG0G
  52666. CCsGAQUFBwEMBGEwX6FdoFswWTBXMFUWCWltYWdlL2dpZjAhMB8wBwYFKw4DAhoEFI/l0xqGrI2O
  52667. a8PPgGrUSBgsexkuMCUWI2h0dHA6Ly9sb2dvLnZlcmlzaWduLmNvbS92c2xvZ28uZ2lmMB0GA1Ud
  52668. DgQWBBS2d/ppSEefUxLVwuoHMnYH0ZcHGTANBgkqhkiG9w0BAQsFAAOCAQEASvj4sAPmLGd75JR3
  52669. Y8xuTPl9Dg3cyLk1uXBPY/ok+myDjEedO2Pzmvl2MpWRsXe8rJq+seQxIcaBlVZaDrHC1LGmWazx
  52670. Y8u4TB1ZkErvkBYoH1quEPuBUDgMbMzxPcP1Y+Oz4yHJJDnp/RVmRvQbEdBNc6N9Rvk97ahfYtTx
  52671. P/jgdFcrGJ2BtMQo2pSXpXDrrB2+BxHw1dvd5Yzw1TKwg+ZX4o+/vqGqvz0dtdQ46tewXDpPaj+P
  52672. wGZsY6rp2aQW9IHRlRQOfc2VNNnSj3BzgXucfr2YYdhFh5iQxeuGMMY1v/D/w1WIg0vvBZIGcfK4
  52673. mJO37M2CYfE45k+XmCpajQ==
  52674. -----END CERTIFICATE-----
  52675. VeriSign Class 3 Public Primary Certification Authority - G4
  52676. ============================================================
  52677. -----BEGIN CERTIFICATE-----
  52678. MIIDhDCCAwqgAwIBAgIQL4D+I4wOIg9IZxIokYesszAKBggqhkjOPQQDAzCByjELMAkGA1UEBhMC
  52679. VVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3
  52680. b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVz
  52681. ZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmlj
  52682. YXRpb24gQXV0aG9yaXR5IC0gRzQwHhcNMDcxMTA1MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCByjEL
  52683. MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBU
  52684. cnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRo
  52685. b3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5
  52686. IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASnVnp8
  52687. Utpkmw4tXNherJI9/gHmGUo9FANL+mAnINmDiWn6VMaaGF5VKmTeBvaNSjutEDxlPZCIBIngMGGz
  52688. rl0Bp3vefLK+ymVhAIau2o970ImtTR1ZmkGxvEeA3J5iw/mjgbIwga8wDwYDVR0TAQH/BAUwAwEB
  52689. /zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEw
  52690. HzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVyaXNpZ24u
  52691. Y29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFLMWkf3upm7ktS5Jj4d4gYDs5bG1MAoGCCqGSM49BAMD
  52692. A2gAMGUCMGYhDBgmYFo4e1ZC4Kf8NoRRkSAsdk1DPcQdhCPQrNZ8NQbOzWm9kA3bbEhCHQ6qQgIx
  52693. AJw9SDkjOVgaFRJZap7v1VmyHVIsmXHNxynfGyphe3HR3vPA5Q06Sqotp9iGKt0uEA==
  52694. -----END CERTIFICATE-----
  52695. NetLock Arany (Class Gold) Főtanúsítvány
  52696. ========================================
  52697. -----BEGIN CERTIFICATE-----
  52698. MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQGEwJIVTERMA8G
  52699. A1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3MDUGA1UECwwuVGFuw7pzw610
  52700. dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBB
  52701. cmFueSAoQ2xhc3MgR29sZCkgRsWRdGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgx
  52702. MjA2MTUwODIxWjCBpzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxO
  52703. ZXRMb2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlmaWNhdGlv
  52704. biBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNzIEdvbGQpIEbFkXRhbsO6
  52705. c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxCRec75LbRTDofTjl5Bu
  52706. 0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrTlF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw
  52707. /HpYzY6b7cNGbIRwXdrzAZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAk
  52708. H3B5r9s5VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRGILdw
  52709. fzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2BJtr+UBdADTHLpl1
  52710. neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAGAQH/AgEEMA4GA1UdDwEB/wQEAwIB
  52711. BjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2MU9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwW
  52712. qZw8UQCgwBEIBaeZ5m8BiFRhbvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTta
  52713. YtOUZcTh5m2C+C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC
  52714. bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2FuLjbvrW5Kfna
  52715. NwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2XjG4Kvte9nHfRCaexOYNkbQu
  52716. dZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E=
  52717. -----END CERTIFICATE-----
  52718. Staat der Nederlanden Root CA - G2
  52719. ==================================
  52720. -----BEGIN CERTIFICATE-----
  52721. MIIFyjCCA7KgAwIBAgIEAJiWjDANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
  52722. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  52723. Um9vdCBDQSAtIEcyMB4XDTA4MDMyNjExMTgxN1oXDTIwMDMyNTExMDMxMFowWjELMAkGA1UEBhMC
  52724. TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
  52725. ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMVZ
  52726. 5291qj5LnLW4rJ4L5PnZyqtdj7U5EILXr1HgO+EASGrP2uEGQxGZqhQlEq0i6ABtQ8SpuOUfiUtn
  52727. vWFI7/3S4GCI5bkYYCjDdyutsDeqN95kWSpGV+RLufg3fNU254DBtvPUZ5uW6M7XxgpT0GtJlvOj
  52728. CwV3SPcl5XCsMBQgJeN/dVrlSPhOewMHBPqCYYdu8DvEpMfQ9XQ+pV0aCPKbJdL2rAQmPlU6Yiil
  52729. e7Iwr/g3wtG61jj99O9JMDeZJiFIhQGp5Rbn3JBV3w/oOM2ZNyFPXfUib2rFEhZgF1XyZWampzCR
  52730. OME4HYYEhLoaJXhena/MUGDWE4dS7WMfbWV9whUYdMrhfmQpjHLYFhN9C0lK8SgbIHRrxT3dsKpI
  52731. CT0ugpTNGmXZK4iambwYfp/ufWZ8Pr2UuIHOzZgweMFvZ9C+X+Bo7d7iscksWXiSqt8rYGPy5V65
  52732. 48r6f1CGPqI0GAwJaCgRHOThuVw+R7oyPxjMW4T182t0xHJ04eOLoEq9jWYv6q012iDTiIJh8BIi
  52733. trzQ1aTsr1SIJSQ8p22xcik/Plemf1WvbibG/ufMQFxRRIEKeN5KzlW/HdXZt1bv8Hb/C3m1r737
  52734. qWmRRpdogBQ2HbN/uymYNqUg+oJgYjOk7Na6B6duxc8UpufWkjTYgfX8HV2qXB72o007uPc5AgMB
  52735. AAGjgZcwgZQwDwYDVR0TAQH/BAUwAwEB/zBSBgNVHSAESzBJMEcGBFUdIAAwPzA9BggrBgEFBQcC
  52736. ARYxaHR0cDovL3d3dy5wa2lvdmVyaGVpZC5ubC9wb2xpY2llcy9yb290LXBvbGljeS1HMjAOBgNV
  52737. HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJFoMocVHYnitfGsNig0jQt8YojrMA0GCSqGSIb3DQEBCwUA
  52738. A4ICAQCoQUpnKpKBglBu4dfYszk78wIVCVBR7y29JHuIhjv5tLySCZa59sCrI2AGeYwRTlHSeYAz
  52739. +51IvuxBQ4EffkdAHOV6CMqqi3WtFMTC6GY8ggen5ieCWxjmD27ZUD6KQhgpxrRW/FYQoAUXvQwj
  52740. f/ST7ZwaUb7dRUG/kSS0H4zpX897IZmflZ85OkYcbPnNe5yQzSipx6lVu6xiNGI1E0sUOlWDuYaN
  52741. kqbG9AclVMwWVxJKgnjIFNkXgiYtXSAfea7+1HAWFpWD2DU5/1JddRwWxRNVz0fMdWVSSt7wsKfk
  52742. CpYL+63C4iWEst3kvX5ZbJvw8NjnyvLplzh+ib7M+zkXYT9y2zqR2GUBGR2tUKRXCnxLvJxxcypF
  52743. URmFzI79R6d0lR2o0a9OF7FpJsKqeFdbxU2n5Z4FF5TKsl+gSRiNNOkmbEgeqmiSBeGCc1qb3Adb
  52744. CG19ndeNIdn8FCCqwkXfP+cAslHkwvgFuXkajDTznlvkN1trSt8sV4pAWja63XVECDdCcAz+3F4h
  52745. oKOKwJCcaNpQ5kUQR3i2TtJlycM33+FCY7BXN0Ute4qcvwXqZVUz9zkQxSgqIXobisQk+T8VyJoV
  52746. IPVVYpbtbZNQvOSqeK3Zywplh6ZmwcSBo3c6WB4L7oOLnR7SUqTMHW+wmG2UMbX4cQrcufx9MmDm
  52747. 66+KAQ==
  52748. -----END CERTIFICATE-----
  52749. Hongkong Post Root CA 1
  52750. =======================
  52751. -----BEGIN CERTIFICATE-----
  52752. MIIDMDCCAhigAwIBAgICA+gwDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoT
  52753. DUhvbmdrb25nIFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMB4XDTAzMDUx
  52754. NTA1MTMxNFoXDTIzMDUxNTA0NTIyOVowRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoTDUhvbmdrb25n
  52755. IFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMIIBIjANBgkqhkiG9w0BAQEF
  52756. AAOCAQ8AMIIBCgKCAQEArP84tulmAknjorThkPlAj3n54r15/gK97iSSHSL22oVyaf7XPwnU3ZG1
  52757. ApzQjVrhVcNQhrkpJsLj2aDxaQMoIIBFIi1WpztUlVYiWR8o3x8gPW2iNr4joLFutbEnPzlTCeqr
  52758. auh0ssJlXI6/fMN4hM2eFvz1Lk8gKgifd/PFHsSaUmYeSF7jEAaPIpjhZY4bXSNmO7ilMlHIhqqh
  52759. qZ5/dpTCpmy3QfDVyAY45tQM4vM7TG1QjMSDJ8EThFk9nnV0ttgCXjqQesBCNnLsak3c78QA3xMY
  52760. V18meMjWCnl3v/evt3a5pQuEF10Q6m/hq5URX208o1xNg1vysxmKgIsLhwIDAQABoyYwJDASBgNV
  52761. HRMBAf8ECDAGAQH/AgEDMA4GA1UdDwEB/wQEAwIBxjANBgkqhkiG9w0BAQUFAAOCAQEADkbVPK7i
  52762. h9legYsCmEEIjEy82tvuJxuC52pF7BaLT4Wg87JwvVqWuspube5Gi27nKi6Wsxkz67SfqLI37pio
  52763. l7Yutmcn1KZJ/RyTZXaeQi/cImyaT/JaFTmxcdcrUehtHJjA2Sr0oYJ71clBoiMBdDhViw+5Lmei
  52764. IAQ32pwL0xch4I+XeTRvhEgCIDMb5jREn5Fw9IBehEPCKdJsEhTkYY2sEJCehFC78JZvRZ+K88ps
  52765. T/oROhUVRsPNH4NbLUES7VBnQRM9IauUiqpOfMGx+6fWtScvl6tu4B3i0RwsH0Ti/L6RoZz71ilT
  52766. c4afU9hDDl3WY4JxHYB0yvbiAmvZWg==
  52767. -----END CERTIFICATE-----
  52768. SecureSign RootCA11
  52769. ===================
  52770. -----BEGIN CERTIFICATE-----
  52771. MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDErMCkGA1UEChMi
  52772. SmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoGA1UEAxMTU2VjdXJlU2lnbiBS
  52773. b290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSsw
  52774. KQYDVQQKEyJKYXBhbiBDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1
  52775. cmVTaWduIFJvb3RDQTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvL
  52776. TJszi1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8h9uuywGO
  52777. wvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOVMdrAG/LuYpmGYz+/3ZMq
  52778. g6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rP
  52779. O7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni8McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitA
  52780. bpSACW22s293bzUIUPsCh8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZX
  52781. t94wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAKCh
  52782. OBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xmKbabfSVSSUOrTC4r
  52783. bnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQX5Ucv+2rIrVls4W6ng+4reV6G4pQ
  52784. Oh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWrQbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01
  52785. y8hSyn+B/tlr0/cR7SXf+Of5pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061
  52786. lgeLKBObjBmNQSdJQO7e5iNEOdyhIta6A/I=
  52787. -----END CERTIFICATE-----
  52788. Microsec e-Szigno Root CA 2009
  52789. ==============================
  52790. -----BEGIN CERTIFICATE-----
  52791. MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYDVQQGEwJIVTER
  52792. MA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jv
  52793. c2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o
  52794. dTAeFw0wOTA2MTYxMTMwMThaFw0yOTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UE
  52795. BwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUt
  52796. U3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTCCASIw
  52797. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvPkd6mJviZpWNwrZuuyjNA
  52798. fW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tccbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG
  52799. 0IMZfcChEhyVbUr02MelTTMuhTlAdX4UfIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKA
  52800. pxn1ntxVUwOXewdI/5n7N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm
  52801. 1HxdrtbCxkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1+rUC
  52802. AwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTLD8bf
  52803. QkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAbBgNVHREE
  52804. FDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqGSIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0o
  52805. lZMEyL/azXm4Q5DwpL7v8u8hmLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfX
  52806. I/OMn74dseGkddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775
  52807. tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c2Pm2G2JwCz02
  52808. yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5tHMN1Rq41Bab2XD0h7lbwyYIi
  52809. LXpUq3DDfSJlgnCW
  52810. -----END CERTIFICATE-----
  52811. GlobalSign Root CA - R3
  52812. =======================
  52813. -----BEGIN CERTIFICATE-----
  52814. MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4GA1UECxMXR2xv
  52815. YmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  52816. bFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  52817. aWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  52818. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWt
  52819. iHL8RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsTgHeMCOFJ
  52820. 0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmmKPZpO/bLyCiR5Z2KYVc3
  52821. rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zdQQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjl
  52822. OCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZXriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2
  52823. xmmFghcCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  52824. FI/wS3+oLkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZURUm7
  52825. lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMpjjM5RcOO5LlXbKr8
  52826. EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK6fBdRoyV3XpYKBovHd7NADdBj+1E
  52827. bddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQXmcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18
  52828. YIvDQVETI53O9zJrlAGomecsMx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7r
  52829. kpeDMdmztcpHWD9f
  52830. -----END CERTIFICATE-----
  52831. Autoridad de Certificacion Firmaprofesional CIF A62634068
  52832. =========================================================
  52833. -----BEGIN CERTIFICATE-----
  52834. MIIGFDCCA/ygAwIBAgIIU+w77vuySF8wDQYJKoZIhvcNAQEFBQAwUTELMAkGA1UEBhMCRVMxQjBA
  52835. BgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2
  52836. MjYzNDA2ODAeFw0wOTA1MjAwODM4MTVaFw0zMDEyMzEwODM4MTVaMFExCzAJBgNVBAYTAkVTMUIw
  52837. QAYDVQQDDDlBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBB
  52838. NjI2MzQwNjgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDD
  52839. Utd9thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQMcas9UX4P
  52840. B99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefGL9ItWY16Ck6WaVICqjaY
  52841. 7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15iNA9wBj4gGFrO93IbJWyTdBSTo3OxDqqH
  52842. ECNZXyAFGUftaI6SEspd/NYrspI8IM/hX68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyI
  52843. plD9amML9ZMWGxmPsu2bm8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctX
  52844. MbScyJCyZ/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirjaEbsX
  52845. LZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/TKI8xWVvTyQKmtFLK
  52846. bpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF6NkBiDkal4ZkQdU7hwxu+g/GvUgU
  52847. vzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVhOSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMBIGA1Ud
  52848. EwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRlzeurNR4APn7VdMActHNH
  52849. DhpkLzCBpgYDVR0gBIGeMIGbMIGYBgRVHSAAMIGPMC8GCCsGAQUFBwIBFiNodHRwOi8vd3d3LmZp
  52850. cm1hcHJvZmVzaW9uYWwuY29tL2NwczBcBggrBgEFBQcCAjBQHk4AUABhAHMAZQBvACAAZABlACAA
  52851. bABhACAAQgBvAG4AYQBuAG8AdgBhACAANAA3ACAAQgBhAHIAYwBlAGwAbwBuAGEAIAAwADgAMAAx
  52852. ADcwDQYJKoZIhvcNAQEFBQADggIBABd9oPm03cXF661LJLWhAqvdpYhKsg9VSytXjDvlMd3+xDLx
  52853. 51tkljYyGOylMnfX40S2wBEqgLk9am58m9Ot/MPWo+ZkKXzR4Tgegiv/J2Wv+xYVxC5xhOW1//qk
  52854. R71kMrv2JYSiJ0L1ILDCExARzRAVukKQKtJE4ZYm6zFIEv0q2skGz3QeqUvVhyj5eTSSPi5E6PaP
  52855. T481PyWzOdxjKpBrIF/EUhJOlywqrJ2X3kjyo2bbwtKDlaZmp54lD+kLM5FlClrD2VQS3a/DTg4f
  52856. Jl4N3LON7NWBcN7STyQF82xO9UxJZo3R/9ILJUFI/lGExkKvgATP0H5kSeTy36LssUzAKh3ntLFl
  52857. osS88Zj0qnAHY7S42jtM+kAiMFsRpvAFDsYCA0irhpuF3dvd6qJ2gHN99ZwExEWN57kci57q13XR
  52858. crHedUTnQn3iV2t93Jm8PYMo6oCTjcVMZcFwgbg4/EMxsvYDNEeyrPsiBsse3RdHHF9mudMaotoR
  52859. saS8I8nkvof/uZS2+F0gStRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTD
  52860. KCOM/iczQ0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQBjLMi
  52861. 6Et8Vcad+qMUu2WFbm5PEn4KPJ2V
  52862. -----END CERTIFICATE-----
  52863. Izenpe.com
  52864. ==========
  52865. -----BEGIN CERTIFICATE-----
  52866. MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4MQswCQYDVQQG
  52867. EwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wHhcNMDcxMjEz
  52868. MTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMu
  52869. QS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ
  52870. 03rKDx6sp4boFmVqscIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAK
  52871. ClaOxdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6HLmYRY2xU
  52872. +zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFXuaOKmMPsOzTFlUFpfnXC
  52873. PCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQDyCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxT
  52874. OTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbK
  52875. F7jJeodWLBoBHmy+E60QrLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK
  52876. 0GqfvEyNBjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8Lhij+
  52877. 0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIBQFqNeb+Lz0vPqhbB
  52878. leStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+HMh3/1uaD7euBUbl8agW7EekFwID
  52879. AQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2luZm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+
  52880. SVpFTlBFIFMuQS4gLSBDSUYgQTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBG
  52881. NjIgUzgxQzBBBgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx
  52882. MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  52883. BBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUAA4ICAQB4pgwWSp9MiDrAyw6l
  52884. Fn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWblaQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbga
  52885. kEyrkgPH7UIBzg/YsfqikuFgba56awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8q
  52886. hT/AQKM6WfxZSzwoJNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Cs
  52887. g1lwLDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCTVyvehQP5
  52888. aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGkLhObNA5me0mrZJfQRsN5
  52889. nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJbUjWumDqtujWTI6cfSN01RpiyEGjkpTHC
  52890. ClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZo
  52891. Q0iy2+tzJOeRf1SktoA+naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1Z
  52892. WrOZyGlsQyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw==
  52893. -----END CERTIFICATE-----
  52894. Chambers of Commerce Root - 2008
  52895. ================================
  52896. -----BEGIN CERTIFICATE-----
  52897. MIIHTzCCBTegAwIBAgIJAKPaQn6ksa7aMA0GCSqGSIb3DQEBBQUAMIGuMQswCQYDVQQGEwJFVTFD
  52898. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  52899. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  52900. QS4xKTAnBgNVBAMTIENoYW1iZXJzIG9mIENvbW1lcmNlIFJvb3QgLSAyMDA4MB4XDTA4MDgwMTEy
  52901. Mjk1MFoXDTM4MDczMTEyMjk1MFowga4xCzAJBgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNl
  52902. ZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNhbWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQF
  52903. EwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENhbWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJl
  52904. cnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC
  52905. AQCvAMtwNyuAWko6bHiUfaN/Gh/2NdW928sNRHI+JrKQUrpjOyhYb6WzbZSm891kDFX29ufyIiKA
  52906. XuFixrYp4YFs8r/lfTJqVKAyGVn+H4vXPWCGhSRv4xGzdz4gljUha7MI2XAuZPeEklPWDrCQiorj
  52907. h40G072QDuKZoRuGDtqaCrsLYVAGUvGef3bsyw/QHg3PmTA9HMRFEFis1tPo1+XqxQEHd9ZR5gN/
  52908. ikilTWh1uem8nk4ZcfUyS5xtYBkL+8ydddy/Js2Pk3g5eXNeJQ7KXOt3EgfLZEFHcpOrUMPrCXZk
  52909. NNI5t3YRCQ12RcSprj1qr7V9ZS+UWBDsXHyvfuK2GNnQm05aSd+pZgvMPMZ4fKecHePOjlO+Bd5g
  52910. D2vlGts/4+EhySnB8esHnFIbAURRPHsl18TlUlRdJQfKFiC4reRB7noI/plvg6aRArBsNlVq5331
  52911. lubKgdaX8ZSD6e2wsWsSaR6s+12pxZjptFtYer49okQ6Y1nUCyXeG0+95QGezdIp1Z8XGQpvvwyQ
  52912. 0wlf2eOKNcx5Wk0ZN5K3xMGtr/R5JJqyAQuxr1yW84Ay+1w9mPGgP0revq+ULtlVmhduYJ1jbLhj
  52913. ya6BXBg14JC7vjxPNyK5fuvPnnchpj04gftI2jE9K+OJ9dC1vX7gUMQSibMjmhAxhduub+84Mxh2
  52914. EQIDAQABo4IBbDCCAWgwEgYDVR0TAQH/BAgwBgEB/wIBDDAdBgNVHQ4EFgQU+SSsD7K1+HnA+mCI
  52915. G8TZTQKeFxkwgeMGA1UdIwSB2zCB2IAU+SSsD7K1+HnA+mCIG8TZTQKeFxmhgbSkgbEwga4xCzAJ
  52916. BgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNlZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNh
  52917. bWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQFEwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENh
  52918. bWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDiC
  52919. CQCj2kJ+pLGu2jAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUH
  52920. AgEWHGh0dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAJASryI1
  52921. wqM58C7e6bXpeHxIvj99RZJe6dqxGfwWPJ+0W2aeaufDuV2I6A+tzyMP3iU6XsxPpcG1Lawk0lgH
  52922. 3qLPaYRgM+gQDROpI9CF5Y57pp49chNyM/WqfcZjHwj0/gF/JM8rLFQJ3uIrbZLGOU8W6jx+ekbU
  52923. RWpGqOt1glanq6B8aBMz9p0w8G8nOSQjKpD9kCk18pPfNKXG9/jvjA9iSnyu0/VU+I22mlaHFoI6
  52924. M6taIgj3grrqLuBHmrS1RaMFO9ncLkVAO+rcf+g769HsJtg1pDDFOqxXnrN2pSB7+R5KBWIBpih1
  52925. YJeSDW4+TTdDDZIVnBgizVGZoCkaPF+KMjNbMMeJL0eYD6MDxvbxrN8y8NmBGuScvfaAFPDRLLmF
  52926. 9dijscilIeUcE5fuDr3fKanvNFNb0+RqE4QGtjICxFKuItLcsiFCGtpA8CnJ7AoMXOLQusxI0zcK
  52927. zBIKinmwPQN/aUv0NCB9szTqjktk9T79syNnFQ0EuPAtwQlRPLJsFfClI9eDdOTlLsn+mCdCxqvG
  52928. nrDQWzilm1DefhiYtUU79nm06PcaewaD+9CL2rvHvRirCG88gGtAPxkZumWK5r7VXNM21+9AUiRg
  52929. OGcEMeyP84LG3rlV8zsxkVrctQgVrXYlCg17LofiDKYGvCYQbTed7N14jHyAxfDZd0jQ
  52930. -----END CERTIFICATE-----
  52931. Global Chambersign Root - 2008
  52932. ==============================
  52933. -----BEGIN CERTIFICATE-----
  52934. MIIHSTCCBTGgAwIBAgIJAMnN0+nVfSPOMA0GCSqGSIb3DQEBBQUAMIGsMQswCQYDVQQGEwJFVTFD
  52935. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  52936. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  52937. QS4xJzAlBgNVBAMTHkdsb2JhbCBDaGFtYmVyc2lnbiBSb290IC0gMjAwODAeFw0wODA4MDExMjMx
  52938. NDBaFw0zODA3MzExMjMxNDBaMIGsMQswCQYDVQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUg
  52939. Y3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAGA1UEBRMJ
  52940. QTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xJzAlBgNVBAMTHkdsb2JhbCBD
  52941. aGFtYmVyc2lnbiBSb290IC0gMjAwODCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMDf
  52942. VtPkOpt2RbQT2//BthmLN0EYlVJH6xedKYiONWwGMi5HYvNJBL99RDaxccy9Wglz1dmFRP+RVyXf
  52943. XjaOcNFccUMd2drvXNL7G706tcuto8xEpw2uIRU/uXpbknXYpBI4iRmKt4DS4jJvVpyR1ogQC7N0
  52944. ZJJ0YPP2zxhPYLIj0Mc7zmFLmY/CDNBAspjcDahOo7kKrmCgrUVSY7pmvWjg+b4aqIG7HkF4ddPB
  52945. /gBVsIdU6CeQNR1MM62X/JcumIS/LMmjv9GYERTtY/jKmIhYF5ntRQOXfjyGHoiMvvKRhI9lNNgA
  52946. TH23MRdaKXoKGCQwoze1eqkBfSbW+Q6OWfH9GzO1KTsXO0G2Id3UwD2ln58fQ1DJu7xsepeY7s2M
  52947. H/ucUa6LcL0nn3HAa6x9kGbo1106DbDVwo3VyJ2dwW3Q0L9R5OP4wzg2rtandeavhENdk5IMagfe
  52948. Ox2YItaswTXbo6Al/3K1dh3ebeksZixShNBFks4c5eUzHdwHU1SjqoI7mjcv3N2gZOnm3b2u/GSF
  52949. HTynyQbehP9r6GsaPMWis0L7iwk+XwhSx2LE1AVxv8Rk5Pihg+g+EpuoHtQ2TS9x9o0o9oOpE9Jh
  52950. wZG7SMA0j0GMS0zbaRL/UJScIINZc+18ofLx/d33SdNDWKBWY8o9PeU1VlnpDsogzCtLkykPAgMB
  52951. AAGjggFqMIIBZjASBgNVHRMBAf8ECDAGAQH/AgEMMB0GA1UdDgQWBBS5CcqcHtvTbDprru1U8VuT
  52952. BjUuXjCB4QYDVR0jBIHZMIHWgBS5CcqcHtvTbDprru1U8VuTBjUuXqGBsqSBrzCBrDELMAkGA1UE
  52953. BhMCRVUxQzBBBgNVBAcTOk1hZHJpZCAoc2VlIGN1cnJlbnQgYWRkcmVzcyBhdCB3d3cuY2FtZXJm
  52954. aXJtYS5jb20vYWRkcmVzcykxEjAQBgNVBAUTCUE4Mjc0MzI4NzEbMBkGA1UEChMSQUMgQ2FtZXJm
  52955. aXJtYSBTLkEuMScwJQYDVQQDEx5HbG9iYWwgQ2hhbWJlcnNpZ24gUm9vdCAtIDIwMDiCCQDJzdPp
  52956. 1X0jzjAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUHAgEWHGh0
  52957. dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAICIf3DekijZBZRG
  52958. /5BXqfEv3xoNa/p8DhxJJHkn2EaqbylZUohwEurdPfWbU1Rv4WCiqAm57OtZfMY18dwY6fFn5a+6
  52959. ReAJ3spED8IXDneRRXozX1+WLGiLwUePmJs9wOzL9dWCkoQ10b42OFZyMVtHLaoXpGNR6woBrX/s
  52960. dZ7LoR/xfxKxueRkf2fWIyr0uDldmOghp+G9PUIadJpwr2hsUF1Jz//7Dl3mLEfXgTpZALVza2Mg
  52961. 9jFFCDkO9HB+QHBaP9BrQql0PSgvAm11cpUJjUhjxsYjV5KTXjXBjfkK9yydYhz2rXzdpjEetrHH
  52962. foUm+qRqtdpjMNHvkzeyZi99Bffnt0uYlDXA2TopwZ2yUDMdSqlapskD7+3056huirRXhOukP9Du
  52963. qqqHW2Pok+JrqNS4cnhrG+055F3Lm6qH1U9OAP7Zap88MQ8oAgF9mOinsKJknnn4SPIVqczmyETr
  52964. P3iZ8ntxPjzxmKfFGBI/5rsoM0LpRQp8bfKGeS/Fghl9CYl8slR2iK7ewfPM4W7bMdaTrpmg7yVq
  52965. c5iJWzouE4gev8CSlDQb4ye3ix5vQv/n6TebUB0tovkC7stYWDpxvGjjqsGvHCgfotwjZT+B6q6Z
  52966. 09gwzxMNTxXJhLynSC34MCN32EZLeW32jO06f2ARePTpm67VVMB0gNELQp/B
  52967. -----END CERTIFICATE-----
  52968. Go Daddy Root Certificate Authority - G2
  52969. ========================================
  52970. -----BEGIN CERTIFICATE-----
  52971. MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  52972. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoTEUdvRGFkZHkuY29tLCBJbmMu
  52973. MTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5
  52974. MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6
  52975. b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8G
  52976. A1UEAxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI
  52977. hvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKDE6bFIEMBO4Tx5oVJnyfq
  52978. 9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD
  52979. +qK+ihVqf94Lw7YZFAXK6sOoBJQ7RnwyDfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutd
  52980. fMh8+7ArU6SSYmlRJQVhGkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMl
  52981. NAJWJwGRtDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEAAaNC
  52982. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFDqahQcQZyi27/a9
  52983. BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmXWWcDYfF+OwYxdS2hII5PZYe096ac
  52984. vNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r
  52985. 5N9ss4UXnT3ZJE95kTXWXwTrgIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYV
  52986. N8Gb5DKj7Tjo2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO
  52987. LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI4uJEvlz36hz1
  52988. -----END CERTIFICATE-----
  52989. Starfield Root Certificate Authority - G2
  52990. =========================================
  52991. -----BEGIN CERTIFICATE-----
  52992. MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  52993. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  52994. b2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVsZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0
  52995. eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAw
  52996. DgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQg
  52997. VGVjaG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZpY2F0ZSBB
  52998. dXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL3twQP89o/8ArFv
  52999. W59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMgnLRJdzIpVv257IzdIvpy3Cdhl+72WoTs
  53000. bhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNk
  53001. N3mSwOxGXn/hbVNMYq/NHwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7Nf
  53002. ZTD4p7dNdloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0HZbU
  53003. JtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  53004. AQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0GCSqGSIb3DQEBCwUAA4IBAQARWfol
  53005. TwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjUsHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx
  53006. 4mcujJUDJi5DnUox9g61DLu34jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUw
  53007. F5okxBDgBPfg8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K
  53008. pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1mMpYjn0q7pBZ
  53009. c2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0
  53010. -----END CERTIFICATE-----
  53011. Starfield Services Root Certificate Authority - G2
  53012. ==================================================
  53013. -----BEGIN CERTIFICATE-----
  53014. MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  53015. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  53016. b2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVsZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRl
  53017. IEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNV
  53018. BAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxT
  53019. dGFyZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2VydmljZXMg
  53020. Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
  53021. AQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20pOsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2
  53022. h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm28xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4Pa
  53023. hHQUw2eeBGg6345AWh1KTs9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLP
  53024. LJGmpufehRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk6mFB
  53025. rMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAwDwYDVR0TAQH/BAUw
  53026. AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+qAdcwKziIorhtSpzyEZGDMA0GCSqG
  53027. SIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMIbw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPP
  53028. E95Dz+I0swSdHynVv/heyNXBve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTy
  53029. xQGjhdByPq1zqwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd
  53030. iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn0q23KXB56jza
  53031. YyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCNsSi6
  53032. -----END CERTIFICATE-----
  53033. AffirmTrust Commercial
  53034. ======================
  53035. -----BEGIN CERTIFICATE-----
  53036. MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCVVMxFDAS
  53037. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMB4XDTEw
  53038. MDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  53039. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEF
  53040. AAOCAQ8AMIIBCgKCAQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6Eqdb
  53041. DuKPHx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yrba0F8PrV
  53042. C8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPALMeIrJmqbTFeurCA+ukV6
  53043. BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1yHp52UKqK39c/s4mT6NmgTWvRLpUHhww
  53044. MmWd5jyTXlBOeuM61G7MGvv50jeuJCqrVwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNV
  53045. HQ4EFgQUnZPGU4teyq8/nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  53046. AQYwDQYJKoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYGXUPG
  53047. hi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNjvbz4YYCanrHOQnDi
  53048. qX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivtZ8SOyUOyXGsViQK8YvxO8rUzqrJv
  53049. 0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9gN53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0kh
  53050. sUlHRUe072o0EclNmsxZt9YCnlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8=
  53051. -----END CERTIFICATE-----
  53052. AffirmTrust Networking
  53053. ======================
  53054. -----BEGIN CERTIFICATE-----
  53055. MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UEBhMCVVMxFDAS
  53056. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMB4XDTEw
  53057. MDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  53058. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEF
  53059. AAOCAQ8AMIIBCgKCAQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SE
  53060. Hi3yYJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbuakCNrmreI
  53061. dIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRLQESxG9fhwoXA3hA/Pe24
  53062. /PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gb
  53063. h+0t+nvujArjqWaJGctB+d1ENmHP4ndGyH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNV
  53064. HQ4EFgQUBx/S55zawm6iQLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  53065. AQYwDQYJKoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfOtDIu
  53066. UFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzuQY0x2+c06lkh1QF6
  53067. 12S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZLgo/bNjR9eUJtGxUAArgFU2HdW23
  53068. WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4uolu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9
  53069. /ZFvgrG+CJPbFEfxojfHRZ48x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s=
  53070. -----END CERTIFICATE-----
  53071. AffirmTrust Premium
  53072. ===================
  53073. -----BEGIN CERTIFICATE-----
  53074. MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UEBhMCVVMxFDAS
  53075. BgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMB4XDTEwMDEy
  53076. OTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRy
  53077. dXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  53078. MIICCgKCAgEAxBLfqV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtn
  53079. BKAQJG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ+jjeRFcV
  53080. 5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrSs8PhaJyJ+HoAVt70VZVs
  53081. +7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmd
  53082. GPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d770O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5R
  53083. p9EixAqnOEhss/n/fauGV+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NI
  53084. S+LI+H+SqHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S5u04
  53085. 6uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4IaC1nEWTJ3s7xgaVY5
  53086. /bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TXOwF0lkLgAOIua+rF7nKsu7/+6qqo
  53087. +Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYEFJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB
  53088. /wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByv
  53089. MiPIs0laUZx2KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg
  53090. Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B8OWycvpEgjNC
  53091. 6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQMKSOyARiqcTtNd56l+0OOF6S
  53092. L5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK
  53093. +4w1IX2COPKpVJEZNZOUbWo6xbLQu4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmV
  53094. BtWVyuEklut89pMFu+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFg
  53095. IxpHYoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8GKa1qF60
  53096. g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaORtGdFNrHF+QFlozEJLUb
  53097. zxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6eKeC2uAloGRwYQw==
  53098. -----END CERTIFICATE-----
  53099. AffirmTrust Premium ECC
  53100. =======================
  53101. -----BEGIN CERTIFICATE-----
  53102. MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMCVVMxFDASBgNV
  53103. BAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQcmVtaXVtIEVDQzAeFw0xMDAx
  53104. MjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJBgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1U
  53105. cnVzdDEgMB4GA1UEAwwXQWZmaXJtVHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQA
  53106. IgNiAAQNMF4bFZ0D0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQ
  53107. N8O9ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0GA1UdDgQW
  53108. BBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAK
  53109. BggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/VsaobgxCd05DhT1wV/GzTjxi+zygk8N53X
  53110. 57hG8f2h4nECMEJZh0PUUd+60wkyWs6Iflc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKM
  53111. eQ==
  53112. -----END CERTIFICATE-----
  53113. Certum Trusted Network CA
  53114. =========================
  53115. -----BEGIN CERTIFICATE-----
  53116. MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBMMSIwIAYDVQQK
  53117. ExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlv
  53118. biBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBUcnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIy
  53119. MTIwNzM3WhcNMjkxMjMxMTIwNzM3WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBU
  53120. ZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  53121. MSIwIAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0BAQEFAAOC
  53122. AQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rHUV+rpDKmYYe2bg+G0jAC
  53123. l/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LMTXPb865Px1bVWqeWifrzq2jUI4ZZJ88J
  53124. J7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVUBBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4
  53125. fOQtf/WsX+sWn7Et0brMkUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0
  53126. cvW0QM8xAcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNVHRMB
  53127. Af8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNVHQ8BAf8EBAMCAQYw
  53128. DQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15ysHhE49wcrwn9I0j6vSrEuVUEtRCj
  53129. jSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfLI9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1
  53130. mS1FhIrlQgnXdAIv94nYmem8J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5aj
  53131. Zt3hrvJBW8qYVoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI
  53132. 03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw=
  53133. -----END CERTIFICATE-----
  53134. TWCA Root Certification Authority
  53135. =================================
  53136. -----BEGIN CERTIFICATE-----
  53137. MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJ
  53138. VEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlmaWNh
  53139. dGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMzWhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQG
  53140. EwJUVzESMBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NB
  53141. IFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
  53142. AoIBAQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFEAcK0HMMx
  53143. QhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HHK3XLfJ+utdGdIzdjp9xC
  53144. oi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeXRfwZVzsrb+RH9JlF/h3x+JejiB03HFyP
  53145. 4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/zrX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1r
  53146. y+UPizgN7gr8/g+YnzAx3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIB
  53147. BjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkqhkiG
  53148. 9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeCMErJk/9q56YAf4lC
  53149. mtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdlsXebQ79NqZp4VKIV66IIArB6nCWlW
  53150. QtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62Dlhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVY
  53151. T0bf+215WfKEIlKuD8z7fDvnaspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocny
  53152. Yh0igzyXxfkZYiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw==
  53153. -----END CERTIFICATE-----
  53154. Security Communication RootCA2
  53155. ==============================
  53156. -----BEGIN CERTIFICATE-----
  53157. MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
  53158. U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMeU2VjdXJpdHkgQ29tbXVuaWNh
  53159. dGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoXDTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMC
  53160. SlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3Vy
  53161. aXR5IENvbW11bmljYXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  53162. ANAVOVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGrzbl+dp++
  53163. +T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVMVAX3NuRFg3sUZdbcDE3R
  53164. 3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQhNBqyjoGADdH5H5XTz+L62e4iKrFvlNV
  53165. spHEfbmwhRkGeC7bYRr6hfVKkaHnFtWOojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1K
  53166. EOtOghY6rCcMU/Gt1SSwawNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8
  53167. QIH4D5csOPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEB
  53168. CwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpFcoJxDjrSzG+ntKEj
  53169. u/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXcokgfGT+Ok+vx+hfuzU7jBBJV1uXk
  53170. 3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6q
  53171. tnRGEmyR7jTV7JqR50S+kDFy1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29
  53172. mvVXIwAHIRc/SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03
  53173. -----END CERTIFICATE-----
  53174. EC-ACC
  53175. ======
  53176. -----BEGIN CERTIFICATE-----
  53177. MIIFVjCCBD6gAwIBAgIQ7is969Qh3hSoYqwE893EATANBgkqhkiG9w0BAQUFADCB8zELMAkGA1UE
  53178. BhMCRVMxOzA5BgNVBAoTMkFnZW5jaWEgQ2F0YWxhbmEgZGUgQ2VydGlmaWNhY2lvIChOSUYgUS0w
  53179. ODAxMTc2LUkpMSgwJgYDVQQLEx9TZXJ2ZWlzIFB1YmxpY3MgZGUgQ2VydGlmaWNhY2lvMTUwMwYD
  53180. VQQLEyxWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAoYykwMzE1MDMGA1UE
  53181. CxMsSmVyYXJxdWlhIEVudGl0YXRzIGRlIENlcnRpZmljYWNpbyBDYXRhbGFuZXMxDzANBgNVBAMT
  53182. BkVDLUFDQzAeFw0wMzAxMDcyMzAwMDBaFw0zMTAxMDcyMjU5NTlaMIHzMQswCQYDVQQGEwJFUzE7
  53183. MDkGA1UEChMyQWdlbmNpYSBDYXRhbGFuYSBkZSBDZXJ0aWZpY2FjaW8gKE5JRiBRLTA4MDExNzYt
  53184. SSkxKDAmBgNVBAsTH1NlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8xNTAzBgNVBAsTLFZl
  53185. Z2V1IGh0dHBzOi8vd3d3LmNhdGNlcnQubmV0L3ZlcmFycmVsIChjKTAzMTUwMwYDVQQLEyxKZXJh
  53186. cnF1aWEgRW50aXRhdHMgZGUgQ2VydGlmaWNhY2lvIENhdGFsYW5lczEPMA0GA1UEAxMGRUMtQUND
  53187. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsyLHT+KXQpWIR4NA9h0X84NzJB5R85iK
  53188. w5K4/0CQBXCHYMkAqbWUZRkiFRfCQ2xmRJoNBD45b6VLeqpjt4pEndljkYRm4CgPukLjbo73FCeT
  53189. ae6RDqNfDrHrZqJyTxIThmV6PttPB/SnCWDaOkKZx7J/sxaVHMf5NLWUhdWZXqBIoH7nF2W4onW4
  53190. HvPlQn2v7fOKSGRdghST2MDk/7NQcvJ29rNdQlB50JQ+awwAvthrDk4q7D7SzIKiGGUzE3eeml0a
  53191. E9jD2z3Il3rucO2n5nzbcc8tlGLfbdb1OL4/pYUKGbio2Al1QnDE6u/LDsg0qBIimAy4E5S2S+zw
  53192. 0JDnJwIDAQABo4HjMIHgMB0GA1UdEQQWMBSBEmVjX2FjY0BjYXRjZXJ0Lm5ldDAPBgNVHRMBAf8E
  53193. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUoMOLRKo3pUW/l4Ba0fF4opvpXY0wfwYD
  53194. VR0gBHgwdjB0BgsrBgEEAfV4AQMBCjBlMCwGCCsGAQUFBwIBFiBodHRwczovL3d3dy5jYXRjZXJ0
  53195. Lm5ldC92ZXJhcnJlbDA1BggrBgEFBQcCAjApGidWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5l
  53196. dC92ZXJhcnJlbCAwDQYJKoZIhvcNAQEFBQADggEBAKBIW4IB9k1IuDlVNZyAelOZ1Vr/sXE7zDkJ
  53197. lF7W2u++AVtd0x7Y/X1PzaBB4DSTv8vihpw3kpBWHNzrKQXlxJ7HNd+KDM3FIUPpqojlNcAZQmNa
  53198. Al6kSBg6hW/cnbw/nZzBh7h6YQjpdwt/cKt63dmXLGQehb+8dJahw3oS7AwaboMMPOhyRp/7SNVe
  53199. l+axofjk70YllJyJ22k4vuxcDlbHZVHlUIiIv0LVKz3l+bqeLrPK9HOSAgu+TGbrIP65y7WZf+a2
  53200. E/rKS03Z7lNGBjvGTq2TWoF+bCpLagVFjPIhpDGQh2xlnJ2lYJU6Un/10asIbvPuW/mIPX64b24D
  53201. 5EI=
  53202. -----END CERTIFICATE-----
  53203. Hellenic Academic and Research Institutions RootCA 2011
  53204. =======================================================
  53205. -----BEGIN CERTIFICATE-----
  53206. MIIEMTCCAxmgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBlTELMAkGA1UEBhMCR1IxRDBCBgNVBAoT
  53207. O0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9y
  53208. aXR5MUAwPgYDVQQDEzdIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  53209. IFJvb3RDQSAyMDExMB4XDTExMTIwNjEzNDk1MloXDTMxMTIwMTEzNDk1MlowgZUxCzAJBgNVBAYT
  53210. AkdSMUQwQgYDVQQKEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  53211. IENlcnQuIEF1dGhvcml0eTFAMD4GA1UEAxM3SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNo
  53212. IEluc3RpdHV0aW9ucyBSb290Q0EgMjAxMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  53213. AKlTAOMupvaO+mDYLZU++CwqVE7NuYRhlFhPjz2L5EPzdYmNUeTDN9KKiE15HrcS3UN4SoqS5tdI
  53214. 1Q+kOilENbgH9mgdVc04UfCMJDGFr4PJfel3r+0ae50X+bOdOFAPplp5kYCvN66m0zH7tSYJnTxa
  53215. 71HFK9+WXesyHgLacEnsbgzImjeN9/E2YEsmLIKe0HjzDQ9jpFEw4fkrJxIH2Oq9GGKYsFk3fb7u
  53216. 8yBRQlqD75O6aRXxYp2fmTmCobd0LovUxQt7L/DICto9eQqakxylKHJzkUOap9FNhYS5qXSPFEDH
  53217. 3N6sQWRstBmbAmNtJGSPRLIl6s5ddAxjMlyNh+UCAwEAAaOBiTCBhjAPBgNVHRMBAf8EBTADAQH/
  53218. MAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQUppFC/RNhSiOeCKQp5dgTBCPuQSUwRwYDVR0eBEAwPqA8
  53219. MAWCAy5ncjAFggMuZXUwBoIELmVkdTAGggQub3JnMAWBAy5ncjAFgQMuZXUwBoEELmVkdTAGgQQu
  53220. b3JnMA0GCSqGSIb3DQEBBQUAA4IBAQAf73lB4XtuP7KMhjdCSk4cNx6NZrokgclPEg8hwAOXhiVt
  53221. XdMiKahsog2p6z0GW5k6x8zDmjR/qw7IThzh+uTczQ2+vyT+bOdrwg3IBp5OjWEopmr95fZi6hg8
  53222. TqBTnbI6nOulnJEWtk2C4AwFSKls9cz4y51JtPACpf1wA+2KIaWuE4ZJwzNzvoc7dIsXRSZMFpGD
  53223. /md9zU1jZ/rzAxKWeAaNsWftjj++n08C9bMJL/NMh98qy5V8AcysNnq/onN694/BtZqhFLKPM58N
  53224. 7yLcZnuEvUUXBj08yrl3NI/K6s8/MT7jiOOASSXIl7WdmplNsDz4SgCbZN2fOUvRJ9e4
  53225. -----END CERTIFICATE-----
  53226. Actalis Authentication Root CA
  53227. ==============================
  53228. -----BEGIN CERTIFICATE-----
  53229. MIIFuzCCA6OgAwIBAgIIVwoRl0LE48wwDQYJKoZIhvcNAQELBQAwazELMAkGA1UEBhMCSVQxDjAM
  53230. BgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UE
  53231. AwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290IENBMB4XDTExMDkyMjExMjIwMloXDTMwMDky
  53232. MjExMjIwMlowazELMAkGA1UEBhMCSVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlz
  53233. IFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290
  53234. IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp8bEpSmkLO/lGMWwUKNvUTufClrJ
  53235. wkg4CsIcoBh/kbWHuUA/3R1oHwiD1S0eiKD4j1aPbZkCkpAW1V8IbInX4ay8IMKx4INRimlNAJZa
  53236. by/ARH6jDuSRzVju3PvHHkVH3Se5CAGfpiEd9UEtL0z9KK3giq0itFZljoZUj5NDKd45RnijMCO6
  53237. zfB9E1fAXdKDa0hMxKufgFpbOr3JpyI/gCczWw63igxdBzcIy2zSekciRDXFzMwujt0q7bd9Zg1f
  53238. YVEiVRvjRuPjPdA1YprbrxTIW6HMiRvhMCb8oJsfgadHHwTrozmSBp+Z07/T6k9QnBn+locePGX2
  53239. oxgkg4YQ51Q+qDp2JE+BIcXjDwL4k5RHILv+1A7TaLndxHqEguNTVHnd25zS8gebLra8Pu2Fbe8l
  53240. EfKXGkJh90qX6IuxEAf6ZYGyojnP9zz/GPvG8VqLWeICrHuS0E4UT1lF9gxeKF+w6D9Fz8+vm2/7
  53241. hNN3WpVvrJSEnu68wEqPSpP4RCHiMUVhUE4Q2OM1fEwZtN4Fv6MGn8i1zeQf1xcGDXqVdFUNaBr8
  53242. EBtiZJ1t4JWgw5QHVw0U5r0F+7if5t+L4sbnfpb2U8WANFAoWPASUHEXMLrmeGO89LKtmyuy/uE5
  53243. jF66CyCU3nuDuP/jVo23Eek7jPKxwV2dpAtMK9myGPW1n0sCAwEAAaNjMGEwHQYDVR0OBBYEFFLY
  53244. iDrIn3hm7YnzezhwlMkCAjbQMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUUtiIOsifeGbt
  53245. ifN7OHCUyQICNtAwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQALe3KHwGCmSUyI
  53246. WOYdiPcUZEim2FgKDk8TNd81HdTtBjHIgT5q1d07GjLukD0R0i70jsNjLiNmsGe+b7bAEzlgqqI0
  53247. JZN1Ut6nna0Oh4lScWoWPBkdg/iaKWW+9D+a2fDzWochcYBNy+A4mz+7+uAwTc+G02UQGRjRlwKx
  53248. K3JCaKygvU5a2hi/a5iB0P2avl4VSM0RFbnAKVy06Ij3Pjaut2L9HmLecHgQHEhb2rykOLpn7VU+
  53249. Xlff1ANATIGk0k9jpwlCCRT8AKnCgHNPLsBA2RF7SOp6AsDT6ygBJlh0wcBzIm2Tlf05fbsq4/aC
  53250. 4yyXX04fkZT6/iyj2HYauE2yOE+b+h1IYHkm4vP9qdCa6HCPSXrW5b0KDtst842/6+OkfcvHlXHo
  53251. 2qN8xcL4dJIEG4aspCJTQLas/kx2z/uUMsA1n3Y/buWQbqCmJqK4LL7RK4X9p2jIugErsWx0Hbhz
  53252. lefut8cl8ABMALJ+tguLHPPAUJ4lueAI3jZm/zel0btUZCzJJ7VLkn5l/9Mt4blOvH+kQSGQQXem
  53253. OR/qnuOf0GZvBeyqdn6/axag67XH/JJULysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9
  53254. vwGYT7JZVEc+NHt4bVaTLnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg==
  53255. -----END CERTIFICATE-----
  53256. Trustis FPS Root CA
  53257. ===================
  53258. -----BEGIN CERTIFICATE-----
  53259. MIIDZzCCAk+gAwIBAgIQGx+ttiD5JNM2a/fH8YygWTANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQG
  53260. EwJHQjEYMBYGA1UEChMPVHJ1c3RpcyBMaW1pdGVkMRwwGgYDVQQLExNUcnVzdGlzIEZQUyBSb290
  53261. IENBMB4XDTAzMTIyMzEyMTQwNloXDTI0MDEyMTExMzY1NFowRTELMAkGA1UEBhMCR0IxGDAWBgNV
  53262. BAoTD1RydXN0aXMgTGltaXRlZDEcMBoGA1UECxMTVHJ1c3RpcyBGUFMgUm9vdCBDQTCCASIwDQYJ
  53263. KoZIhvcNAQEBBQADggEPADCCAQoCggEBAMVQe547NdDfxIzNjpvto8A2mfRC6qc+gIMPpqdZh8mQ
  53264. RUN+AOqGeSoDvT03mYlmt+WKVoaTnGhLaASMk5MCPjDSNzoiYYkchU59j9WvezX2fihHiTHcDnlk
  53265. H5nSW7r+f2C/revnPDgpai/lkQtV/+xvWNUtyd5MZnGPDNcE2gfmHhjjvSkCqPoc4Vu5g6hBSLwa
  53266. cY3nYuUtsuvffM/bq1rKMfFMIvMFE/eC+XN5DL7XSxzA0RU8k0Fk0ea+IxciAIleH2ulrG6nS4zt
  53267. o3Lmr2NNL4XSFDWaLk6M6jKYKIahkQlBOrTh4/L68MkKokHdqeMDx4gVOxzUGpTXn2RZEm0CAwEA
  53268. AaNTMFEwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBS6+nEleYtXQSUhhgtx67JkDoshZzAd
  53269. BgNVHQ4EFgQUuvpxJXmLV0ElIYYLceuyZA6LIWcwDQYJKoZIhvcNAQEFBQADggEBAH5Y//01GX2c
  53270. GE+esCu8jowU/yyg2kdbw++BLa8F6nRIW/M+TgfHbcWzk88iNVy2P3UnXwmWzaD+vkAMXBJV+JOC
  53271. yinpXj9WV4s4NvdFGkwozZ5BuO1WTISkQMi4sKUraXAEasP41BIy+Q7DsdwyhEQsb8tGD+pmQQ9P
  53272. 8Vilpg0ND2HepZ5dfWWhPBfnqFVO76DH7cZEf1T1o+CP8HxVIo8ptoGj4W1OLBuAZ+ytIJ8MYmHV
  53273. l/9D7S3B2l0pKoU/rGXuhg8FjZBf3+6f9L/uHfuY5H+QK4R4EA5sSVPvFVtlRkpdr7r7OnIdzfYl
  53274. iB6XzCGcKQENZetX2fNXlrtIzYE=
  53275. -----END CERTIFICATE-----
  53276. Buypass Class 2 Root CA
  53277. =======================
  53278. -----BEGIN CERTIFICATE-----
  53279. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  53280. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMiBSb290IENBMB4X
  53281. DTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1owTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  53282. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIw
  53283. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1
  53284. g1Lr6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPVL4O2fuPn
  53285. 9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC911K2GScuVr1QGbNgGE41b
  53286. /+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHxMlAQTn/0hpPshNOOvEu/XAFOBz3cFIqU
  53287. CqTqc/sLUegTBxj6DvEr0VQVfTzh97QZQmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeff
  53288. awrbD02TTqigzXsu8lkBarcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgI
  53289. zRFo1clrUs3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLiFRhn
  53290. Bkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRSP/TizPJhk9H9Z2vX
  53291. Uq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN9SG9dKpN6nIDSdvHXx1iY8f93ZHs
  53292. M+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxPAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  53293. VR0OBBYEFMmAd+BikoL1RpzzuvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  53294. AAOCAgEAU18h9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s
  53295. A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3tOluwlN5E40EI
  53296. osHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo+fsicdl9sz1Gv7SEr5AcD48S
  53297. aq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYd
  53298. DnkM/crqJIByw5c/8nerQyIKx+u2DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWD
  53299. LfJ6v9r9jv6ly0UsH8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0
  53300. oyLQI+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK75t98biGC
  53301. wWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h3PFaTWwyI0PurKju7koS
  53302. CTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPzY11aWOIv4x3kqdbQCtCev9eBCfHJxyYN
  53303. rJgWVqA=
  53304. -----END CERTIFICATE-----
  53305. Buypass Class 3 Root CA
  53306. =======================
  53307. -----BEGIN CERTIFICATE-----
  53308. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  53309. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMyBSb290IENBMB4X
  53310. DTEwMTAyNjA4Mjg1OFoXDTQwMTAyNjA4Mjg1OFowTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  53311. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDMgUm9vdCBDQTCCAiIw
  53312. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKXaCpUWUOOV8l6ddjEGMnqb8RB2uACatVI2zSRH
  53313. sJ8YZLya9vrVediQYkwiL944PdbgqOkcLNt4EemOaFEVcsfzM4fkoF0LXOBXByow9c3EN3coTRiR
  53314. 5r/VUv1xLXA+58bEiuPwKAv0dpihi4dVsjoT/Lc+JzeOIuOoTyrvYLs9tznDDgFHmV0ST9tD+leh
  53315. 7fmdvhFHJlsTmKtdFoqwNxxXnUX/iJY2v7vKB3tvh2PX0DJq1l1sDPGzbjniazEuOQAnFN44wOwZ
  53316. ZoYS6J1yFhNkUsepNxz9gjDthBgd9K5c/3ATAOux9TN6S9ZV+AWNS2mw9bMoNlwUxFFzTWsL8TQH
  53317. 2xc519woe2v1n/MuwU8XKhDzzMro6/1rqy6any2CbgTUUgGTLT2G/H783+9CHaZr77kgxve9oKeV
  53318. /afmiSTYzIw0bOIjL9kSGiG5VZFvC5F5GQytQIgLcOJ60g7YaEi7ghM5EFjp2CoHxhLbWNvSO1UQ
  53319. RwUVZ2J+GGOmRj8JDlQyXr8NYnon74Do29lLBlo3WiXQCBJ31G8JUJc9yB3D34xFMFbG02SrZvPA
  53320. Xpacw8Tvw3xrizp5f7NJzz3iiZ+gMEuFuZyUJHmPfWupRWgPK9Dx2hzLabjKSWJtyNBjYt1gD1iq
  53321. j6G8BaVmos8bdrKEZLFMOVLAMLrwjEsCsLa3AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  53322. VR0OBBYEFEe4zf/lb+74suwvTg75JbCOPGvDMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  53323. AAOCAgEAACAjQTUEkMJAYmDv4jVM1z+s4jSQuKFvdvoWFqRINyzpkMLyPPgKn9iB5btb2iUspKdV
  53324. cSQy9sgL8rxq+JOssgfCX5/bzMiKqr5qb+FJEMwx14C7u8jYog5kV+qi9cKpMRXSIGrs/CIBKM+G
  53325. uIAeqcwRpTzyFrNHnfzSgCHEy9BHcEGhyoMZCCxt8l13nIoUE9Q2HJLw5QY33KbmkJs4j1xrG0aG
  53326. Q0JfPgEHU1RdZX33inOhmlRaHylDFCfChQ+1iHsaO5S3HWCntZznKWlXWpuTekMwGwPXYshApqr8
  53327. ZORK15FTAaggiG6cX0S5y2CBNOxv033aSF/rtJC8LakcC6wc1aJoIIAE1vyxjy+7SjENSoYc6+I2
  53328. KSb12tjE8nVhz36udmNKekBlk4f4HoCMhuWG1o8O/FMsYOgWYRqiPkN7zTlgVGr18okmAWiDSKIz
  53329. 6MkEkbIRNBE+6tBDGR8Dk5AM/1E9V/RBbuHLoL7ryWPNbczk+DaqaJ3tvV2XcEQNtg413OEMXbug
  53330. UZTLfhbrES+jkkXITHHZvMmZUldGL1DPvTVp9D0VzgalLA8+9oG6lLvDu79leNKGef9JOxqDDPDe
  53331. eOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq4/g7u9xN12TyUb7mqqta6THuBrxzvxNi
  53332. Cp/HuZc=
  53333. -----END CERTIFICATE-----
  53334. T-TeleSec GlobalRoot Class 3
  53335. ============================
  53336. -----BEGIN CERTIFICATE-----
  53337. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  53338. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  53339. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgx
  53340. MDAxMTAyOTU2WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  53341. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  53342. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0GCSqGSIb3
  53343. DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN8ELg63iIVl6bmlQdTQyK
  53344. 9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/RLyTPWGrTs0NvvAgJ1gORH8EGoel15YU
  53345. NpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZF
  53346. iP0Zf3WHHx+xGwpzJFu5ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W
  53347. 0eDrXltMEnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGjQjBA
  53348. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1A/d2O2GCahKqGFPr
  53349. AyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOyWL6ukK2YJ5f+AbGwUgC4TeQbIXQb
  53350. fsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ1GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzT
  53351. ucpH9sry9uetuUg/vBa3wW306gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7h
  53352. P0HHRwA11fXT91Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml
  53353. e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4pTpPDpFQUWw==
  53354. -----END CERTIFICATE-----
  53355. EE Certification Centre Root CA
  53356. ===============================
  53357. -----BEGIN CERTIFICATE-----
  53358. MIIEAzCCAuugAwIBAgIQVID5oHPtPwBMyonY43HmSjANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQG
  53359. EwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1czEoMCYGA1UEAwwfRUUgQ2Vy
  53360. dGlmaWNhdGlvbiBDZW50cmUgUm9vdCBDQTEYMBYGCSqGSIb3DQEJARYJcGtpQHNrLmVlMCIYDzIw
  53361. MTAxMDMwMTAxMDMwWhgPMjAzMDEyMTcyMzU5NTlaMHUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKDBlB
  53362. UyBTZXJ0aWZpdHNlZXJpbWlza2Vza3VzMSgwJgYDVQQDDB9FRSBDZXJ0aWZpY2F0aW9uIENlbnRy
  53363. ZSBSb290IENBMRgwFgYJKoZIhvcNAQkBFglwa2lAc2suZWUwggEiMA0GCSqGSIb3DQEBAQUAA4IB
  53364. DwAwggEKAoIBAQDIIMDs4MVLqwd4lfNE7vsLDP90jmG7sWLqI9iroWUyeuuOF0+W2Ap7kaJjbMeM
  53365. TC55v6kF/GlclY1i+blw7cNRfdCT5mzrMEvhvH2/UpvObntl8jixwKIy72KyaOBhU8E2lf/slLo2
  53366. rpwcpzIP5Xy0xm90/XsY6KxX7QYgSzIwWFv9zajmofxwvI6Sc9uXp3whrj3B9UiHbCe9nyV0gVWw
  53367. 93X2PaRka9ZP585ArQ/dMtO8ihJTmMmJ+xAdTX7Nfh9WDSFwhfYggx/2uh8Ej+p3iDXE/+pOoYtN
  53368. P2MbRMNE1CV2yreN1x5KZmTNXMWcg+HCCIia7E6j8T4cLNlsHaFLAgMBAAGjgYowgYcwDwYDVR0T
  53369. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBLyWj7qVhy/zQas8fElyalL1BSZ
  53370. MEUGA1UdJQQ+MDwGCCsGAQUFBwMCBggrBgEFBQcDAQYIKwYBBQUHAwMGCCsGAQUFBwMEBggrBgEF
  53371. BQcDCAYIKwYBBQUHAwkwDQYJKoZIhvcNAQEFBQADggEBAHv25MANqhlHt01Xo/6tu7Fq1Q+e2+Rj
  53372. xY6hUFaTlrg4wCQiZrxTFGGVv9DHKpY5P30osxBAIWrEr7BSdxjhlthWXePdNl4dp1BUoMUq5KqM
  53373. lIpPnTX/dqQGE5Gion0ARD9V04I8GtVbvFZMIi5GQ4okQC3zErg7cBqklrkar4dBGmoYDQZPxz5u
  53374. uSlNDUmJEYcyW+ZLBMjkXOZ0c5RdFpgTlf7727FE5TpwrDdr5rMzcijJs1eg9gIWiAYLtqZLICjU
  53375. 3j2LrTcFU3T+bsy8QxdxXvnFzBqpYe73dgzzcvRyrc9yAjYHR8/vGVCJYMzpJJUPwssd8m92kMfM
  53376. dcGWxZ0=
  53377. -----END CERTIFICATE-----
  53378. D-TRUST Root Class 3 CA 2 2009
  53379. ==============================
  53380. -----BEGIN CERTIFICATE-----
  53381. MIIEMzCCAxugAwIBAgIDCYPzMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  53382. DAxELVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTAe
  53383. Fw0wOTExMDUwODM1NThaFw0yOTExMDUwODM1NThaME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxE
  53384. LVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTCCASIw
  53385. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANOySs96R+91myP6Oi/WUEWJNTrGa9v+2wBoqOAD
  53386. ER03UAifTUpolDWzU9GUY6cgVq/eUXjsKj3zSEhQPgrfRlWLJ23DEE0NkVJD2IfgXU42tSHKXzlA
  53387. BF9bfsyjxiupQB7ZNoTWSPOSHjRGICTBpFGOShrvUD9pXRl/RcPHAY9RySPocq60vFYJfxLLHLGv
  53388. KZAKyVXMD9O0Gu1HNVpK7ZxzBCHQqr0ME7UAyiZsxGsMlFqVlNpQmvH/pStmMaTJOKDfHR+4CS7z
  53389. p+hnUquVH+BGPtikw8paxTGA6Eian5Rp/hnd2HN8gcqW3o7tszIFZYQ05ub9VxC1X3a/L7AQDcUC
  53390. AwEAAaOCARowggEWMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFP3aFMSfMN4hvR5COfyrYyNJ
  53391. 4PGEMA4GA1UdDwEB/wQEAwIBBjCB0wYDVR0fBIHLMIHIMIGAoH6gfIZ6bGRhcDovL2RpcmVjdG9y
  53392. eS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwUm9vdCUyMENsYXNzJTIwMyUyMENBJTIwMiUyMDIw
  53393. MDksTz1ELVRydXN0JTIwR21iSCxDPURFP2NlcnRpZmljYXRlcmV2b2NhdGlvbmxpc3QwQ6BBoD+G
  53394. PWh0dHA6Ly93d3cuZC10cnVzdC5uZXQvY3JsL2QtdHJ1c3Rfcm9vdF9jbGFzc18zX2NhXzJfMjAw
  53395. OS5jcmwwDQYJKoZIhvcNAQELBQADggEBAH+X2zDI36ScfSF6gHDOFBJpiBSVYEQBrLLpME+bUMJm
  53396. 2H6NMLVwMeniacfzcNsgFYbQDfC+rAF1hM5+n02/t2A7nPPKHeJeaNijnZflQGDSNiH+0LS4F9p0
  53397. o3/U37CYAqxva2ssJSRyoWXuJVrl5jLn8t+rSfrzkGkj2wTZ51xY/GXUl77M/C4KzCUqNQT4YJEV
  53398. dT1B/yMfGchs64JTBKbkTCJNjYy6zltz7GRUUG3RnFX7acM2w4y8PIWmawomDeCTmGCufsYkl4ph
  53399. X5GOZpIJhzbNi5stPvZR1FDUWSi9g/LMKHtThm3YJohw1+qRzT65ysCQblrGXnRl11z+o+I=
  53400. -----END CERTIFICATE-----
  53401. D-TRUST Root Class 3 CA 2 EV 2009
  53402. =================================
  53403. -----BEGIN CERTIFICATE-----
  53404. MIIEQzCCAyugAwIBAgIDCYP0MA0GCSqGSIb3DQEBCwUAMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  53405. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  53406. OTAeFw0wOTExMDUwODUwNDZaFw0yOTExMDUwODUwNDZaMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  53407. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  53408. OTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJnxhDRwui+3MKCOvXwEz75ivJn9gpfS
  53409. egpnljgJ9hBOlSJzmY3aFS3nBfwZcyK3jpgAvDw9rKFs+9Z5JUut8Mxk2og+KbgPCdM03TP1YtHh
  53410. zRnp7hhPTFiu4h7WDFsVWtg6uMQYZB7jM7K1iXdODL/ZlGsTl28So/6ZqQTMFexgaDbtCHu39b+T
  53411. 7WYxg4zGcTSHThfqr4uRjRxWQa4iN1438h3Z0S0NL2lRp75mpoo6Kr3HGrHhFPC+Oh25z1uxav60
  53412. sUYgovseO3Dvk5h9jHOW8sXvhXCtKSb8HgQ+HKDYD8tSg2J87otTlZCpV6LqYQXY+U3EJ/pure35
  53413. 11H3a6UCAwEAAaOCASQwggEgMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNOUikxiEyoZLsyv
  53414. cop9NteaHNxnMA4GA1UdDwEB/wQEAwIBBjCB3QYDVR0fBIHVMIHSMIGHoIGEoIGBhn9sZGFwOi8v
  53415. ZGlyZWN0b3J5LmQtdHJ1c3QubmV0L0NOPUQtVFJVU1QlMjBSb290JTIwQ2xhc3MlMjAzJTIwQ0El
  53416. MjAyJTIwRVYlMjAyMDA5LE89RC1UcnVzdCUyMEdtYkgsQz1ERT9jZXJ0aWZpY2F0ZXJldm9jYXRp
  53417. b25saXN0MEagRKBChkBodHRwOi8vd3d3LmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X3Jvb3RfY2xh
  53418. c3NfM19jYV8yX2V2XzIwMDkuY3JsMA0GCSqGSIb3DQEBCwUAA4IBAQA07XtaPKSUiO8aEXUHL7P+
  53419. PPoeUSbrh/Yp3uDx1MYkCenBz1UbtDDZzhr+BlGmFaQt77JLvyAoJUnRpjZ3NOhk31KxEcdzes05
  53420. nsKtjHEh8lprr988TlWvsoRlFIm5d8sqMb7Po23Pb0iUMkZv53GMoKaEGTcH8gNFCSuGdXzfX2lX
  53421. ANtu2KZyIktQ1HWYVt+3GP9DQ1CuekR78HlR10M9p9OB0/DJT7naxpeG0ILD5EJt/rDiZE4OJudA
  53422. NCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqXKVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVv
  53423. w9y4AyHqnxbxLFS1
  53424. -----END CERTIFICATE-----
  53425. CA Disig Root R2
  53426. ================
  53427. -----BEGIN CERTIFICATE-----
  53428. MIIFaTCCA1GgAwIBAgIJAJK4iNuwisFjMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNVBAYTAlNLMRMw
  53429. EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp
  53430. ZyBSb290IFIyMB4XDTEyMDcxOTA5MTUzMFoXDTQyMDcxOTA5MTUzMFowUjELMAkGA1UEBhMCU0sx
  53431. EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp
  53432. c2lnIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCio8QACdaFXS1tFPbC
  53433. w3OeNcJxVX6B+6tGUODBfEl45qt5WDza/3wcn9iXAng+a0EE6UG9vgMsRfYvZNSrXaNHPWSb6Wia
  53434. xswbP7q+sos0Ai6YVRn8jG+qX9pMzk0DIaPY0jSTVpbLTAwAFjxfGs3Ix2ymrdMxp7zo5eFm1tL7
  53435. A7RBZckQrg4FY8aAamkw/dLukO8NJ9+flXP04SXabBbeQTg06ov80egEFGEtQX6sx3dOy1FU+16S
  53436. GBsEWmjGycT6txOgmLcRK7fWV8x8nhfRyyX+hk4kLlYMeE2eARKmK6cBZW58Yh2EhN/qwGu1pSqV
  53437. g8NTEQxzHQuyRpDRQjrOQG6Vrf/GlK1ul4SOfW+eioANSW1z4nuSHsPzwfPrLgVv2RvPN3YEyLRa
  53438. 5Beny912H9AZdugsBbPWnDTYltxhh5EF5EQIM8HauQhl1K6yNg3ruji6DOWbnuuNZt2Zz9aJQfYE
  53439. koopKW1rOhzndX0CcQ7zwOe9yxndnWCywmZgtrEE7snmhrmaZkCo5xHtgUUDi/ZnWejBBhG93c+A
  53440. Ak9lQHhcR1DIm+YfgXvkRKhbhZri3lrVx/k6RGZL5DJUfORsnLMOPReisjQS1n6yqEm70XooQL6i
  53441. Fh/f5DcfEXP7kAplQ6INfPgGAVUzfbANuPT1rqVCV3w2EYx7XsQDnYx5nQIDAQABo0IwQDAPBgNV
  53442. HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUtZn4r7CU9eMg1gqtzk5WpC5u
  53443. Qu0wDQYJKoZIhvcNAQELBQADggIBACYGXnDnZTPIgm7ZnBc6G3pmsgH2eDtpXi/q/075KMOYKmFM
  53444. tCQSin1tERT3nLXK5ryeJ45MGcipvXrA1zYObYVybqjGom32+nNjf7xueQgcnYqfGopTpti72TVV
  53445. sRHFqQOzVju5hJMiXn7B9hJSi+osZ7z+Nkz1uM/Rs0mSO9MpDpkblvdhuDvEK7Z4bLQjb/D907Je
  53446. dR+Zlais9trhxTF7+9FGs9K8Z7RiVLoJ92Owk6Ka+elSLotgEqv89WBW7xBci8QaQtyDW2QOy7W8
  53447. 1k/BfDxujRNt+3vrMNDcTa/F1balTFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjx
  53448. mHHEt38OFdAlab0inSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01
  53449. utI3gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18DrG5gPcFw0
  53450. sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3OszMOl6W8KjptlwlCFtaOg
  53451. UxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8xL4ysEr3vQCj8KWefshNPZiTEUxnpHikV
  53452. 7+ZtsH8tZ/3zbBt1RqPlShfppNcL
  53453. -----END CERTIFICATE-----
  53454. ACCVRAIZ1
  53455. =========
  53456. -----BEGIN CERTIFICATE-----
  53457. MIIH0zCCBbugAwIBAgIIXsO3pkN/pOAwDQYJKoZIhvcNAQEFBQAwQjESMBAGA1UEAwwJQUNDVlJB
  53458. SVoxMRAwDgYDVQQLDAdQS0lBQ0NWMQ0wCwYDVQQKDARBQ0NWMQswCQYDVQQGEwJFUzAeFw0xMTA1
  53459. MDUwOTM3MzdaFw0zMDEyMzEwOTM3MzdaMEIxEjAQBgNVBAMMCUFDQ1ZSQUlaMTEQMA4GA1UECwwH
  53460. UEtJQUNDVjENMAsGA1UECgwEQUNDVjELMAkGA1UEBhMCRVMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  53461. DwAwggIKAoICAQCbqau/YUqXry+XZpp0X9DZlv3P4uRm7x8fRzPCRKPfmt4ftVTdFXxpNRFvu8gM
  53462. jmoYHtiP2Ra8EEg2XPBjs5BaXCQ316PWywlxufEBcoSwfdtNgM3802/J+Nq2DoLSRYWoG2ioPej0
  53463. RGy9ocLLA76MPhMAhN9KSMDjIgro6TenGEyxCQ0jVn8ETdkXhBilyNpAlHPrzg5XPAOBOp0KoVdD
  53464. aaxXbXmQeOW1tDvYvEyNKKGno6e6Ak4l0Squ7a4DIrhrIA8wKFSVf+DuzgpmndFALW4ir50awQUZ
  53465. 0m/A8p/4e7MCQvtQqR0tkw8jq8bBD5L/0KIV9VMJcRz/RROE5iZe+OCIHAr8Fraocwa48GOEAqDG
  53466. WuzndN9wrqODJerWx5eHk6fGioozl2A3ED6XPm4pFdahD9GILBKfb6qkxkLrQaLjlUPTAYVtjrs7
  53467. 8yM2x/474KElB0iryYl0/wiPgL/AlmXz7uxLaL2diMMxs0Dx6M/2OLuc5NF/1OVYm3z61PMOm3WR
  53468. 5LpSLhl+0fXNWhn8ugb2+1KoS5kE3fj5tItQo05iifCHJPqDQsGH+tUtKSpacXpkatcnYGMN285J
  53469. 9Y0fkIkyF/hzQ7jSWpOGYdbhdQrqeWZ2iE9x6wQl1gpaepPluUsXQA+xtrn13k/c4LOsOxFwYIRK
  53470. Q26ZIMApcQrAZQIDAQABo4ICyzCCAscwfQYIKwYBBQUHAQEEcTBvMEwGCCsGAQUFBzAChkBodHRw
  53471. Oi8vd3d3LmFjY3YuZXMvZmlsZWFkbWluL0FyY2hpdm9zL2NlcnRpZmljYWRvcy9yYWl6YWNjdjEu
  53472. Y3J0MB8GCCsGAQUFBzABhhNodHRwOi8vb2NzcC5hY2N2LmVzMB0GA1UdDgQWBBTSh7Tj3zcnk1X2
  53473. VuqB5TbMjB4/vTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNKHtOPfNyeTVfZW6oHlNsyM
  53474. Hj+9MIIBcwYDVR0gBIIBajCCAWYwggFiBgRVHSAAMIIBWDCCASIGCCsGAQUFBwICMIIBFB6CARAA
  53475. QQB1AHQAbwByAGkAZABhAGQAIABkAGUAIABDAGUAcgB0AGkAZgBpAGMAYQBjAGkA8wBuACAAUgBh
  53476. AO0AegAgAGQAZQAgAGwAYQAgAEEAQwBDAFYAIAAoAEEAZwBlAG4AYwBpAGEAIABkAGUAIABUAGUA
  53477. YwBuAG8AbABvAGcA7QBhACAAeQAgAEMAZQByAHQAaQBmAGkAYwBhAGMAaQDzAG4AIABFAGwAZQBj
  53478. AHQAcgDzAG4AaQBjAGEALAAgAEMASQBGACAAUQA0ADYAMAAxADEANQA2AEUAKQAuACAAQwBQAFMA
  53479. IABlAG4AIABoAHQAdABwADoALwAvAHcAdwB3AC4AYQBjAGMAdgAuAGUAczAwBggrBgEFBQcCARYk
  53480. aHR0cDovL3d3dy5hY2N2LmVzL2xlZ2lzbGFjaW9uX2MuaHRtMFUGA1UdHwROMEwwSqBIoEaGRGh0
  53481. dHA6Ly93d3cuYWNjdi5lcy9maWxlYWRtaW4vQXJjaGl2b3MvY2VydGlmaWNhZG9zL3JhaXphY2N2
  53482. MV9kZXIuY3JsMA4GA1UdDwEB/wQEAwIBBjAXBgNVHREEEDAOgQxhY2N2QGFjY3YuZXMwDQYJKoZI
  53483. hvcNAQEFBQADggIBAJcxAp/n/UNnSEQU5CmH7UwoZtCPNdpNYbdKl02125DgBS4OxnnQ8pdpD70E
  53484. R9m+27Up2pvZrqmZ1dM8MJP1jaGo/AaNRPTKFpV8M9xii6g3+CfYCS0b78gUJyCpZET/LtZ1qmxN
  53485. YEAZSUNUY9rizLpm5U9EelvZaoErQNV/+QEnWCzI7UiRfD+mAM/EKXMRNt6GGT6d7hmKG9Ww7Y49
  53486. nCrADdg9ZuM8Db3VlFzi4qc1GwQA9j9ajepDvV+JHanBsMyZ4k0ACtrJJ1vnE5Bc5PUzolVt3OAJ
  53487. TS+xJlsndQAJxGJ3KQhfnlmstn6tn1QwIgPBHnFk/vk4CpYY3QIUrCPLBhwepH2NDd4nQeit2hW3
  53488. sCPdK6jT2iWH7ehVRE2I9DZ+hJp4rPcOVkkO1jMl1oRQQmwgEh0q1b688nCBpHBgvgW1m54ERL5h
  53489. I6zppSSMEYCUWqKiuUnSwdzRp+0xESyeGabu4VXhwOrPDYTkF7eifKXeVSUG7szAh1xA2syVP1Xg
  53490. Nce4hL60Xc16gwFy7ofmXx2utYXGJt/mwZrpHgJHnyqobalbz+xFd3+YJ5oyXSrjhO7FmGYvliAd
  53491. 3djDJ9ew+f7Zfc3Qn48LFFhRny+Lwzgt3uiP1o2HpPVWQxaZLPSkVrQ0uGE3ycJYgBugl6H8WY3p
  53492. EfbRD0tVNEYqi4Y7
  53493. -----END CERTIFICATE-----
  53494. TWCA Global Root CA
  53495. ===================
  53496. -----BEGIN CERTIFICATE-----
  53497. MIIFQTCCAymgAwIBAgICDL4wDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVFcxEjAQBgNVBAoT
  53498. CVRBSVdBTi1DQTEQMA4GA1UECxMHUm9vdCBDQTEcMBoGA1UEAxMTVFdDQSBHbG9iYWwgUm9vdCBD
  53499. QTAeFw0xMjA2MjcwNjI4MzNaFw0zMDEyMzExNTU5NTlaMFExCzAJBgNVBAYTAlRXMRIwEAYDVQQK
  53500. EwlUQUlXQU4tQ0ExEDAOBgNVBAsTB1Jvb3QgQ0ExHDAaBgNVBAMTE1RXQ0EgR2xvYmFsIFJvb3Qg
  53501. Q0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCwBdvI64zEbooh745NnHEKH1Jw7W2C
  53502. nJfF10xORUnLQEK1EjRsGcJ0pDFfhQKX7EMzClPSnIyOt7h52yvVavKOZsTuKwEHktSz0ALfUPZV
  53503. r2YOy+BHYC8rMjk1Ujoog/h7FsYYuGLWRyWRzvAZEk2tY/XTP3VfKfChMBwqoJimFb3u/Rk28OKR
  53504. Q4/6ytYQJ0lM793B8YVwm8rqqFpD/G2Gb3PpN0Wp8DbHzIh1HrtsBv+baz4X7GGqcXzGHaL3SekV
  53505. tTzWoWH1EfcFbx39Eb7QMAfCKbAJTibc46KokWofwpFFiFzlmLhxpRUZyXx1EcxwdE8tmx2RRP1W
  53506. KKD+u4ZqyPpcC1jcxkt2yKsi2XMPpfRaAok/T54igu6idFMqPVMnaR1sjjIsZAAmY2E2TqNGtz99
  53507. sy2sbZCilaLOz9qC5wc0GZbpuCGqKX6mOL6OKUohZnkfs8O1CWfe1tQHRvMq2uYiN2DLgbYPoA/p
  53508. yJV/v1WRBXrPPRXAb94JlAGD1zQbzECl8LibZ9WYkTunhHiVJqRaCPgrdLQABDzfuBSO6N+pjWxn
  53509. kjMdwLfS7JLIvgm/LCkFbwJrnu+8vyq8W8BQj0FwcYeyTbcEqYSjMq+u7msXi7Kx/mzhkIyIqJdI
  53510. zshNy/MGz19qCkKxHh53L46g5pIOBvwFItIm4TFRfTLcDwIDAQABoyMwITAOBgNVHQ8BAf8EBAMC
  53511. AQYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAXzSBdu+WHdXltdkCY4QWwa6g
  53512. cFGn90xHNcgL1yg9iXHZqjNB6hQbbCEAwGxCGX6faVsgQt+i0trEfJdLjbDorMjupWkEmQqSpqsn
  53513. LhpNgb+E1HAerUf+/UqdM+DyucRFCCEK2mlpc3INvjT+lIutwx4116KD7+U4x6WFH6vPNOw/KP4M
  53514. 8VeGTslV9xzU2KV9Bnpv1d8Q34FOIWWxtuEXeZVFBs5fzNxGiWNoRI2T9GRwoD2dKAXDOXC4Ynsg
  53515. /eTb6QihuJ49CcdP+yz4k3ZB3lLg4VfSnQO8d57+nile98FRYB/e2guyLXW3Q0iT5/Z5xoRdgFlg
  53516. lPx4mI88k1HtQJAH32RjJMtOcQWh15QaiDLxInQirqWm2BJpTGCjAu4r7NRjkgtevi92a6O2JryP
  53517. A9gK8kxkRr05YuWW6zRjESjMlfGt7+/cgFhI6Uu46mWs6fyAtbXIRfmswZ/ZuepiiI7E8UuDEq3m
  53518. i4TWnsLrgxifarsbJGAzcMzs9zLzXNl5fe+epP7JI8Mk7hWSsT2RTyaGvWZzJBPqpK5jwa19hAM8
  53519. EHiGG3njxPPyBJUgriOCxLM6AGK/5jYk4Ve6xx6QddVfP5VhK8E7zeWzaGHQRiapIVJpLesux+t3
  53520. zqY6tQMzT3bR51xUAV3LePTJDL/PEo4XLSNolOer/qmyKwbQBM0=
  53521. -----END CERTIFICATE-----
  53522. TeliaSonera Root CA v1
  53523. ======================
  53524. -----BEGIN CERTIFICATE-----
  53525. MIIFODCCAyCgAwIBAgIRAJW+FqD3LkbxezmCcvqLzZYwDQYJKoZIhvcNAQEFBQAwNzEUMBIGA1UE
  53526. CgwLVGVsaWFTb25lcmExHzAdBgNVBAMMFlRlbGlhU29uZXJhIFJvb3QgQ0EgdjEwHhcNMDcxMDE4
  53527. MTIwMDUwWhcNMzIxMDE4MTIwMDUwWjA3MRQwEgYDVQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwW
  53528. VGVsaWFTb25lcmEgUm9vdCBDQSB2MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMK+
  53529. 6yfwIaPzaSZVfp3FVRaRXP3vIb9TgHot0pGMYzHw7CTww6XScnwQbfQ3t+XmfHnqjLWCi65ItqwA
  53530. 3GV17CpNX8GH9SBlK4GoRz6JI5UwFpB/6FcHSOcZrr9FZ7E3GwYq/t75rH2D+1665I+XZ75Ljo1k
  53531. B1c4VWk0Nj0TSO9P4tNmHqTPGrdeNjPUtAa9GAH9d4RQAEX1jF3oI7x+/jXh7VB7qTCNGdMJjmhn
  53532. Xb88lxhTuylixcpecsHHltTbLaC0H2kD7OriUPEMPPCs81Mt8Bz17Ww5OXOAFshSsCPN4D7c3TxH
  53533. oLs1iuKYaIu+5b9y7tL6pe0S7fyYGKkmdtwoSxAgHNN/Fnct7W+A90m7UwW7XWjH1Mh1Fj+JWov3
  53534. F0fUTPHSiXk+TT2YqGHeOh7S+F4D4MHJHIzTjU3TlTazN19jY5szFPAtJmtTfImMMsJu7D0hADnJ
  53535. oWjiUIMusDor8zagrC/kb2HCUQk5PotTubtn2txTuXZZNp1D5SDgPTJghSJRt8czu90VL6R4pgd7
  53536. gUY2BIbdeTXHlSw7sKMXNeVzH7RcWe/a6hBle3rQf5+ztCo3O3CLm1u5K7fsslESl1MpWtTwEhDc
  53537. TwK7EpIvYtQ/aUN8Ddb8WHUBiJ1YFkveupD/RwGJBmr2X7KQarMCpgKIv7NHfirZ1fpoeDVNAgMB
  53538. AAGjPzA9MA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1UdDgQWBBTwj1k4ALP1j5qW
  53539. DNXr+nuqF+gTEjANBgkqhkiG9w0BAQUFAAOCAgEAvuRcYk4k9AwI//DTDGjkk0kiP0Qnb7tt3oNm
  53540. zqjMDfz1mgbldxSR651Be5kqhOX//CHBXfDkH1e3damhXwIm/9fH907eT/j3HEbAek9ALCI18Bmx
  53541. 0GtnLLCo4MBANzX2hFxc469CeP6nyQ1Q6g2EdvZR74NTxnr/DlZJLo961gzmJ1TjTQpgcmLNkQfW
  53542. pb/ImWvtxBnmq0wROMVvMeJuScg/doAmAyYp4Db29iBT4xdwNBedY2gea+zDTYa4EzAvXUYNR0PV
  53543. G6pZDrlcjQZIrXSHX8f8MVRBE+LHIQ6e4B4N4cB7Q4WQxYpYxmUKeFfyxiMPAdkgS94P+5KFdSpc
  53544. c41teyWRyu5FrgZLAMzTsVlQ2jqIOylDRl6XK1TOU2+NSueW+r9xDkKLfP0ooNBIytrEgUy7onOT
  53545. JsjrDNYmiLbAJM+7vVvrdX3pCI6GMyx5dwlppYn8s3CQh3aP0yK7Qs69cwsgJirQmz1wHiRszYd2
  53546. qReWt88NkvuOGKmYSdGe/mBEciG5Ge3C9THxOUiIkCR1VBatzvT4aRRkOfujuLpwQMcnHL/EVlP6
  53547. Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVxSK236thZiNSQvxaz2ems
  53548. WWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY=
  53549. -----END CERTIFICATE-----
  53550. E-Tugra Certification Authority
  53551. ===============================
  53552. -----BEGIN CERTIFICATE-----
  53553. MIIGSzCCBDOgAwIBAgIIamg+nFGby1MwDQYJKoZIhvcNAQELBQAwgbIxCzAJBgNVBAYTAlRSMQ8w
  53554. DQYDVQQHDAZBbmthcmExQDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamls
  53555. ZXJpIHZlIEhpem1ldGxlcmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBN
  53556. ZXJrZXppMSgwJgYDVQQDDB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTEzMDMw
  53557. NTEyMDk0OFoXDTIzMDMwMzEyMDk0OFowgbIxCzAJBgNVBAYTAlRSMQ8wDQYDVQQHDAZBbmthcmEx
  53558. QDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamlsZXJpIHZlIEhpem1ldGxl
  53559. cmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBNZXJrZXppMSgwJgYDVQQD
  53560. DB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  53561. MIICCgKCAgEA4vU/kwVRHoViVF56C/UYB4Oufq9899SKa6VjQzm5S/fDxmSJPZQuVIBSOTkHS0vd
  53562. hQd2h8y/L5VMzH2nPbxHD5hw+IyFHnSOkm0bQNGZDbt1bsipa5rAhDGvykPL6ys06I+XawGb1Q5K
  53563. CKpbknSFQ9OArqGIW66z6l7LFpp3RMih9lRozt6Plyu6W0ACDGQXwLWTzeHxE2bODHnv0ZEoq1+g
  53564. ElIwcxmOj+GMB6LDu0rw6h8VqO4lzKRG+Bsi77MOQ7osJLjFLFzUHPhdZL3Dk14opz8n8Y4e0ypQ
  53565. BaNV2cvnOVPAmJ6MVGKLJrD3fY185MaeZkJVgkfnsliNZvcHfC425lAcP9tDJMW/hkd5s3kc91r0
  53566. E+xs+D/iWR+V7kI+ua2oMoVJl0b+SzGPWsutdEcf6ZG33ygEIqDUD13ieU/qbIWGvaimzuT6w+Gz
  53567. rt48Ue7LE3wBf4QOXVGUnhMMti6lTPk5cDZvlsouDERVxcr6XQKj39ZkjFqzAQqptQpHF//vkUAq
  53568. jqFGOjGY5RH8zLtJVor8udBhmm9lbObDyz51Sf6Pp+KJxWfXnUYTTjF2OySznhFlhqt/7x3U+Lzn
  53569. rFpct1pHXFXOVbQicVtbC/DP3KBhZOqp12gKY6fgDT+gr9Oq0n7vUaDmUStVkhUXU8u3Zg5mTPj5
  53570. dUyQ5xJwx0UCAwEAAaNjMGEwHQYDVR0OBBYEFC7j27JJ0JxUeVz6Jyr+zE7S6E5UMA8GA1UdEwEB
  53571. /wQFMAMBAf8wHwYDVR0jBBgwFoAULuPbsknQnFR5XPonKv7MTtLoTlQwDgYDVR0PAQH/BAQDAgEG
  53572. MA0GCSqGSIb3DQEBCwUAA4ICAQAFNzr0TbdF4kV1JI+2d1LoHNgQk2Xz8lkGpD4eKexd0dCrfOAK
  53573. kEh47U6YA5n+KGCRHTAduGN8qOY1tfrTYXbm1gdLymmasoR6d5NFFxWfJNCYExL/u6Au/U5Mh/jO
  53574. XKqYGwXgAEZKgoClM4so3O0409/lPun++1ndYYRP0lSWE2ETPo+Aab6TR7U1Q9Jauz1c77NCR807
  53575. VRMGsAnb/WP2OogKmW9+4c4bU2pEZiNRCHu8W1Ki/QY3OEBhj0qWuJA3+GbHeJAAFS6LrVE1Uweo
  53576. a2iu+U48BybNCAVwzDk/dr2l02cmAYamU9JgO3xDf1WKvJUawSg5TB9D0pH0clmKuVb8P7Sd2nCc
  53577. dlqMQ1DujjByTd//SffGqWfZbawCEeI6FiWnWAjLb1NBnEg4R2gz0dfHj9R0IdTDBZB6/86WiLEV
  53578. KV0jq9BgoRJP3vQXzTLlyb/IQ639Lo7xr+L0mPoSHyDYwKcMhcWQ9DstliaxLL5Mq+ux0orJ23gT
  53579. Dx4JnW2PAJ8C2sH6H3p6CcRK5ogql5+Ji/03X186zjhZhkuvcQu02PJwT58yE+Owp1fl2tpDy4Q0
  53580. 8ijE6m30Ku/Ba3ba+367hTzSU8JNvnHhRdH9I2cNE3X7z2VnIp2usAnRCf8dNL/+I5c30jn6PQ0G
  53581. C7TbO6Orb1wdtn7os4I07QZcJA==
  53582. -----END CERTIFICATE-----
  53583. T-TeleSec GlobalRoot Class 2
  53584. ============================
  53585. -----BEGIN CERTIFICATE-----
  53586. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  53587. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  53588. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwHhcNMDgx
  53589. MDAxMTA0MDE0WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  53590. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  53591. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwggEiMA0GCSqGSIb3
  53592. DQEBAQUAA4IBDwAwggEKAoIBAQCqX9obX+hzkeXaXPSi5kfl82hVYAUdAqSzm1nzHoqvNK38DcLZ
  53593. SBnuaY/JIPwhqgcZ7bBcrGXHX+0CfHt8LRvWurmAwhiCFoT6ZrAIxlQjgeTNuUk/9k9uN0goOA/F
  53594. vudocP05l03Sx5iRUKrERLMjfTlH6VJi1hKTXrcxlkIF+3anHqP1wvzpesVsqXFP6st4vGCvx970
  53595. 2cu+fjOlbpSD8DT6IavqjnKgP6TeMFvvhk1qlVtDRKgQFRzlAVfFmPHmBiiRqiDFt1MmUUOyCxGV
  53596. WOHAD3bZwI18gfNycJ5v/hqO2V81xrJvNHy+SE/iWjnX2J14np+GPgNeGYtEotXHAgMBAAGjQjBA
  53597. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS/WSA2AHmgoCJrjNXy
  53598. YdK4LMuCSjANBgkqhkiG9w0BAQsFAAOCAQEAMQOiYQsfdOhyNsZt+U2e+iKo4YFWz827n+qrkRk4
  53599. r6p8FU3ztqONpfSO9kSpp+ghla0+AGIWiPACuvxhI+YzmzB6azZie60EI4RYZeLbK4rnJVM3YlNf
  53600. vNoBYimipidx5joifsFvHZVwIEoHNN/q/xWA5brXethbdXwFeilHfkCoMRN3zUA7tFFHei4R40cR
  53601. 3p1m0IvVVGb6g1XqfMIpiRvpb7PO4gWEyS8+eIVibslfwXhjdFjASBgMmTnrpMwatXlajRWc2BQN
  53602. 9noHV8cigwUtPJslJj0Ys6lDfMjIq2SPDqO/nBudMNva0Bkuqjzx+zOAduTNrRlPBSeOE6Fuwg==
  53603. -----END CERTIFICATE-----
  53604. Atos TrustedRoot 2011
  53605. =====================
  53606. -----BEGIN CERTIFICATE-----
  53607. MIIDdzCCAl+gAwIBAgIIXDPLYixfszIwDQYJKoZIhvcNAQELBQAwPDEeMBwGA1UEAwwVQXRvcyBU
  53608. cnVzdGVkUm9vdCAyMDExMQ0wCwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0xMTA3MDcxNDU4
  53609. MzBaFw0zMDEyMzEyMzU5NTlaMDwxHjAcBgNVBAMMFUF0b3MgVHJ1c3RlZFJvb3QgMjAxMTENMAsG
  53610. A1UECgwEQXRvczELMAkGA1UEBhMCREUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCV
  53611. hTuXbyo7LjvPpvMpNb7PGKw+qtn4TaA+Gke5vJrf8v7MPkfoepbCJI419KkM/IL9bcFyYie96mvr
  53612. 54rMVD6QUM+A1JX76LWC1BTFtqlVJVfbsVD2sGBkWXppzwO3bw2+yj5vdHLqqjAqc2K+SZFhyBH+
  53613. DgMq92og3AIVDV4VavzjgsG1xZ1kCWyjWZgHJ8cblithdHFsQ/H3NYkQ4J7sVaE3IqKHBAUsR320
  53614. HLliKWYoyrfhk/WklAOZuXCFteZI6o1Q/NnezG8HDt0Lcp2AMBYHlT8oDv3FdU9T1nSatCQujgKR
  53615. z3bFmx5VdJx4IbHwLfELn8LVlhgf8FQieowHAgMBAAGjfTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7R
  53616. l+lwrrw7GWzbITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZ
  53617. bNshMBgGA1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEB
  53618. CwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8jvZfza1zv7v1Apt+h
  53619. k6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kPDpFrdRbhIfzYJsdHt6bPWHJxfrrh
  53620. TZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pcmaHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a9
  53621. 61qn8FYiqTxlVMYVqL2Gns2Dlmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G
  53622. 3mB/ufNPRJLvKrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed
  53623. -----END CERTIFICATE-----
  53624. QuoVadis Root CA 1 G3
  53625. =====================
  53626. -----BEGIN CERTIFICATE-----
  53627. MIIFYDCCA0igAwIBAgIUeFhfLq0sGUvjNwc1NBMotZbUZZMwDQYJKoZIhvcNAQELBQAwSDELMAkG
  53628. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  53629. b3QgQ0EgMSBHMzAeFw0xMjAxMTIxNzI3NDRaFw00MjAxMTIxNzI3NDRaMEgxCzAJBgNVBAYTAkJN
  53630. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDEg
  53631. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCgvlAQjunybEC0BJyFuTHK3C3kEakE
  53632. PBtVwedYMB0ktMPvhd6MLOHBPd+C5k+tR4ds7FtJwUrVu4/sh6x/gpqG7D0DmVIB0jWerNrwU8lm
  53633. PNSsAgHaJNM7qAJGr6Qc4/hzWHa39g6QDbXwz8z6+cZM5cOGMAqNF34168Xfuw6cwI2H44g4hWf6
  53634. Pser4BOcBRiYz5P1sZK0/CPTz9XEJ0ngnjybCKOLXSoh4Pw5qlPafX7PGglTvF0FBM+hSo+LdoIN
  53635. ofjSxxR3W5A2B4GbPgb6Ul5jxaYA/qXpUhtStZI5cgMJYr2wYBZupt0lwgNm3fME0UDiTouG9G/l
  53636. g6AnhF4EwfWQvTA9xO+oabw4m6SkltFi2mnAAZauy8RRNOoMqv8hjlmPSlzkYZqn0ukqeI1RPToV
  53637. 7qJZjqlc3sX5kCLliEVx3ZGZbHqfPT2YfF72vhZooF6uCyP8Wg+qInYtyaEQHeTTRCOQiJ/GKubX
  53638. 9ZqzWB4vMIkIG1SitZgj7Ah3HJVdYdHLiZxfokqRmu8hqkkWCKi9YSgxyXSthfbZxbGL0eUQMk1f
  53639. iyA6PEkfM4VZDdvLCXVDaXP7a3F98N/ETH3Goy7IlXnLc6KOTk0k+17kBL5yG6YnLUlamXrXXAkg
  53640. t3+UuU/xDRxeiEIbEbfnkduebPRq34wGmAOtzCjvpUfzUwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  53641. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUo5fW816iEOGrRZ88F2Q87gFwnMwwDQYJKoZI
  53642. hvcNAQELBQADggIBABj6W3X8PnrHX3fHyt/PX8MSxEBd1DKquGrX1RUVRpgjpeaQWxiZTOOtQqOC
  53643. MTaIzen7xASWSIsBx40Bz1szBpZGZnQdT+3Btrm0DWHMY37XLneMlhwqI2hrhVd2cDMT/uFPpiN3
  53644. GPoajOi9ZcnPP/TJF9zrx7zABC4tRi9pZsMbj/7sPtPKlL92CiUNqXsCHKnQO18LwIE6PWThv6ct
  53645. Tr1NxNgpxiIY0MWscgKCP6o6ojoilzHdCGPDdRS5YCgtW2jgFqlmgiNR9etT2DGbe+m3nUvriBbP
  53646. +V04ikkwj+3x6xn0dxoxGE1nVGwvb2X52z3sIexe9PSLymBlVNFxZPT5pqOBMzYzcfCkeF9OrYMh
  53647. 3jRJjehZrJ3ydlo28hP0r+AJx2EqbPfgna67hkooby7utHnNkDPDs3b69fBsnQGQ+p6Q9pxyz0fa
  53648. wx/kNSBT8lTR32GDpgLiJTjehTItXnOQUl1CxM49S+H5GYQd1aJQzEH7QRTDvdbJWqNjZgKAvQU6
  53649. O0ec7AAmTPWIUb+oI38YB7AL7YsmoWTTYUrrXJ/es69nA7Mf3W1daWhpq1467HxpvMc7hU6eFbm0
  53650. FU/DlXpY18ls6Wy58yljXrQs8C097Vpl4KlbQMJImYFtnh8GKjwStIsPm6Ik8KaN1nrgS7ZklmOV
  53651. hMJKzRwuJIczYOXD
  53652. -----END CERTIFICATE-----
  53653. QuoVadis Root CA 2 G3
  53654. =====================
  53655. -----BEGIN CERTIFICATE-----
  53656. MIIFYDCCA0igAwIBAgIURFc0JFuBiZs18s64KztbpybwdSgwDQYJKoZIhvcNAQELBQAwSDELMAkG
  53657. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  53658. b3QgQ0EgMiBHMzAeFw0xMjAxMTIxODU5MzJaFw00MjAxMTIxODU5MzJaMEgxCzAJBgNVBAYTAkJN
  53659. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDIg
  53660. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQChriWyARjcV4g/Ruv5r+LrI3HimtFh
  53661. ZiFfqq8nUeVuGxbULX1QsFN3vXg6YOJkApt8hpvWGo6t/x8Vf9WVHhLL5hSEBMHfNrMWn4rjyduY
  53662. NM7YMxcoRvynyfDStNVNCXJJ+fKH46nafaF9a7I6JaltUkSs+L5u+9ymc5GQYaYDFCDy54ejiK2t
  53663. oIz/pgslUiXnFgHVy7g1gQyjO/Dh4fxaXc6AcW34Sas+O7q414AB+6XrW7PFXmAqMaCvN+ggOp+o
  53664. MiwMzAkd056OXbxMmO7FGmh77FOm6RQ1o9/NgJ8MSPsc9PG/Srj61YxxSscfrf5BmrODXfKEVu+l
  53665. V0POKa2Mq1W/xPtbAd0jIaFYAI7D0GoT7RPjEiuA3GfmlbLNHiJuKvhB1PLKFAeNilUSxmn1uIZo
  53666. L1NesNKqIcGY5jDjZ1XHm26sGahVpkUG0CM62+tlXSoREfA7T8pt9DTEceT/AFr2XK4jYIVz8eQQ
  53667. sSWu1ZK7E8EM4DnatDlXtas1qnIhO4M15zHfeiFuuDIIfR0ykRVKYnLP43ehvNURG3YBZwjgQQvD
  53668. 6xVu+KQZ2aKrr+InUlYrAoosFCT5v0ICvybIxo/gbjh9Uy3l7ZizlWNof/k19N+IxWA1ksB8aRxh
  53669. lRbQ694Lrz4EEEVlWFA4r0jyWbYW8jwNkALGcC4BrTwV1wIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  53670. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU7edvdlq/YOxJW8ald7tyFnGbxD0wDQYJKoZI
  53671. hvcNAQELBQADggIBAJHfgD9DCX5xwvfrs4iP4VGyvD11+ShdyLyZm3tdquXK4Qr36LLTn91nMX66
  53672. AarHakE7kNQIXLJgapDwyM4DYvmL7ftuKtwGTTwpD4kWilhMSA/ohGHqPHKmd+RCroijQ1h5fq7K
  53673. pVMNqT1wvSAZYaRsOPxDMuHBR//47PERIjKWnML2W2mWeyAMQ0GaW/ZZGYjeVYg3UQt4XAoeo0L9
  53674. x52ID8DyeAIkVJOviYeIyUqAHerQbj5hLja7NQ4nlv1mNDthcnPxFlxHBlRJAHpYErAK74X9sbgz
  53675. dWqTHBLmYF5vHX/JHyPLhGGfHoJE+V+tYlUkmlKY7VHnoX6XOuYvHxHaU4AshZ6rNRDbIl9qxV6X
  53676. U/IyAgkwo1jwDQHVcsaxfGl7w/U2Rcxhbl5MlMVerugOXou/983g7aEOGzPuVBj+D77vfoRrQ+Nw
  53677. mNtddbINWQeFFSM51vHfqSYP1kjHs6Yi9TM3WpVHn3u6GBVv/9YUZINJ0gpnIdsPNWNgKCLjsZWD
  53678. zYWm3S8P52dSbrsvhXz1SnPnxT7AvSESBT/8twNJAlvIJebiVDj1eYeMHVOyToV7BjjHLPj4sHKN
  53679. JeV3UvQDHEimUF+IIDBu8oJDqz2XhOdT+yHBTw8imoa4WSr2Rz0ZiC3oheGe7IUIarFsNMkd7Egr
  53680. O3jtZsSOeWmD3n+M
  53681. -----END CERTIFICATE-----
  53682. QuoVadis Root CA 3 G3
  53683. =====================
  53684. -----BEGIN CERTIFICATE-----
  53685. MIIFYDCCA0igAwIBAgIULvWbAiin23r/1aOp7r0DoM8Sah0wDQYJKoZIhvcNAQELBQAwSDELMAkG
  53686. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  53687. b3QgQ0EgMyBHMzAeFw0xMjAxMTIyMDI2MzJaFw00MjAxMTIyMDI2MzJaMEgxCzAJBgNVBAYTAkJN
  53688. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDMg
  53689. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCzyw4QZ47qFJenMioKVjZ/aEzHs286
  53690. IxSR/xl/pcqs7rN2nXrpixurazHb+gtTTK/FpRp5PIpM/6zfJd5O2YIyC0TeytuMrKNuFoM7pmRL
  53691. Mon7FhY4futD4tN0SsJiCnMK3UmzV9KwCoWdcTzeo8vAMvMBOSBDGzXRU7Ox7sWTaYI+FrUoRqHe
  53692. 6okJ7UO4BUaKhvVZR74bbwEhELn9qdIoyhA5CcoTNs+cra1AdHkrAj80//ogaX3T7mH1urPnMNA3
  53693. I4ZyYUUpSFlob3emLoG+B01vr87ERRORFHAGjx+f+IdpsQ7vw4kZ6+ocYfx6bIrc1gMLnia6Et3U
  53694. VDmrJqMz6nWB2i3ND0/kA9HvFZcba5DFApCTZgIhsUfei5pKgLlVj7WiL8DWM2fafsSntARE60f7
  53695. 5li59wzweyuxwHApw0BiLTtIadwjPEjrewl5qW3aqDCYz4ByA4imW0aucnl8CAMhZa634RylsSqi
  53696. Md5mBPfAdOhx3v89WcyWJhKLhZVXGqtrdQtEPREoPHtht+KPZ0/l7DxMYIBpVzgeAVuNVejH38DM
  53697. dyM0SXV89pgR6y3e7UEuFAUCf+D+IOs15xGsIs5XPd7JMG0QA4XN8f+MFrXBsj6IbGB/kE+V9/Yt
  53698. rQE5BwT6dYB9v0lQ7e/JxHwc64B+27bQ3RP+ydOc17KXqQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  53699. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUxhfQvKjqAkPyGwaZXSuQILnXnOQwDQYJKoZI
  53700. hvcNAQELBQADggIBADRh2Va1EodVTd2jNTFGu6QHcrxfYWLopfsLN7E8trP6KZ1/AvWkyaiTt3px
  53701. KGmPc+FSkNrVvjrlt3ZqVoAh313m6Tqe5T72omnHKgqwGEfcIHB9UqM+WXzBusnIFUBhynLWcKzS
  53702. t/Ac5IYp8M7vaGPQtSCKFWGafoaYtMnCdvvMujAWzKNhxnQT5WvvoxXqA/4Ti2Tk08HS6IT7SdEQ
  53703. TXlm66r99I0xHnAUrdzeZxNMgRVhvLfZkXdxGYFgu/BYpbWcC/ePIlUnwEsBbTuZDdQdm2NnL9Du
  53704. DcpmvJRPpq3t/O5jrFc/ZSXPsoaP0Aj/uHYUbt7lJ+yreLVTubY/6CD50qi+YUbKh4yE8/nxoGib
  53705. Ih6BJpsQBJFxwAYf3KDTuVan45gtf4Od34wrnDKOMpTwATwiKp9Dwi7DmDkHOHv8XgBCH/MyJnmD
  53706. hPbl8MFREsALHgQjDFSlTC9JxUrRtm5gDWv8a4uFJGS3iQ6rJUdbPM9+Sb3H6QrG2vd+DhcI00iX
  53707. 0HGS8A85PjRqHH3Y8iKuu2n0M7SmSFXRDw4m6Oy2Cy2nhTXN/VnIn9HNPlopNLk9hM6xZdRZkZFW
  53708. dSHBd575euFgndOtBBj0fOtek49TSiIp+EgrPk2GrFt/ywaZWWDYWGWVjUTR939+J399roD1B0y2
  53709. PpxxVJkES/1Y+Zj0
  53710. -----END CERTIFICATE-----
  53711. DigiCert Assured ID Root G2
  53712. ===========================
  53713. -----BEGIN CERTIFICATE-----
  53714. MIIDljCCAn6gAwIBAgIQC5McOtY5Z+pnI7/Dr5r0SzANBgkqhkiG9w0BAQsFADBlMQswCQYDVQQG
  53715. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  53716. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIwHhcNMTMwODAxMTIwMDAwWhcNMzgw
  53717. MTE1MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  53718. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIw
  53719. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZ5ygvUj82ckmIkzTz+GoeMVSAn61UQbVH
  53720. 35ao1K+ALbkKz3X9iaV9JPrjIgwrvJUXCzO/GU1BBpAAvQxNEP4HteccbiJVMWWXvdMX0h5i89vq
  53721. bFCMP4QMls+3ywPgym2hFEwbid3tALBSfK+RbLE4E9HpEgjAALAcKxHad3A2m67OeYfcgnDmCXRw
  53722. VWmvo2ifv922ebPynXApVfSr/5Vh88lAbx3RvpO704gqu52/clpWcTs/1PPRCv4o76Pu2ZmvA9OP
  53723. YLfykqGxvYmJHzDNw6YuYjOuFgJ3RFrngQo8p0Quebg/BLxcoIfhG69Rjs3sLPr4/m3wOnyqi+Rn
  53724. lTGNAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTO
  53725. w0q5mVXyuNtgv6l+vVa1lzan1jANBgkqhkiG9w0BAQsFAAOCAQEAyqVVjOPIQW5pJ6d1Ee88hjZv
  53726. 0p3GeDgdaZaikmkuOGybfQTUiaWxMTeKySHMq2zNixya1r9I0jJmwYrA8y8678Dj1JGG0VDjA9tz
  53727. d29KOVPt3ibHtX2vK0LRdWLjSisCx1BL4GnilmwORGYQRI+tBev4eaymG+g3NJ1TyWGqolKvSnAW
  53728. hsI6yLETcDbYz+70CjTVW0z9B5yiutkBclzzTcHdDrEcDcRjvq30FPuJ7KJBDkzMyFdA0G4Dqs0M
  53729. jomZmWzwPDCvON9vvKO+KSAnq3T/EyJ43pdSVR6DtVQgA+6uwE9W3jfMw3+qBCe703e4YtsXfJwo
  53730. IhNzbM8m9Yop5w==
  53731. -----END CERTIFICATE-----
  53732. DigiCert Assured ID Root G3
  53733. ===========================
  53734. -----BEGIN CERTIFICATE-----
  53735. MIICRjCCAc2gAwIBAgIQC6Fa+h3foLVJRK/NJKBs7DAKBggqhkjOPQQDAzBlMQswCQYDVQQGEwJV
  53736. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQwIgYD
  53737. VQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  53738. MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  53739. d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwdjAQ
  53740. BgcqhkjOPQIBBgUrgQQAIgNiAAQZ57ysRGXtzbg/WPuNsVepRC0FFfLvC/8QdJ+1YlJfZn4f5dwb
  53741. RXkLzMZTCp2NXQLZqVneAlr2lSoOjThKiknGvMYDOAdfVdp+CW7if17QRSAPWXYQ1qAk8C3eNvJs
  53742. KTmjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTL0L2p4ZgF
  53743. UaFNN6KDec6NHSrkhDAKBggqhkjOPQQDAwNnADBkAjAlpIFFAmsSS3V0T8gj43DydXLefInwz5Fy
  53744. YZ5eEJJZVrmDxxDnOOlYJjZ91eQ0hjkCMHw2U/Aw5WJjOpnitqM7mzT6HtoQknFekROn3aRukswy
  53745. 1vUhZscv6pZjamVFkpUBtA==
  53746. -----END CERTIFICATE-----
  53747. DigiCert Global Root G2
  53748. =======================
  53749. -----BEGIN CERTIFICATE-----
  53750. MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQG
  53751. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  53752. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMjAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUx
  53753. MjAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  53754. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEcyMIIBIjANBgkq
  53755. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuzfNNNx7a8myaJCtSnX/RrohCgiN9RlUyfuI2/Ou8jqJ
  53756. kTx65qsGGmvPrC3oXgkkRLpimn7Wo6h+4FR1IAWsULecYxpsMNzaHxmx1x7e/dfgy5SDN67sH0NO
  53757. 3Xss0r0upS/kqbitOtSZpLYl6ZtrAGCSYP9PIUkY92eQq2EGnI/yuum06ZIya7XzV+hdG82MHauV
  53758. BJVJ8zUtluNJbd134/tJS7SsVQepj5WztCO7TG1F8PapspUwtP1MVYwnSlcUfIKdzXOS0xZKBgyM
  53759. UNGPHgm+F6HmIcr9g+UQvIOlCsRnKPZzFBQ9RnbDhxSJITRNrw9FDKZJobq7nMWxM4MphQIDAQAB
  53760. o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUTiJUIBiV5uNu
  53761. 5g/6+rkS7QYXjzkwDQYJKoZIhvcNAQELBQADggEBAGBnKJRvDkhj6zHd6mcY1Yl9PMWLSn/pvtsr
  53762. F9+wX3N3KjITOYFnQoQj8kVnNeyIv/iPsGEMNKSuIEyExtv4NeF22d+mQrvHRAiGfzZ0JFrabA0U
  53763. WTW98kndth/Jsw1HKj2ZL7tcu7XUIOGZX1NGFdtom/DzMNU+MeKNhJ7jitralj41E6Vf8PlwUHBH
  53764. QRFXGU7Aj64GxJUTFy8bJZ918rGOmaFvE7FBcf6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/
  53765. iyK5S9kJRaTepLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl
  53766. MrY=
  53767. -----END CERTIFICATE-----
  53768. DigiCert Global Root G3
  53769. =======================
  53770. -----BEGIN CERTIFICATE-----
  53771. MIICPzCCAcWgAwIBAgIQBVVWvPJepDU1w6QP1atFcjAKBggqhkjOPQQDAzBhMQswCQYDVQQGEwJV
  53772. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAwHgYD
  53773. VQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMzAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAw
  53774. MDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5k
  53775. aWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEczMHYwEAYHKoZIzj0C
  53776. AQYFK4EEACIDYgAE3afZu4q4C/sLfyHS8L6+c/MzXRq8NOrexpu80JX28MzQC7phW1FGfp4tn+6O
  53777. YwwX7Adw9c+ELkCDnOg/QW07rdOkFFk2eJ0DQ+4QE2xy3q6Ip6FrtUPOZ9wj/wMco+I+o0IwQDAP
  53778. BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUs9tIpPmhxdiuNkHMEWNp
  53779. Yim8S8YwCgYIKoZIzj0EAwMDaAAwZQIxAK288mw/EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y
  53780. 3maTD/HMsQmP3Wyr+mt/oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34
  53781. VOKa5Vt8sycX
  53782. -----END CERTIFICATE-----
  53783. DigiCert Trusted Root G4
  53784. ========================
  53785. -----BEGIN CERTIFICATE-----
  53786. MIIFkDCCA3igAwIBAgIQBZsbV56OITLiOQe9p3d1XDANBgkqhkiG9w0BAQwFADBiMQswCQYDVQQG
  53787. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSEw
  53788. HwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  53789. MTIwMDAwWjBiMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  53790. d3cuZGlnaWNlcnQuY29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwggIiMA0G
  53791. CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC/5pBzaN675F1KPDAiMGkz7MKnJS7JIT3yithZwuEp
  53792. pz1Yq3aaza57G4QNxDAf8xukOBbrVsaXbR2rsnnyyhHS5F/WBTxSD1Ifxp4VpX6+n6lXFllVcq9o
  53793. k3DCsrp1mWpzMpTREEQQLt+C8weE5nQ7bXHiLQwb7iDVySAdYyktzuxeTsiT+CFhmzTrBcZe7Fsa
  53794. vOvJz82sNEBfsXpm7nfISKhmV1efVFiODCu3T6cw2Vbuyntd463JT17lNecxy9qTXtyOj4DatpGY
  53795. QJB5w3jHtrHEtWoYOAMQjdjUN6QuBX2I9YI+EJFwq1WCQTLX2wRzKm6RAXwhTNS8rhsDdV14Ztk6
  53796. MUSaM0C/CNdaSaTC5qmgZ92kJ7yhTzm1EVgX9yRcRo9k98FpiHaYdj1ZXUJ2h4mXaXpI8OCiEhtm
  53797. mnTK3kse5w5jrubU75KSOp493ADkRSWJtppEGSt+wJS00mFt6zPZxd9LBADMfRyVw4/3IbKyEbe7
  53798. f/LVjHAsQWCqsWMYRJUadmJ+9oCw++hkpjPRiQfhvbfmQ6QYuKZ3AeEPlAwhHbJUKSWJbOUOUlFH
  53799. dL4mrLZBdd56rF+NP8m800ERElvlEFDrMcXKchYiCd98THU/Y+whX8QgUWtvsauGi0/C1kVfnSD8
  53800. oR7FwI+isX4KJpn15GkvmB0t9dmpsh3lGwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud
  53801. DwEB/wQEAwIBhjAdBgNVHQ4EFgQU7NfjgtJxXWRM3y5nP+e6mK4cD08wDQYJKoZIhvcNAQEMBQAD
  53802. ggIBALth2X2pbL4XxJEbw6GiAI3jZGgPVs93rnD5/ZpKmbnJeFwMDF/k5hQpVgs2SV1EY+CtnJYY
  53803. ZhsjDT156W1r1lT40jzBQ0CuHVD1UvyQO7uYmWlrx8GnqGikJ9yd+SeuMIW59mdNOj6PWTkiU0Tr
  53804. yF0Dyu1Qen1iIQqAyHNm0aAFYF/opbSnr6j3bTWcfFqK1qI4mfN4i/RN0iAL3gTujJtHgXINwBQy
  53805. 7zBZLq7gcfJW5GqXb5JQbZaNaHqasjYUegbyJLkJEVDXCLG4iXqEI2FCKeWjzaIgQdfRnGTZ6iah
  53806. ixTXTBmyUEFxPT9NcCOGDErcgdLMMpSEDQgJlxxPwO5rIHQw0uA5NBCFIRUBCOhVMt5xSdkoF1BN
  53807. 5r5N0XWs0Mr7QbhDparTwwVETyw2m+L64kW4I1NsBm9nVX9GtUw/bihaeSbSpKhil9Ie4u1Ki7wb
  53808. /UdKDd9nZn6yW0HQO+T0O/QEY+nvwlQAUaCKKsnOeMzV6ocEGLPOr0mIr/OSmbaz5mEP0oUA51Aa
  53809. 5BuVnRmhuZyxm7EAHu/QD09CbMkKvO5D+jpxpchNJqU1/YldvIViHTLSoCtU7ZpXwdv6EM8Zt4tK
  53810. G48BtieVU+i2iW1bvGjUI+iLUaJW+fCmgKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP
  53811. 82Z+
  53812. -----END CERTIFICATE-----
  53813. COMODO RSA Certification Authority
  53814. ==================================
  53815. -----BEGIN CERTIFICATE-----
  53816. MIIF2DCCA8CgAwIBAgIQTKr5yttjb+Af907YWwOGnTANBgkqhkiG9w0BAQwFADCBhTELMAkGA1UE
  53817. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  53818. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlv
  53819. biBBdXRob3JpdHkwHhcNMTAwMTE5MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMC
  53820. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  53821. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBB
  53822. dXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCR6FSS0gpWsawNJN3Fz0Rn
  53823. dJkrN6N9I3AAcbxT38T6KhKPS38QVr2fcHK3YX/JSw8Xpz3jsARh7v8Rl8f0hj4K+j5c+ZPmNHrZ
  53824. FGvnnLOFoIJ6dq9xkNfs/Q36nGz637CC9BR++b7Epi9Pf5l/tfxnQ3K9DADWietrLNPtj5gcFKt+
  53825. 5eNu/Nio5JIk2kNrYrhV/erBvGy2i/MOjZrkm2xpmfh4SDBF1a3hDTxFYPwyllEnvGfDyi62a+pG
  53826. x8cgoLEfZd5ICLqkTqnyg0Y3hOvozIFIQ2dOciqbXL1MGyiKXCJ7tKuY2e7gUYPDCUZObT6Z+pUX
  53827. 2nwzV0E8jVHtC7ZcryxjGt9XyD+86V3Em69FmeKjWiS0uqlWPc9vqv9JWL7wqP/0uK3pN/u6uPQL
  53828. OvnoQ0IeidiEyxPx2bvhiWC4jChWrBQdnArncevPDt09qZahSL0896+1DSJMwBGB7FY79tOi4lu3
  53829. sgQiUpWAk2nojkxl8ZEDLXB0AuqLZxUpaVICu9ffUGpVRr+goyhhf3DQw6KqLCGqR84onAZFdr+C
  53830. GCe01a60y1Dma/RMhnEw6abfFobg2P9A3fvQQoh/ozM6LlweQRGBY84YcWsr7KaKtzFcOmpH4MN5
  53831. WdYgGq/yapiqcrxXStJLnbsQ/LBMQeXtHT1eKJ2czL+zUdqnR+WEUwIDAQABo0IwQDAdBgNVHQ4E
  53832. FgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w
  53833. DQYJKoZIhvcNAQEMBQADggIBAArx1UaEt65Ru2yyTUEUAJNMnMvlwFTPoCWOAvn9sKIN9SCYPBMt
  53834. rFaisNZ+EZLpLrqeLppysb0ZRGxhNaKatBYSaVqM4dc+pBroLwP0rmEdEBsqpIt6xf4FpuHA1sj+
  53835. nq6PK7o9mfjYcwlYRm6mnPTXJ9OV2jeDchzTc+CiR5kDOF3VSXkAKRzH7JsgHAckaVd4sjn8OoSg
  53836. tZx8jb8uk2IntznaFxiuvTwJaP+EmzzV1gsD41eeFPfR60/IvYcjt7ZJQ3mFXLrrkguhxuhoqEwW
  53837. sRqZCuhTLJK7oQkYdQxlqHvLI7cawiiFwxv/0Cti76R7CZGYZ4wUAc1oBmpjIXUDgIiKboHGhfKp
  53838. pC3n9KUkEEeDys30jXlYsQab5xoq2Z0B15R97QNKyvDb6KkBPvVWmckejkk9u+UJueBPSZI9FoJA
  53839. zMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yLS0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHq
  53840. ZJx64SIDqZxubw5lT2yHh17zbqD5daWbQOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk52
  53841. 7RH89elWsn2/x20Kk4yl0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7I
  53842. LaZRfyHBNVOFBkpdn627G190
  53843. -----END CERTIFICATE-----
  53844. USERTrust RSA Certification Authority
  53845. =====================================
  53846. -----BEGIN CERTIFICATE-----
  53847. MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCBiDELMAkGA1UE
  53848. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  53849. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  53850. dGlvbiBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UE
  53851. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  53852. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  53853. dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCAEmUXNg7D2wiz
  53854. 0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2j
  53855. Y0K2dvKpOyuR+OJv0OwWIJAJPuLodMkYtJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFn
  53856. RghRy4YUVD+8M/5+bJz/Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O
  53857. +T23LLb2VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT79uq
  53858. /nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6c0Plfg6lZrEpfDKE
  53859. Y1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmTYo61Zs8liM2EuLE/pDkP2QKe6xJM
  53860. lXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97lc6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8
  53861. yexDJtC/QV9AqURE9JnnV4eeUB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+
  53862. eLf8ZxXhyVeEHg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd
  53863. BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
  53864. MAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPFUp/L+M+ZBn8b2kMVn54CVVeW
  53865. FPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KOVWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ
  53866. 7l8wXEskEVX/JJpuXior7gtNn3/3ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQ
  53867. Eg9zKC7F4iRO/Fjs8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM
  53868. 8WcRiQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYzeSf7dNXGi
  53869. FSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZXHlKYC6SQK5MNyosycdi
  53870. yA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9c
  53871. J2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRBVXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGw
  53872. sAvgnEzDHNb842m1R0aBL6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gx
  53873. Q+6IHdfGjjxDah2nGN59PRbxYvnKkKj9
  53874. -----END CERTIFICATE-----
  53875. USERTrust ECC Certification Authority
  53876. =====================================
  53877. -----BEGIN CERTIFICATE-----
  53878. MIICjzCCAhWgAwIBAgIQXIuZxVqUxdJxVt7NiYDMJjAKBggqhkjOPQQDAzCBiDELMAkGA1UEBhMC
  53879. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  53880. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  53881. biBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMC
  53882. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  53883. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  53884. biBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQarFRaqfloI+d61SRvU8Za2EurxtW2
  53885. 0eZzca7dnNYMYf3boIkDuAUU7FfO7l0/4iGzzvfUinngo4N+LZfQYcTxmdwlkWOrfzCjtHDix6Ez
  53886. nPO/LlxTsV+zfTJ/ijTjeXmjQjBAMB0GA1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1xmNjmjAOBgNV
  53887. HQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjA2Z6EWCNzklwBB
  53888. HU6+4WMBzzuqQhFkoJ2UOQIReVx7Hfpkue4WQrO/isIJxOzksU0CMQDpKmFHjFJKS04YcPbWRNZu
  53889. 9YO6bVi9JNlWSOrvxKJGgYhqOkbRqZtNyWHa0V1Xahg=
  53890. -----END CERTIFICATE-----
  53891. GlobalSign ECC Root CA - R4
  53892. ===========================
  53893. -----BEGIN CERTIFICATE-----
  53894. MIIB4TCCAYegAwIBAgIRKjikHJYKBN5CsiilC+g0mAIwCgYIKoZIzj0EAwIwUDEkMCIGA1UECxMb
  53895. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  53896. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  53897. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  53898. EwpHbG9iYWxTaWduMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEuMZ5049sJQ6fLjkZHAOkrprl
  53899. OQcJFspjsbmG+IpXwVfOQvpzofdlQv8ewQCybnMO/8ch5RikqtlxP6jUuc6MHaNCMEAwDgYDVR0P
  53900. AQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFFSwe61FuOJAf/sKbvu+M8k8o4TV
  53901. MAoGCCqGSM49BAMCA0gAMEUCIQDckqGgE6bPA7DmxCGXkPoUVy0D7O48027KqGx2vKLeuwIgJ6iF
  53902. JzWbVsaj8kfSt24bAgAXqmemFZHe+pTsewv4n4Q=
  53903. -----END CERTIFICATE-----
  53904. GlobalSign ECC Root CA - R5
  53905. ===========================
  53906. -----BEGIN CERTIFICATE-----
  53907. MIICHjCCAaSgAwIBAgIRYFlJ4CYuu1X5CneKcflK2GwwCgYIKoZIzj0EAwMwUDEkMCIGA1UECxMb
  53908. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  53909. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  53910. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  53911. EwpHbG9iYWxTaWduMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAER0UOlvt9Xb/pOdEh+J8LttV7HpI6
  53912. SFkc8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8kehOvRnkmS
  53913. h5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
  53914. BgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYIKoZIzj0EAwMDaAAwZQIxAOVpEslu28Yx
  53915. uglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7
  53916. yFz9SO8NdCKoCOJuxUnOxwy8p2Fp8fc74SrL+SvzZpA3
  53917. -----END CERTIFICATE-----
  53918. Staat der Nederlanden Root CA - G3
  53919. ==================================
  53920. -----BEGIN CERTIFICATE-----
  53921. MIIFdDCCA1ygAwIBAgIEAJiiOTANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
  53922. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  53923. Um9vdCBDQSAtIEczMB4XDTEzMTExNDExMjg0MloXDTI4MTExMzIzMDAwMFowWjELMAkGA1UEBhMC
  53924. TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
  53925. ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMzCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAL4y
  53926. olQPcPssXFnrbMSkUeiFKrPMSjTysF/zDsccPVMeiAho2G89rcKezIJnByeHaHE6n3WWIkYFsO2t
  53927. x1ueKt6c/DrGlaf1F2cY5y9JCAxcz+bMNO14+1Cx3Gsy8KL+tjzk7FqXxz8ecAgwoNzFs21v0IJy
  53928. EavSgWhZghe3eJJg+szeP4TrjTgzkApyI/o1zCZxMdFyKJLZWyNtZrVtB0LrpjPOktvA9mxjeM3K
  53929. Tj215VKb8b475lRgsGYeCasH/lSJEULR9yS6YHgamPfJEf0WwTUaVHXvQ9Plrk7O53vDxk5hUUur
  53930. mkVLoR9BvUhTFXFkC4az5S6+zqQbwSmEorXLCCN2QyIkHxcE1G6cxvx/K2Ya7Irl1s9N9WMJtxU5
  53931. 1nus6+N86U78dULI7ViVDAZCopz35HCz33JvWjdAidiFpNfxC95DGdRKWCyMijmev4SH8RY7Ngzp
  53932. 07TKbBlBUgmhHbBqv4LvcFEhMtwFdozL92TkA1CvjJFnq8Xy7ljY3r735zHPbMk7ccHViLVlvMDo
  53933. FxcHErVc0qsgk7TmgoNwNsXNo42ti+yjwUOH5kPiNL6VizXtBznaqB16nzaeErAMZRKQFWDZJkBE
  53934. 41ZgpRDUajz9QdwOWke275dhdU/Z/seyHdTtXUmzqWrLZoQT1Vyg3N9udwbRcXXIV2+vD3dbAgMB
  53935. AAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRUrfrHkleu
  53936. yjWcLhL75LpdINyUVzANBgkqhkiG9w0BAQsFAAOCAgEAMJmdBTLIXg47mAE6iqTnB/d6+Oea31BD
  53937. U5cqPco8R5gu4RV78ZLzYdqQJRZlwJ9UXQ4DO1t3ApyEtg2YXzTdO2PCwyiBwpwpLiniyMMB8jPq
  53938. KqrMCQj3ZWfGzd/TtiunvczRDnBfuCPRy5FOCvTIeuXZYzbB1N/8Ipf3YF3qKS9Ysr1YvY2WTxB1
  53939. v0h7PVGHoTx0IsL8B3+A3MSs/mrBcDCw6Y5p4ixpgZQJut3+TcCDjJRYwEYgr5wfAvg1VUkvRtTA
  53940. 8KCWAg8zxXHzniN9lLf9OtMJgwYh/WA9rjLA0u6NpvDntIJ8CsxwyXmA+P5M9zWEGYox+wrZ13+b
  53941. 8KKaa8MFSu1BYBQw0aoRQm7TIwIEC8Zl3d1Sd9qBa7Ko+gE4uZbqKmxnl4mUnrzhVNXkanjvSr0r
  53942. mj1AfsbAddJu+2gw7OyLnflJNZoaLNmzlTnVHpL3prllL+U9bTpITAjc5CgSKL59NVzq4BZ+Extq
  53943. 1z7XnvwtdbLBFNUjA9tbbws+eC8N3jONFrdI54OagQ97wUNNVQQXOEpR1VmiiXTTn74eS9fGbbeI
  53944. JG9gkaSChVtWQbzQRKtqE77RLFi3EjNYsjdj3BP1lB0/QFH1T/U67cjF68IeHRaVesd+QnGTbksV
  53945. tzDfqu1XhUisHWrdOWnk4Xl4vs4Fv6EM94B7IWcnMFk=
  53946. -----END CERTIFICATE-----
  53947. Staat der Nederlanden EV Root CA
  53948. ================================
  53949. -----BEGIN CERTIFICATE-----
  53950. MIIFcDCCA1igAwIBAgIEAJiWjTANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQGEwJOTDEeMBwGA1UE
  53951. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSkwJwYDVQQDDCBTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  53952. RVYgUm9vdCBDQTAeFw0xMDEyMDgxMTE5MjlaFw0yMjEyMDgxMTEwMjhaMFgxCzAJBgNVBAYTAk5M
  53953. MR4wHAYDVQQKDBVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xKTAnBgNVBAMMIFN0YWF0IGRlciBOZWRl
  53954. cmxhbmRlbiBFViBSb290IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA48d+ifkk
  53955. SzrSM4M1LGns3Amk41GoJSt5uAg94JG6hIXGhaTK5skuU6TJJB79VWZxXSzFYGgEt9nCUiY4iKTW
  53956. O0Cmws0/zZiTs1QUWJZV1VD+hq2kY39ch/aO5ieSZxeSAgMs3NZmdO3dZ//BYY1jTw+bbRcwJu+r
  53957. 0h8QoPnFfxZpgQNH7R5ojXKhTbImxrpsX23Wr9GxE46prfNeaXUmGD5BKyF/7otdBwadQ8QpCiv8
  53958. Kj6GyzyDOvnJDdrFmeK8eEEzduG/L13lpJhQDBXd4Pqcfzho0LKmeqfRMb1+ilgnQ7O6M5HTp5gV
  53959. XJrm0w912fxBmJc+qiXbj5IusHsMX/FjqTf5m3VpTCgmJdrV8hJwRVXj33NeN/UhbJCONVrJ0yPr
  53960. 08C+eKxCKFhmpUZtcALXEPlLVPxdhkqHz3/KRawRWrUgUY0viEeXOcDPusBCAUCZSCELa6fS/ZbV
  53961. 0b5GnUngC6agIk440ME8MLxwjyx1zNDFjFE7PZQIZCZhfbnDZY8UnCHQqv0XcgOPvZuM5l5Tnrmd
  53962. 74K74bzickFbIZTTRTeU0d8JOV3nI6qaHcptqAqGhYqCvkIH1vI4gnPah1vlPNOePqc7nvQDs/nx
  53963. fRN0Av+7oeX6AHkcpmZBiFxgV6YuCcS6/ZrPpx9Aw7vMWgpVSzs4dlG4Y4uElBbmVvMCAwEAAaNC
  53964. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFP6rAJCYniT8qcwa
  53965. ivsnuL8wbqg7MA0GCSqGSIb3DQEBCwUAA4ICAQDPdyxuVr5Os7aEAJSrR8kN0nbHhp8dB9O2tLsI
  53966. eK9p0gtJ3jPFrK3CiAJ9Brc1AsFgyb/E6JTe1NOpEyVa/m6irn0F3H3zbPB+po3u2dfOWBfoqSmu
  53967. c0iH55vKbimhZF8ZE/euBhD/UcabTVUlT5OZEAFTdfETzsemQUHSv4ilf0X8rLiltTMMgsT7B/Zq
  53968. 5SWEXwbKwYY5EdtYzXc7LMJMD16a4/CrPmEbUCTCwPTxGfARKbalGAKb12NMcIxHowNDXLldRqAN
  53969. b/9Zjr7dn3LDWyvfjFvO5QxGbJKyCqNMVEIYFRIYvdr8unRu/8G2oGTYqV9Vrp9canaW2HNnh/tN
  53970. f1zuacpzEPuKqf2evTY4SUmH9A4U8OmHuD+nT3pajnnUk+S7aFKErGzp85hwVXIy+TSrK0m1zSBi
  53971. 5Dp6Z2Orltxtrpfs/J92VoguZs9btsmksNcFuuEnL5O7Jiqik7Ab846+HUCjuTaPPoIaGl6I6lD4
  53972. WeKDRikL40Rc4ZW2aZCaFG+XroHPaO+Zmr615+F/+PoTRxZMzG0IQOeLeG9QgkRQP2YGiqtDhFZK
  53973. DyAthg710tvSeopLzaXoTvFeJiUBWSOgftL2fiFX1ye8FVdMpEbB4IMeDExNH08GGeL5qPQ6gqGy
  53974. eUN51q1veieQA6TqJIc/2b3Z6fJfUEkc7uzXLg==
  53975. -----END CERTIFICATE-----
  53976. IdenTrust Commercial Root CA 1
  53977. ==============================
  53978. -----BEGIN CERTIFICATE-----
  53979. MIIFYDCCA0igAwIBAgIQCgFCgAAAAUUjyES1AAAAAjANBgkqhkiG9w0BAQsFADBKMQswCQYDVQQG
  53980. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBS
  53981. b290IENBIDEwHhcNMTQwMTE2MTgxMjIzWhcNMzQwMTE2MTgxMjIzWjBKMQswCQYDVQQGEwJVUzES
  53982. MBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBSb290IENB
  53983. IDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnUBneP5k91DNG8W9RYYKyqU+PZ4ld
  53984. hNlT3Qwo2dfw/66VQ3KZ+bVdfIrBQuExUHTRgQ18zZshq0PirK1ehm7zCYofWjK9ouuU+ehcCuz/
  53985. mNKvcbO0U59Oh++SvL3sTzIwiEsXXlfEU8L2ApeN2WIrvyQfYo3fw7gpS0l4PJNgiCL8mdo2yMKi
  53986. 1CxUAGc1bnO/AljwpN3lsKImesrgNqUZFvX9t++uP0D1bVoE/c40yiTcdCMbXTMTEl3EASX2MN0C
  53987. XZ/g1Ue9tOsbobtJSdifWwLziuQkkORiT0/Br4sOdBeo0XKIanoBScy0RnnGF7HamB4HWfp1IYVl
  53988. 3ZBWzvurpWCdxJ35UrCLvYf5jysjCiN2O/cz4ckA82n5S6LgTrx+kzmEB/dEcH7+B1rlsazRGMzy
  53989. NeVJSQjKVsk9+w8YfYs7wRPCTY/JTw436R+hDmrfYi7LNQZReSzIJTj0+kuniVyc0uMNOYZKdHzV
  53990. WYfCP04MXFL0PfdSgvHqo6z9STQaKPNBiDoT7uje/5kdX7rL6B7yuVBgwDHTc+XvvqDtMwt0viAg
  53991. xGds8AgDelWAf0ZOlqf0Hj7h9tgJ4TNkK2PXMl6f+cB7D3hvl7yTmvmcEpB4eoCHFddydJxVdHix
  53992. uuFucAS6T6C6aMN7/zHwcz09lCqxC0EOoP5NiGVreTO01wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMC
  53993. AQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU7UQZwNPwBovupHu+QucmVMiONnYwDQYJKoZI
  53994. hvcNAQELBQADggIBAA2ukDL2pkt8RHYZYR4nKM1eVO8lvOMIkPkp165oCOGUAFjvLi5+U1KMtlwH
  53995. 6oi6mYtQlNeCgN9hCQCTrQ0U5s7B8jeUeLBfnLOic7iPBZM4zY0+sLj7wM+x8uwtLRvM7Kqas6pg
  53996. ghstO8OEPVeKlh6cdbjTMM1gCIOQ045U8U1mwF10A0Cj7oV+wh93nAbowacYXVKV7cndJZ5t+qnt
  53997. ozo00Fl72u1Q8zW/7esUTTHHYPTa8Yec4kjixsU3+wYQ+nVZZjFHKdp2mhzpgq7vmrlR94gjmmmV
  53998. YjzlVYA211QC//G5Xc7UI2/YRYRKW2XviQzdFKcgyxilJbQN+QHwotL0AMh0jqEqSI5l2xPE4iUX
  53999. feu+h1sXIFRRk0pTAwvsXcoz7WL9RccvW9xYoIA55vrX/hMUpu09lEpCdNTDd1lzzY9GvlU47/ro
  54000. kTLql1gEIt44w8y8bckzOmoKaT+gyOpyj4xjhiO9bTyWnpXgSUyqorkqG5w2gXjtw+hG4iZZRHUe
  54001. 2XWJUc0QhJ1hYMtd+ZciTY6Y5uN/9lu7rs3KSoFrXgvzUeF0K+l+J6fZmUlO+KWA2yUPHGNiiskz
  54002. Z2s8EIPGrd6ozRaOjfAHN3Gf8qv8QfXBi+wAN10J5U6A7/qxXDgGpRtK4dw4LTzcqx+QGtVKnO7R
  54003. cGzM7vRX+Bi6hG6H
  54004. -----END CERTIFICATE-----
  54005. IdenTrust Public Sector Root CA 1
  54006. =================================
  54007. -----BEGIN CERTIFICATE-----
  54008. MIIFZjCCA06gAwIBAgIQCgFCgAAAAUUjz0Z8AAAAAjANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQG
  54009. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3Rv
  54010. ciBSb290IENBIDEwHhcNMTQwMTE2MTc1MzMyWhcNMzQwMTE2MTc1MzMyWjBNMQswCQYDVQQGEwJV
  54011. UzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3RvciBS
  54012. b290IENBIDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2IpT8pEiv6EdrCvsnduTy
  54013. P4o7ekosMSqMjbCpwzFrqHd2hCa2rIFCDQjrVVi7evi8ZX3yoG2LqEfpYnYeEe4IFNGyRBb06tD6
  54014. Hi9e28tzQa68ALBKK0CyrOE7S8ItneShm+waOh7wCLPQ5CQ1B5+ctMlSbdsHyo+1W/CD80/HLaXI
  54015. rcuVIKQxKFdYWuSNG5qrng0M8gozOSI5Cpcu81N3uURF/YTLNiCBWS2ab21ISGHKTN9T0a9SvESf
  54016. qy9rg3LvdYDaBjMbXcjaY8ZNzaxmMc3R3j6HEDbhuaR672BQssvKplbgN6+rNBM5Jeg5ZuSYeqoS
  54017. mJxZZoY+rfGwyj4GD3vwEUs3oERte8uojHH01bWRNszwFcYr3lEXsZdMUD2xlVl8BX0tIdUAvwFn
  54018. ol57plzy9yLxkA2T26pEUWbMfXYD62qoKjgZl3YNa4ph+bz27nb9cCvdKTz4Ch5bQhyLVi9VGxyh
  54019. LrXHFub4qjySjmm2AcG1hp2JDws4lFTo6tyePSW8Uybt1as5qsVATFSrsrTZ2fjXctscvG29ZV/v
  54020. iDUqZi/u9rNl8DONfJhBaUYPQxxp+pu10GFqzcpL2UyQRqsVWaFHVCkugyhfHMKiq3IXAAaOReyL
  54021. 4jM9f9oZRORicsPfIsbyVtTdX5Vy7W1f90gDW/3FKqD2cyOEEBsB5wIDAQABo0IwQDAOBgNVHQ8B
  54022. Af8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU43HgntinQtnbcZFrlJPrw6PRFKMw
  54023. DQYJKoZIhvcNAQELBQADggIBAEf63QqwEZE4rU1d9+UOl1QZgkiHVIyqZJnYWv6IAcVYpZmxI1Qj
  54024. t2odIFflAWJBF9MJ23XLblSQdf4an4EKwt3X9wnQW3IV5B4Jaj0z8yGa5hV+rVHVDRDtfULAj+7A
  54025. mgjVQdZcDiFpboBhDhXAuM/FSRJSzL46zNQuOAXeNf0fb7iAaJg9TaDKQGXSc3z1i9kKlT/YPyNt
  54026. GtEqJBnZhbMX73huqVjRI9PHE+1yJX9dsXNw0H8GlwmEKYBhHfpe/3OsoOOJuBxxFcbeMX8S3OFt
  54027. m6/n6J91eEyrRjuazr8FGF1NFTwWmhlQBJqymm9li1JfPFgEKCXAZmExfrngdbkaqIHWchezxQMx
  54028. NRF4eKLg6TCMf4DfWN88uieW4oA0beOY02QnrEh+KHdcxiVhJfiFDGX6xDIvpZgF5PgLZxYWxoK4
  54029. Mhn5+bl53B/N66+rDt0b20XkeucC4pVd/GnwU2lhlXV5C15V5jgclKlZM57IcXR5f1GJtshquDDI
  54030. ajjDbp7hNxbqBWJMWxJH7ae0s1hWx0nzfxJoCTFx8G34Tkf71oXuxVhAGaQdp/lLQzfcaFpPz+vC
  54031. ZHTetBXZ9FRUGi8c15dxVJCO2SCdUyt/q4/i6jC8UDfv8Ue1fXwsBOxonbRJRBD0ckscZOf85muQ
  54032. 3Wl9af0AVqW3rLatt8o+Ae+c
  54033. -----END CERTIFICATE-----
  54034. Entrust Root Certification Authority - G2
  54035. =========================================
  54036. -----BEGIN CERTIFICATE-----
  54037. MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMCVVMxFjAUBgNV
  54038. BAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVy
  54039. bXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ug
  54040. b25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIw
  54041. HhcNMDkwNzA3MTcyNTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoT
  54042. DUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMx
  54043. OTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25s
  54044. eTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwggEi
  54045. MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP
  54046. /vaCeb9zYQYKpSfYs1/TRU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXz
  54047. HHfV1IWNcCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hWwcKU
  54048. s/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1U1+cPvQXLOZprE4y
  54049. TGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0jaWvYkxN4FisZDQSA/i2jZRjJKRx
  54050. AgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ6
  54051. 0B7vfec7aVHUbI2fkBJmqzANBgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5Z
  54052. iXMRrEPR9RP/jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ
  54053. Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v1fN2D807iDgi
  54054. nWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4RnAuknZoh8/CbCzB428Hch0P+
  54055. vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmHVHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xO
  54056. e4pIb4tF9g==
  54057. -----END CERTIFICATE-----
  54058. Entrust Root Certification Authority - EC1
  54059. ==========================================
  54060. -----BEGIN CERTIFICATE-----
  54061. MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkGA1UEBhMCVVMx
  54062. FjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVn
  54063. YWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXpl
  54064. ZCB1c2Ugb25seTEzMDEGA1UEAxMqRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  54065. IC0gRUMxMB4XDTEyMTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYw
  54066. FAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0L2xlZ2Fs
  54067. LXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhvcml6ZWQg
  54068. dXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAt
  54069. IEVDMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHy
  54070. AsWfoPZb1YsGGYZPUxBtByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef
  54071. 9eNi1KlHBz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  54072. FLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVCR98crlOZF7ZvHH3h
  54073. vxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nXhTcGtXsI/esni0qU+eH6p44mCOh8
  54074. kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G
  54075. -----END CERTIFICATE-----
  54076. CFCA EV ROOT
  54077. ============
  54078. -----BEGIN CERTIFICATE-----
  54079. MIIFjTCCA3WgAwIBAgIEGErM1jANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJDTjEwMC4GA1UE
  54080. CgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQDDAxDRkNB
  54081. IEVWIFJPT1QwHhcNMTIwODA4MDMwNzAxWhcNMjkxMjMxMDMwNzAxWjBWMQswCQYDVQQGEwJDTjEw
  54082. MC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQD
  54083. DAxDRkNBIEVWIFJPT1QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDXXWvNED8fBVnV
  54084. BU03sQ7smCuOFR36k0sXgiFxEFLXUWRwFsJVaU2OFW2fvwwbwuCjZ9YMrM8irq93VCpLTIpTUnrD
  54085. 7i7es3ElweldPe6hL6P3KjzJIx1qqx2hp/Hz7KDVRM8Vz3IvHWOX6Jn5/ZOkVIBMUtRSqy5J35DN
  54086. uF++P96hyk0g1CXohClTt7GIH//62pCfCqktQT+x8Rgp7hZZLDRJGqgG16iI0gNyejLi6mhNbiyW
  54087. ZXvKWfry4t3uMCz7zEasxGPrb382KzRzEpR/38wmnvFyXVBlWY9ps4deMm/DGIq1lY+wejfeWkU7
  54088. xzbh72fROdOXW3NiGUgthxwG+3SYIElz8AXSG7Ggo7cbcNOIabla1jj0Ytwli3i/+Oh+uFzJlU9f
  54089. py25IGvPa931DfSCt/SyZi4QKPaXWnuWFo8BGS1sbn85WAZkgwGDg8NNkt0yxoekN+kWzqotaK8K
  54090. gWU6cMGbrU1tVMoqLUuFG7OA5nBFDWteNfB/O7ic5ARwiRIlk9oKmSJgamNgTnYGmE69g60dWIol
  54091. hdLHZR4tjsbftsbhf4oEIRUpdPA+nJCdDC7xij5aqgwJHsfVPKPtl8MeNPo4+QgO48BdK4PRVmrJ
  54092. tqhUUy54Mmc9gn900PvhtgVguXDbjgv5E1hvcWAQUhC5wUEJ73IfZzF4/5YFjQIDAQABo2MwYTAf
  54093. BgNVHSMEGDAWgBTj/i39KNALtbq2osS/BqoFjJP7LzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB
  54094. /wQEAwIBBjAdBgNVHQ4EFgQU4/4t/SjQC7W6tqLEvwaqBYyT+y8wDQYJKoZIhvcNAQELBQADggIB
  54095. ACXGumvrh8vegjmWPfBEp2uEcwPenStPuiB/vHiyz5ewG5zz13ku9Ui20vsXiObTej/tUxPQ4i9q
  54096. ecsAIyjmHjdXNYmEwnZPNDatZ8POQQaIxffu2Bq41gt/UP+TqhdLjOztUmCypAbqTuv0axn96/Ua
  54097. 4CUqmtzHQTb3yHQFhDmVOdYLO6Qn+gjYXB74BGBSESgoA//vU2YApUo0FmZ8/Qmkrp5nGm9BC2sG
  54098. E5uPhnEFtC+NiWYzKXZUmhH4J/qyP5Hgzg0b8zAarb8iXRvTvyUFTeGSGn+ZnzxEk8rUQElsgIfX
  54099. BDrDMlI1Dlb4pd19xIsNER9Tyx6yF7Zod1rg1MvIB671Oi6ON7fQAUtDKXeMOZePglr4UeWJoBjn
  54100. aH9dCi77o0cOPaYjesYBx4/IXr9tgFa+iiS6M+qf4TIRnvHST4D2G0CvOJ4RUHlzEhLN5mydLIhy
  54101. PDCBBpEi6lmt2hkuIsKNuYyH4Ga8cyNfIWRjgEj1oDwYPZTISEEdQLpe/v5WOaHIz16eGWRGENoX
  54102. kbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+ZAAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3C
  54103. ekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su
  54104. -----END CERTIFICATE-----
  54105. Certinomis - Root CA
  54106. ====================
  54107. -----BEGIN CERTIFICATE-----
  54108. MIIFkjCCA3qgAwIBAgIBATANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJGUjETMBEGA1UEChMK
  54109. Q2VydGlub21pczEXMBUGA1UECxMOMDAwMiA0MzM5OTg5MDMxHTAbBgNVBAMTFENlcnRpbm9taXMg
  54110. LSBSb290IENBMB4XDTEzMTAyMTA5MTcxOFoXDTMzMTAyMTA5MTcxOFowWjELMAkGA1UEBhMCRlIx
  54111. EzARBgNVBAoTCkNlcnRpbm9taXMxFzAVBgNVBAsTDjAwMDIgNDMzOTk4OTAzMR0wGwYDVQQDExRD
  54112. ZXJ0aW5vbWlzIC0gUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANTMCQos
  54113. P5L2fxSeC5yaah1AMGT9qt8OHgZbn1CF6s2Nq0Nn3rD6foCWnoR4kkjW4znuzuRZWJflLieY6pOo
  54114. d5tK8O90gC3rMB+12ceAnGInkYjwSond3IjmFPnVAy//ldu9n+ws+hQVWZUKxkd8aRi5pwP5ynap
  54115. z8dvtF4F/u7BUrJ1Mofs7SlmO/NKFoL21prbcpjp3vDFTKWrteoB4owuZH9kb/2jJZOLyKIOSY00
  54116. 8B/sWEUuNKqEUL3nskoTuLAPrjhdsKkb5nPJWqHZZkCqqU2mNAKthH6yI8H7KsZn9DS2sJVqM09x
  54117. RLWtwHkziOC/7aOgFLScCbAK42C++PhmiM1b8XcF4LVzbsF9Ri6OSyemzTUK/eVNfaoqoynHWmgE
  54118. 6OXWk6RiwsXm9E/G+Z8ajYJJGYrKWUM66A0ywfRMEwNvbqY/kXPLynNvEiCL7sCCeN5LLsJJwx3t
  54119. FvYk9CcbXFcx3FXuqB5vbKziRcxXV4p1VxngtViZSTYxPDMBbRZKzbgqg4SGm/lg0h9tkQPTYKbV
  54120. PZrdd5A9NaSfD171UkRpucC63M9933zZxKyGIjK8e2uR73r4F2iw4lNVYC2vPsKD2NkJK/DAZNuH
  54121. i5HMkesE/Xa0lZrmFAYb1TQdvtj/dBxThZngWVJKYe2InmtJiUZ+IFrZ50rlau7SZRFDAgMBAAGj
  54122. YzBhMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTvkUz1pcMw6C8I
  54123. 6tNxIqSSaHh02TAfBgNVHSMEGDAWgBTvkUz1pcMw6C8I6tNxIqSSaHh02TANBgkqhkiG9w0BAQsF
  54124. AAOCAgEAfj1U2iJdGlg+O1QnurrMyOMaauo++RLrVl89UM7g6kgmJs95Vn6RHJk/0KGRHCwPT5iV
  54125. WVO90CLYiF2cN/z7ZMF4jIuaYAnq1fohX9B0ZedQxb8uuQsLrbWwF6YSjNRieOpWauwK0kDDPAUw
  54126. Pk2Ut59KA9N9J0u2/kTO+hkzGm2kQtHdzMjI1xZSg081lLMSVX3l4kLr5JyTCcBMWwerx20RoFAX
  54127. lCOotQqSD7J6wWAsOMwaplv/8gzjqh8c3LigkyfeY+N/IZ865Z764BNqdeuWXGKRlI5nU7aJ+BIJ
  54128. y29SWwNyhlCVCNSNh4YVH5Uk2KRvms6knZtt0rJ2BobGVgjF6wnaNsIbW0G+YSrjcOa4pvi2WsS9
  54129. Iff/ql+hbHY5ZtbqTFXhADObE5hjyW/QASAJN1LnDE8+zbz1X5YnpyACleAu6AdBBR8Vbtaw5Bng
  54130. DwKTACdyxYvRVB9dSsNAl35VpnzBMwQUAR1JIGkLGZOdblgi90AMRgwjY/M50n92Uaf0yKHxDHYi
  54131. I0ZSKS3io0EHVmmY0gUJvGnHWmHNj4FgFU2A3ZDifcRQ8ow7bkrHxuaAKzyBvBGAFhAn1/DNP3nM
  54132. cyrDflOR1m749fPH0FFNjkulW+YZFzvWgQncItzujrnEj1PhZ7szuIgVRs/taTX/dQ1G885x4cVr
  54133. hkIGuUE=
  54134. -----END CERTIFICATE-----
  54135. OISTE WISeKey Global Root GB CA
  54136. ===============================
  54137. -----BEGIN CERTIFICATE-----
  54138. MIIDtTCCAp2gAwIBAgIQdrEgUnTwhYdGs/gjGvbCwDANBgkqhkiG9w0BAQsFADBtMQswCQYDVQQG
  54139. EwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNl
  54140. ZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQiBDQTAeFw0xNDEyMDExNTAw
  54141. MzJaFw0zOTEyMDExNTEwMzFaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYD
  54142. VQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEds
  54143. b2JhbCBSb290IEdCIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2Be3HEokKtaX
  54144. scriHvt9OO+Y9bI5mE4nuBFde9IllIiCFSZqGzG7qFshISvYD06fWvGxWuR51jIjK+FTzJlFXHtP
  54145. rby/h0oLS5daqPZI7H17Dc0hBt+eFf1Biki3IPShehtX1F1Q/7pn2COZH8g/497/b1t3sWtuuMlk
  54146. 9+HKQUYOKXHQuSP8yYFfTvdv37+ErXNku7dCjmn21HYdfp2nuFeKUWdy19SouJVUQHMD9ur06/4o
  54147. Qnc/nSMbsrY9gBQHTC5P99UKFg29ZkM3fiNDecNAhvVMKdqOmq0NpQSHiB6F4+lT1ZvIiwNjeOvg
  54148. GUpuuy9rM2RYk61pv48b74JIxwIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB
  54149. /zAdBgNVHQ4EFgQUNQ/INmNe4qPs+TtmFc5RUuORmj0wEAYJKwYBBAGCNxUBBAMCAQAwDQYJKoZI
  54150. hvcNAQELBQADggEBAEBM+4eymYGQfp3FsLAmzYh7KzKNbrghcViXfa43FK8+5/ea4n32cZiZBKpD
  54151. dHij40lhPnOMTZTg+XHEthYOU3gf1qKHLwI5gSk8rxWYITD+KJAAjNHhy/peyP34EEY7onhCkRd0
  54152. VQreUGdNZtGn//3ZwLWoo4rOZvUPQ82nK1d7Y0Zqqi5S2PTt4W2tKZB4SLrhI6qjiey1q5bAtEui
  54153. HZeeevJuQHHfaPFlTc58Bd9TZaml8LGXBHAVRgOY1NK/VLSgWH1Sb9pWJmLU2NuJMW8c8CLC02Ic
  54154. Nc1MaRVUGpCY3useX8p3x8uOPUNpnJpY0CQ73xtAln41rYHHTnG6iBM=
  54155. -----END CERTIFICATE-----
  54156. SZAFIR ROOT CA2
  54157. ===============
  54158. -----BEGIN CERTIFICATE-----
  54159. MIIDcjCCAlqgAwIBAgIUPopdB+xV0jLVt+O2XwHrLdzk1uQwDQYJKoZIhvcNAQELBQAwUTELMAkG
  54160. A1UEBhMCUEwxKDAmBgNVBAoMH0tyYWpvd2EgSXpiYSBSb3psaWN6ZW5pb3dhIFMuQS4xGDAWBgNV
  54161. BAMMD1NaQUZJUiBST09UIENBMjAeFw0xNTEwMTkwNzQzMzBaFw0zNTEwMTkwNzQzMzBaMFExCzAJ
  54162. BgNVBAYTAlBMMSgwJgYDVQQKDB9LcmFqb3dhIEl6YmEgUm96bGljemVuaW93YSBTLkEuMRgwFgYD
  54163. VQQDDA9TWkFGSVIgUk9PVCBDQTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC3vD5Q
  54164. qEvNQLXOYeeWyrSh2gwisPq1e3YAd4wLz32ohswmUeQgPYUM1ljj5/QqGJ3a0a4m7utT3PSQ1hNK
  54165. DJA8w/Ta0o4NkjrcsbH/ON7Dui1fgLkCvUqdGw+0w8LBZwPd3BucPbOw3gAeqDRHu5rr/gsUvTaE
  54166. 2g0gv/pby6kWIK05YO4vdbbnl5z5Pv1+TW9NL++IDWr63fE9biCloBK0TXC5ztdyO4mTp4CEHCdJ
  54167. ckm1/zuVnsHMyAHs6A6KCpbns6aH5db5BSsNl0BwPLqsdVqc1U2dAgrSS5tmS0YHF2Wtn2yIANwi
  54168. ieDhZNRnvDF5YTy7ykHNXGoAyDw4jlivAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0P
  54169. AQH/BAQDAgEGMB0GA1UdDgQWBBQuFqlKGLXLzPVvUPMjX/hd56zwyDANBgkqhkiG9w0BAQsFAAOC
  54170. AQEAtXP4A9xZWx126aMqe5Aosk3AM0+qmrHUuOQn/6mWmc5G4G18TKI4pAZw8PRBEew/R40/cof5
  54171. O/2kbytTAOD/OblqBw7rHRz2onKQy4I9EYKL0rufKq8h5mOGnXkZ7/e7DDWQw4rtTw/1zBLZpD67
  54172. oPwglV9PJi8RI4NOdQcPv5vRtB3pEAT+ymCPoky4rc/hkA/NrgrHXXu3UNLUYfrVFdvXn4dRVOul
  54173. 4+vJhaAlIDf7js4MNIThPIGyd05DpYhfhmehPea0XGG2Ptv+tyjFogeutcrKjSoS75ftwjCkySp6
  54174. +/NNIxuZMzSgLvWpCz/UXeHPhJ/iGcJfitYgHuNztw==
  54175. -----END CERTIFICATE-----
  54176. Certum Trusted Network CA 2
  54177. ===========================
  54178. -----BEGIN CERTIFICATE-----
  54179. MIIF0jCCA7qgAwIBAgIQIdbQSk8lD8kyN/yqXhKN6TANBgkqhkiG9w0BAQ0FADCBgDELMAkGA1UE
  54180. BhMCUEwxIjAgBgNVBAoTGVVuaXpldG8gVGVjaG5vbG9naWVzIFMuQS4xJzAlBgNVBAsTHkNlcnR1
  54181. bSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEkMCIGA1UEAxMbQ2VydHVtIFRydXN0ZWQgTmV0d29y
  54182. ayBDQSAyMCIYDzIwMTExMDA2MDgzOTU2WhgPMjA0NjEwMDYwODM5NTZaMIGAMQswCQYDVQQGEwJQ
  54183. TDEiMCAGA1UEChMZVW5pemV0byBUZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENl
  54184. cnRpZmljYXRpb24gQXV0aG9yaXR5MSQwIgYDVQQDExtDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENB
  54185. IDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC9+Xj45tWADGSdhhuWZGc/IjoedQF9
  54186. 7/tcZ4zJzFxrqZHmuULlIEub2pt7uZld2ZuAS9eEQCsn0+i6MLs+CRqnSZXvK0AkwpfHp+6bJe+o
  54187. CgCXhVqqndwpyeI1B+twTUrWwbNWuKFBOJvR+zF/j+Bf4bE/D44WSWDXBo0Y+aomEKsq09DRZ40b
  54188. Rr5HMNUuctHFY9rnY3lEfktjJImGLjQ/KUxSiyqnwOKRKIm5wFv5HdnnJ63/mgKXwcZQkpsCLL2p
  54189. uTRZCr+ESv/f/rOf69me4Jgj7KZrdxYq28ytOxykh9xGc14ZYmhFV+SQgkK7QtbwYeDBoz1mo130
  54190. GO6IyY0XRSmZMnUCMe4pJshrAua1YkV/NxVaI2iJ1D7eTiew8EAMvE0Xy02isx7QBlrd9pPPV3WZ
  54191. 9fqGGmd4s7+W/jTcvedSVuWz5XV710GRBdxdaeOVDUO5/IOWOZV7bIBaTxNyxtd9KXpEulKkKtVB
  54192. Rgkg/iKgtlswjbyJDNXXcPiHUv3a76xRLgezTv7QCdpw75j6VuZt27VXS9zlLCUVyJ4ueE742pye
  54193. hizKV/Ma5ciSixqClnrDvFASadgOWkaLOusm+iPJtrCBvkIApPjW/jAux9JG9uWOdf3yzLnQh1vM
  54194. BhBgu4M1t15n3kfsmUjxpKEV/q2MYo45VU85FrmxY53/twIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  54195. AQH/MB0GA1UdDgQWBBS2oVQ5AsOgP46KvPrU+Bym0ToO/TAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZI
  54196. hvcNAQENBQADggIBAHGlDs7k6b8/ONWJWsQCYftMxRQXLYtPU2sQF/xlhMcQSZDe28cmk4gmb3DW
  54197. Al45oPePq5a1pRNcgRRtDoGCERuKTsZPpd1iHkTfCVn0W3cLN+mLIMb4Ck4uWBzrM9DPhmDJ2vuA
  54198. L55MYIR4PSFk1vtBHxgP58l1cb29XN40hz5BsA72udY/CROWFC/emh1auVbONTqwX3BNXuMp8SMo
  54199. clm2q8KMZiYcdywmdjWLKKdpoPk79SPdhRB0yZADVpHnr7pH1BKXESLjokmUbOe3lEu6LaTaM4tM
  54200. pkT/WjzGHWTYtTHkpjx6qFcL2+1hGsvxznN3Y6SHb0xRONbkX8eftoEq5IVIeVheO/jbAoJnwTnb
  54201. w3RLPTYe+SmTiGhbqEQZIfCn6IENLOiTNrQ3ssqwGyZ6miUfmpqAnksqP/ujmv5zMnHCnsZy4Ypo
  54202. J/HkD7TETKVhk/iXEAcqMCWpuchxuO9ozC1+9eB+D4Kob7a6bINDd82Kkhehnlt4Fj1F4jNy3eFm
  54203. ypnTycUm/Q1oBEauttmbjL4ZvrHG8hnjXALKLNhvSgfZyTXaQHXyxKcZb55CEJh15pWLYLztxRLX
  54204. is7VmFxWlgPF7ncGNf/P5O4/E2Hu29othfDNrp2yGAlFw5Khchf8R7agCyzxxN5DaAhqXzvwdmP7
  54205. zAYspsbiDrW5viSP
  54206. -----END CERTIFICATE-----
  54207. Hellenic Academic and Research Institutions RootCA 2015
  54208. =======================================================
  54209. -----BEGIN CERTIFICATE-----
  54210. MIIGCzCCA/OgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcT
  54211. BkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0
  54212. aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNVBAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNl
  54213. YXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIwMTUwHhcNMTUwNzA3MTAxMTIxWhcNNDAwNjMwMTAx
  54214. MTIxWjCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMg
  54215. QWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNV
  54216. BAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIw
  54217. MTUwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDC+Kk/G4n8PDwEXT2QNrCROnk8Zlrv
  54218. bTkBSRq0t89/TSNTt5AA4xMqKKYx8ZEA4yjsriFBzh/a/X0SWwGDD7mwX5nh8hKDgE0GPt+sr+eh
  54219. iGsxr/CL0BgzuNtFajT0AoAkKAoCFZVedioNmToUW/bLy1O8E00BiDeUJRtCvCLYjqOWXjrZMts+
  54220. 6PAQZe104S+nfK8nNLspfZu2zwnI5dMK/IhlZXQK3HMcXM1AsRzUtoSMTFDPaI6oWa7CJ06CojXd
  54221. FPQf/7J31Ycvqm59JCfnxssm5uX+Zwdj2EUN3TpZZTlYepKZcj2chF6IIbjV9Cz82XBST3i4vTwr
  54222. i5WY9bPRaM8gFH5MXF/ni+X1NYEZN9cRCLdmvtNKzoNXADrDgfgXy5I2XdGj2HUb4Ysn6npIQf1F
  54223. GQatJ5lOwXBH3bWfgVMS5bGMSF0xQxfjjMZ6Y5ZLKTBOhE5iGV48zpeQpX8B653g+IuJ3SWYPZK2
  54224. fu/Z8VFRfS0myGlZYeCsargqNhEEelC9MoS+L9xy1dcdFkfkR2YgP/SWxa+OAXqlD3pk9Q0Yh9mu
  54225. iNX6hME6wGkoLfINaFGq46V3xqSQDqE3izEjR8EJCOtu93ib14L8hCCZSRm2Ekax+0VVFqmjZayc
  54226. Bw/qa9wfLgZy7IaIEuQt218FL+TwA9MmM+eAws1CoRc0CwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  54227. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUcRVnyMjJvXVdctA4GGqd83EkVAswDQYJKoZI
  54228. hvcNAQELBQADggIBAHW7bVRLqhBYRjTyYtcWNl0IXtVsyIe9tC5G8jH4fOpCtZMWVdyhDBKg2mF+
  54229. D1hYc2Ryx+hFjtyp8iY/xnmMsVMIM4GwVhO+5lFc2JsKT0ucVlMC6U/2DWDqTUJV6HwbISHTGzrM
  54230. d/K4kPFox/la/vot9L/J9UUbzjgQKjeKeaO04wlshYaT/4mWJ3iBj2fjRnRUjtkNaeJK9E10A/+y
  54231. d+2VZ5fkscWrv2oj6NSU4kQoYsRL4vDY4ilrGnB+JGGTe08DMiUNRSQrlrRGar9KC/eaj8GsGsVn
  54232. 82800vpzY4zvFrCopEYq+OsS7HK07/grfoxSwIuEVPkvPuNVqNxmsdnhX9izjFk0WaSrT2y7Hxjb
  54233. davYy5LNlDhhDgcGH0tGEPEVvo2FXDtKK4F5D7Rpn0lQl033DlZdwJVqwjbDG2jJ9SrcR5q+ss7F
  54234. Jej6A7na+RZukYT1HCjI/CbM1xyQVqdfbzoEvM14iQuODy+jqk+iGxI9FghAD/FGTNeqewjBCvVt
  54235. J94Cj8rDtSvK6evIIVM4pcw72Hc3MKJP2W/R8kCtQXoXxdZKNYm3QdV8hn9VTYNKpXMgwDqvkPGa
  54236. JI7ZjnHKe7iG2rKPmT4dEw0SEe7Uq/DpFXYC5ODfqiAeW2GFZECpkJcNrVPSWh2HagCXZWK0vm9q
  54237. p/UsQu0yrbYhnr68
  54238. -----END CERTIFICATE-----
  54239. Hellenic Academic and Research Institutions ECC RootCA 2015
  54240. ===========================================================
  54241. -----BEGIN CERTIFICATE-----
  54242. MIICwzCCAkqgAwIBAgIBADAKBggqhkjOPQQDAjCBqjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0
  54243. aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9u
  54244. cyBDZXJ0LiBBdXRob3JpdHkxRDBCBgNVBAMTO0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJj
  54245. aCBJbnN0aXR1dGlvbnMgRUNDIFJvb3RDQSAyMDE1MB4XDTE1MDcwNzEwMzcxMloXDTQwMDYzMDEw
  54246. MzcxMlowgaoxCzAJBgNVBAYTAkdSMQ8wDQYDVQQHEwZBdGhlbnMxRDBCBgNVBAoTO0hlbGxlbmlj
  54247. IEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9yaXR5MUQwQgYD
  54248. VQQDEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25zIEVDQyBSb290
  54249. Q0EgMjAxNTB2MBAGByqGSM49AgEGBSuBBAAiA2IABJKgQehLgoRc4vgxEZmGZE4JJS+dQS8KrjVP
  54250. dJWyUWRrjWvmP3CV8AVER6ZyOFB2lQJajq4onvktTpnvLEhvTCUp6NFxW98dwXU3tNf6e3pCnGoK
  54251. Vlp8aQuqgAkkbH7BRqNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  54252. BBYEFLQiC4KZJAEOnLvkDv2/+5cgk5kqMAoGCCqGSM49BAMCA2cAMGQCMGfOFmI4oqxiRaeplSTA
  54253. GiecMjvAwNW6qef4BENThe5SId6d9SWDPp5YSy/XZxMOIQIwBeF1Ad5o7SofTUwJCA3sS61kFyjn
  54254. dc5FZXIhF8siQQ6ME5g4mlRtm8rifOoCWCKR
  54255. -----END CERTIFICATE-----
  54256. ISRG Root X1
  54257. ============
  54258. -----BEGIN CERTIFICATE-----
  54259. MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAwTzELMAkGA1UE
  54260. BhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2VhcmNoIEdyb3VwMRUwEwYDVQQD
  54261. EwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQG
  54262. EwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMT
  54263. DElTUkcgUm9vdCBYMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54r
  54264. Vygch77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+0TM8ukj1
  54265. 3Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6UA5/TR5d8mUgjU+g4rk8K
  54266. b4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sWT8KOEUt+zwvo/7V3LvSye0rgTBIlDHCN
  54267. Aymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyHB5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ
  54268. 4Q7e2RCOFvu396j3x+UCB5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf
  54269. 1b0SHzUvKBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWnOlFu
  54270. hjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTnjh8BCNAw1FtxNrQH
  54271. usEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbwqHyGO0aoSCqI3Haadr8faqU9GY/r
  54272. OPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CIrU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4G
  54273. A1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY
  54274. 9umbbjANBgkqhkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
  54275. ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ3BebYhtF8GaV
  54276. 0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KKNFtY2PwByVS5uCbMiogziUwt
  54277. hDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJw
  54278. TdwJx4nLCgdNbOhdjsnvzqvHu7UrTkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nx
  54279. e5AW0wdeRlN8NwdCjNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZA
  54280. JzVcoyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq4RgqsahD
  54281. YVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPAmRGunUHBcnWEvgJBQl9n
  54282. JEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57demyPxgcYxn/eR44/KJ4EBs+lVDR3veyJ
  54283. m+kXQ99b21/+jh5Xos1AnX5iItreGCc=
  54284. -----END CERTIFICATE-----
  54285. AC RAIZ FNMT-RCM
  54286. ================
  54287. -----BEGIN CERTIFICATE-----
  54288. MIIFgzCCA2ugAwIBAgIPXZONMGc2yAYdGsdUhGkHMA0GCSqGSIb3DQEBCwUAMDsxCzAJBgNVBAYT
  54289. AkVTMREwDwYDVQQKDAhGTk1ULVJDTTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTAeFw0wODEw
  54290. MjkxNTU5NTZaFw0zMDAxMDEwMDAwMDBaMDsxCzAJBgNVBAYTAkVTMREwDwYDVQQKDAhGTk1ULVJD
  54291. TTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  54292. ggIBALpxgHpMhm5/yBNtwMZ9HACXjywMI7sQmkCpGreHiPibVmr75nuOi5KOpyVdWRHbNi63URcf
  54293. qQgfBBckWKo3Shjf5TnUV/3XwSyRAZHiItQDwFj8d0fsjz50Q7qsNI1NOHZnjrDIbzAzWHFctPVr
  54294. btQBULgTfmxKo0nRIBnuvMApGGWn3v7v3QqQIecaZ5JCEJhfTzC8PhxFtBDXaEAUwED653cXeuYL
  54295. j2VbPNmaUtu1vZ5Gzz3rkQUCwJaydkxNEJY7kvqcfw+Z374jNUUeAlz+taibmSXaXvMiwzn15Cou
  54296. 08YfxGyqxRxqAQVKL9LFwag0Jl1mpdICIfkYtwb1TplvqKtMUejPUBjFd8g5CSxJkjKZqLsXF3mw
  54297. WsXmo8RZZUc1g16p6DULmbvkzSDGm0oGObVo/CK67lWMK07q87Hj/LaZmtVC+nFNCM+HHmpxffnT
  54298. tOmlcYF7wk5HlqX2doWjKI/pgG6BU6VtX7hI+cL5NqYuSf+4lsKMB7ObiFj86xsc3i1w4peSMKGJ
  54299. 47xVqCfWS+2QrYv6YyVZLag13cqXM7zlzced0ezvXg5KkAYmY6252TUtB7p2ZSysV4999AeU14EC
  54300. ll2jB0nVetBX+RvnU0Z1qrB5QstocQjpYL05ac70r8NWQMetUqIJ5G+GR4of6ygnXYMgrwTJbFaa
  54301. i0b1AgMBAAGjgYMwgYAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE
  54302. FPd9xf3E6Jobd2Sn9R2gzL+HYJptMD4GA1UdIAQ3MDUwMwYEVR0gADArMCkGCCsGAQUFBwIBFh1o
  54303. dHRwOi8vd3d3LmNlcnQuZm5tdC5lcy9kcGNzLzANBgkqhkiG9w0BAQsFAAOCAgEAB5BK3/MjTvDD
  54304. nFFlm5wioooMhfNzKWtN/gHiqQxjAb8EZ6WdmF/9ARP67Jpi6Yb+tmLSbkyU+8B1RXxlDPiyN8+s
  54305. D8+Nb/kZ94/sHvJwnvDKuO+3/3Y3dlv2bojzr2IyIpMNOmqOFGYMLVN0V2Ue1bLdI4E7pWYjJ2cJ
  54306. j+F3qkPNZVEI7VFY/uY5+ctHhKQV8Xa7pO6kO8Rf77IzlhEYt8llvhjho6Tc+hj507wTmzl6NLrT
  54307. Qfv6MooqtyuGC2mDOL7Nii4LcK2NJpLuHvUBKwrZ1pebbuCoGRw6IYsMHkCtA+fdZn71uSANA+iW
  54308. +YJF1DngoABd15jmfZ5nc8OaKveri6E6FO80vFIOiZiaBECEHX5FaZNXzuvO+FB8TxxuBEOb+dY7
  54309. Ixjp6o7RTUaN8Tvkasq6+yO3m/qZASlaWFot4/nUbQ4mrcFuNLwy+AwF+mWj2zs3gyLp1txyM/1d
  54310. 8iC9djwj2ij3+RvrWWTV3F9yfiD8zYm1kGdNYno/Tq0dwzn+evQoFt9B9kiABdcPUXmsEKvU7ANm
  54311. 5mqwujGSQkBqvjrTcuFqN1W8rB2Vt2lh8kORdOag0wokRqEIr9baRRmW1FMdW4R58MD3R++Lj8UG
  54312. rp1MYp3/RgT408m2ECVAdf4WqslKYIYvuu8wd+RU4riEmViAqhOLUTpPSPaLtrM=
  54313. -----END CERTIFICATE-----
  54314. Amazon Root CA 1
  54315. ================
  54316. -----BEGIN CERTIFICATE-----
  54317. MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsFADA5MQswCQYD
  54318. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAxMB4XDTE1
  54319. MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  54320. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  54321. ggEBALJ4gHHKeNXjca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgH
  54322. FzZM9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qwIFAGbHrQ
  54323. gLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6VOujw5H5SNz/0egwLX0t
  54324. dHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L93FcXmn/6pUCyziKrlA4b9v7LWIbxcce
  54325. VOF34GfID5yHI9Y/QCB/IIDEgEw+OyQmjgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB
  54326. /zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3
  54327. DQEBCwUAA4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDIU5PM
  54328. CCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUsN+gDS63pYaACbvXy
  54329. 8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vvo/ufQJVtMVT8QtPHRh8jrdkPSHCa
  54330. 2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2
  54331. xJNDd2ZhwLnoQdeXeGADbkpyrqXRfboQnoZsG4q5WTP468SQvvG5
  54332. -----END CERTIFICATE-----
  54333. Amazon Root CA 2
  54334. ================
  54335. -----BEGIN CERTIFICATE-----
  54336. MIIFQTCCAymgAwIBAgITBmyf0pY1hp8KD+WGePhbJruKNzANBgkqhkiG9w0BAQwFADA5MQswCQYD
  54337. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAyMB4XDTE1
  54338. MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  54339. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  54340. ggIBAK2Wny2cSkxKgXlRmeyKy2tgURO8TW0G/LAIjd0ZEGrHJgw12MBvIITplLGbhQPDW9tK6Mj4
  54341. kHbZW0/jTOgGNk3Mmqw9DJArktQGGWCsN0R5hYGCrVo34A3MnaZMUnbqQ523BNFQ9lXg1dKmSYXp
  54342. N+nKfq5clU1Imj+uIFptiJXZNLhSGkOQsL9sBbm2eLfq0OQ6PBJTYv9K8nu+NQWpEjTj82R0Yiw9
  54343. AElaKP4yRLuH3WUnAnE72kr3H9rN9yFVkE8P7K6C4Z9r2UXTu/Bfh+08LDmG2j/e7HJV63mjrdvd
  54344. fLC6HM783k81ds8P+HgfajZRRidhW+mez/CiVX18JYpvL7TFz4QuK/0NURBs+18bvBt+xa47mAEx
  54345. kv8LV/SasrlX6avvDXbR8O70zoan4G7ptGmh32n2M8ZpLpcTnqWHsFcQgTfJU7O7f/aS0ZzQGPSS
  54346. btqDT6ZjmUyl+17vIWR6IF9sZIUVyzfpYgwLKhbcAS4y2j5L9Z469hdAlO+ekQiG+r5jqFoz7Mt0
  54347. Q5X5bGlSNscpb/xVA1wf+5+9R+vnSUeVC06JIglJ4PVhHvG/LopyboBZ/1c6+XUyo05f7O0oYtlN
  54348. c/LMgRdg7c3r3NunysV+Ar3yVAhU/bQtCSwXVEqY0VThUWcI0u1ufm8/0i2BWSlmy5A5lREedCf+
  54349. 3euvAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSw
  54350. DPBMMPQFWAJI/TPlUq9LhONmUjANBgkqhkiG9w0BAQwFAAOCAgEAqqiAjw54o+Ci1M3m9Zh6O+oA
  54351. A7CXDpO8Wqj2LIxyh6mx/H9z/WNxeKWHWc8w4Q0QshNabYL1auaAn6AFC2jkR2vHat+2/XcycuUY
  54352. +gn0oJMsXdKMdYV2ZZAMA3m3MSNjrXiDCYZohMr/+c8mmpJ5581LxedhpxfL86kSk5Nrp+gvU5LE
  54353. YFiwzAJRGFuFjWJZY7attN6a+yb3ACfAXVU3dJnJUH/jWS5E4ywl7uxMMne0nxrpS10gxdr9HIcW
  54354. xkPo1LsmmkVwXqkLN1PiRnsn/eBG8om3zEK2yygmbtmlyTrIQRNg91CMFa6ybRoVGld45pIq2WWQ
  54355. gj9sAq+uEjonljYE1x2igGOpm/HlurR8FLBOybEfdF849lHqm/osohHUqS0nGkWxr7JOcQ3AWEbW
  54356. aQbLU8uz/mtBzUF+fUwPfHJ5elnNXkoOrJupmHN5fLT0zLm4BwyydFy4x2+IoZCn9Kr5v2c69BoV
  54357. Yh63n749sSmvZ6ES8lgQGVMDMBu4Gon2nL2XA46jCfMdiyHxtN/kHNGfZQIG6lzWE7OE76KlXIx3
  54358. KadowGuuQNKotOrN8I1LOJwZmhsoVLiJkO/KdYE+HvJkJMcYr07/R54H9jVlpNMKVv/1F2Rs76gi
  54359. JUmTtt8AF9pYfl3uxRuw0dFfIRDH+fO6AgonB8Xx1sfT4PsJYGw=
  54360. -----END CERTIFICATE-----
  54361. Amazon Root CA 3
  54362. ================
  54363. -----BEGIN CERTIFICATE-----
  54364. MIIBtjCCAVugAwIBAgITBmyf1XSXNmY/Owua2eiedgPySjAKBggqhkjOPQQDAjA5MQswCQYDVQQG
  54365. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAzMB4XDTE1MDUy
  54366. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  54367. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCmXp8ZB
  54368. f8ANm+gBG1bG8lKlui2yEujSLtf6ycXYqm0fc4E7O5hrOXwzpcVOho6AF2hiRVd9RFgdszflZwjr
  54369. Zt6jQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSrttvXBp43
  54370. rDCGB5Fwx5zEGbF4wDAKBggqhkjOPQQDAgNJADBGAiEA4IWSoxe3jfkrBqWTrBqYaGFy+uGh0Psc
  54371. eGCmQ5nFuMQCIQCcAu/xlJyzlvnrxir4tiz+OpAUFteMYyRIHN8wfdVoOw==
  54372. -----END CERTIFICATE-----
  54373. Amazon Root CA 4
  54374. ================
  54375. -----BEGIN CERTIFICATE-----
  54376. MIIB8jCCAXigAwIBAgITBmyf18G7EEwpQ+Vxe3ssyBrBDjAKBggqhkjOPQQDAzA5MQswCQYDVQQG
  54377. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSA0MB4XDTE1MDUy
  54378. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  54379. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgNDB2MBAGByqGSM49AgEGBSuBBAAiA2IABNKrijdPo1MN
  54380. /sGKe0uoe0ZLY7Bi9i0b2whxIdIA6GO9mif78DluXeo9pcmBqqNbIJhFXRbb/egQbeOc4OO9X4Ri
  54381. 83BkM6DLJC9wuoihKqB1+IGuYgbEgds5bimwHvouXKNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV
  54382. HQ8BAf8EBAMCAYYwHQYDVR0OBBYEFNPsxzplbszh2naaVvuc84ZtV+WBMAoGCCqGSM49BAMDA2gA
  54383. MGUCMDqLIfG9fhGt0O9Yli/W651+kI0rz2ZVwyzjKKlwCkcO8DdZEv8tmZQoTipPNU0zWgIxAOp1
  54384. AE47xDqUEpHJWEadIRNyp4iciuRMStuW1KyLa2tJElMzrdfkviT8tQp21KW8EA==
  54385. -----END CERTIFICATE-----
  54386. LuxTrust Global Root 2
  54387. ======================
  54388. -----BEGIN CERTIFICATE-----
  54389. MIIFwzCCA6ugAwIBAgIUCn6m30tEntpqJIWe5rgV0xZ/u7EwDQYJKoZIhvcNAQELBQAwRjELMAkG
  54390. A1UEBhMCTFUxFjAUBgNVBAoMDUx1eFRydXN0IFMuQS4xHzAdBgNVBAMMFkx1eFRydXN0IEdsb2Jh
  54391. bCBSb290IDIwHhcNMTUwMzA1MTMyMTU3WhcNMzUwMzA1MTMyMTU3WjBGMQswCQYDVQQGEwJMVTEW
  54392. MBQGA1UECgwNTHV4VHJ1c3QgUy5BLjEfMB0GA1UEAwwWTHV4VHJ1c3QgR2xvYmFsIFJvb3QgMjCC
  54393. AiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANeFl78RmOnwYoNMPIf5U2o3C/IPPIfOb9wm
  54394. Kb3FibrJgz337spbxm1Jc7TJRqMbNBM/wYlFV/TZsfs2ZUv7COJIcRHIbjuend+JZTemhfY7RBi2
  54395. xjcwYkSSl2l9QjAk5A0MiWtj3sXh306pFGxT4GHO9hcvHTy95iJMHZP1EMShduxq3sVs35a0VkBC
  54396. wGKSMKEtFZSg0iAGCW5qbeXrt77U8PEVfIvmTroTzEsnXpk8F12PgX8zPU/TPxvsXD/wPEx1bvKm
  54397. 1Z3aLQdjAsZy6ZS8TEmVT4hSyNvoaYL4zDRbIvCGp4m9SAptZoFtyMhk+wHh9OHe2Z7d21vUKpkm
  54398. FRseTJIpgp7VkoGSQXAZ96Tlk0u8d2cx3Rz9MXANF5kM+Qw5GSoXtTBxVdUPrljhPS80m8+f9niF
  54399. wpN6cj5mj5wWEWCPnolvZ77gR1o7DJpni89Gxq44o/KnvObWhWszJHAiS8sIm7vI+AIpHb4gDEa/
  54400. a4ebsypmQjVGbKq6rfmYe+lQVRQxv7HaLe2ArWgk+2mr2HETMOZns4dA/Yl+8kPREd8vZS9kzl8U
  54401. ubG/Mb2HeFpZZYiq/FkySIbWTLkpS5XTdvN3JW1CHDiDTf2jX5t/Lax5Gw5CMZdjpPuKadUiDTSQ
  54402. MC6otOBttpSsvItO13D8xTiOZCXhTTmQzsmHhFhxAgMBAAGjgagwgaUwDwYDVR0TAQH/BAUwAwEB
  54403. /zBCBgNVHSAEOzA5MDcGByuBKwEBAQowLDAqBggrBgEFBQcCARYeaHR0cHM6Ly9yZXBvc2l0b3J5
  54404. Lmx1eHRydXN0Lmx1MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBT/GCh2+UgFLKGu8SsbK7JT
  54405. +Et8szAdBgNVHQ4EFgQU/xgodvlIBSyhrvErGyuyU/hLfLMwDQYJKoZIhvcNAQELBQADggIBAGoZ
  54406. FO1uecEsh9QNcH7X9njJCwROxLHOk3D+sFTAMs2ZMGQXvw/l4jP9BzZAcg4atmpZ1gDlaCDdLnIN
  54407. H2pkMSCEfUmmWjfrRcmF9dTHF5kH5ptV5AzoqbTOjFu1EVzPig4N1qx3gf4ynCSecs5U89BvolbW
  54408. 7MM3LGVYvlcAGvI1+ut7MV3CwRI9loGIlonBWVx65n9wNOeD4rHh4bhY79SV5GCc8JaXcozrhAIu
  54409. ZY+kt9J/Z93I055cqqmkoCUUBpvsT34tC38ddfEz2O3OuHVtPlu5mB0xDVbYQw8wkbIEa91WvpWA
  54410. VWe+2M2D2RjuLg+GLZKecBPs3lHJQ3gCpU3I+V/EkVhGFndadKpAvAefMLmx9xIX3eP/JEAdemrR
  54411. TxgKqpAd60Ae36EeRJIQmvKN4dFLRp7oRUKX6kWZ8+xm1QL68qZKJKrezrnK+T+Tb/mjuuqlPpmt
  54412. /f97mfVl7vBZKGfXkJWkE4SphMHozs51k2MavDzq1WQfLSoSOcbDWjLtR5EWDrw4wVDej8oqkDQc
  54413. 7kGUnF4ZLvhFSZl0kbAEb+MEWrGrKqv+x9CWttrhSmQGbmBNvUJO/3jaJMobtNeWOWyu8Q6qp31I
  54414. iyBMz2TWuJdGsE7RKlY6oJO9r4Ak4Ap+58rVyuiFVdw2KuGUaJPHZnJED4AhMmwlxyOAgwrr
  54415. -----END CERTIFICATE-----
  54416. TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1
  54417. =============================================
  54418. -----BEGIN CERTIFICATE-----
  54419. MIIEYzCCA0ugAwIBAgIBATANBgkqhkiG9w0BAQsFADCB0jELMAkGA1UEBhMCVFIxGDAWBgNVBAcT
  54420. D0dlYnplIC0gS29jYWVsaTFCMEAGA1UEChM5VHVya2l5ZSBCaWxpbXNlbCB2ZSBUZWtub2xvamlr
  54421. IEFyYXN0aXJtYSBLdXJ1bXUgLSBUVUJJVEFLMS0wKwYDVQQLEyRLYW11IFNlcnRpZmlrYXN5b24g
  54422. TWVya2V6aSAtIEthbXUgU00xNjA0BgNVBAMTLVRVQklUQUsgS2FtdSBTTSBTU0wgS29rIFNlcnRp
  54423. ZmlrYXNpIC0gU3VydW0gMTAeFw0xMzExMjUwODI1NTVaFw00MzEwMjUwODI1NTVaMIHSMQswCQYD
  54424. VQQGEwJUUjEYMBYGA1UEBxMPR2ViemUgLSBLb2NhZWxpMUIwQAYDVQQKEzlUdXJraXllIEJpbGlt
  54425. c2VsIHZlIFRla25vbG9qaWsgQXJhc3Rpcm1hIEt1cnVtdSAtIFRVQklUQUsxLTArBgNVBAsTJEth
  54426. bXUgU2VydGlmaWthc3lvbiBNZXJrZXppIC0gS2FtdSBTTTE2MDQGA1UEAxMtVFVCSVRBSyBLYW11
  54427. IFNNIFNTTCBLb2sgU2VydGlmaWthc2kgLSBTdXJ1bSAxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  54428. MIIBCgKCAQEAr3UwM6q7a9OZLBI3hNmNe5eA027n/5tQlT6QlVZC1xl8JoSNkvoBHToP4mQ4t4y8
  54429. 6Ij5iySrLqP1N+RAjhgleYN1Hzv/bKjFxlb4tO2KRKOrbEz8HdDc72i9z+SqzvBV96I01INrN3wc
  54430. wv61A+xXzry0tcXtAA9TNypN9E8Mg/uGz8v+jE69h/mniyFXnHrfA2eJLJ2XYacQuFWQfw4tJzh0
  54431. 3+f92k4S400VIgLI4OD8D62K18lUUMw7D8oWgITQUVbDjlZ/iSIzL+aFCr2lqBs23tPcLG07xxO9
  54432. WSMs5uWk99gL7eqQQESolbuT1dCANLZGeA4fAJNG4e7p+exPFwIDAQABo0IwQDAdBgNVHQ4EFgQU
  54433. ZT/HiobGPN08VFw1+DrtUgxHV8gwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJ
  54434. KoZIhvcNAQELBQADggEBACo/4fEyjq7hmFxLXs9rHmoJ0iKpEsdeV31zVmSAhHqT5Am5EM2fKifh
  54435. AHe+SMg1qIGf5LgsyX8OsNJLN13qudULXjS99HMpw+0mFZx+CFOKWI3QSyjfwbPfIPP54+M638yc
  54436. lNhOT8NrF7f3cuitZjO1JVOr4PhMqZ398g26rrnZqsZr+ZO7rqu4lzwDGrpDxpa5RXI4s6ehlj2R
  54437. e37AIVNMh+3yC1SVUZPVIqUNivGTDj5UDrDYyU7c8jEyVupk+eq1nRZmQnLzf9OxMUP8pI4X8W0j
  54438. q5Rm+K37DwhuJi1/FwcJsoz7UMCflo3Ptv0AnVoUmr8CRPXBwp8iXqIPoeM=
  54439. -----END CERTIFICATE-----
  54440. GDCA TrustAUTH R5 ROOT
  54441. ======================
  54442. -----BEGIN CERTIFICATE-----
  54443. MIIFiDCCA3CgAwIBAgIIfQmX/vBH6nowDQYJKoZIhvcNAQELBQAwYjELMAkGA1UEBhMCQ04xMjAw
  54444. BgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZIENPLixMVEQuMR8wHQYDVQQD
  54445. DBZHRENBIFRydXN0QVVUSCBSNSBST09UMB4XDTE0MTEyNjA1MTMxNVoXDTQwMTIzMTE1NTk1OVow
  54446. YjELMAkGA1UEBhMCQ04xMjAwBgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZ
  54447. IENPLixMVEQuMR8wHQYDVQQDDBZHRENBIFRydXN0QVVUSCBSNSBST09UMIICIjANBgkqhkiG9w0B
  54448. AQEFAAOCAg8AMIICCgKCAgEA2aMW8Mh0dHeb7zMNOwZ+Vfy1YI92hhJCfVZmPoiC7XJjDp6L3TQs
  54449. AlFRwxn9WVSEyfFrs0yw6ehGXTjGoqcuEVe6ghWinI9tsJlKCvLriXBjTnnEt1u9ol2x8kECK62p
  54450. OqPseQrsXzrj/e+APK00mxqriCZ7VqKChh/rNYmDf1+uKU49tm7srsHwJ5uu4/Ts765/94Y9cnrr
  54451. pftZTqfrlYwiOXnhLQiPzLyRuEH3FMEjqcOtmkVEs7LXLM3GKeJQEK5cy4KOFxg2fZfmiJqwTTQJ
  54452. 9Cy5WmYqsBebnh52nUpmMUHfP/vFBu8btn4aRjb3ZGM74zkYI+dndRTVdVeSN72+ahsmUPI2JgaQ
  54453. xXABZG12ZuGR224HwGGALrIuL4xwp9E7PLOR5G62xDtw8mySlwnNR30YwPO7ng/Wi64HtloPzgsM
  54454. R6flPri9fcebNaBhlzpBdRfMK5Z3KpIhHtmVdiBnaM8Nvd/WHwlqmuLMc3GkL30SgLdTMEZeS1SZ
  54455. D2fJpcjyIMGC7J0R38IC+xo70e0gmu9lZJIQDSri3nDxGGeCjGHeuLzRL5z7D9Ar7Rt2ueQ5Vfj4
  54456. oR24qoAATILnsn8JuLwwoC8N9VKejveSswoAHQBUlwbgsQfZxw9cZX08bVlX5O2ljelAU58VS6Bx
  54457. 9hoh49pwBiFYFIeFd3mqgnkCAwEAAaNCMEAwHQYDVR0OBBYEFOLJQJ9NzuiaoXzPDj9lxSmIahlR
  54458. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQDRSVfg
  54459. p8xoWLoBDysZzY2wYUWsEe1jUGn4H3++Fo/9nesLqjJHdtJnJO29fDMylyrHBYZmDRd9FBUb1Ov9
  54460. H5r2XpdptxolpAqzkT9fNqyL7FeoPueBihhXOYV0GkLH6VsTX4/5COmSdI31R9KrO9b7eGZONn35
  54461. 6ZLpBN79SWP8bfsUcZNnL0dKt7n/HipzcEYwv1ryL3ml4Y0M2fmyYzeMN2WFcGpcWwlyua1jPLHd
  54462. +PwyvzeG5LuOmCd+uh8W4XAR8gPfJWIyJyYYMoSf/wA6E7qaTfRPuBRwIrHKK5DOKcFw9C+df/KQ
  54463. HtZa37dG/OaG+svgIHZ6uqbL9XzeYqWxi+7egmaKTjowHz+Ay60nugxe19CxVsp3cbK1daFQqUBD
  54464. F8Io2c9Si1vIY9RCPqAzekYu9wogRlR+ak8x8YF+QnQ4ZXMn7sZ8uI7XpTrXmKGcjBBV09tL7ECQ
  54465. 8s1uV9JiDnxXk7Gnbc2dg7sq5+W2O3FYrf3RRbxake5TFW/TRQl1brqQXR4EzzffHqhmsYzmIGrv
  54466. /EhOdJhCrylvLmrH+33RZjEizIYAfmaDDEL0vTSSwxrqT8p+ck0LcIymSLumoRT2+1hEmRSuqguT
  54467. aaApJUqlyyvdimYHFngVV3Eb7PVHhPOeMTd61X8kreS8/f3MboPoDKi3QWwH3b08hpcv0g==
  54468. -----END CERTIFICATE-----
  54469. TrustCor RootCert CA-1
  54470. ======================
  54471. -----BEGIN CERTIFICATE-----
  54472. MIIEMDCCAxigAwIBAgIJANqb7HHzA7AZMA0GCSqGSIb3DQEBCwUAMIGkMQswCQYDVQQGEwJQQTEP
  54473. MA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3Ig
  54474. U3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5UcnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3Jp
  54475. dHkxHzAdBgNVBAMMFlRydXN0Q29yIFJvb3RDZXJ0IENBLTEwHhcNMTYwMjA0MTIzMjE2WhcNMjkx
  54476. MjMxMTcyMzE2WjCBpDELMAkGA1UEBhMCUEExDzANBgNVBAgMBlBhbmFtYTEUMBIGA1UEBwwLUGFu
  54477. YW1hIENpdHkxJDAiBgNVBAoMG1RydXN0Q29yIFN5c3RlbXMgUy4gZGUgUi5MLjEnMCUGA1UECwwe
  54478. VHJ1c3RDb3IgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MR8wHQYDVQQDDBZUcnVzdENvciBSb290Q2Vy
  54479. dCBDQS0xMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv463leLCJhJrMxnHQFgKq1mq
  54480. jQCj/IDHUHuO1CAmujIS2CNUSSUQIpidRtLByZ5OGy4sDjjzGiVoHKZaBeYei0i/mJZ0PmnK6bV4
  54481. pQa81QBeCQryJ3pS/C3Vseq0iWEk8xoT26nPUu0MJLq5nux+AHT6k61sKZKuUbS701e/s/OojZz0
  54482. JEsq1pme9J7+wH5COucLlVPat2gOkEz7cD+PSiyU8ybdY2mplNgQTsVHCJCZGxdNuWxu72CVEY4h
  54483. gLW9oHPY0LJ3xEXqWib7ZnZ2+AYfYW0PVcWDtxBWcgYHpfOxGgMFZA6dWorWhnAbJN7+KIor0Gqw
  54484. /Hqi3LJ5DotlDwIDAQABo2MwYTAdBgNVHQ4EFgQU7mtJPHo/DeOxCbeKyKsZn3MzUOcwHwYDVR0j
  54485. BBgwFoAU7mtJPHo/DeOxCbeKyKsZn3MzUOcwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  54486. AYYwDQYJKoZIhvcNAQELBQADggEBACUY1JGPE+6PHh0RU9otRCkZoB5rMZ5NDp6tPVxBb5UrJKF5
  54487. mDo4Nvu7Zp5I/5CQ7z3UuJu0h3U/IJvOcs+hVcFNZKIZBqEHMwwLKeXx6quj7LUKdJDHfXLy11yf
  54488. ke+Ri7fc7Waiz45mO7yfOgLgJ90WmMCV1Aqk5IGadZQ1nJBfiDcGrVmVCrDRZ9MZyonnMlo2HD6C
  54489. qFqTvsbQZJG2z9m2GM/bftJlo6bEjhcxwft+dtvTheNYsnd6djtsL1Ac59v2Z3kf9YKVmgenFK+P
  54490. 3CghZwnS1k1aHBkcjndcw5QkPTJrS37UeJSDvjdNzl/HHk484IkzlQsPpTLWPFp5LBk=
  54491. -----END CERTIFICATE-----
  54492. TrustCor RootCert CA-2
  54493. ======================
  54494. -----BEGIN CERTIFICATE-----
  54495. MIIGLzCCBBegAwIBAgIIJaHfyjPLWQIwDQYJKoZIhvcNAQELBQAwgaQxCzAJBgNVBAYTAlBBMQ8w
  54496. DQYDVQQIDAZQYW5hbWExFDASBgNVBAcMC1BhbmFtYSBDaXR5MSQwIgYDVQQKDBtUcnVzdENvciBT
  54497. eXN0ZW1zIFMuIGRlIFIuTC4xJzAlBgNVBAsMHlRydXN0Q29yIENlcnRpZmljYXRlIEF1dGhvcml0
  54498. eTEfMB0GA1UEAwwWVHJ1c3RDb3IgUm9vdENlcnQgQ0EtMjAeFw0xNjAyMDQxMjMyMjNaFw0zNDEy
  54499. MzExNzI2MzlaMIGkMQswCQYDVQQGEwJQQTEPMA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5h
  54500. bWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3IgU3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5U
  54501. cnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxHzAdBgNVBAMMFlRydXN0Q29yIFJvb3RDZXJ0
  54502. IENBLTIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnIG7CKqJiJJWQdsg4foDSq8Gb
  54503. ZQWU9MEKENUCrO2fk8eHyLAnK0IMPQo+QVqedd2NyuCb7GgypGmSaIwLgQ5WoD4a3SwlFIIvl9Nk
  54504. RvRUqdw6VC0xK5mC8tkq1+9xALgxpL56JAfDQiDyitSSBBtlVkxs1Pu2YVpHI7TYabS3OtB0PAx1
  54505. oYxOdqHp2yqlO/rOsP9+aij9JxzIsekp8VduZLTQwRVtDr4uDkbIXvRR/u8OYzo7cbrPb1nKDOOb
  54506. XUm4TOJXsZiKQlecdu/vvdFoqNL0Cbt3Nb4lggjEFixEIFapRBF37120Hapeaz6LMvYHL1cEksr1
  54507. /p3C6eizjkxLAjHZ5DxIgif3GIJ2SDpxsROhOdUuxTTCHWKF3wP+TfSvPd9cW436cOGlfifHhi5q
  54508. jxLGhF5DUVCcGZt45vz27Ud+ez1m7xMTiF88oWP7+ayHNZ/zgp6kPwqcMWmLmaSISo5uZk3vFsQP
  54509. eSghYA2FFn3XVDjxklb9tTNMg9zXEJ9L/cb4Qr26fHMC4P99zVvh1Kxhe1fVSntb1IVYJ12/+Ctg
  54510. rKAmrhQhJ8Z3mjOAPF5GP/fDsaOGM8boXg25NSyqRsGFAnWAoOsk+xWq5Gd/bnc/9ASKL3x74xdh
  54511. 8N0JqSDIvgmk0H5Ew7IwSjiqqewYmgeCK9u4nBit2uBGF6zPXQIDAQABo2MwYTAdBgNVHQ4EFgQU
  54512. 2f4hQG6UnrybPZx9mCAZ5YwwYrIwHwYDVR0jBBgwFoAU2f4hQG6UnrybPZx9mCAZ5YwwYrIwDwYD
  54513. VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQELBQADggIBAJ5Fngw7tu/h
  54514. Osh80QA9z+LqBrWyOrsGS2h60COXdKcs8AjYeVrXWoSK2BKaG9l9XE1wxaX5q+WjiYndAfrs3fnp
  54515. kpfbsEZC89NiqpX+MWcUaViQCqoL7jcjx1BRtPV+nuN79+TMQjItSQzL/0kMmx40/W5ulop5A7Zv
  54516. 2wnL/V9lFDfhOPXzYRZY5LVtDQsEGz9QLX+zx3oaFoBg+Iof6Rsqxvm6ARppv9JYx1RXCI/hOWB3
  54517. S6xZhBqI8d3LT3jX5+EzLfzuQfogsL7L9ziUwOHQhQ+77Sxzq+3+knYaZH9bDTMJBzN7Bj8RpFxw
  54518. PIXAz+OQqIN3+tvmxYxoZxBnpVIt8MSZj3+/0WvitUfW2dCFmU2Umw9Lje4AWkcdEQOsQRivh7dv
  54519. DDqPys/cA8GiCcjl/YBeyGBCARsaU1q7N6a3vLqE6R5sGtRk2tRD/pOLS/IseRYQ1JMLiI+h2IYU
  54520. RpFHmygk71dSTlxCnKr3Sewn6EAes6aJInKc9Q0ztFijMDvd1GpUk74aTfOTlPf8hAs/hCBcNANE
  54521. xdqtvArBAs8e5ZTZ845b2EzwnexhF7sUMlQMAimTHpKG9n/v55IFDlndmQguLvqcAFLTxWYp5KeX
  54522. RKQOKIETNcX2b2TmQcTVL8w0RSXPQQCWPUouwpaYT05KnJe32x+SMsj/D1Fu1uwJ
  54523. -----END CERTIFICATE-----
  54524. TrustCor ECA-1
  54525. ==============
  54526. -----BEGIN CERTIFICATE-----
  54527. MIIEIDCCAwigAwIBAgIJAISCLF8cYtBAMA0GCSqGSIb3DQEBCwUAMIGcMQswCQYDVQQGEwJQQTEP
  54528. MA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3Ig
  54529. U3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5UcnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3Jp
  54530. dHkxFzAVBgNVBAMMDlRydXN0Q29yIEVDQS0xMB4XDTE2MDIwNDEyMzIzM1oXDTI5MTIzMTE3Mjgw
  54531. N1owgZwxCzAJBgNVBAYTAlBBMQ8wDQYDVQQIDAZQYW5hbWExFDASBgNVBAcMC1BhbmFtYSBDaXR5
  54532. MSQwIgYDVQQKDBtUcnVzdENvciBTeXN0ZW1zIFMuIGRlIFIuTC4xJzAlBgNVBAsMHlRydXN0Q29y
  54533. IENlcnRpZmljYXRlIEF1dGhvcml0eTEXMBUGA1UEAwwOVHJ1c3RDb3IgRUNBLTEwggEiMA0GCSqG
  54534. SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDPj+ARtZ+odnbb3w9U73NjKYKtR8aja+3+XzP4Q1HpGjOR
  54535. MRegdMTUpwHmspI+ap3tDvl0mEDTPwOABoJA6LHip1GnHYMma6ve+heRK9jGrB6xnhkB1Zem6g23
  54536. xFUfJ3zSCNV2HykVh0A53ThFEXXQmqc04L/NyFIduUd+Dbi7xgz2c1cWWn5DkR9VOsZtRASqnKmc
  54537. p0yJF4OuowReUoCLHhIlERnXDH19MURB6tuvsBzvgdAsxZohmz3tQjtQJvLsznFhBmIhVE5/wZ0+
  54538. fyCMgMsq2JdiyIMzkX2woloPV+g7zPIlstR8L+xNxqE6FXrntl019fZISjZFZtS6mFjBAgMBAAGj
  54539. YzBhMB0GA1UdDgQWBBREnkj1zG1I1KBLf/5ZJC+Dl5mahjAfBgNVHSMEGDAWgBREnkj1zG1I1KBL
  54540. f/5ZJC+Dl5mahjAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsF
  54541. AAOCAQEABT41XBVwm8nHc2FvcivUwo/yQ10CzsSUuZQRg2dd4mdsdXa/uwyqNsatR5Nj3B5+1t4u
  54542. /ukZMjgDfxT2AHMsWbEhBuH7rBiVDKP/mZb3Kyeb1STMHd3BOuCYRLDE5D53sXOpZCz2HAF8P11F
  54543. hcCF5yWPldwX8zyfGm6wyuMdKulMY/okYWLW2n62HGz1Ah3UKt1VkOsqEUc8Ll50soIipX1TH0Xs
  54544. J5F95yIW6MBoNtjG8U+ARDL54dHRHareqKucBK+tIA5kmE2la8BIWJZpTdwHjFGTot+fDz2LYLSC
  54545. jaoITmJF4PkL0uDgPFveXHEnJcLmA4GLEFPjx1WitJ/X5g==
  54546. -----END CERTIFICATE-----
  54547. SSL.com Root Certification Authority RSA
  54548. ========================================
  54549. -----BEGIN CERTIFICATE-----
  54550. MIIF3TCCA8WgAwIBAgIIeyyb0xaAMpkwDQYJKoZIhvcNAQELBQAwfDELMAkGA1UEBhMCVVMxDjAM
  54551. BgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24x
  54552. MTAvBgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBSU0EwHhcNMTYw
  54553. MjEyMTczOTM5WhcNNDEwMjEyMTczOTM5WjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
  54554. EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NM
  54555. LmNvbSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFJTQTCCAiIwDQYJKoZIhvcNAQEBBQAD
  54556. ggIPADCCAgoCggIBAPkP3aMrfcvQKv7sZ4Wm5y4bunfh4/WvpOz6Sl2RxFdHaxh3a3by/ZPkPQ/C
  54557. Fp4LZsNWlJ4Xg4XOVu/yFv0AYvUiCVToZRdOQbngT0aXqhvIuG5iXmmxX9sqAn78bMrzQdjt0Oj8
  54558. P2FI7bADFB0QDksZ4LtO7IZl/zbzXmcCC52GVWH9ejjt/uIZALdvoVBidXQ8oPrIJZK0bnoix/ge
  54559. oeOy3ZExqysdBP+lSgQ36YWkMyv94tZVNHwZpEpox7Ko07fKoZOI68GXvIz5HdkihCR0xwQ9aqkp
  54560. k8zruFvh/l8lqjRYyMEjVJ0bmBHDOJx+PYZspQ9AhnwC9FwCTyjLrnGfDzrIM/4RJTXq/LrFYD3Z
  54561. fBjVsqnTdXgDciLKOsMf7yzlLqn6niy2UUb9rwPW6mBo6oUWNmuF6R7As93EJNyAKoFBbZQ+yODJ
  54562. gUEAnl6/f8UImKIYLEJAs/lvOCdLToD0PYFH4Ih86hzOtXVcUS4cK38acijnALXRdMbX5J+tB5O2
  54563. UzU1/Dfkw/ZdFr4hc96SCvigY2q8lpJqPvi8ZVWb3vUNiSYE/CUapiVpy8JtynziWV+XrOvvLsi8
  54564. 1xtZPCvM8hnIk2snYxnP/Okm+Mpxm3+T/jRnhE6Z6/yzeAkzcLpmpnbtG3PrGqUNxCITIJRWCk4s
  54565. bE6x/c+cCbqiM+2HAgMBAAGjYzBhMB0GA1UdDgQWBBTdBAkHovV6fVJTEpKV7jiAJQ2mWTAPBgNV
  54566. HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFN0ECQei9Xp9UlMSkpXuOIAlDaZZMA4GA1UdDwEB/wQE
  54567. AwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAIBgRlCn7Jp0cHh5wYfGVcpNxJK1ok1iOMq8bs3AD/CUr
  54568. dIWQPXhq9LmLpZc7tRiRux6n+UBbkflVma8eEdBcHadm47GUBwwyOabqG7B52B2ccETjit3E+ZUf
  54569. ijhDPwGFpUenPUayvOUiaPd7nNgsPgohyC0zrL/FgZkxdMF1ccW+sfAjRfSda/wZY52jvATGGAsl
  54570. u1OJD7OAUN5F7kR/q5R4ZJjT9ijdh9hwZXT7DrkT66cPYakylszeu+1jTBi7qUD3oFRuIIhxdRjq
  54571. erQ0cuAjJ3dctpDqhiVAq+8zD8ufgr6iIPv2tS0a5sKFsXQP+8hlAqRSAUfdSSLBv9jra6x+3uxj
  54572. MxW3IwiPxg+NQVrdjsW5j+VFP3jbutIbQLH+cU0/4IGiul607BXgk90IH37hVZkLId6Tngr75qNJ
  54573. vTYw/ud3sqB1l7UtgYgXZSD32pAAn8lSzDLKNXz1PQ/YK9f1JmzJBjSWFupwWRoyeXkLtoh/D1JI
  54574. Pb9s2KJELtFOt3JY04kTlf5Eq/jXixtunLwsoFvVagCvXzfh1foQC5ichucmj87w7G6KVwuA406y
  54575. wKBjYZC6VWg3dGq2ktufoYYitmUnDuy2n0Jg5GfCtdpBC8TTi2EbvPofkSvXRAdeuims2cXp71NI
  54576. WuuA8ShYIc2wBlX7Jz9TkHCpBB5XJ7k=
  54577. -----END CERTIFICATE-----
  54578. SSL.com Root Certification Authority ECC
  54579. ========================================
  54580. -----BEGIN CERTIFICATE-----
  54581. MIICjTCCAhSgAwIBAgIIdebfy8FoW6gwCgYIKoZIzj0EAwIwfDELMAkGA1UEBhMCVVMxDjAMBgNV
  54582. BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xMTAv
  54583. BgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYwMjEy
  54584. MTgxNDAzWhcNNDEwMjEyMTgxNDAzWjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAO
  54585. BgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NMLmNv
  54586. bSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuBBAAiA2IA
  54587. BEVuqVDEpiM2nl8ojRfLliJkP9x6jh3MCLOicSS6jkm5BBtHllirLZXI7Z4INcgn64mMU1jrYor+
  54588. 8FsPazFSY0E7ic3s7LaNGdM0B9y7xgZ/wkWV7Mt/qCPgCemB+vNH06NjMGEwHQYDVR0OBBYEFILR
  54589. hXMw5zUE044CkvvlpNHEIejNMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUgtGFczDnNQTT
  54590. jgKS++Wk0cQh6M0wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2cAMGQCMG/n61kRpGDPYbCW
  54591. e+0F+S8Tkdzt5fxQaxFGRrMcIQBiu77D5+jNB5n5DQtdcj7EqgIwH7y6C+IwJPt8bYBVCpk+gA0z
  54592. 5Wajs6O7pdWLjwkspl1+4vAHCGht0nxpbl/f5Wpl
  54593. -----END CERTIFICATE-----
  54594. SSL.com EV Root Certification Authority RSA R2
  54595. ==============================================
  54596. -----BEGIN CERTIFICATE-----
  54597. MIIF6zCCA9OgAwIBAgIIVrYpzTS8ePYwDQYJKoZIhvcNAQELBQAwgYIxCzAJBgNVBAYTAlVTMQ4w
  54598. DAYDVQQIDAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9u
  54599. MTcwNQYDVQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIy
  54600. MB4XDTE3MDUzMTE4MTQzN1oXDTQyMDUzMDE4MTQzN1owgYIxCzAJBgNVBAYTAlVTMQ4wDAYDVQQI
  54601. DAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMTcwNQYD
  54602. VQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIyMIICIjAN
  54603. BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAjzZlQOHWTcDXtOlG2mvqM0fNTPl9fb69LT3w23jh
  54604. hqXZuglXaO1XPqDQCEGD5yhBJB/jchXQARr7XnAjssufOePPxU7Gkm0mxnu7s9onnQqG6YE3Bf7w
  54605. cXHswxzpY6IXFJ3vG2fThVUCAtZJycxa4bH3bzKfydQ7iEGonL3Lq9ttewkfokxykNorCPzPPFTO
  54606. Zw+oz12WGQvE43LrrdF9HSfvkusQv1vrO6/PgN3B0pYEW3p+pKk8OHakYo6gOV7qd89dAFmPZiw+
  54607. B6KjBSYRaZfqhbcPlgtLyEDhULouisv3D5oi53+aNxPN8k0TayHRwMwi8qFG9kRpnMphNQcAb9Zh
  54608. CBHqurj26bNg5U257J8UZslXWNvNh2n4ioYSA0e/ZhN2rHd9NCSFg83XqpyQGp8hLH94t2S42Oim
  54609. 9HizVcuE0jLEeK6jj2HdzghTreyI/BXkmg3mnxp3zkyPuBQVPWKchjgGAGYS5Fl2WlPAApiiECto
  54610. RHuOec4zSnaqW4EWG7WK2NAAe15itAnWhmMOpgWVSbooi4iTsjQc2KRVbrcc0N6ZVTsj9CLg+Slm
  54611. JuwgUHfbSguPvuUCYHBBXtSuUDkiFCbLsjtzdFVHB3mBOagwE0TlBIqulhMlQg+5U8Sb/M3kHN48
  54612. +qvWBkofZ6aYMBzdLNvcGJVXZsb/XItW9XcCAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNV
  54613. HSMEGDAWgBT5YLvU49U09rj1BoAlp3PbRmmonjAdBgNVHQ4EFgQU+WC71OPVNPa49QaAJadz20Zp
  54614. qJ4wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQBWs47LCp1Jjr+kxJG7ZhcFUZh1
  54615. ++VQLHqe8RT6q9OKPv+RKY9ji9i0qVQBDb6Thi/5Sm3HXvVX+cpVHBK+Rw82xd9qt9t1wkclf7nx
  54616. Y/hoLVUE0fKNsKTPvDxeH3jnpaAgcLAExbf3cqfeIg29MyVGjGSSJuM+LmOW2puMPfgYCdcDzH2G
  54617. guDKBAdRUNf/ktUM79qGn5nX67evaOI5JpS6aLe/g9Pqemc9YmeuJeVy6OLk7K4S9ksrPJ/psEDz
  54618. OFSz/bdoyNrGj1E8svuR3Bznm53htw1yj+KkxKl4+esUrMZDBcJlOSgYAsOCsp0FvmXtll9ldDz7
  54619. CTUue5wT/RsPXcdtgTpWD8w74a8CLyKsRspGPKAcTNZEtF4uXBVmCeEmKf7GUmG6sXP/wwyc5Wxq
  54620. lD8UykAWlYTzWamsX0xhk23RO8yilQwipmdnRC652dKKQbNmC1r7fSOl8hqw/96bg5Qu0T/fkreR
  54621. rwU7ZcegbLHNYhLDkBvjJc40vG93drEQw/cFGsDWr3RiSBd3kmmQYRzelYB0VI8YHMPzA9C/pEN1
  54622. hlMYegouCRw2n5H9gooiS9EOUCXdywMMF8mDAAhONU2Ki+3wApRmLER/y5UnlhetCTCstnEXbosX
  54623. 9hwJ1C07mKVx01QT2WDz9UtmT/rx7iASjbSsV7FFY6GsdqnC+w==
  54624. -----END CERTIFICATE-----
  54625. SSL.com EV Root Certification Authority ECC
  54626. ===========================================
  54627. -----BEGIN CERTIFICATE-----
  54628. MIIClDCCAhqgAwIBAgIILCmcWxbtBZUwCgYIKoZIzj0EAwIwfzELMAkGA1UEBhMCVVMxDjAMBgNV
  54629. BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xNDAy
  54630. BgNVBAMMK1NTTC5jb20gRVYgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYw
  54631. MjEyMTgxNTIzWhcNNDEwMjEyMTgxNTIzWjB/MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
  54632. EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjE0MDIGA1UEAwwrU1NM
  54633. LmNvbSBFViBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuB
  54634. BAAiA2IABKoSR5CYG/vvw0AHgyBO8TCCogbR8pKGYfL2IWjKAMTH6kMAVIbc/R/fALhBYlzccBYy
  54635. 3h+Z1MzFB8gIH2EWB1E9fVwHU+M1OIzfzZ/ZLg1KthkuWnBaBu2+8KGwytAJKaNjMGEwHQYDVR0O
  54636. BBYEFFvKXuXe0oGqzagtZFG22XKbl+ZPMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUW8pe
  54637. 5d7SgarNqC1kUbbZcpuX5k8wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2gAMGUCMQCK5kCJ
  54638. N+vp1RPZytRrJPOwPYdGWBrssd9v+1a6cGvHOMzosYxPD/fxZ3YOg9AeUY8CMD32IygmTMZgh5Mm
  54639. m7I1HrrW9zzRHM76JTymGoEVW/MSD2zuZYrJh6j5B+BimoxcSg==
  54640. -----END CERTIFICATE-----
  54641. GlobalSign Root CA - R6
  54642. =======================
  54643. -----BEGIN CERTIFICATE-----
  54644. MIIFgzCCA2ugAwIBAgIORea7A4Mzw4VlSOb/RVEwDQYJKoZIhvcNAQEMBQAwTDEgMB4GA1UECxMX
  54645. R2xvYmFsU2lnbiBSb290IENBIC0gUjYxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkds
  54646. b2JhbFNpZ24wHhcNMTQxMjEwMDAwMDAwWhcNMzQxMjEwMDAwMDAwWjBMMSAwHgYDVQQLExdHbG9i
  54647. YWxTaWduIFJvb3QgQ0EgLSBSNjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFs
  54648. U2lnbjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAJUH6HPKZvnsFMp7PPcNCPG0RQss
  54649. grRIxutbPK6DuEGSMxSkb3/pKszGsIhrxbaJ0cay/xTOURQh7ErdG1rG1ofuTToVBu1kZguSgMpE
  54650. 3nOUTvOniX9PeGMIyBJQbUJmL025eShNUhqKGoC3GYEOfsSKvGRMIRxDaNc9PIrFsmbVkJq3MQbF
  54651. vuJtMgamHvm566qjuL++gmNQ0PAYid/kD3n16qIfKtJwLnvnvJO7bVPiSHyMEAc4/2ayd2F+4OqM
  54652. PKq0pPbzlUoSB239jLKJz9CgYXfIWHSw1CM69106yqLbnQneXUQtkPGBzVeS+n68UARjNN9rkxi+
  54653. azayOeSsJDa38O+2HBNXk7besvjihbdzorg1qkXy4J02oW9UivFyVm4uiMVRQkQVlO6jxTiWm05O
  54654. WgtH8wY2SXcwvHE35absIQh1/OZhFj931dmRl4QKbNQCTXTAFO39OfuD8l4UoQSwC+n+7o/hbguy
  54655. CLNhZglqsQY6ZZZZwPA1/cnaKI0aEYdwgQqomnUdnjqGBQCe24DWJfncBZ4nWUx2OVvq+aWh2IMP
  54656. 0f/fMBH5hc8zSPXKbWQULHpYT9NLCEnFlWQaYw55PfWzjMpYrZxCRXluDocZXFSxZba/jJvcE+kN
  54657. b7gu3GduyYsRtYQUigAZcIN5kZeR1BonvzceMgfYFGM8KEyvAgMBAAGjYzBhMA4GA1UdDwEB/wQE
  54658. AwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSubAWjkxPioufi1xzWx/B/yGdToDAfBgNV
  54659. HSMEGDAWgBSubAWjkxPioufi1xzWx/B/yGdToDANBgkqhkiG9w0BAQwFAAOCAgEAgyXt6NH9lVLN
  54660. nsAEoJFp5lzQhN7craJP6Ed41mWYqVuoPId8AorRbrcWc+ZfwFSY1XS+wc3iEZGtIxg93eFyRJa0
  54661. lV7Ae46ZeBZDE1ZXs6KzO7V33EByrKPrmzU+sQghoefEQzd5Mr6155wsTLxDKZmOMNOsIeDjHfrY
  54662. BzN2VAAiKrlNIC5waNrlU/yDXNOd8v9EDERm8tLjvUYAGm0CuiVdjaExUd1URhxN25mW7xocBFym
  54663. Fe944Hn+Xds+qkxV/ZoVqW/hpvvfcDDpw+5CRu3CkwWJ+n1jez/QcYF8AOiYrg54NMMl+68KnyBr
  54664. 3TsTjxKM4kEaSHpzoHdpx7Zcf4LIHv5YGygrqGytXm3ABdJ7t+uA/iU3/gKbaKxCXcPu9czc8FB1
  54665. 0jZpnOZ7BN9uBmm23goJSFmH63sUYHpkqmlD75HHTOwY3WzvUy2MmeFe8nI+z1TIvWfspA9MRf/T
  54666. uTAjB0yPEL+GltmZWrSZVxykzLsViVO6LAUP5MSeGbEYNNVMnbrt9x+vJJUEeKgDu+6B5dpffItK
  54667. oZB0JaezPkvILFa9x8jvOOJckvB595yEunQtYQEgfn7R8k8HWV+LLUNS60YMlOH1Zkd5d9VUWx+t
  54668. JDfLRVpOoERIyNiwmcUVhAn21klJwGW45hpxbqCo8YLoRT5s1gLXCmeDBVrJpBA=
  54669. -----END CERTIFICATE-----
  54670. OISTE WISeKey Global Root GC CA
  54671. ===============================
  54672. -----BEGIN CERTIFICATE-----
  54673. MIICaTCCAe+gAwIBAgIQISpWDK7aDKtARb8roi066jAKBggqhkjOPQQDAzBtMQswCQYDVQQGEwJD
  54674. SDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEo
  54675. MCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQyBDQTAeFw0xNzA1MDkwOTQ4MzRa
  54676. Fw00MjA1MDkwOTU4MzNaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYDVQQL
  54677. ExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEdsb2Jh
  54678. bCBSb290IEdDIENBMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAETOlQwMYPchi82PG6s4nieUqjFqdr
  54679. VCTbUf/q9Akkwwsin8tqJ4KBDdLArzHkdIJuyiXZjHWd8dvQmqJLIX4Wp2OQ0jnUsYd4XxiWD1Ab
  54680. NTcPasbc2RNNpI6QN+a9WzGRo1QwUjAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
  54681. BgNVHQ4EFgQUSIcUrOPDnpBgOtfKie7TrYy0UGYwEAYJKwYBBAGCNxUBBAMCAQAwCgYIKoZIzj0E
  54682. AwMDaAAwZQIwJsdpW9zV57LnyAyMjMPdeYwbY9XJUpROTYJKcx6ygISpJcBMWm1JKWB4E+J+SOtk
  54683. AjEA2zQgMgj/mkkCtojeFK9dbJlxjRo/i9fgojaGHAeCOnZT/cKi7e97sIBPWA9LUzm9
  54684. -----END CERTIFICATE-----
  54685. <?php
  54686. if (PHP_SAPI !== 'cli') {
  54687. echo 'Warning: Composer should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
  54688. }
  54689. setlocale(LC_ALL, 'C');
  54690. require __DIR__.'/../src/bootstrap.php';
  54691. use Composer\Console\Application;
  54692. use Composer\XdebugHandler\XdebugHandler;
  54693. error_reporting(-1);
  54694. // Restart without xdebug
  54695. $xdebug = new XdebugHandler('Composer', '--ansi');
  54696. $xdebug->check();
  54697. unset($xdebug);
  54698. if (function_exists('ini_set')) {
  54699. @ini_set('display_errors', 1);
  54700. $memoryInBytes = function ($value) {
  54701. $unit = strtolower(substr($value, -1, 1));
  54702. $value = (int) $value;
  54703. switch($unit) {
  54704. case 'g':
  54705. $value *= 1024;
  54706. // no break (cumulative multiplier)
  54707. case 'm':
  54708. $value *= 1024;
  54709. // no break (cumulative multiplier)
  54710. case 'k':
  54711. $value *= 1024;
  54712. }
  54713. return $value;
  54714. };
  54715. $memoryLimit = trim(ini_get('memory_limit'));
  54716. // Increase memory_limit if it is lower than 1.5GB
  54717. if ($memoryLimit != -1 && $memoryInBytes($memoryLimit) < 1024 * 1024 * 1536) {
  54718. @ini_set('memory_limit', '1536M');
  54719. }
  54720. // Set user defined memory limit
  54721. if ($memoryLimit = getenv('COMPOSER_MEMORY_LIMIT')) {
  54722. @ini_set('memory_limit', $memoryLimit);
  54723. }
  54724. unset($memoryInBytes, $memoryLimit);
  54725. }
  54726. putenv('COMPOSER_BINARY='.realpath($_SERVER['argv'][0]));
  54727. // run the command application
  54728. $application = new Application();
  54729. $application->run();
  54730. Copyright (c) Nils Adermann, Jordi Boggiano
  54731. Permission is hereby granted, free of charge, to any person obtaining a copy
  54732. of this software and associated documentation files (the "Software"), to deal
  54733. in the Software without restriction, including without limitation the rights
  54734. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  54735. copies of the Software, and to permit persons to whom the Software is furnished
  54736. to do so, subject to the following conditions:
  54737. The above copyright notice and this permission notice shall be included in all
  54738. copies or substantial portions of the Software.
  54739. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  54740. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  54741. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  54742. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  54743. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  54744. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  54745. THE SOFTWARE.
  54746. u’ÖÞì¥pÍ
  54747. tz#›±GBMB