composer.phar 1.8 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966649676496864969649706497164972649736497464975649766497764978649796498064981649826498364984649856498664987649886498964990649916499264993649946499564996649976499864999650006500165002650036500465005650066500765008650096501065011650126501365014650156501665017650186501965020650216502265023650246502565026650276502865029650306503165032650336503465035650366503765038650396504065041650426504365044650456504665047650486504965050650516505265053650546505565056650576505865059650606506165062650636506465065650666506765068650696507065071650726507365074650756507665077650786507965080650816508265083650846508565086650876508865089650906509165092650936509465095650966509765098650996510065101651026510365104651056510665107651086510965110651116511265113651146511565116651176511865119651206512165122651236512465125651266512765128651296513065131651326513365134651356513665137651386513965140651416514265143651446514565146651476514865149651506515165152651536515465155651566515765158651596516065161651626516365164651656516665167651686516965170651716517265173651746517565176651776517865179651806518165182651836518465185651866518765188651896519065191651926519365194651956519665197651986519965200652016520265203652046520565206652076520865209652106521165212652136521465215652166521765218652196522065221652226522365224652256522665227652286522965230652316523265233652346523565236652376523865239652406524165242652436524465245652466524765248652496525065251652526525365254652556525665257652586525965260652616526265263652646526565266652676526865269652706527165272652736527465275652766527765278652796528065281652826528365284652856528665287652886528965290652916529265293652946529565296652976529865299653006530165302653036530465305653066530765308653096531065311653126531365314653156531665317653186531965320653216532265323653246532565326653276532865329653306533165332653336533465335653366533765338653396534065341653426534365344653456534665347653486534965350653516535265353653546535565356653576535865359653606536165362653636536465365653666536765368653696537065371653726537365374653756537665377653786537965380653816538265383653846538565386653876538865389653906539165392653936539465395653966539765398653996540065401654026540365404654056540665407654086540965410654116541265413654146541565416654176541865419654206542165422654236542465425654266542765428654296543065431654326543365434654356543665437654386543965440654416544265443654446544565446654476544865449654506545165452654536545465455654566545765458654596546065461654626546365464654656546665467654686546965470654716547265473654746547565476654776547865479654806548165482654836548465485654866548765488654896549065491654926549365494654956549665497654986549965500655016550265503655046550565506655076550865509655106551165512655136551465515655166551765518655196552065521655226552365524655256552665527655286552965530655316553265533655346553565536655376553865539655406554165542655436554465545655466554765548655496555065551655526555365554655556555665557655586555965560655616556265563655646556565566655676556865569655706557165572655736557465575655766557765578655796558065581655826558365584655856558665587655886558965590655916559265593655946559565596655976559865599656006560165602656036560465605656066560765608656096561065611656126561365614656156561665617656186561965620656216562265623656246562565626656276562865629656306563165632656336563465635656366563765638656396564065641656426564365644656456564665647656486564965650656516565265653656546565565656656576565865659656606566165662656636566465665656666566765668656696567065671656726567365674656756567665677656786567965680656816568265683656846568565686656876568865689656906569165692656936569465695656966569765698656996570065701657026570365704657056570665707657086570965710657116571265713657146571565716657176571865719657206572165722657236572465725657266572765728657296573065731657326573365734657356573665737657386573965740657416574265743657446574565746657476574865749657506575165752657536575465755657566575765758657596576065761657626576365764657656576665767657686576965770657716577265773657746577565776657776577865779657806578165782657836578465785657866578765788657896579065791657926579365794657956579665797657986579965800658016580265803658046580565806658076580865809658106581165812658136581465815658166581765818658196582065821658226582365824658256582665827658286582965830658316583265833658346583565836658376583865839658406584165842658436584465845658466584765848658496585065851658526585365854658556585665857658586585965860658616586265863658646586565866658676586865869658706587165872658736587465875658766587765878658796588065881658826588365884658856588665887658886588965890658916589265893658946589565896658976589865899659006590165902659036590465905659066590765908659096591065911659126591365914659156591665917659186591965920659216592265923659246592565926659276592865929659306593165932659336593465935659366593765938659396594065941659426594365944659456594665947659486594965950659516595265953659546595565956659576595865959659606596165962659636596465965659666596765968659696597065971659726597365974659756597665977659786597965980659816598265983659846598565986659876598865989659906599165992659936599465995659966599765998659996600066001660026600366004660056600666007660086600966010660116601266013660146601566016660176601866019660206602166022660236602466025660266602766028660296603066031660326603366034660356603666037660386603966040660416604266043660446604566046660476604866049660506605166052660536605466055660566605766058660596606066061660626606366064660656606666067660686606966070660716607266073660746607566076660776607866079660806608166082660836608466085660866608766088660896609066091660926609366094660956609666097660986609966100661016610266103661046610566106661076610866109661106611166112661136611466115661166611766118661196612066121661226612366124661256612666127661286612966130661316613266133661346613566136661376613866139661406614166142661436614466145661466614766148661496615066151661526615366154661556615666157661586615966160661616616266163661646616566166661676616866169661706617166172661736617466175661766617766178661796618066181661826618366184661856618666187661886618966190661916619266193661946619566196661976619866199662006620166202662036620466205662066620766208662096621066211662126621366214662156621666217662186621966220662216622266223662246622566226662276622866229662306623166232662336623466235662366623766238662396624066241662426624366244662456624666247662486624966250662516625266253662546625566256662576625866259662606626166262662636626466265662666626766268662696627066271662726627366274662756627666277662786627966280662816628266283662846628566286662876628866289662906629166292662936629466295662966629766298662996630066301663026630366304663056630666307663086630966310663116631266313663146631566316663176631866319663206632166322663236632466325663266632766328663296633066331663326633366334663356633666337663386633966340663416634266343663446634566346663476634866349663506635166352663536635466355663566635766358663596636066361663626636366364663656636666367663686636966370663716637266373663746637566376663776637866379663806638166382663836638466385663866638766388663896639066391663926639366394663956639666397663986639966400664016640266403664046640566406664076640866409664106641166412664136641466415664166641766418664196642066421664226642366424664256642666427664286642966430664316643266433664346643566436664376643866439664406644166442664436644466445664466644766448664496645066451664526645366454664556645666457664586645966460664616646266463664646646566466664676646866469664706647166472664736647466475664766647766478664796648066481664826648366484664856648666487664886648966490664916649266493664946649566496664976649866499665006650166502665036650466505665066650766508665096651066511665126651366514665156651666517665186651966520665216652266523665246652566526665276652866529665306653166532665336653466535665366653766538665396654066541665426654366544665456654666547665486654966550665516655266553665546655566556665576655866559665606656166562665636656466565665666656766568665696657066571665726657366574665756657666577665786657966580665816658266583665846658566586665876658866589665906659166592665936659466595665966659766598665996660066601666026660366604666056660666607666086660966610666116661266613666146661566616666176661866619666206662166622666236662466625666266662766628666296663066631666326663366634666356663666637666386663966640666416664266643666446664566646666476664866649666506665166652666536665466655666566665766658666596666066661666626666366664666656666666667666686666966670666716667266673666746667566676666776667866679666806668166682666836668466685666866668766688666896669066691666926669366694666956669666697666986669966700667016670266703667046670566706667076670866709667106671166712667136671466715667166671766718667196672066721667226672366724667256672666727667286672966730667316673266733667346673566736667376673866739667406674166742667436674466745667466674766748667496675066751667526675366754667556675666757667586675966760667616676266763667646676566766667676676866769667706677166772667736677466775667766677766778667796678066781667826678366784667856678666787667886678966790667916679266793667946679566796667976679866799668006680166802668036680466805668066680766808668096681066811668126681366814668156681666817668186681966820668216682266823668246682566826668276682866829668306683166832668336683466835668366683766838668396684066841668426684366844668456684666847668486684966850668516685266853668546685566856668576685866859668606686166862668636686466865668666686766868668696687066871668726687366874668756687666877668786687966880668816688266883668846688566886668876688866889668906689166892668936689466895668966689766898668996690066901669026690366904669056690666907669086690966910669116691266913669146691566916669176691866919669206692166922669236692466925669266692766928669296693066931669326693366934669356693666937669386693966940669416694266943669446694566946669476694866949669506695166952669536695466955669566695766958669596696066961669626696366964669656696666967669686696966970669716697266973669746697566976669776697866979669806698166982669836698466985669866698766988669896699066991669926699366994669956699666997669986699967000670016700267003670046700567006670076700867009670106701167012670136701467015670166701767018670196702067021670226702367024670256702667027670286702967030670316703267033670346703567036670376703867039670406704167042670436704467045670466704767048670496705067051670526705367054670556705667057670586705967060670616706267063670646706567066670676706867069670706707167072670736707467075670766707767078670796708067081670826708367084670856708667087670886708967090670916709267093670946709567096670976709867099671006710167102671036710467105671066710767108671096711067111671126711367114671156711667117671186711967120671216712267123671246712567126671276712867129671306713167132671336713467135671366713767138671396714067141671426714367144671456714667147671486714967150671516715267153671546715567156671576715867159671606716167162671636716467165671666716767168671696717067171671726717367174671756717667177671786717967180671816718267183671846718567186671876718867189671906719167192671936719467195671966719767198671996720067201672026720367204672056720667207672086720967210672116721267213672146721567216672176721867219672206722167222672236722467225672266722767228672296723067231672326723367234672356723667237672386723967240672416724267243672446724567246672476724867249672506725167252672536725467255672566725767258672596726067261672626726367264672656726667267672686726967270672716727267273672746727567276672776727867279672806728167282672836728467285672866728767288672896729067291672926729367294672956729667297672986729967300673016730267303673046730567306673076730867309673106731167312673136731467315673166731767318673196732067321673226732367324673256732667327673286732967330673316733267333673346733567336673376733867339673406734167342673436734467345673466734767348673496735067351673526735367354673556735667357673586735967360673616736267363673646736567366673676736867369673706737167372673736737467375673766737767378673796738067381673826738367384673856738667387673886738967390673916739267393673946739567396673976739867399674006740167402674036740467405674066740767408674096741067411674126741367414674156741667417674186741967420674216742267423674246742567426674276742867429674306743167432674336743467435674366743767438674396744067441674426744367444674456744667447674486744967450674516745267453674546745567456674576745867459674606746167462674636746467465674666746767468674696747067471674726747367474674756747667477674786747967480674816748267483674846748567486674876748867489674906749167492674936749467495674966749767498674996750067501675026750367504675056750667507675086750967510675116751267513675146751567516675176751867519675206752167522675236752467525675266752767528675296753067531675326753367534675356753667537675386753967540675416754267543675446754567546675476754867549675506755167552675536755467555675566755767558675596756067561675626756367564675656756667567675686756967570675716757267573675746757567576675776757867579675806758167582675836758467585675866758767588675896759067591675926759367594675956759667597675986759967600676016760267603676046760567606676076760867609676106761167612676136761467615676166761767618676196762067621676226762367624676256762667627676286762967630676316763267633676346763567636676376763867639676406764167642676436764467645676466764767648676496765067651676526765367654676556765667657676586765967660676616766267663676646766567666676676766867669676706767167672676736767467675676766767767678676796768067681676826768367684676856768667687676886768967690676916769267693676946769567696676976769867699677006770167702677036770467705677066770767708677096771067711677126771367714677156771667717677186771967720677216772267723677246772567726677276772867729677306773167732677336773467735677366773767738677396774067741677426774367744677456774667747677486774967750677516775267753677546775567756677576775867759677606776167762677636776467765677666776767768677696777067771677726777367774677756777667777677786777967780677816778267783677846778567786677876778867789677906779167792677936779467795677966779767798677996780067801678026780367804678056780667807678086780967810678116781267813678146781567816678176781867819678206782167822678236782467825678266782767828678296783067831678326783367834678356783667837678386783967840678416784267843678446784567846678476784867849678506785167852678536785467855678566785767858678596786067861678626786367864678656786667867678686786967870678716787267873678746787567876678776787867879678806788167882678836788467885678866788767888678896789067891678926789367894678956789667897678986789967900679016790267903679046790567906679076790867909679106791167912679136791467915679166791767918679196792067921679226792367924679256792667927679286792967930679316793267933679346793567936679376793867939679406794167942679436794467945679466794767948679496795067951679526795367954679556795667957679586795967960679616796267963679646796567966679676796867969679706797167972679736797467975679766797767978679796798067981679826798367984679856798667987679886798967990679916799267993679946799567996679976799867999680006800168002680036800468005680066800768008680096801068011680126801368014680156801668017680186801968020680216802268023680246802568026680276802868029680306803168032680336803468035680366803768038680396804068041680426804368044680456804668047680486804968050680516805268053680546805568056680576805868059680606806168062680636806468065680666806768068680696807068071680726807368074680756807668077680786807968080680816808268083680846808568086680876808868089680906809168092680936809468095680966809768098680996810068101681026810368104681056810668107681086810968110681116811268113681146811568116681176811868119681206812168122681236812468125681266812768128681296813068131681326813368134681356813668137681386813968140681416814268143681446814568146681476814868149681506815168152681536815468155681566815768158681596816068161681626816368164681656816668167681686816968170681716817268173681746817568176681776817868179681806818168182681836818468185681866818768188681896819068191681926819368194681956819668197681986819968200682016820268203682046820568206682076820868209682106821168212682136821468215682166821768218682196822068221682226822368224682256822668227682286822968230682316823268233682346823568236682376823868239682406824168242682436824468245682466824768248682496825068251682526825368254682556825668257682586825968260682616826268263682646826568266682676826868269682706827168272682736827468275682766827768278682796828068281682826828368284682856828668287682886828968290682916829268293682946829568296682976829868299683006830168302683036830468305683066830768308683096831068311683126831368314683156831668317683186831968320683216832268323683246832568326683276832868329683306833168332683336833468335683366833768338683396834068341683426834368344683456834668347683486834968350683516835268353683546835568356683576835868359683606836168362683636836468365683666836768368683696837068371683726837368374683756837668377683786837968380683816838268383683846838568386683876838868389683906839168392683936839468395683966839768398683996840068401684026840368404684056840668407684086840968410684116841268413684146841568416684176841868419684206842168422684236842468425684266842768428684296843068431684326843368434684356843668437684386843968440684416844268443684446844568446684476844868449684506845168452684536845468455684566845768458684596846068461684626846368464684656846668467684686846968470684716847268473684746847568476684776847868479684806848168482684836848468485684866848768488684896849068491684926849368494684956849668497684986849968500685016850268503685046850568506685076850868509685106851168512685136851468515685166851768518685196852068521685226852368524685256852668527685286852968530685316853268533685346853568536685376853868539685406854168542685436854468545685466854768548685496855068551685526855368554685556855668557685586855968560685616856268563685646856568566685676856868569685706857168572685736857468575685766857768578685796858068581685826858368584685856858668587685886858968590685916859268593685946859568596685976859868599686006860168602686036860468605686066860768608686096861068611686126861368614686156861668617686186861968620686216862268623686246862568626686276862868629686306863168632686336863468635686366863768638686396864068641686426864368644686456864668647686486864968650686516865268653686546865568656686576865868659686606866168662686636866468665686666866768668686696867068671686726867368674686756867668677686786867968680686816868268683686846868568686686876868868689686906869168692686936869468695686966869768698686996870068701687026870368704687056870668707687086870968710687116871268713687146871568716687176871868719687206872168722687236872468725687266872768728687296873068731687326873368734687356873668737687386873968740687416874268743687446874568746687476874868749687506875168752687536875468755687566875768758687596876068761687626876368764687656876668767687686876968770687716877268773687746877568776687776877868779687806878168782687836878468785687866878768788687896879068791687926879368794687956879668797687986879968800688016880268803688046880568806688076880868809688106881168812688136881468815688166881768818688196882068821688226882368824688256882668827688286882968830688316883268833688346883568836688376883868839688406884168842688436884468845688466884768848688496885068851688526885368854688556885668857688586885968860688616886268863688646886568866688676886868869688706887168872688736887468875688766887768878688796888068881688826888368884688856888668887688886888968890688916889268893688946889568896688976889868899689006890168902689036890468905689066890768908689096891068911689126891368914689156891668917689186891968920689216892268923689246892568926689276892868929689306893168932689336893468935689366893768938689396894068941689426894368944689456894668947689486894968950689516895268953689546895568956689576895868959689606896168962689636896468965689666896768968689696897068971689726897368974689756897668977689786897968980689816898268983689846898568986689876898868989689906899168992689936899468995689966899768998689996900069001690026900369004690056900669007690086900969010690116901269013690146901569016690176901869019690206902169022690236902469025690266902769028690296903069031690326903369034690356903669037690386903969040690416904269043690446904569046690476904869049690506905169052690536905469055690566905769058690596906069061690626906369064690656906669067690686906969070690716907269073690746907569076690776907869079690806908169082690836908469085690866908769088690896909069091690926909369094690956909669097690986909969100691016910269103691046910569106691076910869109691106911169112691136911469115691166911769118691196912069121691226912369124691256912669127691286912969130691316913269133691346913569136691376913869139691406914169142691436914469145691466914769148691496915069151691526915369154691556915669157691586915969160691616916269163691646916569166691676916869169691706917169172691736917469175691766917769178691796918069181691826918369184691856918669187691886918969190691916919269193691946919569196691976919869199692006920169202692036920469205692066920769208692096921069211692126921369214692156921669217692186921969220692216922269223692246922569226692276922869229692306923169232692336923469235692366923769238692396924069241692426924369244692456924669247692486924969250692516925269253692546925569256692576925869259692606926169262692636926469265692666926769268692696927069271692726927369274692756927669277692786927969280692816928269283692846928569286692876928869289692906929169292692936929469295692966929769298692996930069301693026930369304693056930669307693086930969310693116931269313693146931569316693176931869319693206932169322693236932469325693266932769328693296933069331693326933369334693356933669337693386933969340693416934269343693446934569346693476934869349693506935169352693536935469355693566935769358693596936069361693626936369364693656936669367693686936969370693716937269373693746937569376693776937869379693806938169382693836938469385693866938769388693896939069391693926939369394693956939669397693986939969400694016940269403694046940569406694076940869409694106941169412694136941469415694166941769418694196942069421694226942369424694256942669427694286942969430694316943269433694346943569436694376943869439694406944169442694436944469445694466944769448694496945069451694526945369454694556945669457694586945969460694616946269463694646946569466694676946869469694706947169472694736947469475694766947769478694796948069481694826948369484694856948669487694886948969490694916949269493694946949569496694976949869499695006950169502695036950469505695066950769508695096951069511695126951369514695156951669517695186951969520695216952269523695246952569526695276952869529695306953169532695336953469535695366953769538695396954069541695426954369544695456954669547695486954969550695516955269553695546955569556695576955869559695606956169562695636956469565695666956769568695696957069571695726957369574695756957669577695786957969580695816958269583695846958569586695876958869589695906959169592695936959469595695966959769598695996960069601696026960369604696056960669607696086960969610696116961269613696146961569616696176961869619696206962169622696236962469625696266962769628696296963069631696326963369634696356963669637696386963969640696416964269643696446964569646696476964869649696506965169652696536965469655696566965769658696596966069661696626966369664696656966669667696686966969670696716967269673696746967569676696776967869679696806968169682696836968469685696866968769688696896969069691696926969369694696956969669697696986969969700697016970269703697046970569706697076970869709697106971169712697136971469715697166971769718697196972069721697226972369724697256972669727697286972969730697316973269733697346973569736697376973869739697406974169742697436974469745697466974769748697496975069751697526975369754697556975669757697586975969760697616976269763697646976569766697676976869769697706977169772697736977469775697766977769778697796978069781697826978369784697856978669787697886978969790697916979269793697946979569796697976979869799698006980169802698036980469805698066980769808698096981069811698126981369814698156981669817698186981969820698216982269823698246982569826698276982869829698306983169832698336983469835698366983769838698396984069841698426984369844698456984669847698486984969850698516985269853698546985569856698576985869859698606986169862698636986469865698666986769868698696987069871698726987369874698756987669877698786987969880698816988269883698846988569886698876988869889698906989169892698936989469895698966989769898698996990069901699026990369904699056990669907699086990969910699116991269913699146991569916699176991869919699206992169922699236992469925699266992769928699296993069931699326993369934699356993669937699386993969940699416994269943699446994569946699476994869949699506995169952699536995469955699566995769958699596996069961699626996369964699656996669967699686996969970699716997269973699746997569976699776997869979699806998169982699836998469985699866998769988699896999069991699926999369994699956999669997699986999970000700017000270003700047000570006700077000870009700107001170012700137001470015700167001770018700197002070021700227002370024700257002670027700287002970030700317003270033700347003570036700377003870039700407004170042700437004470045700467004770048700497005070051700527005370054700557005670057700587005970060700617006270063700647006570066700677006870069700707007170072700737007470075700767007770078700797008070081700827008370084700857008670087700887008970090700917009270093700947009570096700977009870099701007010170102701037010470105701067010770108701097011070111701127011370114701157011670117701187011970120701217012270123701247012570126701277012870129701307013170132701337013470135701367013770138701397014070141701427014370144701457014670147701487014970150701517015270153701547015570156701577015870159701607016170162701637016470165701667016770168701697017070171701727017370174701757017670177701787017970180701817018270183701847018570186701877018870189701907019170192701937019470195701967019770198701997020070201702027020370204702057020670207702087020970210702117021270213702147021570216702177021870219702207022170222702237022470225702267022770228702297023070231702327023370234702357023670237702387023970240702417024270243702447024570246702477024870249702507025170252702537025470255702567025770258702597026070261702627026370264702657026670267702687026970270702717027270273702747027570276702777027870279702807028170282702837028470285702867028770288702897029070291702927029370294702957029670297702987029970300703017030270303703047030570306703077030870309703107031170312703137031470315703167031770318703197032070321703227032370324703257032670327703287032970330703317033270333703347033570336703377033870339703407034170342703437034470345703467034770348703497035070351703527035370354703557035670357703587035970360703617036270363703647036570366703677036870369703707037170372703737037470375703767037770378703797038070381703827038370384703857038670387703887038970390703917039270393703947039570396703977039870399704007040170402704037040470405704067040770408704097041070411704127041370414704157041670417704187041970420704217042270423704247042570426704277042870429704307043170432704337043470435704367043770438704397044070441704427044370444704457044670447704487044970450704517045270453704547045570456704577045870459704607046170462704637046470465704667046770468704697047070471704727047370474704757047670477704787047970480704817048270483704847048570486704877048870489704907049170492704937049470495704967049770498704997050070501705027050370504705057050670507705087050970510705117051270513705147051570516705177051870519705207052170522705237052470525705267052770528705297053070531705327053370534705357053670537705387053970540705417054270543705447054570546705477054870549705507055170552705537055470555705567055770558705597056070561705627056370564705657056670567705687056970570705717057270573705747057570576705777057870579705807058170582705837058470585705867058770588705897059070591705927059370594705957059670597705987059970600706017060270603706047060570606706077060870609706107061170612706137061470615706167061770618706197062070621706227062370624706257062670627706287062970630706317063270633706347063570636706377063870639706407064170642706437064470645706467064770648706497065070651706527065370654706557065670657706587065970660706617066270663706647066570666706677066870669706707067170672706737067470675706767067770678706797068070681706827068370684706857068670687706887068970690706917069270693706947069570696706977069870699707007070170702707037070470705707067070770708707097071070711707127071370714707157071670717707187071970720707217072270723707247072570726707277072870729707307073170732707337073470735707367073770738707397074070741707427074370744707457074670747707487074970750707517075270753707547075570756707577075870759707607076170762707637076470765707667076770768707697077070771707727077370774707757077670777707787077970780707817078270783707847078570786707877078870789707907079170792707937079470795707967079770798707997080070801708027080370804708057080670807708087080970810708117081270813708147081570816708177081870819708207082170822708237082470825708267082770828708297083070831708327083370834708357083670837708387083970840708417084270843708447084570846708477084870849708507085170852708537085470855708567085770858708597086070861708627086370864708657086670867708687086970870708717087270873708747087570876708777087870879708807088170882708837088470885708867088770888708897089070891708927089370894708957089670897708987089970900709017090270903709047090570906709077090870909709107091170912709137091470915709167091770918709197092070921709227092370924709257092670927709287092970930709317093270933709347093570936709377093870939709407094170942709437094470945709467094770948709497095070951709527095370954709557095670957709587095970960709617096270963709647096570966709677096870969709707097170972709737097470975709767097770978709797098070981709827098370984709857098670987709887098970990709917099270993709947099570996709977099870999710007100171002710037100471005710067100771008710097101071011710127101371014710157101671017710187101971020710217102271023710247102571026710277102871029710307103171032710337103471035710367103771038710397104071041710427104371044710457104671047710487104971050710517105271053710547105571056710577105871059710607106171062710637106471065710667106771068710697107071071710727107371074710757107671077710787107971080710817108271083710847108571086710877108871089710907109171092710937109471095710967109771098710997110071101711027110371104711057110671107711087110971110711117111271113711147111571116711177111871119711207112171122711237112471125711267112771128711297113071131711327113371134711357113671137711387113971140711417114271143711447114571146711477114871149711507115171152711537115471155711567115771158711597116071161711627116371164711657116671167711687116971170711717117271173711747117571176711777117871179711807118171182711837118471185711867118771188711897119071191711927119371194711957119671197711987119971200712017120271203712047120571206712077120871209712107121171212712137121471215712167121771218712197122071221712227122371224712257122671227712287122971230712317123271233712347123571236712377123871239712407124171242712437124471245712467124771248712497125071251712527125371254712557125671257712587125971260712617126271263712647126571266712677126871269712707127171272712737127471275712767127771278712797128071281712827128371284712857128671287712887128971290712917129271293712947129571296712977129871299713007130171302713037130471305713067130771308713097131071311713127131371314713157131671317713187131971320713217132271323713247132571326713277132871329713307133171332713337133471335713367133771338713397134071341713427134371344713457134671347713487134971350713517135271353713547135571356713577135871359713607136171362713637136471365713667136771368713697137071371713727137371374713757137671377713787137971380713817138271383713847138571386713877138871389713907139171392713937139471395713967139771398713997140071401714027140371404714057140671407714087140971410714117141271413714147141571416714177141871419714207142171422714237142471425714267142771428714297143071431714327143371434714357143671437714387143971440714417144271443714447144571446714477144871449714507145171452714537145471455714567145771458714597146071461714627146371464714657146671467714687146971470714717147271473714747147571476714777147871479714807148171482714837148471485714867148771488714897149071491714927149371494714957149671497714987149971500715017150271503715047150571506715077150871509715107151171512715137151471515715167151771518715197152071521715227152371524715257152671527715287152971530715317153271533715347153571536715377153871539715407154171542715437154471545715467154771548715497155071551715527155371554715557155671557715587155971560715617156271563715647156571566715677156871569715707157171572715737157471575715767157771578715797158071581715827158371584715857158671587715887158971590715917159271593715947159571596715977159871599716007160171602716037160471605716067160771608716097161071611716127161371614716157161671617716187161971620716217162271623716247162571626716277162871629716307163171632716337163471635716367163771638716397164071641716427164371644716457164671647716487164971650716517165271653716547165571656716577165871659716607166171662716637166471665716667166771668716697167071671716727167371674716757167671677716787167971680716817168271683716847168571686716877168871689716907169171692716937169471695716967169771698716997170071701717027170371704717057170671707717087170971710717117171271713717147171571716717177171871719717207172171722717237172471725717267172771728717297173071731717327173371734717357173671737717387173971740717417174271743717447174571746717477174871749717507175171752717537175471755717567175771758717597176071761717627176371764717657176671767717687176971770717717177271773717747177571776717777177871779717807178171782717837178471785717867178771788717897179071791717927179371794717957179671797717987179971800718017180271803718047180571806718077180871809718107181171812718137181471815718167181771818718197182071821718227182371824718257182671827718287182971830718317183271833718347183571836718377183871839718407184171842718437184471845718467184771848718497185071851718527185371854718557185671857718587185971860718617186271863718647186571866718677186871869718707187171872718737187471875718767187771878718797188071881718827188371884718857188671887718887188971890718917189271893718947189571896718977189871899719007190171902719037190471905719067190771908719097191071911719127191371914719157191671917719187191971920719217192271923719247192571926719277192871929719307193171932719337193471935719367193771938719397194071941719427194371944719457194671947719487194971950719517195271953719547195571956719577195871959719607196171962719637196471965719667196771968719697197071971719727197371974719757197671977719787197971980719817198271983719847198571986719877198871989719907199171992719937199471995719967199771998719997200072001720027200372004720057200672007720087200972010720117201272013720147201572016720177201872019720207202172022720237202472025720267202772028720297203072031720327203372034720357203672037720387203972040720417204272043720447204572046720477204872049720507205172052720537205472055720567205772058720597206072061720627206372064720657206672067720687206972070720717207272073720747207572076720777207872079720807208172082720837208472085720867208772088720897209072091720927209372094720957209672097720987209972100721017210272103721047210572106721077210872109721107211172112721137211472115721167211772118721197212072121721227212372124721257212672127721287212972130721317213272133721347213572136721377213872139721407214172142721437214472145721467214772148721497215072151721527215372154721557215672157721587215972160721617216272163721647216572166721677216872169721707217172172721737217472175721767217772178721797218072181721827218372184721857218672187721887218972190721917219272193721947219572196721977219872199722007220172202722037220472205722067220772208722097221072211722127221372214722157221672217722187221972220722217222272223722247222572226722277222872229722307223172232722337223472235722367223772238722397224072241722427224372244722457224672247722487224972250722517225272253722547225572256722577225872259722607226172262722637226472265722667226772268722697227072271722727227372274722757227672277722787227972280722817228272283722847228572286722877228872289722907229172292722937229472295722967229772298722997230072301723027230372304723057230672307723087230972310723117231272313723147231572316723177231872319723207232172322723237232472325723267232772328723297233072331723327233372334723357233672337723387233972340723417234272343723447234572346723477234872349723507235172352723537235472355723567235772358723597236072361723627236372364723657236672367723687236972370723717237272373723747237572376723777237872379723807238172382723837238472385723867238772388723897239072391723927239372394723957239672397723987239972400724017240272403724047240572406724077240872409724107241172412724137241472415724167241772418724197242072421724227242372424724257242672427724287242972430724317243272433724347243572436724377243872439724407244172442724437244472445724467244772448724497245072451724527245372454724557245672457724587245972460724617246272463724647246572466724677246872469724707247172472724737247472475724767247772478724797248072481724827248372484724857248672487724887248972490724917249272493724947249572496724977249872499725007250172502725037250472505725067250772508725097251072511725127251372514725157251672517725187251972520725217252272523725247252572526725277252872529725307253172532725337253472535725367253772538725397254072541725427254372544725457254672547725487254972550725517255272553725547255572556725577255872559725607256172562725637256472565725667256772568725697257072571725727257372574725757257672577725787257972580725817258272583725847258572586725877258872589725907259172592725937259472595725967259772598725997260072601726027260372604726057260672607726087260972610726117261272613726147261572616726177261872619726207262172622726237262472625726267262772628726297263072631726327263372634726357263672637726387263972640726417264272643726447264572646726477264872649726507265172652726537265472655726567265772658726597266072661726627266372664726657266672667726687266972670726717267272673726747267572676726777267872679726807268172682726837268472685726867268772688726897269072691726927269372694726957269672697726987269972700727017270272703727047270572706727077270872709727107271172712727137271472715727167271772718727197272072721727227272372724727257272672727727287272972730727317273272733727347273572736727377273872739727407274172742727437274472745727467274772748727497275072751727527275372754727557275672757727587275972760727617276272763727647276572766727677276872769727707277172772727737277472775727767277772778727797278072781727827278372784727857278672787727887278972790727917279272793727947279572796727977279872799728007280172802728037280472805728067280772808728097281072811728127281372814728157281672817728187281972820728217282272823728247282572826728277282872829728307283172832728337283472835728367283772838728397284072841728427284372844728457284672847728487284972850728517285272853728547285572856728577285872859728607286172862728637286472865728667286772868728697287072871728727287372874728757287672877728787287972880728817288272883728847288572886728877288872889728907289172892728937289472895728967289772898728997290072901729027290372904729057290672907729087290972910729117291272913729147291572916729177291872919729207292172922729237292472925729267292772928729297293072931729327293372934729357293672937729387293972940729417294272943729447294572946729477294872949729507295172952729537295472955729567295772958729597296072961729627296372964729657296672967729687296972970729717297272973729747297572976729777297872979729807298172982729837298472985729867298772988729897299072991729927299372994729957299672997729987299973000730017300273003730047300573006730077300873009730107301173012730137301473015730167301773018730197302073021730227302373024730257302673027730287302973030730317303273033730347303573036730377303873039730407304173042730437304473045730467304773048730497305073051730527305373054730557305673057730587305973060730617306273063730647306573066730677306873069730707307173072730737307473075730767307773078730797308073081730827308373084730857308673087730887308973090730917309273093730947309573096730977309873099731007310173102731037310473105731067310773108731097311073111731127311373114731157311673117731187311973120731217312273123731247312573126731277312873129731307313173132731337313473135731367313773138731397314073141731427314373144731457314673147731487314973150731517315273153731547315573156731577315873159731607316173162731637316473165731667316773168731697317073171731727317373174731757317673177731787317973180731817318273183731847318573186731877318873189731907319173192731937319473195731967319773198731997320073201732027320373204732057320673207732087320973210732117321273213732147321573216732177321873219732207322173222732237322473225732267322773228732297323073231732327323373234732357323673237732387323973240732417324273243732447324573246732477324873249732507325173252732537325473255732567325773258732597326073261732627326373264732657326673267732687326973270732717327273273732747327573276732777327873279732807328173282732837328473285732867328773288732897329073291732927329373294732957329673297732987329973300733017330273303733047330573306733077330873309733107331173312733137331473315733167331773318733197332073321733227332373324733257332673327733287332973330733317333273333733347333573336733377333873339733407334173342733437334473345733467334773348733497335073351733527335373354733557335673357733587335973360733617336273363733647336573366733677336873369733707337173372733737337473375733767337773378733797338073381733827338373384733857338673387733887338973390733917339273393733947339573396733977339873399734007340173402734037340473405734067340773408734097341073411734127341373414734157341673417734187341973420734217342273423734247342573426734277342873429734307343173432734337343473435734367343773438734397344073441734427344373444734457344673447734487344973450734517345273453734547345573456734577345873459734607346173462734637346473465734667346773468734697347073471734727347373474734757347673477734787347973480734817348273483734847348573486734877348873489734907349173492734937349473495734967349773498734997350073501735027350373504735057350673507735087350973510735117351273513735147351573516735177351873519735207352173522735237352473525735267352773528735297353073531735327353373534735357353673537735387353973540735417354273543735447354573546735477354873549735507355173552735537355473555735567355773558735597356073561735627356373564735657356673567735687356973570735717357273573735747357573576735777357873579735807358173582735837358473585735867358773588735897359073591735927359373594735957359673597735987359973600736017360273603736047360573606736077360873609736107361173612736137361473615736167361773618736197362073621736227362373624736257362673627736287362973630736317363273633736347363573636736377363873639736407364173642736437364473645736467364773648736497365073651736527365373654736557365673657736587365973660736617366273663736647366573666736677366873669736707367173672736737367473675736767367773678736797368073681736827368373684736857368673687736887368973690736917369273693736947369573696736977369873699737007370173702737037370473705737067370773708737097371073711737127371373714737157371673717737187371973720737217372273723737247372573726737277372873729737307373173732737337373473735737367373773738737397374073741737427374373744737457374673747737487374973750737517375273753737547375573756737577375873759737607376173762737637376473765737667376773768737697377073771737727377373774737757377673777737787377973780737817378273783737847378573786737877378873789737907379173792737937379473795737967379773798737997380073801738027380373804738057380673807738087380973810738117381273813738147381573816738177381873819738207382173822738237382473825738267382773828738297383073831738327383373834738357383673837738387383973840738417384273843738447384573846738477384873849738507385173852738537385473855738567385773858738597386073861738627386373864738657386673867738687386973870738717387273873738747387573876738777387873879738807388173882738837388473885738867388773888738897389073891738927389373894738957389673897738987389973900739017390273903739047390573906739077390873909739107391173912739137391473915739167391773918739197392073921739227392373924739257392673927739287392973930739317393273933739347393573936739377393873939739407394173942739437394473945739467394773948739497395073951739527395373954739557395673957739587395973960739617396273963739647396573966739677396873969739707397173972739737397473975739767397773978739797398073981739827398373984739857398673987739887398973990739917399273993739947399573996739977399873999740007400174002740037400474005740067400774008740097401074011740127401374014740157401674017740187401974020740217402274023740247402574026740277402874029740307403174032740337403474035740367403774038740397404074041740427404374044740457404674047740487404974050740517405274053740547405574056740577405874059740607406174062740637406474065740667406774068740697407074071740727407374074740757407674077740787407974080740817408274083740847408574086740877408874089740907409174092740937409474095740967409774098740997410074101741027410374104741057410674107741087410974110741117411274113741147411574116741177411874119741207412174122741237412474125741267412774128741297413074131741327413374134741357413674137741387413974140741417414274143741447414574146741477414874149741507415174152741537415474155741567415774158741597416074161741627416374164741657416674167741687416974170741717417274173741747417574176741777417874179741807418174182741837418474185741867418774188741897419074191741927419374194741957419674197741987419974200742017420274203742047420574206742077420874209742107421174212742137421474215742167421774218742197422074221742227422374224742257422674227742287422974230742317423274233742347423574236742377423874239742407424174242742437424474245742467424774248742497425074251742527425374254742557425674257742587425974260742617426274263742647426574266742677426874269742707427174272742737427474275742767427774278742797428074281742827428374284742857428674287742887428974290742917429274293742947429574296742977429874299743007430174302743037430474305743067430774308743097431074311743127431374314743157431674317743187431974320743217432274323743247432574326743277432874329743307433174332743337433474335743367433774338743397434074341743427434374344743457434674347743487434974350743517435274353743547435574356743577435874359743607436174362743637436474365743667436774368743697437074371743727437374374743757437674377743787437974380743817438274383743847438574386743877438874389743907439174392743937439474395743967439774398743997440074401744027440374404744057440674407744087440974410744117441274413744147441574416744177441874419744207442174422744237442474425744267442774428744297443074431744327443374434744357443674437744387443974440744417444274443744447444574446744477444874449744507445174452744537445474455744567445774458744597446074461744627446374464744657446674467744687446974470744717447274473744747447574476744777447874479744807448174482744837448474485744867448774488744897449074491744927449374494744957449674497744987449974500745017450274503745047450574506745077450874509745107451174512745137451474515745167451774518745197452074521745227452374524745257452674527745287452974530745317453274533745347453574536745377453874539745407454174542745437454474545745467454774548745497455074551745527455374554745557455674557745587455974560745617456274563745647456574566745677456874569745707457174572745737457474575745767457774578745797458074581745827458374584745857458674587745887458974590745917459274593745947459574596745977459874599746007460174602746037460474605746067460774608746097461074611746127461374614746157461674617746187461974620746217462274623746247462574626746277462874629746307463174632746337463474635746367463774638746397464074641746427464374644746457464674647746487464974650746517465274653746547465574656746577465874659746607466174662746637466474665746667466774668746697467074671746727467374674746757467674677746787467974680746817468274683746847468574686746877468874689746907469174692746937469474695746967469774698746997470074701747027470374704747057470674707747087470974710747117471274713747147471574716747177471874719747207472174722747237472474725747267472774728747297473074731747327473374734747357473674737747387473974740747417474274743747447474574746747477474874749747507475174752747537475474755747567475774758747597476074761747627476374764747657476674767747687476974770747717477274773747747477574776747777477874779747807478174782747837478474785747867478774788747897479074791747927479374794747957479674797747987479974800748017480274803748047480574806748077480874809748107481174812748137481474815748167481774818748197482074821748227482374824748257482674827748287482974830748317483274833748347483574836748377483874839748407484174842748437484474845748467484774848748497485074851748527485374854748557485674857748587485974860748617486274863748647486574866748677486874869748707487174872748737487474875748767487774878748797488074881748827488374884748857488674887748887488974890748917489274893748947489574896748977489874899749007490174902749037490474905749067490774908749097491074911749127491374914749157491674917749187491974920749217492274923749247492574926749277492874929749307493174932749337493474935749367493774938749397494074941749427494374944749457494674947749487494974950749517495274953749547495574956749577495874959749607496174962749637496474965749667496774968749697497074971749727497374974749757497674977749787497974980749817498274983749847498574986749877498874989749907499174992749937499474995749967499774998749997500075001750027500375004750057500675007750087500975010750117501275013750147501575016750177501875019750207502175022750237502475025750267502775028750297503075031750327503375034750357503675037750387503975040750417504275043750447504575046750477504875049750507505175052750537505475055750567505775058750597506075061750627506375064750657506675067750687506975070750717507275073750747507575076750777507875079750807508175082750837508475085750867508775088750897509075091750927509375094750957509675097750987509975100751017510275103751047510575106751077510875109751107511175112751137511475115751167511775118751197512075121751227512375124751257512675127751287512975130751317513275133751347513575136751377513875139751407514175142751437514475145751467514775148751497515075151751527515375154751557515675157751587515975160751617516275163751647516575166751677516875169751707517175172751737517475175751767517775178751797518075181751827518375184751857518675187751887518975190751917519275193751947519575196751977519875199752007520175202752037520475205752067520775208752097521075211752127521375214752157521675217752187521975220752217522275223752247522575226752277522875229752307523175232752337523475235752367523775238752397524075241752427524375244752457524675247752487524975250752517525275253752547525575256752577525875259752607526175262752637526475265752667526775268752697527075271752727527375274752757527675277752787527975280752817528275283752847528575286752877528875289752907529175292752937529475295752967529775298752997530075301753027530375304753057530675307753087530975310753117531275313753147531575316753177531875319753207532175322753237532475325753267532775328753297533075331753327533375334753357533675337753387533975340753417534275343753447534575346753477534875349753507535175352753537535475355753567535775358753597536075361753627536375364753657536675367753687536975370753717537275373753747537575376753777537875379753807538175382753837538475385753867538775388753897539075391753927539375394753957539675397753987539975400754017540275403754047540575406754077540875409754107541175412754137541475415754167541775418754197542075421754227542375424754257542675427754287542975430754317543275433754347543575436754377543875439754407544175442754437544475445754467544775448754497545075451754527545375454754557545675457754587545975460754617546275463754647546575466754677546875469754707547175472754737547475475754767547775478754797548075481754827548375484754857548675487754887548975490754917549275493754947549575496754977549875499755007550175502755037550475505755067550775508755097551075511755127551375514755157551675517755187551975520755217552275523755247552575526755277552875529755307553175532755337553475535755367553775538755397554075541755427554375544755457554675547755487554975550755517555275553755547555575556755577555875559755607556175562755637556475565755667556775568755697557075571755727557375574755757557675577755787557975580755817558275583755847558575586755877558875589755907559175592755937559475595755967559775598755997560075601756027560375604756057560675607756087560975610756117561275613756147561575616756177561875619756207562175622756237562475625756267562775628756297563075631756327563375634756357563675637756387563975640756417564275643756447564575646756477564875649756507565175652756537565475655756567565775658756597566075661756627566375664756657566675667756687566975670756717567275673756747567575676756777567875679756807568175682756837568475685756867568775688756897569075691756927569375694756957569675697756987569975700757017570275703757047570575706757077570875709757107571175712757137571475715757167571775718757197572075721757227572375724757257572675727757287572975730757317573275733757347573575736757377573875739757407574175742757437574475745757467574775748757497575075751757527575375754757557575675757757587575975760757617576275763757647576575766757677576875769757707577175772757737577475775757767577775778757797578075781757827578375784757857578675787757887578975790757917579275793757947579575796757977579875799758007580175802758037580475805758067580775808758097581075811758127581375814758157581675817758187581975820758217582275823758247582575826758277582875829758307583175832758337583475835758367583775838758397584075841758427584375844758457584675847758487584975850758517585275853758547585575856758577585875859758607586175862758637586475865758667586775868758697587075871758727587375874758757587675877758787587975880758817588275883758847588575886758877588875889758907589175892758937589475895758967589775898758997590075901759027590375904759057590675907759087590975910759117591275913759147591575916759177591875919759207592175922759237592475925759267592775928759297593075931759327593375934759357593675937759387593975940759417594275943759447594575946759477594875949759507595175952759537595475955759567595775958759597596075961759627596375964759657596675967759687596975970759717597275973759747597575976759777597875979759807598175982759837598475985759867598775988759897599075991759927599375994759957599675997759987599976000760017600276003760047600576006760077600876009760107601176012760137601476015760167601776018760197602076021760227602376024760257602676027760287602976030760317603276033760347603576036760377603876039760407604176042760437604476045760467604776048760497605076051760527605376054760557605676057760587605976060760617606276063760647606576066760677606876069760707607176072760737607476075760767607776078760797608076081760827608376084760857608676087760887608976090760917609276093760947609576096760977609876099761007610176102761037610476105761067610776108761097611076111761127611376114761157611676117761187611976120761217612276123761247612576126761277612876129761307613176132761337613476135761367613776138761397614076141761427614376144761457614676147761487614976150761517615276153761547615576156761577615876159761607616176162761637616476165761667616776168761697617076171761727617376174761757617676177761787617976180761817618276183761847618576186761877618876189761907619176192761937619476195761967619776198761997620076201762027620376204762057620676207762087620976210762117621276213762147621576216762177621876219762207622176222762237622476225762267622776228762297623076231762327623376234762357623676237762387623976240762417624276243762447624576246762477624876249762507625176252762537625476255762567625776258762597626076261762627626376264762657626676267762687626976270762717627276273762747627576276762777627876279762807628176282762837628476285762867628776288762897629076291762927629376294762957629676297762987629976300763017630276303763047630576306763077630876309763107631176312763137631476315763167631776318763197632076321763227632376324763257632676327763287632976330763317633276333763347633576336763377633876339763407634176342763437634476345763467634776348763497635076351763527635376354763557635676357763587635976360763617636276363763647636576366763677636876369763707637176372763737637476375763767637776378763797638076381763827638376384763857638676387763887638976390763917639276393763947639576396763977639876399764007640176402764037640476405764067640776408764097641076411764127641376414764157641676417764187641976420764217642276423764247642576426764277642876429764307643176432764337643476435764367643776438764397644076441764427644376444764457644676447764487644976450764517645276453764547645576456764577645876459764607646176462764637646476465764667646776468764697647076471764727647376474764757647676477764787647976480764817648276483764847648576486764877648876489764907649176492764937649476495764967649776498764997650076501765027650376504765057650676507765087650976510765117651276513765147651576516765177651876519765207652176522765237652476525765267652776528765297653076531765327653376534765357653676537765387653976540765417654276543765447654576546765477654876549765507655176552765537655476555765567655776558765597656076561765627656376564765657656676567765687656976570765717657276573765747657576576765777657876579765807658176582765837658476585765867658776588765897659076591765927659376594765957659676597765987659976600766017660276603766047660576606766077660876609766107661176612766137661476615766167661776618766197662076621766227662376624766257662676627766287662976630766317663276633766347663576636766377663876639766407664176642766437664476645766467664776648766497665076651766527665376654766557665676657766587665976660766617666276663766647666576666766677666876669766707667176672766737667476675766767667776678766797668076681766827668376684766857668676687766887668976690766917669276693766947669576696766977669876699767007670176702767037670476705767067670776708767097671076711767127671376714767157671676717767187671976720767217672276723767247672576726767277672876729767307673176732767337673476735767367673776738767397674076741767427674376744767457674676747767487674976750767517675276753767547675576756767577675876759767607676176762767637676476765767667676776768767697677076771767727677376774767757677676777767787677976780767817678276783767847678576786767877678876789767907679176792767937679476795767967679776798767997680076801768027680376804768057680676807768087680976810768117681276813768147681576816768177681876819768207682176822768237682476825768267682776828768297683076831768327683376834768357683676837768387683976840768417684276843768447684576846768477684876849768507685176852768537685476855768567685776858768597686076861768627686376864768657686676867768687686976870768717687276873768747687576876768777687876879768807688176882768837688476885768867688776888768897689076891768927689376894768957689676897768987689976900769017690276903769047690576906769077690876909769107691176912769137691476915769167691776918769197692076921769227692376924769257692676927769287692976930769317693276933769347693576936769377693876939769407694176942769437694476945769467694776948769497695076951769527695376954769557695676957769587695976960769617696276963769647696576966769677696876969769707697176972769737697476975769767697776978769797698076981769827698376984769857698676987769887698976990769917699276993769947699576996769977699876999770007700177002770037700477005770067700777008770097701077011770127701377014770157701677017770187701977020770217702277023770247702577026770277702877029770307703177032770337703477035770367703777038770397704077041770427704377044770457704677047770487704977050770517705277053770547705577056770577705877059770607706177062770637706477065770667706777068770697707077071770727707377074770757707677077770787707977080770817708277083770847708577086770877708877089770907709177092770937709477095770967709777098770997710077101771027710377104771057710677107771087710977110771117711277113771147711577116771177711877119771207712177122771237712477125771267712777128771297713077131771327713377134771357713677137771387713977140771417714277143771447714577146771477714877149771507715177152771537715477155771567715777158771597716077161771627716377164771657716677167771687716977170771717717277173771747717577176771777717877179771807718177182771837718477185771867718777188771897719077191771927719377194771957719677197771987719977200772017720277203772047720577206772077720877209772107721177212772137721477215772167721777218772197722077221772227722377224772257722677227772287722977230772317723277233772347723577236772377723877239772407724177242772437724477245772467724777248772497725077251772527725377254772557725677257772587725977260772617726277263772647726577266772677726877269772707727177272772737727477275772767727777278772797728077281772827728377284772857728677287772887728977290772917729277293772947729577296772977729877299773007730177302773037730477305773067730777308773097731077311773127731377314773157731677317773187731977320773217732277323773247732577326773277732877329773307733177332773337733477335773367733777338773397734077341773427734377344773457734677347773487734977350773517735277353773547735577356773577735877359773607736177362773637736477365773667736777368773697737077371773727737377374773757737677377773787737977380773817738277383773847738577386773877738877389773907739177392773937739477395773967739777398773997740077401774027740377404774057740677407774087740977410774117741277413774147741577416774177741877419774207742177422774237742477425774267742777428774297743077431774327743377434774357743677437774387743977440774417744277443774447744577446774477744877449774507745177452774537745477455774567745777458774597746077461774627746377464774657746677467774687746977470774717747277473774747747577476774777747877479774807748177482774837748477485774867748777488774897749077491774927749377494774957749677497774987749977500775017750277503775047750577506775077750877509775107751177512775137751477515775167751777518775197752077521775227752377524775257752677527775287752977530775317753277533775347753577536775377753877539775407754177542775437754477545775467754777548775497755077551775527755377554775557755677557775587755977560775617756277563775647756577566775677756877569775707757177572775737757477575775767757777578775797758077581775827758377584775857758677587775887758977590775917759277593775947759577596775977759877599776007760177602776037760477605776067760777608776097761077611776127761377614776157761677617776187761977620776217762277623776247762577626776277762877629776307763177632776337763477635776367763777638776397764077641776427764377644776457764677647776487764977650776517765277653776547765577656776577765877659776607766177662776637766477665776667766777668776697767077671776727767377674776757767677677776787767977680776817768277683776847768577686776877768877689776907769177692776937769477695776967769777698776997770077701777027770377704777057770677707777087770977710777117771277713777147771577716777177771877719777207772177722777237772477725777267772777728777297773077731777327773377734777357773677737777387773977740777417774277743777447774577746777477774877749777507775177752777537775477755777567775777758777597776077761777627776377764777657776677767777687776977770777717777277773777747777577776777777777877779777807778177782777837778477785777867778777788777897779077791777927779377794777957779677797777987779977800778017780277803778047780577806778077780877809778107781177812778137781477815778167781777818778197782077821778227782377824778257782677827778287782977830778317783277833778347783577836778377783877839778407784177842778437784477845778467784777848778497785077851778527785377854778557785677857778587785977860778617786277863778647786577866778677786877869778707787177872778737787477875778767787777878778797788077881778827788377884778857788677887778887788977890778917789277893778947789577896778977789877899779007790177902779037790477905779067790777908779097791077911779127791377914779157791677917779187791977920779217792277923779247792577926779277792877929779307793177932779337793477935779367793777938779397794077941779427794377944779457794677947779487794977950779517795277953779547795577956779577795877959779607796177962779637796477965779667796777968779697797077971779727797377974779757797677977779787797977980779817798277983779847798577986779877798877989779907799177992779937799477995779967799777998779997800078001780027800378004780057800678007780087800978010780117801278013780147801578016780177801878019780207802178022780237802478025780267802778028780297803078031780327803378034780357803678037780387803978040780417804278043780447804578046780477804878049780507805178052780537805478055780567805778058780597806078061780627806378064780657806678067780687806978070780717807278073780747807578076780777807878079780807808178082780837808478085780867808778088780897809078091780927809378094780957809678097780987809978100781017810278103781047810578106781077810878109781107811178112781137811478115781167811778118781197812078121781227812378124781257812678127781287812978130781317813278133781347813578136781377813878139781407814178142781437814478145781467814778148781497815078151781527815378154781557815678157781587815978160781617816278163781647816578166781677816878169781707817178172781737817478175781767817778178781797818078181781827818378184781857818678187781887818978190781917819278193781947819578196781977819878199782007820178202782037820478205782067820778208782097821078211782127821378214782157821678217782187821978220782217822278223782247822578226782277822878229782307823178232782337823478235782367823778238782397824078241782427824378244782457824678247782487824978250782517825278253782547825578256782577825878259782607826178262782637826478265782667826778268782697827078271782727827378274782757827678277782787827978280782817828278283782847828578286782877828878289782907829178292782937829478295782967829778298782997830078301783027830378304783057830678307783087830978310783117831278313783147831578316783177831878319783207832178322783237832478325783267832778328783297833078331783327833378334783357833678337783387833978340783417834278343783447834578346783477834878349783507835178352783537835478355783567835778358783597836078361783627836378364783657836678367783687836978370783717837278373783747837578376783777837878379783807838178382783837838478385783867838778388783897839078391783927839378394783957839678397783987839978400784017840278403784047840578406784077840878409784107841178412784137841478415784167841778418784197842078421784227842378424784257842678427784287842978430784317843278433784347843578436784377843878439784407844178442784437844478445784467844778448784497845078451784527845378454784557845678457784587845978460784617846278463784647846578466784677846878469784707847178472784737847478475784767847778478784797848078481784827848378484784857848678487784887848978490784917849278493784947849578496784977849878499785007850178502785037850478505785067850778508785097851078511785127851378514785157851678517785187851978520785217852278523785247852578526785277852878529785307853178532785337853478535785367853778538785397854078541785427854378544785457854678547785487854978550785517855278553785547855578556785577855878559785607856178562785637856478565785667856778568785697857078571785727857378574785757857678577785787857978580785817858278583785847858578586785877858878589785907859178592785937859478595785967859778598785997860078601786027860378604786057860678607786087860978610786117861278613786147861578616786177861878619786207862178622786237862478625786267862778628786297863078631786327863378634786357863678637786387863978640786417864278643786447864578646786477864878649786507865178652786537865478655786567865778658786597866078661786627866378664786657866678667786687866978670786717867278673786747867578676786777867878679786807868178682786837868478685786867868778688786897869078691786927869378694786957869678697786987869978700787017870278703787047870578706787077870878709787107871178712787137871478715787167871778718787197872078721787227872378724787257872678727787287872978730787317873278733787347873578736787377873878739787407874178742787437874478745787467874778748787497875078751787527875378754787557875678757787587875978760787617876278763787647876578766787677876878769787707877178772787737877478775787767877778778787797878078781787827878378784787857878678787787887878978790787917879278793787947879578796787977879878799788007880178802788037880478805788067880778808788097881078811788127881378814788157881678817788187881978820788217882278823788247882578826788277882878829788307883178832788337883478835788367883778838788397884078841788427884378844788457884678847788487884978850788517885278853788547885578856788577885878859788607886178862788637886478865788667886778868788697887078871788727887378874788757887678877788787887978880788817888278883788847888578886788877888878889788907889178892788937889478895788967889778898788997890078901789027890378904789057890678907789087890978910789117891278913789147891578916789177891878919789207892178922789237892478925789267892778928789297893078931789327893378934789357893678937789387893978940789417894278943789447894578946789477894878949789507895178952789537895478955789567895778958789597896078961789627896378964789657896678967789687896978970789717897278973789747897578976789777897878979789807898178982789837898478985789867898778988789897899078991789927899378994789957899678997789987899979000790017900279003790047900579006790077900879009790107901179012790137901479015790167901779018790197902079021790227902379024790257902679027790287902979030790317903279033790347903579036790377903879039790407904179042790437904479045790467904779048790497905079051790527905379054790557905679057790587905979060790617906279063790647906579066790677906879069790707907179072790737907479075790767907779078790797908079081790827908379084790857908679087790887908979090790917909279093790947909579096790977909879099791007910179102791037910479105791067910779108791097911079111791127911379114791157911679117791187911979120791217912279123791247912579126791277912879129791307913179132791337913479135791367913779138791397914079141791427914379144791457914679147791487914979150791517915279153791547915579156791577915879159791607916179162791637916479165791667916779168791697917079171791727917379174791757917679177791787917979180791817918279183791847918579186791877918879189791907919179192791937919479195791967919779198791997920079201792027920379204792057920679207792087920979210792117921279213792147921579216792177921879219792207922179222792237922479225792267922779228792297923079231792327923379234792357923679237792387923979240792417924279243792447924579246792477924879249792507925179252792537925479255792567925779258792597926079261792627926379264792657926679267792687926979270792717927279273792747927579276792777927879279792807928179282792837928479285792867928779288792897929079291792927929379294792957929679297792987929979300793017930279303793047930579306793077930879309793107931179312793137931479315793167931779318793197932079321793227932379324793257932679327793287932979330793317933279333793347933579336793377933879339793407934179342793437934479345793467934779348793497935079351793527935379354793557935679357793587935979360793617936279363793647936579366793677936879369793707937179372793737937479375793767937779378793797938079381793827938379384793857938679387793887938979390793917939279393793947939579396793977939879399794007940179402794037940479405794067940779408794097941079411794127941379414794157941679417794187941979420794217942279423794247942579426794277942879429794307943179432794337943479435794367943779438794397944079441794427944379444794457944679447794487944979450794517945279453794547945579456794577945879459794607946179462794637946479465794667946779468794697947079471794727947379474794757947679477794787947979480794817948279483794847948579486794877948879489794907949179492794937949479495794967949779498794997950079501795027950379504795057950679507795087950979510795117951279513795147951579516795177951879519795207952179522795237952479525795267952779528795297953079531795327953379534795357953679537795387953979540795417954279543795447954579546795477954879549795507955179552795537955479555795567955779558795597956079561795627956379564795657956679567795687956979570795717957279573795747957579576795777957879579795807958179582795837958479585795867958779588795897959079591795927959379594795957959679597795987959979600796017960279603796047960579606796077960879609796107961179612796137961479615796167961779618796197962079621796227962379624796257962679627796287962979630796317963279633796347963579636796377963879639796407964179642796437964479645796467964779648796497965079651796527965379654796557965679657796587965979660796617966279663796647966579666796677966879669796707967179672796737967479675796767967779678796797968079681796827968379684796857968679687796887968979690796917969279693796947969579696796977969879699797007970179702797037970479705797067970779708797097971079711797127971379714797157971679717797187971979720797217972279723797247972579726797277972879729797307973179732797337973479735797367973779738797397974079741797427974379744797457974679747797487974979750797517975279753797547975579756797577975879759797607976179762797637976479765797667976779768797697977079771797727977379774797757977679777797787977979780797817978279783797847978579786797877978879789797907979179792797937979479795797967979779798797997980079801798027980379804798057980679807798087980979810798117981279813798147981579816798177981879819798207982179822798237982479825798267982779828798297983079831798327983379834798357983679837798387983979840798417984279843798447984579846798477984879849798507985179852798537985479855798567985779858798597986079861798627986379864798657986679867798687986979870798717987279873798747987579876798777987879879798807988179882798837988479885798867988779888798897989079891798927989379894798957989679897798987989979900799017990279903799047990579906799077990879909799107991179912799137991479915799167991779918799197992079921799227992379924799257992679927799287992979930799317993279933799347993579936799377993879939799407994179942799437994479945799467994779948799497995079951799527995379954799557995679957799587995979960799617996279963799647996579966799677996879969799707997179972799737997479975799767997779978799797998079981799827998379984799857998679987799887998979990799917999279993799947999579996799977999879999800008000180002800038000480005800068000780008800098001080011800128001380014800158001680017800188001980020800218002280023800248002580026800278002880029800308003180032800338003480035800368003780038800398004080041800428004380044800458004680047800488004980050800518005280053800548005580056800578005880059800608006180062800638006480065800668006780068800698007080071800728007380074800758007680077800788007980080800818008280083800848008580086800878008880089800908009180092800938009480095800968009780098800998010080101801028010380104801058010680107801088010980110801118011280113801148011580116801178011880119801208012180122801238012480125801268012780128801298013080131801328013380134801358013680137801388013980140801418014280143801448014580146801478014880149801508015180152801538015480155801568015780158801598016080161801628016380164801658016680167801688016980170801718017280173801748017580176801778017880179801808018180182801838018480185801868018780188801898019080191801928019380194801958019680197801988019980200802018020280203802048020580206802078020880209802108021180212802138021480215802168021780218802198022080221802228022380224802258022680227802288022980230802318023280233802348023580236802378023880239802408024180242802438024480245802468024780248802498025080251802528025380254802558025680257802588025980260802618026280263802648026580266802678026880269802708027180272802738027480275802768027780278802798028080281802828028380284802858028680287802888028980290802918029280293802948029580296802978029880299803008030180302803038030480305803068030780308803098031080311803128031380314803158031680317803188031980320803218032280323803248032580326803278032880329803308033180332803338033480335803368033780338803398034080341803428034380344803458034680347803488034980350803518035280353803548035580356803578035880359803608036180362803638036480365803668036780368803698037080371803728037380374803758037680377803788037980380803818038280383803848038580386803878038880389803908039180392803938039480395803968039780398803998040080401804028040380404804058040680407804088040980410804118041280413804148041580416804178041880419804208042180422804238042480425804268042780428804298043080431804328043380434804358043680437804388043980440804418044280443804448044580446804478044880449804508045180452804538045480455804568045780458804598046080461804628046380464804658046680467804688046980470804718047280473804748047580476804778047880479804808048180482804838048480485804868048780488804898049080491804928049380494804958049680497804988049980500805018050280503805048050580506805078050880509805108051180512805138051480515805168051780518805198052080521805228052380524805258052680527805288052980530805318053280533805348053580536805378053880539805408054180542805438054480545805468054780548805498055080551805528055380554805558055680557805588055980560805618056280563805648056580566805678056880569805708057180572805738057480575805768057780578805798058080581805828058380584805858058680587805888058980590805918059280593805948059580596805978059880599806008060180602806038060480605806068060780608806098061080611806128061380614806158061680617806188061980620806218062280623806248062580626806278062880629806308063180632806338063480635806368063780638806398064080641806428064380644806458064680647806488064980650806518065280653806548065580656806578065880659806608066180662806638066480665806668066780668806698067080671806728067380674806758067680677806788067980680806818068280683806848068580686806878068880689806908069180692806938069480695806968069780698806998070080701807028070380704807058070680707807088070980710807118071280713807148071580716807178071880719807208072180722807238072480725807268072780728807298073080731807328073380734807358073680737807388073980740807418074280743807448074580746807478074880749807508075180752807538075480755807568075780758807598076080761807628076380764807658076680767807688076980770807718077280773807748077580776807778077880779807808078180782807838078480785807868078780788807898079080791807928079380794807958079680797807988079980800808018080280803808048080580806808078080880809808108081180812808138081480815808168081780818808198082080821808228082380824808258082680827808288082980830808318083280833808348083580836808378083880839808408084180842808438084480845808468084780848808498085080851808528085380854808558085680857808588085980860808618086280863808648086580866808678086880869808708087180872808738087480875808768087780878808798088080881808828088380884808858088680887808888088980890808918089280893808948089580896808978089880899809008090180902809038090480905809068090780908809098091080911809128091380914809158091680917809188091980920809218092280923809248092580926809278092880929809308093180932809338093480935809368093780938809398094080941809428094380944809458094680947809488094980950809518095280953809548095580956809578095880959809608096180962809638096480965809668096780968809698097080971809728097380974809758097680977809788097980980809818098280983809848098580986809878098880989809908099180992809938099480995809968099780998809998100081001810028100381004810058100681007810088100981010810118101281013810148101581016810178101881019810208102181022810238102481025810268102781028810298103081031810328103381034810358103681037810388103981040810418104281043810448104581046810478104881049810508105181052810538105481055810568105781058810598106081061810628106381064810658106681067810688106981070810718107281073810748107581076810778107881079810808108181082810838108481085810868108781088810898109081091810928109381094810958109681097810988109981100811018110281103811048110581106811078110881109811108111181112811138111481115811168111781118811198112081121811228112381124811258112681127811288112981130811318113281133811348113581136811378113881139811408114181142811438114481145811468114781148811498115081151811528115381154811558115681157811588115981160811618116281163811648116581166811678116881169811708117181172811738117481175811768117781178811798118081181811828118381184811858118681187811888118981190811918119281193811948119581196811978119881199812008120181202812038120481205812068120781208812098121081211812128121381214812158121681217812188121981220812218122281223812248122581226812278122881229812308123181232812338123481235812368123781238812398124081241812428124381244812458124681247812488124981250812518125281253812548125581256812578125881259812608126181262812638126481265812668126781268812698127081271812728127381274812758127681277812788127981280812818128281283812848128581286812878128881289812908129181292812938129481295812968129781298812998130081301813028130381304813058130681307813088130981310813118131281313813148131581316813178131881319813208132181322813238132481325813268132781328813298133081331813328133381334813358133681337813388133981340813418134281343813448134581346813478134881349813508135181352813538135481355813568135781358813598136081361813628136381364813658136681367813688136981370813718137281373813748137581376813778137881379813808138181382813838138481385813868138781388813898139081391813928139381394813958139681397813988139981400814018140281403814048140581406814078140881409814108141181412814138141481415814168141781418814198142081421814228142381424814258142681427814288142981430814318143281433814348143581436814378143881439814408144181442814438144481445814468144781448814498145081451814528145381454814558145681457814588145981460814618146281463814648146581466814678146881469814708147181472814738147481475814768147781478814798148081481814828148381484814858148681487814888148981490814918149281493814948149581496814978149881499815008150181502815038150481505815068150781508815098151081511815128151381514815158151681517815188151981520815218152281523815248152581526815278152881529815308153181532815338153481535815368153781538815398154081541815428154381544815458154681547815488154981550815518155281553815548155581556815578155881559815608156181562815638156481565815668156781568815698157081571815728157381574815758157681577815788157981580815818158281583815848158581586815878158881589815908159181592815938159481595815968159781598815998160081601816028160381604816058160681607816088160981610816118161281613816148161581616816178161881619816208162181622816238162481625816268162781628816298163081631816328163381634816358163681637816388163981640816418164281643816448164581646816478164881649816508165181652816538165481655816568165781658816598166081661816628166381664816658166681667816688166981670816718167281673816748167581676816778167881679816808168181682816838168481685816868168781688816898169081691816928169381694816958169681697816988169981700817018170281703817048170581706817078170881709817108171181712817138171481715817168171781718817198172081721817228172381724817258172681727817288172981730817318173281733817348173581736817378173881739817408174181742817438174481745817468174781748817498175081751817528175381754817558175681757817588175981760817618176281763817648176581766817678176881769817708177181772817738177481775817768177781778817798178081781817828178381784817858178681787817888178981790817918179281793817948179581796817978179881799818008180181802818038180481805818068180781808818098181081811818128181381814818158181681817818188181981820818218182281823818248182581826818278182881829818308183181832818338183481835818368183781838818398184081841818428184381844818458184681847818488184981850818518185281853818548185581856818578185881859818608186181862818638186481865818668186781868818698187081871818728187381874818758187681877818788187981880818818188281883818848188581886818878188881889818908189181892818938189481895818968189781898818998190081901819028190381904819058190681907819088190981910819118191281913819148191581916819178191881919819208192181922819238192481925819268192781928819298193081931819328193381934819358193681937819388193981940819418194281943819448194581946819478194881949819508195181952819538195481955819568195781958819598196081961819628196381964819658196681967819688196981970819718197281973819748197581976819778197881979819808198181982819838198481985819868198781988819898199081991819928199381994819958199681997819988199982000820018200282003820048200582006820078200882009820108201182012820138201482015820168201782018820198202082021820228202382024820258202682027820288202982030820318203282033820348203582036820378203882039820408204182042820438204482045820468204782048820498205082051820528205382054820558205682057820588205982060820618206282063820648206582066820678206882069820708207182072820738207482075820768207782078820798208082081820828208382084820858208682087820888208982090820918209282093820948209582096820978209882099821008210182102821038210482105821068210782108821098211082111821128211382114821158211682117821188211982120821218212282123821248212582126821278212882129821308213182132821338213482135821368213782138821398214082141821428214382144821458214682147821488214982150821518215282153821548215582156821578215882159821608216182162821638216482165821668216782168821698217082171821728217382174821758217682177821788217982180821818218282183821848218582186821878218882189821908219182192821938219482195821968219782198821998220082201822028220382204822058220682207822088220982210822118221282213822148221582216822178221882219822208222182222822238222482225822268222782228822298223082231822328223382234822358223682237822388223982240822418224282243822448224582246822478224882249822508225182252822538225482255822568225782258822598226082261822628226382264822658226682267822688226982270822718227282273822748227582276822778227882279822808228182282822838228482285822868228782288822898229082291822928229382294822958229682297822988229982300823018230282303823048230582306823078230882309823108231182312823138231482315823168231782318823198232082321823228232382324823258232682327823288232982330823318233282333823348233582336823378233882339823408234182342823438234482345823468234782348823498235082351823528235382354823558235682357823588235982360823618236282363823648236582366823678236882369823708237182372823738237482375823768237782378823798238082381823828238382384823858238682387823888238982390823918239282393823948239582396823978239882399824008240182402824038240482405824068240782408824098241082411824128241382414824158241682417824188241982420824218242282423824248242582426824278242882429824308243182432824338243482435824368243782438824398244082441824428244382444824458244682447824488244982450824518245282453824548245582456824578245882459824608246182462824638246482465824668246782468824698247082471824728247382474824758247682477824788247982480824818248282483824848248582486824878248882489824908249182492824938249482495824968249782498824998250082501825028250382504825058250682507825088250982510825118251282513825148251582516825178251882519825208252182522825238252482525825268252782528825298253082531825328253382534825358253682537825388253982540825418254282543825448254582546825478254882549825508255182552825538255482555825568255782558825598256082561825628256382564825658256682567825688256982570825718257282573825748257582576825778257882579825808258182582825838258482585825868258782588825898259082591825928259382594825958259682597825988259982600826018260282603826048260582606826078260882609826108261182612826138261482615826168261782618826198262082621826228262382624826258262682627826288262982630826318263282633826348263582636826378263882639826408264182642826438264482645826468264782648826498265082651826528265382654826558265682657826588265982660826618266282663826648266582666826678266882669826708267182672826738267482675826768267782678826798268082681826828268382684826858268682687826888268982690826918269282693826948269582696826978269882699827008270182702827038270482705827068270782708827098271082711827128271382714827158271682717827188271982720827218272282723827248272582726827278272882729827308273182732827338273482735827368273782738827398274082741827428274382744827458274682747827488274982750827518275282753827548275582756827578275882759827608276182762827638276482765827668276782768827698277082771827728277382774827758277682777827788277982780827818278282783827848278582786827878278882789827908279182792827938279482795827968279782798827998280082801828028280382804828058280682807828088280982810828118281282813828148281582816828178281882819828208282182822828238282482825828268282782828828298283082831828328283382834828358283682837828388283982840828418284282843828448284582846828478284882849828508285182852828538285482855828568285782858828598286082861828628286382864828658286682867828688286982870828718287282873828748287582876828778287882879828808288182882828838288482885828868288782888828898289082891828928289382894828958289682897828988289982900829018290282903829048290582906829078290882909829108291182912829138291482915829168291782918829198292082921829228292382924829258292682927829288292982930829318293282933829348293582936829378293882939829408294182942829438294482945829468294782948829498295082951829528295382954829558295682957829588295982960829618296282963829648296582966829678296882969829708297182972829738297482975829768297782978829798298082981829828298382984829858298682987829888298982990829918299282993829948299582996829978299882999830008300183002830038300483005830068300783008830098301083011830128301383014830158301683017830188301983020830218302283023830248302583026830278302883029830308303183032830338303483035830368303783038830398304083041830428304383044830458304683047830488304983050830518305283053830548305583056830578305883059830608306183062830638306483065830668306783068830698307083071830728307383074830758307683077830788307983080830818308283083830848308583086830878308883089830908309183092830938309483095830968309783098830998310083101831028310383104831058310683107831088310983110831118311283113831148311583116831178311883119831208312183122831238312483125831268312783128831298313083131831328313383134831358313683137831388313983140831418314283143831448314583146831478314883149831508315183152831538315483155831568315783158831598316083161831628316383164831658316683167831688316983170831718317283173831748317583176831778317883179831808318183182831838318483185831868318783188831898319083191831928319383194831958319683197831988319983200832018320283203832048320583206832078320883209832108321183212832138321483215832168321783218832198322083221832228322383224832258322683227832288322983230832318323283233832348323583236832378323883239832408324183242832438324483245832468324783248832498325083251832528325383254832558325683257832588325983260832618326283263832648326583266832678326883269832708327183272832738327483275832768327783278832798328083281832828328383284832858328683287832888328983290832918329283293832948329583296832978329883299833008330183302833038330483305833068330783308833098331083311833128331383314833158331683317833188331983320833218332283323833248332583326833278332883329833308333183332833338333483335833368333783338833398334083341833428334383344833458334683347833488334983350833518335283353833548335583356833578335883359833608336183362833638336483365833668336783368833698337083371833728337383374833758337683377833788337983380833818338283383833848338583386833878338883389833908339183392833938339483395833968339783398833998340083401834028340383404834058340683407834088340983410834118341283413834148341583416834178341883419834208342183422834238342483425834268342783428834298343083431834328343383434834358343683437834388343983440834418344283443834448344583446834478344883449834508345183452834538345483455834568345783458834598346083461834628346383464834658346683467834688346983470834718347283473834748347583476834778347883479834808348183482834838348483485834868348783488834898349083491834928349383494834958349683497834988349983500835018350283503835048350583506835078350883509835108351183512835138351483515835168351783518835198352083521835228352383524835258352683527835288352983530835318353283533835348353583536835378353883539835408354183542835438354483545835468354783548835498355083551835528355383554835558355683557835588355983560835618356283563835648356583566835678356883569835708357183572835738357483575835768357783578835798358083581835828358383584835858358683587835888358983590835918359283593835948359583596835978359883599836008360183602836038360483605836068360783608836098361083611836128361383614836158361683617836188361983620836218362283623836248362583626836278362883629836308363183632836338363483635836368363783638836398364083641836428364383644836458364683647836488364983650836518365283653836548365583656836578365883659836608366183662836638366483665836668366783668836698367083671836728367383674836758367683677836788367983680836818368283683836848368583686836878368883689836908369183692836938369483695836968369783698836998370083701837028370383704837058370683707837088370983710837118371283713837148371583716837178371883719837208372183722837238372483725837268372783728837298373083731837328373383734837358373683737837388373983740837418374283743837448374583746837478374883749837508375183752837538375483755837568375783758837598376083761837628376383764837658376683767837688376983770837718377283773837748377583776837778377883779837808378183782837838378483785837868378783788837898379083791837928379383794837958379683797837988379983800838018380283803838048380583806838078380883809838108381183812838138381483815838168381783818838198382083821838228382383824838258382683827838288382983830838318383283833838348383583836838378383883839838408384183842838438384483845838468384783848838498385083851838528385383854838558385683857838588385983860838618386283863838648386583866838678386883869838708387183872838738387483875838768387783878838798388083881838828388383884838858388683887838888388983890838918389283893838948389583896838978389883899839008390183902839038390483905839068390783908839098391083911839128391383914839158391683917839188391983920839218392283923839248392583926839278392883929839308393183932839338393483935839368393783938839398394083941839428394383944839458394683947839488394983950839518395283953839548395583956839578395883959839608396183962839638396483965839668396783968839698397083971839728397383974839758397683977839788397983980839818398283983839848398583986839878398883989839908399183992839938399483995839968399783998839998400084001840028400384004840058400684007840088400984010840118401284013840148401584016840178401884019840208402184022840238402484025840268402784028840298403084031840328403384034840358403684037840388403984040840418404284043840448404584046840478404884049840508405184052840538405484055840568405784058840598406084061840628406384064840658406684067840688406984070840718407284073840748407584076840778407884079840808408184082840838408484085840868408784088840898409084091840928409384094840958409684097840988409984100841018410284103841048410584106841078410884109841108411184112841138411484115841168411784118841198412084121841228412384124841258412684127841288412984130841318413284133841348413584136841378413884139841408414184142841438414484145841468414784148841498415084151841528415384154841558415684157841588415984160841618416284163841648416584166841678416884169841708417184172841738417484175841768417784178841798418084181841828418384184841858418684187841888418984190841918419284193841948419584196841978419884199842008420184202842038420484205842068420784208842098421084211842128421384214842158421684217842188421984220842218422284223842248422584226842278422884229842308423184232842338423484235842368423784238842398424084241842428424384244842458424684247842488424984250842518425284253842548425584256842578425884259842608426184262842638426484265842668426784268842698427084271842728427384274842758427684277842788427984280842818428284283842848428584286842878428884289842908429184292842938429484295842968429784298842998430084301843028430384304843058430684307843088430984310843118431284313843148431584316843178431884319843208432184322843238432484325843268432784328843298433084331843328433384334843358433684337843388433984340843418434284343843448434584346843478434884349843508435184352843538435484355843568435784358843598436084361843628436384364843658436684367843688436984370843718437284373843748437584376843778437884379843808438184382843838438484385843868438784388843898439084391843928439384394843958439684397843988439984400844018440284403844048440584406844078440884409844108441184412844138441484415844168441784418844198442084421844228442384424844258442684427844288442984430844318443284433844348443584436844378443884439844408444184442844438444484445844468444784448844498445084451844528445384454844558445684457844588445984460844618446284463844648446584466844678446884469844708447184472844738447484475844768447784478844798448084481844828448384484844858448684487844888448984490844918449284493844948449584496844978449884499845008450184502845038450484505845068450784508845098451084511845128451384514845158451684517845188451984520845218452284523845248452584526845278452884529845308453184532845338453484535845368453784538845398454084541845428454384544845458454684547845488454984550845518455284553845548455584556845578455884559845608456184562845638456484565845668456784568845698457084571845728457384574845758457684577845788457984580845818458284583845848458584586845878458884589845908459184592845938459484595845968459784598845998460084601846028460384604846058460684607846088460984610846118461284613846148461584616846178461884619846208462184622846238462484625846268462784628846298463084631846328463384634846358463684637846388463984640846418464284643846448464584646846478464884649846508465184652846538465484655846568465784658846598466084661846628466384664846658466684667846688466984670846718467284673846748467584676846778467884679846808468184682846838468484685846868468784688846898469084691846928469384694846958469684697846988469984700847018470284703847048470584706847078470884709847108471184712847138471484715847168471784718847198472084721847228472384724847258472684727847288472984730847318473284733847348473584736847378473884739847408474184742847438474484745847468474784748847498475084751847528475384754847558475684757847588475984760847618476284763847648476584766847678476884769847708477184772847738477484775847768477784778847798478084781847828478384784847858478684787847888478984790847918479284793847948479584796847978479884799848008480184802848038480484805848068480784808848098481084811848128481384814848158481684817848188481984820848218482284823848248482584826848278482884829848308483184832848338483484835848368483784838848398484084841848428484384844848458484684847848488484984850848518485284853848548485584856848578485884859848608486184862848638486484865848668486784868848698487084871848728487384874848758487684877848788487984880848818488284883848848488584886848878488884889848908489184892848938489484895848968489784898848998490084901849028490384904849058490684907849088490984910849118491284913849148491584916849178491884919849208492184922849238492484925849268492784928849298493084931849328493384934849358493684937849388493984940849418494284943849448494584946849478494884949849508495184952849538495484955849568495784958849598496084961849628496384964849658496684967849688496984970849718497284973849748497584976849778497884979849808498184982849838498484985849868498784988849898499084991849928499384994849958499684997849988499985000850018500285003850048500585006850078500885009850108501185012850138501485015850168501785018850198502085021850228502385024850258502685027850288502985030850318503285033850348503585036850378503885039850408504185042850438504485045850468504785048850498505085051850528505385054850558505685057850588505985060850618506285063850648506585066850678506885069850708507185072850738507485075850768507785078850798508085081850828508385084850858508685087850888508985090850918509285093850948509585096850978509885099851008510185102851038510485105851068510785108851098511085111851128511385114851158511685117851188511985120851218512285123851248512585126851278512885129851308513185132851338513485135851368513785138851398514085141851428514385144851458514685147851488514985150851518515285153851548515585156851578515885159851608516185162851638516485165851668516785168851698517085171851728517385174851758517685177851788517985180851818518285183851848518585186851878518885189851908519185192851938519485195851968519785198851998520085201852028520385204852058520685207852088520985210852118521285213852148521585216852178521885219852208522185222852238522485225852268522785228852298523085231852328523385234852358523685237852388523985240852418524285243852448524585246852478524885249852508525185252852538525485255852568525785258852598526085261852628526385264852658526685267852688526985270852718527285273852748527585276852778527885279852808528185282852838528485285852868528785288852898529085291852928529385294852958529685297852988529985300853018530285303853048530585306853078530885309853108531185312853138531485315853168531785318853198532085321853228532385324853258532685327853288532985330853318533285333853348533585336853378533885339853408534185342853438534485345853468534785348853498535085351853528535385354853558535685357853588535985360853618536285363853648536585366853678536885369853708537185372853738537485375853768537785378853798538085381853828538385384853858538685387853888538985390853918539285393853948539585396853978539885399854008540185402854038540485405854068540785408854098541085411854128541385414854158541685417854188541985420854218542285423854248542585426854278542885429854308543185432854338543485435854368543785438854398544085441854428544385444854458544685447854488544985450854518545285453854548545585456854578545885459854608546185462854638546485465854668546785468854698547085471854728547385474854758547685477854788547985480854818548285483854848548585486854878548885489854908549185492854938549485495854968549785498854998550085501855028550385504855058550685507855088550985510855118551285513855148551585516855178551885519855208552185522855238552485525855268552785528855298553085531855328553385534855358553685537855388553985540855418554285543855448554585546855478554885549855508555185552855538555485555855568555785558855598556085561855628556385564855658556685567855688556985570855718557285573855748557585576855778557885579855808558185582855838558485585855868558785588855898559085591855928559385594855958559685597855988559985600856018560285603856048560585606856078560885609856108561185612856138561485615856168561785618856198562085621856228562385624856258562685627856288562985630856318563285633856348563585636856378563885639856408564185642856438564485645856468564785648856498565085651856528565385654856558565685657856588565985660856618566285663856648566585666856678566885669856708567185672856738567485675856768567785678856798568085681856828568385684856858568685687856888568985690856918569285693856948569585696856978569885699857008570185702857038570485705857068570785708857098571085711857128571385714857158571685717857188571985720857218572285723857248572585726857278572885729857308573185732857338573485735857368573785738857398574085741857428574385744857458574685747857488574985750857518575285753857548575585756857578575885759857608576185762857638576485765857668576785768857698577085771857728577385774857758577685777857788577985780857818578285783857848578585786857878578885789857908579185792857938579485795857968579785798857998580085801858028580385804858058580685807858088580985810858118581285813858148581585816858178581885819858208582185822858238582485825858268582785828858298583085831858328583385834858358583685837858388583985840858418584285843858448584585846858478584885849858508585185852858538585485855858568585785858858598586085861858628586385864858658586685867858688586985870858718587285873858748587585876858778587885879858808588185882858838588485885858868588785888858898589085891858928589385894858958589685897858988589985900859018590285903859048590585906859078590885909859108591185912859138591485915859168591785918859198592085921859228592385924859258592685927859288592985930859318593285933859348593585936859378593885939859408594185942859438594485945859468594785948859498595085951859528595385954859558595685957859588595985960859618596285963859648596585966859678596885969859708597185972859738597485975859768597785978859798598085981859828598385984859858598685987859888598985990859918599285993859948599585996859978599885999860008600186002860038600486005860068600786008860098601086011860128601386014860158601686017860188601986020860218602286023860248602586026860278602886029860308603186032860338603486035860368603786038860398604086041860428604386044860458604686047860488604986050860518605286053860548605586056860578605886059860608606186062860638606486065860668606786068860698607086071860728607386074860758607686077860788607986080860818608286083860848608586086860878608886089860908609186092860938609486095860968609786098860998610086101861028610386104861058610686107861088610986110861118611286113861148611586116861178611886119861208612186122861238612486125861268612786128861298613086131861328613386134861358613686137861388613986140861418614286143861448614586146861478614886149861508615186152861538615486155861568615786158861598616086161861628616386164861658616686167861688616986170861718617286173861748617586176861778617886179861808618186182861838618486185861868618786188861898619086191861928619386194861958619686197861988619986200862018620286203862048620586206862078620886209862108621186212862138621486215862168621786218862198622086221862228622386224862258622686227862288622986230862318623286233862348623586236862378623886239862408624186242862438624486245862468624786248862498625086251862528625386254862558625686257862588625986260862618626286263862648626586266862678626886269862708627186272862738627486275862768627786278862798628086281862828628386284862858628686287862888628986290862918629286293862948629586296862978629886299863008630186302863038630486305863068630786308863098631086311863128631386314863158631686317863188631986320863218632286323863248632586326863278632886329863308633186332863338633486335863368633786338863398634086341863428634386344863458634686347863488634986350863518635286353863548635586356863578635886359863608636186362863638636486365863668636786368863698637086371863728637386374863758637686377863788637986380863818638286383863848638586386863878638886389863908639186392863938639486395863968639786398863998640086401864028640386404864058640686407864088640986410864118641286413864148641586416864178641886419864208642186422864238642486425864268642786428864298643086431864328643386434864358643686437864388643986440864418644286443864448644586446864478644886449864508645186452864538645486455864568645786458864598646086461864628646386464864658646686467864688646986470864718647286473864748647586476864778647886479864808648186482864838648486485864868648786488864898649086491864928649386494864958649686497864988649986500865018650286503865048650586506865078650886509865108651186512865138651486515865168651786518865198652086521865228652386524865258652686527865288652986530865318653286533865348653586536865378653886539865408654186542865438654486545865468654786548865498655086551865528655386554865558655686557865588655986560865618656286563865648656586566865678656886569865708657186572865738657486575865768657786578865798658086581865828658386584865858658686587865888658986590865918659286593865948659586596865978659886599866008660186602866038660486605866068660786608866098661086611866128661386614866158661686617866188661986620866218662286623866248662586626866278662886629866308663186632866338663486635866368663786638866398664086641866428664386644866458664686647866488664986650866518665286653866548665586656866578665886659866608666186662866638666486665866668666786668866698667086671866728667386674866758667686677866788667986680866818668286683866848668586686866878668886689866908669186692866938669486695866968669786698866998670086701867028670386704867058670686707867088670986710867118671286713867148671586716867178671886719867208672186722867238672486725867268672786728867298673086731867328673386734867358673686737867388673986740867418674286743867448674586746867478674886749867508675186752867538675486755867568675786758867598676086761867628676386764867658676686767867688676986770867718677286773867748677586776867778677886779867808678186782867838678486785867868678786788867898679086791867928679386794867958679686797867988679986800868018680286803868048680586806868078680886809868108681186812868138681486815868168681786818868198682086821868228682386824868258682686827868288682986830868318683286833868348683586836868378683886839868408684186842868438684486845868468684786848868498685086851868528685386854868558685686857868588685986860868618686286863868648686586866868678686886869868708687186872868738687486875868768687786878868798688086881868828688386884868858688686887868888688986890868918689286893868948689586896868978689886899869008690186902869038690486905869068690786908869098691086911869128691386914869158691686917869188691986920869218692286923869248692586926869278692886929869308693186932869338693486935869368693786938869398694086941869428694386944869458694686947869488694986950869518695286953869548695586956869578695886959869608696186962869638696486965869668696786968869698697086971869728697386974869758697686977869788697986980869818698286983869848698586986869878698886989869908699186992869938699486995869968699786998869998700087001870028700387004870058700687007870088700987010870118701287013870148701587016870178701887019870208702187022870238702487025870268702787028870298703087031870328703387034870358703687037870388703987040870418704287043870448704587046870478704887049870508705187052870538705487055870568705787058870598706087061870628706387064870658706687067870688706987070870718707287073870748707587076870778707887079870808708187082870838708487085870868708787088870898709087091870928709387094870958709687097870988709987100871018710287103871048710587106871078710887109871108711187112871138711487115871168711787118871198712087121871228712387124871258712687127871288712987130871318713287133871348713587136871378713887139871408714187142871438714487145871468714787148871498715087151871528715387154871558715687157871588715987160871618716287163871648716587166871678716887169871708717187172871738717487175871768717787178871798718087181871828718387184871858718687187871888718987190871918719287193871948719587196871978719887199872008720187202872038720487205872068720787208872098721087211872128721387214872158721687217872188721987220872218722287223872248722587226872278722887229872308723187232872338723487235872368723787238872398724087241872428724387244872458724687247872488724987250872518725287253872548725587256872578725887259872608726187262872638726487265872668726787268872698727087271872728727387274872758727687277872788727987280872818728287283872848728587286872878728887289872908729187292872938729487295872968729787298872998730087301873028730387304873058730687307873088730987310873118731287313873148731587316873178731887319873208732187322873238732487325873268732787328873298733087331873328733387334873358733687337873388733987340873418734287343873448734587346873478734887349873508735187352873538735487355873568735787358873598736087361873628736387364873658736687367873688736987370873718737287373873748737587376873778737887379873808738187382873838738487385873868738787388873898739087391873928739387394873958739687397873988739987400874018740287403874048740587406874078740887409874108741187412874138741487415874168741787418874198742087421874228742387424874258742687427874288742987430874318743287433874348743587436874378743887439874408744187442874438744487445874468744787448874498745087451874528745387454874558745687457874588745987460874618746287463874648746587466874678746887469874708747187472874738747487475874768747787478874798748087481874828748387484874858748687487874888748987490874918749287493874948749587496874978749887499875008750187502875038750487505875068750787508875098751087511875128751387514875158751687517875188751987520875218752287523875248752587526875278752887529875308753187532875338753487535875368753787538875398754087541875428754387544875458754687547875488754987550875518755287553875548755587556875578755887559875608756187562875638756487565875668756787568875698757087571875728757387574875758757687577875788757987580875818758287583875848758587586875878758887589875908759187592875938759487595875968759787598875998760087601876028760387604876058760687607876088760987610876118761287613876148761587616876178761887619876208762187622876238762487625876268762787628876298763087631876328763387634876358763687637876388763987640876418764287643876448764587646876478764887649876508765187652876538765487655876568765787658876598766087661876628766387664876658766687667876688766987670876718767287673876748767587676876778767887679876808768187682876838768487685876868768787688876898769087691876928769387694876958769687697876988769987700877018770287703877048770587706877078770887709877108771187712877138771487715877168771787718877198772087721877228772387724877258772687727877288772987730877318773287733877348773587736877378773887739877408774187742877438774487745877468774787748877498775087751877528775387754877558775687757877588775987760877618776287763877648776587766877678776887769877708777187772877738777487775877768777787778877798778087781877828778387784877858778687787877888778987790877918779287793877948779587796877978779887799878008780187802878038780487805878068780787808878098781087811878128781387814878158781687817878188781987820878218782287823878248782587826878278782887829878308783187832878338783487835878368783787838878398784087841878428784387844878458784687847878488784987850878518785287853878548785587856878578785887859878608786187862878638786487865878668786787868878698787087871878728787387874878758787687877878788787987880878818788287883878848788587886878878788887889878908789187892878938789487895878968789787898878998790087901879028790387904879058790687907879088790987910879118791287913879148791587916879178791887919879208792187922879238792487925879268792787928879298793087931879328793387934879358793687937879388793987940879418794287943879448794587946879478794887949879508795187952879538795487955879568795787958879598796087961879628796387964879658796687967879688796987970879718797287973879748797587976879778797887979879808798187982879838798487985879868798787988879898799087991879928799387994879958799687997879988799988000880018800288003880048800588006880078800888009880108801188012880138801488015880168801788018880198802088021880228802388024880258802688027880288802988030880318803288033880348803588036880378803888039880408804188042880438804488045880468804788048880498805088051880528805388054880558805688057880588805988060880618806288063880648806588066880678806888069880708807188072880738807488075880768807788078880798808088081880828808388084880858808688087880888808988090880918809288093880948809588096880978809888099881008810188102881038810488105881068810788108881098811088111881128811388114881158811688117881188811988120881218812288123881248812588126881278812888129881308813188132881338813488135881368813788138881398814088141881428814388144881458814688147881488814988150881518815288153881548815588156881578815888159881608816188162881638816488165881668816788168881698817088171881728817388174881758817688177881788817988180881818818288183881848818588186881878818888189881908819188192881938819488195881968819788198881998820088201882028820388204882058820688207882088820988210882118821288213882148821588216882178821888219882208822188222882238822488225882268822788228882298823088231882328823388234882358823688237882388823988240882418824288243882448824588246882478824888249882508825188252882538825488255882568825788258882598826088261882628826388264882658826688267882688826988270882718827288273882748827588276882778827888279882808828188282882838828488285882868828788288882898829088291882928829388294882958829688297882988829988300883018830288303883048830588306883078830888309883108831188312883138831488315883168831788318883198832088321883228832388324883258832688327883288832988330883318833288333883348833588336883378833888339883408834188342883438834488345883468834788348883498835088351883528835388354883558835688357883588835988360883618836288363883648836588366883678836888369883708837188372883738837488375883768837788378883798838088381883828838388384883858838688387883888838988390883918839288393883948839588396883978839888399884008840188402884038840488405884068840788408884098841088411884128841388414884158841688417884188841988420884218842288423884248842588426884278842888429884308843188432884338843488435884368843788438884398844088441884428844388444884458844688447884488844988450884518845288453884548845588456884578845888459884608846188462884638846488465884668846788468884698847088471884728847388474884758847688477884788847988480884818848288483884848848588486884878848888489884908849188492884938849488495884968849788498884998850088501885028850388504885058850688507885088850988510885118851288513885148851588516885178851888519885208852188522885238852488525885268852788528885298853088531885328853388534885358853688537885388853988540885418854288543885448854588546885478854888549885508855188552885538855488555885568855788558885598856088561885628856388564885658856688567885688856988570885718857288573885748857588576885778857888579885808858188582885838858488585885868858788588885898859088591885928859388594885958859688597885988859988600886018860288603886048860588606886078860888609886108861188612886138861488615886168861788618886198862088621886228862388624886258862688627886288862988630886318863288633886348863588636886378863888639886408864188642886438864488645886468864788648886498865088651886528865388654886558865688657886588865988660886618866288663886648866588666886678866888669886708867188672886738867488675886768867788678886798868088681886828868388684886858868688687886888868988690886918869288693886948869588696886978869888699887008870188702887038870488705887068870788708887098871088711887128871388714887158871688717887188871988720887218872288723887248872588726887278872888729887308873188732887338873488735887368873788738887398874088741887428874388744887458874688747887488874988750887518875288753887548875588756887578875888759887608876188762887638876488765887668876788768887698877088771887728877388774887758877688777887788877988780887818878288783887848878588786887878878888789887908879188792887938879488795887968879788798887998880088801888028880388804888058880688807888088880988810888118881288813888148881588816888178881888819888208882188822888238882488825888268882788828888298883088831888328883388834888358883688837888388883988840888418884288843888448884588846888478884888849888508885188852888538885488855888568885788858888598886088861888628886388864888658886688867888688886988870888718887288873888748887588876888778887888879888808888188882888838888488885888868888788888888898889088891888928889388894888958889688897888988889988900889018890288903889048890588906889078890888909889108891188912889138891488915889168891788918889198892088921889228892388924889258892688927889288892988930889318893288933889348893588936889378893888939889408894188942889438894488945889468894788948889498895088951889528895388954889558895688957889588895988960889618896288963889648896588966889678896888969889708897188972889738897488975889768897788978889798898088981889828898388984889858898688987889888898988990889918899288993889948899588996889978899888999890008900189002890038900489005890068900789008890098901089011890128901389014890158901689017890188901989020890218902289023890248902589026890278902889029890308903189032890338903489035890368903789038890398904089041890428904389044890458904689047890488904989050890518905289053890548905589056890578905889059890608906189062890638906489065890668906789068890698907089071890728907389074890758907689077890788907989080890818908289083890848908589086890878908889089890908909189092890938909489095890968909789098890998910089101891028910389104891058910689107891088910989110891118911289113891148911589116891178911889119891208912189122891238912489125891268912789128891298913089131891328913389134891358913689137891388913989140891418914289143891448914589146891478914889149891508915189152891538915489155891568915789158891598916089161891628916389164891658916689167891688916989170891718917289173891748917589176891778917889179891808918189182891838918489185891868918789188891898919089191891928919389194891958919689197891988919989200892018920289203892048920589206892078920889209892108921189212892138921489215892168921789218892198922089221892228922389224892258922689227892288922989230892318923289233892348923589236892378923889239892408924189242892438924489245892468924789248892498925089251892528925389254892558925689257892588925989260892618926289263892648926589266892678926889269892708927189272892738927489275892768927789278892798928089281892828928389284892858928689287892888928989290892918929289293892948929589296892978929889299893008930189302893038930489305893068930789308893098931089311893128931389314893158931689317893188931989320893218932289323893248932589326893278932889329893308933189332893338933489335893368933789338893398934089341893428934389344893458934689347893488934989350893518935289353893548935589356893578935889359893608936189362893638936489365893668936789368893698937089371893728937389374893758937689377893788937989380893818938289383893848938589386893878938889389893908939189392893938939489395893968939789398893998940089401894028940389404894058940689407894088940989410894118941289413894148941589416894178941889419894208942189422894238942489425894268942789428894298943089431894328943389434894358943689437894388943989440894418944289443894448944589446894478944889449894508945189452894538945489455894568945789458894598946089461894628946389464894658946689467894688946989470894718947289473894748947589476894778947889479894808948189482894838948489485894868948789488894898949089491894928949389494894958949689497894988949989500895018950289503895048950589506895078950889509895108951189512895138951489515895168951789518895198952089521895228952389524895258952689527895288952989530895318953289533895348953589536895378953889539895408954189542895438954489545895468954789548895498955089551895528955389554895558955689557895588955989560895618956289563895648956589566895678956889569895708957189572895738957489575895768957789578895798958089581895828958389584895858958689587895888958989590895918959289593895948959589596895978959889599896008960189602896038960489605896068960789608896098961089611896128961389614896158961689617896188961989620896218962289623896248962589626896278962889629896308963189632896338963489635896368963789638896398964089641896428964389644896458964689647896488964989650896518965289653896548965589656896578965889659896608966189662896638966489665896668966789668896698967089671896728967389674896758967689677896788967989680896818968289683896848968589686896878968889689896908969189692896938969489695896968969789698896998970089701897028970389704897058970689707897088970989710897118971289713897148971589716897178971889719897208972189722897238972489725897268972789728897298973089731897328973389734897358973689737897388973989740897418974289743897448974589746897478974889749897508975189752897538975489755897568975789758897598976089761897628976389764897658976689767897688976989770897718977289773897748977589776897778977889779897808978189782897838978489785897868978789788897898979089791897928979389794897958979689797897988979989800898018980289803898048980589806898078980889809898108981189812898138981489815898168981789818898198982089821898228982389824898258982689827898288982989830898318983289833898348983589836898378983889839898408984189842898438984489845898468984789848898498985089851898528985389854898558985689857898588985989860898618986289863898648986589866898678986889869898708987189872898738987489875898768987789878898798988089881898828988389884898858988689887898888988989890898918989289893898948989589896898978989889899899008990189902899038990489905899068990789908899098991089911899128991389914899158991689917899188991989920899218992289923899248992589926899278992889929899308993189932899338993489935899368993789938899398994089941899428994389944899458994689947899488994989950899518995289953899548995589956899578995889959899608996189962899638996489965899668996789968899698997089971899728997389974899758997689977899788997989980899818998289983899848998589986899878998889989899908999189992899938999489995899968999789998899999000090001900029000390004900059000690007900089000990010900119001290013900149001590016900179001890019900209002190022900239002490025900269002790028900299003090031900329003390034900359003690037900389003990040900419004290043900449004590046900479004890049900509005190052900539005490055900569005790058900599006090061900629006390064900659006690067900689006990070900719007290073900749007590076900779007890079900809008190082900839008490085900869008790088900899009090091900929009390094900959009690097900989009990100901019010290103901049010590106901079010890109901109011190112901139011490115901169011790118901199012090121901229012390124901259012690127901289012990130901319013290133901349013590136901379013890139901409014190142901439014490145901469014790148901499015090151901529015390154901559015690157901589015990160901619016290163901649016590166901679016890169901709017190172901739017490175901769017790178901799018090181901829018390184901859018690187901889018990190901919019290193901949019590196901979019890199902009020190202902039020490205902069020790208902099021090211902129021390214902159021690217902189021990220902219022290223902249022590226902279022890229902309023190232902339023490235902369023790238902399024090241902429024390244902459024690247902489024990250902519025290253902549025590256902579025890259902609026190262902639026490265902669026790268902699027090271902729027390274902759027690277902789027990280902819028290283902849028590286902879028890289902909029190292902939029490295902969029790298902999030090301903029030390304903059030690307903089030990310903119031290313903149031590316903179031890319903209032190322903239032490325903269032790328903299033090331903329033390334903359033690337903389033990340903419034290343903449034590346903479034890349903509035190352903539035490355903569035790358903599036090361903629036390364903659036690367903689036990370903719037290373903749037590376903779037890379903809038190382903839038490385903869038790388903899039090391903929039390394903959039690397903989039990400904019040290403904049040590406904079040890409904109041190412904139041490415904169041790418904199042090421904229042390424904259042690427904289042990430904319043290433904349043590436904379043890439904409044190442904439044490445904469044790448904499045090451904529045390454904559045690457904589045990460904619046290463904649046590466904679046890469904709047190472904739047490475904769047790478904799048090481904829048390484904859048690487904889048990490904919049290493904949049590496904979049890499905009050190502905039050490505905069050790508905099051090511905129051390514905159051690517905189051990520905219052290523905249052590526905279052890529905309053190532905339053490535905369053790538905399054090541905429054390544905459054690547905489054990550905519055290553905549055590556905579055890559905609056190562905639056490565905669056790568905699057090571905729057390574905759057690577905789057990580905819058290583905849058590586905879058890589905909059190592905939059490595905969059790598905999060090601906029060390604906059060690607906089060990610906119061290613906149061590616906179061890619906209062190622906239062490625906269062790628906299063090631906329063390634906359063690637906389063990640906419064290643906449064590646906479064890649906509065190652906539065490655906569065790658906599066090661906629066390664906659066690667906689066990670906719067290673906749067590676906779067890679906809068190682906839068490685906869068790688906899069090691906929069390694906959069690697906989069990700907019070290703907049070590706907079070890709907109071190712907139071490715907169071790718907199072090721907229072390724907259072690727907289072990730907319073290733907349073590736907379073890739907409074190742907439074490745907469074790748907499075090751907529075390754907559075690757907589075990760907619076290763907649076590766907679076890769907709077190772907739077490775907769077790778907799078090781907829078390784907859078690787907889078990790907919079290793907949079590796907979079890799908009080190802908039080490805908069080790808908099081090811908129081390814908159081690817908189081990820908219082290823908249082590826908279082890829908309083190832908339083490835908369083790838908399084090841908429084390844908459084690847908489084990850908519085290853908549085590856
  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. define('COMPOSER_DEV_WARNING_TIME', 1579200857);
  23. require 'phar://composer.phar/bin/composer';
  24. __HALT_COMPILER(); ?>
  25. ¨•��ø������ ���composer.phar����+���src/Composer/Autoload/AutoloadGenerator.php`d��Y—Ñ]`d��×Ù�*´������+���src/Composer/Autoload/ClassMapGenerator.php���Y—Ñ]���rßõÄ´���������src/Composer/Cache.phpç��Y—Ñ]ç��³›î´������%���src/Composer/Command/AboutCommand.phpØ��Y—Ñ]Ø��ö÷;‡´������'���src/Composer/Command/ArchiveCommand.phpž��Y—Ñ]ž��lG´������$���src/Composer/Command/BaseCommand.phpÜ ��Y—Ñ]Ü ��gô1´������.���src/Composer/Command/BaseDependencyCommand.phpñ��Y—Ñ]ñ��XgFð´������1���src/Composer/Command/CheckPlatformReqsCommand.php ��Y—Ñ] ��*Þ¯T´������*���src/Composer/Command/ClearCacheCommand.phpµ��Y—Ñ]µ��vÿyƒ´������&���src/Composer/Command/ConfigCommand.phpMM��Y—Ñ]MM��EœB´������-���src/Composer/Command/CreateProjectCommand.phpß5��Y—Ñ]ß5��ü�_÷´������'���src/Composer/Command/DependsCommand.phpø��Y—Ñ]ø��ªeá´������(���src/Composer/Command/DiagnoseCommand.phpåM��Y—Ñ]åM��hÇÔ´������,���src/Composer/Command/DumpAutoloadCommand.php ��Y—Ñ] ��~üÖ7´������$���src/Composer/Command/ExecCommand.phpï��Y—Ñ]ï��Xrœ¾´������&���src/Composer/Command/GlobalCommand.phpz ��Y—Ñ]z ��³çå?´������$���src/Composer/Command/HomeCommand.php��Y—Ñ]��qLBŽ´������$���src/Composer/Command/InitCommand.phpR��Y—Ñ]R��OR’ÿ´������'���src/Composer/Command/InstallCommand.phpT��Y—Ñ]T��Þùõ›´������(���src/Composer/Command/LicensesCommand.php‚��Y—Ñ]‚��±s'´������(���src/Composer/Command/OutdatedCommand.php ��Y—Ñ] ��اc´������)���src/Composer/Command/ProhibitsCommand.php��Y—Ñ]��_¤éS´������&���src/Composer/Command/RemoveCommand.phpá��Y—Ñ]á��½í�)´������'���src/Composer/Command/RequireCommand.phpŒ)��Y—Ñ]Œ)��ËÍu–´������)���src/Composer/Command/RunScriptCommand.php=��Y—Ñ]=��rºmÜ´������+���src/Composer/Command/ScriptAliasCommand.php¯��Y—Ñ]¯��?=Ñ´������&���src/Composer/Command/SearchCommand.phpU ��Y—Ñ]U ��…ß´������*���src/Composer/Command/SelfUpdateCommand.php;3��Y—Ñ];3��kð˜m´������$���src/Composer/Command/ShowCommand.phpOr��Y—Ñ]Or��i®îÙ´������&���src/Composer/Command/StatusCommand.php–��Y—Ñ]–��ùjØ´������(���src/Composer/Command/SuggestsCommand.php��Y—Ñ]��ò‚BÉ´������&���src/Composer/Command/UpdateCommand.phpñ#��Y—Ñ]ñ#��p\F´������(���src/Composer/Command/ValidateCommand.php€��Y—Ñ]€��ÍÃ�î´���������src/Composer/Composer.phpy ��Y—Ñ]y ��mÂÄÆ´���������src/Composer/Config.phpË$��Y—Ñ]Ë$��ψ«,´������-���src/Composer/Config/ConfigSourceInterface.php��Y—Ñ]��³ [/´������(���src/Composer/Config/JsonConfigSource.php²��Y—Ñ]²��QiÃb´������$���src/Composer/Console/Application.phpý6��Y—Ñ]ý6��)<å´������,���src/Composer/Console/HtmlOutputFormatter.php3��Y—Ñ]3��Ú�Eu´������-���src/Composer/DependencyResolver/Decisions.php6��Y—Ñ]6��à• ž´������1���src/Composer/DependencyResolver/DefaultPolicy.php��Y—Ñ]��õÝv´������/���src/Composer/DependencyResolver/GenericRule.phpµ��Y—Ñ]µ��᫤´������>���src/Composer/DependencyResolver/Operation/InstallOperation.phpC��Y—Ñ]C��´\õ*´������I���src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php÷��Y—Ñ]÷��ïÎà÷´������K���src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.phpý��Y—Ñ]ý��3#†´������@���src/Composer/DependencyResolver/Operation/OperationInterface.phpÓ���Y—Ñ]Ó���Ùâ&ä´������=���src/Composer/DependencyResolver/Operation/SolverOperation.php¹��Y—Ñ]¹��&¢e
  26. ´������@���src/Composer/DependencyResolver/Operation/UninstallOperation.phpI��Y—Ñ]I��FûÂÉ´������=���src/Composer/DependencyResolver/Operation/UpdateOperation.phph��Y—Ñ]h��öSÕ]´������3���src/Composer/DependencyResolver/PolicyInterface.php­��Y—Ñ]­��Ÿ‹R´������(���src/Composer/DependencyResolver/Pool.php¯"��Y—Ñ]¯"��m½ ´������+���src/Composer/DependencyResolver/Problem.phpú��Y—Ñ]ú��]D5´������+���src/Composer/DependencyResolver/Request.phpƒ��Y—Ñ]ƒ��åVP„´������(���src/Composer/DependencyResolver/Rule.php?��Y—Ñ]?��¬‘œü´������1���src/Composer/DependencyResolver/Rule2Literals.php��Y—Ñ]��tZÅÉ´������+���src/Composer/DependencyResolver/RuleSet.phpª
  27. ��Y—Ñ]ª
  28. ��_΂´������4���src/Composer/DependencyResolver/RuleSetGenerator.phpÊ��Y—Ñ]Ê��D¦õZ´������3���src/Composer/DependencyResolver/RuleSetIterator.php��Y—Ñ]��›Cü$´������2���src/Composer/DependencyResolver/RuleWatchChain.phpi��Y—Ñ]i��hïš,´������2���src/Composer/DependencyResolver/RuleWatchGraph.phpá��Y—Ñ]á��‰rôv´������1���src/Composer/DependencyResolver/RuleWatchNode.php��Y—Ñ]���Gd7´������*���src/Composer/DependencyResolver/Solver.php�:��Y—Ñ]�:��æ¯Ép´������6���src/Composer/DependencyResolver/SolverBugException.php™��Y—Ñ]™��Xg6´������;���src/Composer/DependencyResolver/SolverProblemsException.phpô��Y—Ñ]ô��×|Ŧ´������/���src/Composer/DependencyResolver/Transaction.php×��Y—Ñ]×��Vm쟴������-���src/Composer/Downloader/ArchiveDownloader.phpÆ ��Y—Ñ]Æ ��G s0´������1���src/Composer/Downloader/ChangeReportInterface.phpÌ���Y—Ñ]Ì���¯à¨¿´������+���src/Composer/Downloader/DownloadManager.php`��Y—Ñ]`��#ÏX´������/���src/Composer/Downloader/DownloaderInterface.phpÊ��Y—Ñ]Ê��gs!l´������3���src/Composer/Downloader/DvcsDownloaderInterface.phpÑ���Y—Ñ]Ñ���&Áœ¿´������*���src/Composer/Downloader/FileDownloader.phpG��Y—Ñ]G��äOд������/���src/Composer/Downloader/FilesystemException.php
  29. ��Y—Ñ]
  30. ��.-‹´������,���src/Composer/Downloader/FossilDownloader.php‚ ��Y—Ñ]‚ ��Ü�Ii´������)���src/Composer/Downloader/GitDownloader.php³6��Y—Ñ]³6��¦Ü(9´������*���src/Composer/Downloader/GzipDownloader.phpó��Y—Ñ]ó��}Úo´������(���src/Composer/Downloader/HgDownloader.php”��Y—Ñ]”��ßisÌ´������*���src/Composer/Downloader/PathDownloader.phpé��Y—Ñ]é��$²FQ´������0���src/Composer/Downloader/PearPackageExtractor.phpu��Y—Ñ]u��z„‡´������.���src/Composer/Downloader/PerforceDownloader.phpž��Y—Ñ]ž��Öüñ9´������*���src/Composer/Downloader/PharDownloader.phpå���Y—Ñ]å���ÞÉç´������)���src/Composer/Downloader/RarDownloader.phpž��Y—Ñ]ž��6 3U´������)���src/Composer/Downloader/SvnDownloader.phpG��Y—Ñ]G��M#j´������)���src/Composer/Downloader/TarDownloader.phpã���Y—Ñ]ã���Í’X?´������.���src/Composer/Downloader/TransportException.php=��Y—Ñ]=��ZÎÈÞ´������9���src/Composer/Downloader/VcsCapableDownloaderInterface.phpÔ���Y—Ñ]Ô���`§ôö´������)���src/Composer/Downloader/VcsDownloader.php¡��Y—Ñ]¡��( à>´������(���src/Composer/Downloader/XzDownloader.php§��Y—Ñ]§��W$;á´������)���src/Composer/Downloader/ZipDownloader.phpk��Y—Ñ]k��Òo”δ������&���src/Composer/EventDispatcher/Event.php ��Y—Ñ] ��±™jï´������0���src/Composer/EventDispatcher/EventDispatcher.php$4��Y—Ñ]$4��x‹@´������9���src/Composer/EventDispatcher/EventSubscriberInterface.php©���Y—Ñ]©���h·0´������9���src/Composer/EventDispatcher/ScriptExecutionException.phpv���Y—Ñ]v���wZ8S´������)���src/Composer/Exception/NoSslException.phpf���Y—Ñ]f���ËíM�´���������src/Composer/Factory.php_=��Y—Ñ]_=��x"Å´���������src/Composer/IO/BaseIO.phpÝ��Y—Ñ]Ý��¢âº´���������src/Composer/IO/BufferIO.php¾��Y—Ñ]¾��X~d´���������src/Composer/IO/ConsoleIO.php7��Y—Ñ]7��¥<È´���������src/Composer/IO/IOInterface.phpì��Y—Ñ]ì���Õ�´���������src/Composer/IO/NullIO.phpÀ��Y—Ñ]À��F`sÊ´���������src/Composer/Installer.phpýž��Y—Ñ]ýž��ÉX´������*���src/Composer/Installer/BinaryInstaller.php
  31. ��Y—Ñ]
  32. ��t¤{ø´������2���src/Composer/Installer/BinaryPresenceInterface.phpË���Y—Ñ]Ë���À5š¨´������.���src/Composer/Installer/InstallationManager.php-��Y—Ñ]-��¾}Œ7´������)���src/Composer/Installer/InstallerEvent.php��Y—Ñ]��lÔzi´������*���src/Composer/Installer/InstallerEvents.phpÞ���Y—Ñ]Þ���ìŸ@G´������-���src/Composer/Installer/InstallerInterface.phpã��Y—Ñ]ã��^ƒ“Ê´������+���src/Composer/Installer/LibraryInstaller.php%��Y—Ñ]%�� »�Ì´������/���src/Composer/Installer/MetapackageInstaller.phpÊ��Y—Ñ]Ê��Ùti·´������(���src/Composer/Installer/NoopInstaller.php+��Y—Ñ]+��À·M}´������'���src/Composer/Installer/PackageEvent.phpe��Y—Ñ]e��;° ´������(���src/Composer/Installer/PackageEvents.php¸��Y—Ñ]¸��dbØs´������.���src/Composer/Installer/PearBinaryInstaller.phpø ��Y—Ñ]ø ��*ë•k´������(���src/Composer/Installer/PearInstaller.php¢��Y—Ñ]¢��È‚¶Ñ´������*���src/Composer/Installer/PluginInstaller.php‹��Y—Ñ]‹��ÒX8´������+���src/Composer/Installer/ProjectInstaller.php��Y—Ñ]��*0@P´������4���src/Composer/Installer/SuggestedPackagesReporter.php:��Y—Ñ]:��‚´UV´���������src/Composer/Json/JsonFile.php[��Y—Ñ][��°�Ë™´������#���src/Composer/Json/JsonFormatter.phpb��Y—Ñ]b��ÝNš´������%���src/Composer/Json/JsonManipulator.phpÀ3��Y—Ñ]À3���™ ´������-���src/Composer/Json/JsonValidationException.php\��Y—Ñ]\��.XóÜ´������%���src/Composer/Package/AliasPackage.php§��Y—Ñ]§��Õ”R™´������7���src/Composer/Package/Archiver/ArchivableFilesFilter.php ��Y—Ñ] ��yY+¦´������7���src/Composer/Package/Archiver/ArchivableFilesFinder.phpÞ��Y—Ñ]Þ�� ²²¹´������0���src/Composer/Package/Archiver/ArchiveManager.phpÝ ��Y—Ñ]Ý ��í<´B´������3���src/Composer/Package/Archiver/ArchiverInterface.php��Y—Ñ]��ñ´> ´������3���src/Composer/Package/Archiver/BaseExcludeFilter.php–��Y—Ñ]–��y¶=Æ´������7���src/Composer/Package/Archiver/ComposerExcludeFilter.php��Y—Ñ]��‹SZ0´������2���src/Composer/Package/Archiver/GitExcludeFilter.phpr��Y—Ñ]r��3‘Mh´������1���src/Composer/Package/Archiver/HgExcludeFilter.php ��Y—Ñ] �� •¦S´������.���src/Composer/Package/Archiver/PharArchiver.php?��Y—Ñ]?��®— u´������-���src/Composer/Package/Archiver/ZipArchiver.php½��Y—Ñ]½��VÀ‚¨´������$���src/Composer/Package/BasePackage.php��Y—Ñ]��D|ŸÈ´������*���src/Composer/Package/Comparer/Comparer.phpR��Y—Ñ]R��Ïسî´������(���src/Composer/Package/CompletePackage.phpü��Y—Ñ]ü��þM˶´������1���src/Composer/Package/CompletePackageInterface.phpõ��Y—Ñ]õ��¦Ê�ò´������+���src/Composer/Package/Dumper/ArrayDumper.phpW ��Y—Ñ]W ��¿éÁ¦´���������src/Composer/Package/Link.phpˆ��Y—Ñ]ˆ��å¶Y«´������7���src/Composer/Package/LinkConstraint/EmptyConstraint.php‚��Y—Ñ]‚��é~‹´������?���src/Composer/Package/LinkConstraint/LinkConstraintInterface.phpd��Y—Ñ]d��¤ôLn´������7���src/Composer/Package/LinkConstraint/MultiConstraint.php‚��Y—Ñ]‚��ób`ý´������:���src/Composer/Package/LinkConstraint/SpecificConstraint.phpi��Y—Ñ]i��Þ”š%´������9���src/Composer/Package/LinkConstraint/VersionConstraint.phpX��Y—Ñ]X��}`y´������+���src/Composer/Package/Loader/ArrayLoader.phpN��Y—Ñ]N��âQ¬´������7���src/Composer/Package/Loader/InvalidPackageException.phpE��Y—Ñ]E��xb¾´������*���src/Composer/Package/Loader/JsonLoader.phpù��Y—Ñ]ù��!~ˆ{´������/���src/Composer/Package/Loader/LoaderInterface.php²���Y—Ñ]²���¦}úδ������1���src/Composer/Package/Loader/RootPackageLoader.phpó��Y—Ñ]ó��l”.Ø´������5���src/Composer/Package/Loader/ValidatingArrayLoader.php(>��Y—Ñ](>��„´P´���������src/Composer/Package/Locker.php¥!��Y—Ñ]¥!��/=xö´������ ���src/Composer/Package/Package.phpÉ��Y—Ñ]É��cÃ�h´������)���src/Composer/Package/PackageInterface.php\��Y—Ñ]\��xåp¨´������)���src/Composer/Package/RootAliasPackage.php ��Y—Ñ] �� _€ø´������$���src/Composer/Package/RootPackage.php��Y—Ñ]��ŽÎ_´������-���src/Composer/Package/RootPackageInterface.php¹��Y—Ñ]¹��"maV´������/���src/Composer/Package/Version/VersionGuesser.phpÏ��Y—Ñ]Ï��ÌÂß´������.���src/Composer/Package/Version/VersionParser.php¥��Y—Ñ]¥��ô´à´������0���src/Composer/Package/Version/VersionSelector.phpK ��Y—Ñ]K ��²<È´������-���src/Composer/Plugin/Capability/Capability.phpW���Y—Ñ]W���æ_¨1´������2���src/Composer/Plugin/Capability/CommandProvider.php—���Y—Ñ]—���ûOâ>´���������src/Composer/Plugin/Capable.php���Y—Ñ]���Æq+´������$���src/Composer/Plugin/CommandEvent.phpâ��Y—Ñ]â��³ÆÇW´������$���src/Composer/Plugin/PluginEvents.phpö���Y—Ñ]ö���á1=z´������'���src/Composer/Plugin/PluginInterface.phpô���Y—Ñ]ô���)'*Ø´������%���src/Composer/Plugin/PluginManager.phpª$��Y—Ñ]ª$��m‰ƒä´������*���src/Composer/Plugin/PreCommandRunEvent.phpõ��Y—Ñ]õ��:ðd´������,���src/Composer/Plugin/PreFileDownloadEvent.php`��Y—Ñ]`���9-δ������4���src/Composer/Question/StrictConfirmationQuestion.php��Y—Ñ]��'.³è´������+���src/Composer/Repository/ArrayRepository.php��Y—Ñ]��éÌt�´������.���src/Composer/Repository/ArtifactRepository.phpí��Y—Ñ]í��q9OS´������*���src/Composer/Repository/BaseRepository.phpŠ��Y—Ñ]Š��äÝ÷´������.���src/Composer/Repository/ComposerRepository.php‡T��Y—Ñ]‡T��Ž÷Æ´������/���src/Composer/Repository/CompositeRepository.php;��Y—Ñ];��¤¯S´������;���src/Composer/Repository/ConfigurableRepositoryInterface.php…���Y—Ñ]…���±Ÿ_´������0���src/Composer/Repository/FilesystemRepository.phpp��Y—Ñ]p��#ù´������4���src/Composer/Repository/InstalledArrayRepository.php£���Y—Ñ]£���/ö~>´������9���src/Composer/Repository/InstalledFilesystemRepository.php£���Y—Ñ]£���V
  33. •_´������8���src/Composer/Repository/InstalledRepositoryInterface.php‡���Y—Ñ]‡���£9p´������6���src/Composer/Repository/InvalidRepositoryException.phpn���Y—Ñ]n���à“똴������-���src/Composer/Repository/PackageRepository.phpj��Y—Ñ]j��¥ôòÌ´������*���src/Composer/Repository/PathRepository.php� ��Y—Ñ]� ��Ç<óÀ´������2���src/Composer/Repository/Pear/BaseChannelReader.phpI��Y—Ñ]I��c6³´������,���src/Composer/Repository/Pear/ChannelInfo.phpÄ��Y—Ñ]Ä��:T*É´������.���src/Composer/Repository/Pear/ChannelReader.phpí��Y—Ñ]í��?ÈYT´������4���src/Composer/Repository/Pear/ChannelRest10Reader.php® ��Y—Ñ]® ��™ÖÛú´������4���src/Composer/Repository/Pear/ChannelRest11Reader.php& ��Y—Ñ]& ��òUb´������5���src/Composer/Repository/Pear/DependencyConstraint.phpq��Y—Ñ]q��9=´������/���src/Composer/Repository/Pear/DependencyInfo.phpq��Y—Ñ]q��fºTò´������8���src/Composer/Repository/Pear/PackageDependencyParser.php…��Y—Ñ]…��÷$Li´������,���src/Composer/Repository/Pear/PackageInfo.php°��Y—Ñ]°��Ÿ ¸ ´������,���src/Composer/Repository/Pear/ReleaseInfo.php’��Y—Ñ]’��o“ŠÃ´������*���src/Composer/Repository/PearRepository.phpª��Y—Ñ]ª��)Ÿƒ}´������.���src/Composer/Repository/PlatformRepository.phpå��Y—Ñ]å��»G÷å´������-���src/Composer/Repository/RepositoryFactory.php`��Y—Ñ]`��K¾du´������/���src/Composer/Repository/RepositoryInterface.phpÛ��Y—Ñ]Û��’âÁ´������-���src/Composer/Repository/RepositoryManager.php2
  34. ��Y—Ñ]2
  35. ��á…5#´������7���src/Composer/Repository/RepositorySecurityException.phpo���Y—Ñ]o���pÕ«ª´������/���src/Composer/Repository/Vcs/BitbucketDriver.php• ��Y—Ñ]• ��$©Rç´������,���src/Composer/Repository/Vcs/FossilDriver.php³��Y—Ñ]³��ÐCk´������2���src/Composer/Repository/Vcs/GitBitbucketDriver.phpë��Y—Ñ]ë��œ´½X´������)���src/Composer/Repository/Vcs/GitDriver.phpu��Y—Ñ]u��}Ýs!´������,���src/Composer/Repository/Vcs/GitHubDriver.php})��Y—Ñ]})��ê¦x®´������,���src/Composer/Repository/Vcs/GitLabDriver.php]%��Y—Ñ]]%��sÇø ´������1���src/Composer/Repository/Vcs/HgBitbucketDriver.phpå��Y—Ñ]å��@)‰L´������(���src/Composer/Repository/Vcs/HgDriver.phpB��Y—Ñ]B��»ƒî´������.���src/Composer/Repository/Vcs/PerforceDriver.phpù ��Y—Ñ]ù ��&½tÙ´������)���src/Composer/Repository/Vcs/SvnDriver.php¤��Y—Ñ]¤�� ´������)���src/Composer/Repository/Vcs/VcsDriver.phpæ
  36. ��Y—Ñ]æ
  37. ��eׯ-´������2���src/Composer/Repository/Vcs/VcsDriverInterface.php÷��Y—Ñ]÷��ÇX[‰´������)���src/Composer/Repository/VcsRepository.phpÙ*��Y—Ñ]Ù*��~Á£f´������1���src/Composer/Repository/VersionCacheInterface.php”���Y—Ñ]”���A?Rï´������3���src/Composer/Repository/WritableArrayRepository.php��Y—Ñ]��¾G*´������7���src/Composer/Repository/WritableRepositoryInterface.php‰��Y—Ñ]‰��‘/sï´������$���src/Composer/Script/CommandEvent.phpW���Y—Ñ]W���£VZt´���������src/Composer/Script/Event.phpº��Y—Ñ]º��ò�»¤´������$���src/Composer/Script/PackageEvent.phpœ���Y—Ñ]œ���§ÿÉ ´������$���src/Composer/Script/ScriptEvents.phpP��Y—Ñ]P��‡�¶´������ ���src/Composer/SelfUpdate/Keys.php���Y—Ñ]��� îÊN´������$���src/Composer/SelfUpdate/Versions.phpì��Y—Ñ]ì��͵‘ƒ´������ ���src/Composer/Util/AuthHelper.phpË��Y—Ñ]Ë��>zx–´���������src/Composer/Util/Bitbucket.php*��Y—Ñ]*��,Lšk´������$���src/Composer/Util/ComposerMirror.php±��Y—Ñ]±��­½øØ´������%���src/Composer/Util/ConfigValidator.php÷��Y—Ñ]÷��v•Í´������"���src/Composer/Util/ErrorHandler.php»��Y—Ñ]»��O›rk´������ ���src/Composer/Util/Filesystem.phpr/��Y—Ñ]r/��Ò^j´���������src/Composer/Util/Git.phpí-��Y—Ñ]í-��Pë.´���������src/Composer/Util/GitHub.php| ��Y—Ñ]| ��`0tü´���������src/Composer/Util/GitLab.php¬ ��Y—Ñ]¬ ��B3 ë´���������src/Composer/Util/Hg.php¾��Y—Ñ]¾��LÓ �´���������src/Composer/Util/IniHelper.phph��Y—Ñ]h��;FP´������$���src/Composer/Util/NoProxyPattern.php¾��Y—Ñ]¾��Z+°m´������#���src/Composer/Util/PackageSorter.phpÞ��Y—Ñ]Þ��ê×ìY´���������src/Composer/Util/Perforce.php¸2��Y—Ñ]¸2��Ás&}´���������src/Composer/Util/Platform.phpü��Y—Ñ]ü��s­fç´������%���src/Composer/Util/ProcessExecutor.phpl ��Y—Ñ]l ��m7_š´������&���src/Composer/Util/RemoteFilesystem.phpÝq��Y—Ñ]Ýq��_%—´���������src/Composer/Util/Silencer.phpé��Y—Ñ]é��“Vjf´������!���src/Composer/Util/SpdxLicense.php��Y—Ñ]��¾7
  38. ñ´������*���src/Composer/Util/StreamContextFactory.php��Y—Ñ]��CÉ…ù´���������src/Composer/Util/Svn.php,��Y—Ñ],��Ì žÄ´���������src/Composer/Util/TlsHelper.phpL
  39. ��Y—Ñ]L
  40. ��" i´���������src/Composer/Util/Url.php£��Y—Ñ]£��3œÉÜ´���������src/Composer/Util/Zip.php³��Y—Ñ]³��äŠÎª´���������src/Composer/XdebugHandler.phpð��Y—Ñ]ð��zÓf~´���������src/bootstrap.php¹��Y—Ñ]¹��I}œ´������%���src/Composer/Autoload/ClassLoader.php“4��Y—Ñ]“4��²z�–´������#���res/composer-repository-schema.jsonð��Y—Ñ]ð���GÐà´���������res/composer-schema.jsonæ˜��Y—Ñ]æ˜��µ�zo´������6���vendor/composer/spdx-licenses/res/spdx-exceptions.json%
  41. ��Y—Ñ]%
  42. ��ïBð´������4���vendor/composer/spdx-licenses/res/spdx-licenses.jsonÓ˜��Y—Ñ]Ó˜��Id¤÷´������4���vendor/symfony/console/Resources/bin/hiddeninput.exe�$��Y—Ñ]�$��•�¥v´������&���vendor/symfony/console/Application.php=X��Y—Ñ]=X��� S’´������*���vendor/symfony/console/Command/Command.phpî"��Y—Ñ]î"��x°jÕ´������.���vendor/symfony/console/Command/HelpCommand.phpØ��Y—Ñ]Ø��¦Ú-:´������.���vendor/symfony/console/Command/ListCommand.phpZ��Y—Ñ]Z��»w`´������(���vendor/symfony/console/ConsoleEvents.phpé���Y—Ñ]é���RÛÔe´������<���vendor/symfony/console/Descriptor/ApplicationDescription.phpÐ��Y—Ñ]Ð��™Ž5°´������0���vendor/symfony/console/Descriptor/Descriptor.php���Y—Ñ]���¿N•´������9���vendor/symfony/console/Descriptor/DescriptorInterface.phpü���Y—Ñ]ü���±Qµ´������4���vendor/symfony/console/Descriptor/JsonDescriptor.phpÜ ��Y—Ñ]Ü ��*û�É´������8���vendor/symfony/console/Descriptor/MarkdownDescriptor.php¶��Y—Ñ]¶��·Ô;Ý´������4���vendor/symfony/console/Descriptor/TextDescriptor.php¼��Y—Ñ]¼��òç$´������3���vendor/symfony/console/Descriptor/XmlDescriptor.php��Y—Ñ]��b{<´������4���vendor/symfony/console/Event/ConsoleCommandEvent.php°��Y—Ñ]°��!�È´������-���vendor/symfony/console/Event/ConsoleEvent.phpÅ��Y—Ñ]Å��ÒxÛ\´������6���vendor/symfony/console/Event/ConsoleExceptionEvent.php��Y—Ñ]��á2é´������6���vendor/symfony/console/Event/ConsoleTerminateEvent.phpz��Y—Ñ]z��³,îL´������=���vendor/symfony/console/Exception/CommandNotFoundException.phpÔ��Y—Ñ]Ô��È÷ L´������7���vendor/symfony/console/Exception/ExceptionInterface.phpf���Y—Ñ]f���¡ABª´������=���vendor/symfony/console/Exception/InvalidArgumentException.php¦���Y—Ñ]¦���Ö̽Z´������;���vendor/symfony/console/Exception/InvalidOptionException.php¦���Y—Ñ]¦���Ë×H´������3���vendor/symfony/console/Exception/LogicException.php’���Y—Ñ]’���ÍO\e´������5���vendor/symfony/console/Exception/RuntimeException.php–���Y—Ñ]–���Ùí,6´������4���vendor/symfony/console/Formatter/OutputFormatter.php6��Y—Ñ]6��?=¨´������=���vendor/symfony/console/Formatter/OutputFormatterInterface.phpŒ��Y—Ñ]Œ��òññÀ´������9���vendor/symfony/console/Formatter/OutputFormatterStyle.phpF��Y—Ñ]F��𦴴������B���vendor/symfony/console/Formatter/OutputFormatterStyleInterface.php„��Y—Ñ]„��÷½G´������>���vendor/symfony/console/Formatter/OutputFormatterStyleStack.php@��Y—Ñ]@��G¨ýU´������6���vendor/symfony/console/Helper/DebugFormatterHelper.phpy��Y—Ñ]y��Ì8Æд������2���vendor/symfony/console/Helper/DescriptorHelper.phpw��Y—Ñ]w��|¦C´������.���vendor/symfony/console/Helper/DialogHelper.php��Y—Ñ]��¹ÜÃ_´������1���vendor/symfony/console/Helper/FormatterHelper.phpd��Y—Ñ]d��§×,¸´������(���vendor/symfony/console/Helper/Helper.php«��Y—Ñ]«��!�§—´������1���vendor/symfony/console/Helper/HelperInterface.phpå���Y—Ñ]å���Š ´������+���vendor/symfony/console/Helper/HelperSet.phpÊ��Y—Ñ]Ê��áÏW"´������2���vendor/symfony/console/Helper/InputAwareHelper.phpc��Y—Ñ]c��Ìøƒ´������/���vendor/symfony/console/Helper/ProcessHelper.phpÓ ��Y—Ñ]Ó ��©w‚R´������-���vendor/symfony/console/Helper/ProgressBar.phpl%��Y—Ñ]l%�� díÛ´������0���vendor/symfony/console/Helper/ProgressHelper.php]��Y—Ñ]]��ù»‰X´������3���vendor/symfony/console/Helper/ProgressIndicator.phpN��Y—Ñ]N��ÿ§³l´������0���vendor/symfony/console/Helper/QuestionHelper.phpl��Y—Ñ]l��Ntó´������7���vendor/symfony/console/Helper/SymfonyQuestionHelper.php–
  43. ��Y—Ñ]–
  44. ��- Ø´������'���vendor/symfony/console/Helper/Table.phpÄ*��Y—Ñ]Ä*��¾™ØT´������+���vendor/symfony/console/Helper/TableCell.php���Y—Ñ]���åV^´������-���vendor/symfony/console/Helper/TableHelper.php ��Y—Ñ] ��›uô™´������0���vendor/symfony/console/Helper/TableSeparator.phpÊ���Y—Ñ]Ê���az´������,���vendor/symfony/console/Helper/TableStyle.php
  45. ��Y—Ñ]
  46. ��_ÍI"´������*���vendor/symfony/console/Input/ArgvInput.php��Y—Ñ]��×ö†›´������+���vendor/symfony/console/Input/ArrayInput.php) ��Y—Ñ]) ��¥ÑC´������&���vendor/symfony/console/Input/Input.php£ ��Y—Ñ]£ ��f¡?´������.���vendor/symfony/console/Input/InputArgument.php��Y—Ñ]��D £´������4���vendor/symfony/console/Input/InputAwareInterface.php˜���Y—Ñ]˜���­O°´������0���vendor/symfony/console/Input/InputDefinition.php†��Y—Ñ]†��¤U)¤´������/���vendor/symfony/console/Input/InputInterface.php£��Y—Ñ]£��ÆBŒ'´������,���vendor/symfony/console/Input/InputOption.php ��Y—Ñ] ��\¢Ü=´������,���vendor/symfony/console/Input/StringInput.phpš��Y—Ñ]š��žµ è´���������vendor/symfony/console/LICENSE)��Y—Ñ])��NUN½´������/���vendor/symfony/console/Logger/ConsoleLogger.php0 ��Y—Ñ]0 ��…� ¸´������0���vendor/symfony/console/Output/BufferedOutput.php_��Y—Ñ]_��‹ >P´������/���vendor/symfony/console/Output/ConsoleOutput.php±��Y—Ñ]±��nì!f´������8���vendor/symfony/console/Output/ConsoleOutputInterface.phpà���Y—Ñ]à���‡†ÆÊ´������,���vendor/symfony/console/Output/NullOutput.phpÏ��Y—Ñ]Ï��®˜‹Z´������(���vendor/symfony/console/Output/Output.php˜ ��Y—Ñ]˜ ��0p´������1���vendor/symfony/console/Output/OutputInterface.php��Y—Ñ]���ì&´������.���vendor/symfony/console/Output/StreamOutput.php���Y—Ñ]���Ä’Oç´������2���vendor/symfony/console/Question/ChoiceQuestion.phpx
  47. ��Y—Ñ]x
  48. ��W€!´������8���vendor/symfony/console/Question/ConfirmationQuestion.phpè��Y—Ñ]è��/Ô�´������,���vendor/symfony/console/Question/Question.phpÎ ��Y—Ñ]Î ��lF´������ ���vendor/symfony/console/Shell.phpæ��Y—Ñ]æ��¼XÒA´������,���vendor/symfony/console/Style/OutputStyle.php\��Y—Ñ]\��wפ´������/���vendor/symfony/console/Style/StyleInterface.phpÏ��Y—Ñ]Ï��&nÅÑ´������-���vendor/symfony/console/Style/SymfonyStyle.phpä��Y—Ñ]ä��­å (´������3���vendor/symfony/console/Tester/ApplicationTester.phpÏ��Y—Ñ]Ï��sž9i´������/���vendor/symfony/console/Tester/CommandTester.phpª��Y—Ñ]ª��¬K z´������(���vendor/symfony/debug/BufferingLogger.phpt��Y—Ñ]t��=�hÜ´���������vendor/symfony/debug/Debug.php,��Y—Ñ],��Ë~Ž.´������)���vendor/symfony/debug/DebugClassLoader.phpµ��Y—Ñ]µ��1rEÓ´������%���vendor/symfony/debug/ErrorHandler.phpH��Y—Ñ]H��¹:D#´������9���vendor/symfony/debug/Exception/ClassNotFoundException.php–��Y—Ñ]–��i‰æô´������8���vendor/symfony/debug/Exception/ContextErrorException.php˜��Y—Ñ]˜��-
  49. d2´������1���vendor/symfony/debug/Exception/DummyException.php��Y—Ñ]��®+Ãê´������6���vendor/symfony/debug/Exception/FatalErrorException.php��Y—Ñ]��™Ä´������6���vendor/symfony/debug/Exception/FatalThrowableError.phpW��Y—Ñ]W��?àèK´������3���vendor/symfony/debug/Exception/FlattenException.php¼��Y—Ñ]¼�� ×´������7���vendor/symfony/debug/Exception/OutOfMemoryException.php~���Y—Ñ]~���ë¨oâ´������=���vendor/symfony/debug/Exception/UndefinedFunctionException.phpš��Y—Ñ]š���ñJÀ´������;���vendor/symfony/debug/Exception/UndefinedMethodException.php˜��Y—Ñ]˜��nöêØ´������)���vendor/symfony/debug/ExceptionHandler.php)3��Y—Ñ])3���h5=´������I���vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.phpA��Y—Ñ]A��Ϥ¹l´������E���vendor/symfony/debug/FatalErrorHandler/FatalErrorHandlerInterface.php��Y—Ñ]��ĹBV´������M���vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.phpx��Y—Ñ]x��~ò"´������K���vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.phpO��Y—Ñ]O���ž¦*´���������vendor/symfony/debug/LICENSE)��Y—Ñ])��NUN½´������:���vendor/symfony/filesystem/Exception/ExceptionInterface.phpi���Y—Ñ]i���$ ÿ›´������=���vendor/symfony/filesystem/Exception/FileNotFoundException.php¼��Y—Ñ]¼��pí\¶´������3���vendor/symfony/filesystem/Exception/IOException.php‡��Y—Ñ]‡��€ü#Ñ´������<���vendor/symfony/filesystem/Exception/IOExceptionInterface.php¦���Y—Ñ]¦���jÙwM´������(���vendor/symfony/filesystem/Filesystem.phpc4��Y—Ñ]c4��‹×@þ´������!���vendor/symfony/filesystem/LICENSE)��Y—Ñ])��NUN½´������)���vendor/symfony/filesystem/LockHandler.phpö��Y—Ñ]ö��ŸZµ1´������1���vendor/symfony/finder/Adapter/AbstractAdapter.php\ ��Y—Ñ]\ ��hˆB´������5���vendor/symfony/finder/Adapter/AbstractFindAdapter.php���Y—Ñ]���HC€/´������2���vendor/symfony/finder/Adapter/AdapterInterface.php›��Y—Ñ]›��Mþ´������0���vendor/symfony/finder/Adapter/BsdFindAdapter.php3��Y—Ñ]3��75$·´������0���vendor/symfony/finder/Adapter/GnuFindAdapter.php��Y—Ñ]��Ÿ`]´������,���vendor/symfony/finder/Adapter/PhpAdapter.phpô��Y—Ñ]ô��Þdè;´������/���vendor/symfony/finder/Comparator/Comparator.php���Y—Ñ]���¾üœµ´������3���vendor/symfony/finder/Comparator/DateComparator.php#��Y—Ñ]#��°δ������5���vendor/symfony/finder/Comparator/NumberComparator.php|��Y—Ñ]|��ITÇÍ´������9���vendor/symfony/finder/Exception/AccessDeniedException.php„���Y—Ñ]„���½¾sœ´������;���vendor/symfony/finder/Exception/AdapterFailureException.php¬��Y—Ñ]¬��wR´������6���vendor/symfony/finder/Exception/ExceptionInterface.php„���Y—Ñ]„���Gz-´������A���vendor/symfony/finder/Exception/OperationNotPermitedException.php)��Y—Ñ])��x§e´������@���vendor/symfony/finder/Exception/ShellCommandFailureException.phpº��Y—Ñ]º��˜þ˜´������/���vendor/symfony/finder/Expression/Expression.php��Y—Ñ]��i¥:Å´������)���vendor/symfony/finder/Expression/Glob.phpf��Y—Ñ]f��DÞcj´������*���vendor/symfony/finder/Expression/Regex.php��Y—Ñ]��ü(ÃÏ´������3���vendor/symfony/finder/Expression/ValueInterface.phpÍ��Y—Ñ]Í��\p4†´������ ���vendor/symfony/finder/Finder.phpc.��Y—Ñ]c.��:ˆ5g´���������vendor/symfony/finder/Glob.phpL��Y—Ñ]L��jÍ9×´������7���vendor/symfony/finder/Iterator/CustomFilterIterator.php]��Y—Ñ]]��ÎoÅÆ´������:���vendor/symfony/finder/Iterator/DateRangeFilterIterator.phpx��Y—Ñ]x��ôP´������;���vendor/symfony/finder/Iterator/DepthRangeFilterIterator.phpî��Y—Ñ]î��üÍ�q´������A���vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.phpí��Y—Ñ]í��nõH´������4���vendor/symfony/finder/Iterator/FilePathsIterator.php#��Y—Ñ]#��G?T½´������9���vendor/symfony/finder/Iterator/FileTypeFilterIterator.phpZ��Y—Ñ]Z��(&ø´������<���vendor/symfony/finder/Iterator/FilecontentFilterIterator.php5��Y—Ñ]5��ší´������9���vendor/symfony/finder/Iterator/FilenameFilterIterator.phpr��Y—Ñ]r��tu´������1���vendor/symfony/finder/Iterator/FilterIterator.phpÃ��Y—Ñ]Ã��š+µÞ´������=���vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php-��Y—Ñ]-��ºÎÒ_´������5���vendor/symfony/finder/Iterator/PathFilterIterator.phpÐ��Y—Ñ]Ð��‚c´������=���vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php ��Y—Ñ] ��ë]í»´������:���vendor/symfony/finder/Iterator/SizeRangeFilterIterator.phpe��Y—Ñ]e��Ÿ’áé´������3���vendor/symfony/finder/Iterator/SortableIterator.php+��Y—Ñ]+��õÝË ´���������vendor/symfony/finder/LICENSE)��Y—Ñ])��NUN½´������'���vendor/symfony/finder/Shell/Command.php> ��Y—Ñ]> ��_~u ´������%���vendor/symfony/finder/Shell/Shell.phpr��Y—Ñ]r��þpN´������%���vendor/symfony/finder/SplFileInfo.php��Y—Ñ]��þ�íù´������'���vendor/symfony/polyfill-ctype/Ctype.phpH ��Y—Ñ]H ��³�ÕÝ´������%���vendor/symfony/polyfill-ctype/LICENSE)��Y—Ñ])��´`e0´������+���vendor/symfony/polyfill-ctype/bootstrap.phpI��Y—Ñ]I���D!e´������(���vendor/symfony/polyfill-mbstring/LICENSE)��Y—Ñ])��“\ª´������-���vendor/symfony/polyfill-mbstring/Mbstring.phpõE��Y—Ñ]õE��K"Ü´������@���vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php÷@��Y—Ñ]÷@��õžØ´������F���vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.phpã��Y—Ñ]ã��öy_•´������@���vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.phpfA��Y—Ñ]fA��Úf”ß´������.���vendor/symfony/polyfill-mbstring/bootstrap.php‚��Y—Ñ]‚��À‘ Š´������7���vendor/symfony/process/Exception/ExceptionInterface.phpf���Y—Ñ]f���]ö>T´������=���vendor/symfony/process/Exception/InvalidArgumentException.php¨���Y—Ñ]¨���ÐÀ+_´������3���vendor/symfony/process/Exception/LogicException.php”���Y—Ñ]”��� ³ãñ´������;���vendor/symfony/process/Exception/ProcessFailedException.phpx��Y—Ñ]x��¨Ìzy´������=���vendor/symfony/process/Exception/ProcessTimedOutException.php��Y—Ñ]��ï«´������5���vendor/symfony/process/Exception/RuntimeException.php˜���Y—Ñ]˜���¢Ø:´������+���vendor/symfony/process/ExecutableFinder.php���Y—Ñ]���ûus€´���������vendor/symfony/process/LICENSE)��Y—Ñ])��NUN½´������.���vendor/symfony/process/PhpExecutableFinder.phpÏ��Y—Ñ]Ï��Î%h´������%���vendor/symfony/process/PhpProcess.phpü��Y—Ñ]ü��‡jûü´������.���vendor/symfony/process/Pipes/AbstractPipes.php½��Y—Ñ]½��憴������/���vendor/symfony/process/Pipes/PipesInterface.phpD��Y—Ñ]D��vØî¡´������*���vendor/symfony/process/Pipes/UnixPipes.php>��Y—Ñ]>��ª•ir´������-���vendor/symfony/process/Pipes/WindowsPipes.phpp ��Y—Ñ]p ��âU~É´������"���vendor/symfony/process/Process.php·R��Y—Ñ]·R��Š`Õ´������)���vendor/symfony/process/ProcessBuilder.phpâ
  50. ��Y—Ñ]â
  51. ��†M¶´������'���vendor/symfony/process/ProcessUtils.phpQ��Y—Ñ]Q��b-$m´���������vendor/seld/jsonlint/LICENSE"��Y—Ñ]"��aƒsy´������@���vendor/seld/jsonlint/src/Seld/JsonLint/DuplicateKeyException.php*��Y—Ñ]*��•pñ´������5���vendor/seld/jsonlint/src/Seld/JsonLint/JsonParser.php82��Y—Ñ]82��ªÃZt´������0���vendor/seld/jsonlint/src/Seld/JsonLint/Lexer.php��Y—Ñ]��%ÿ3N´������;���vendor/seld/jsonlint/src/Seld/JsonLint/ParsingException.php��Y—Ñ]��‰²ñ´������4���vendor/seld/jsonlint/src/Seld/JsonLint/Undefined.php>���Y—Ñ]>���ÿqŸŸ´������(���vendor/justinrainbow/json-schema/LICENSE ��Y—Ñ] ��ºç©´������.���vendor/justinrainbow/json-schema/demo/demo.phpñ��Y—Ñ]ñ��fC´������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php¡ ��Y—Ñ]¡ ��†wÌl´������T���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/CollectionConstraint.php�
  52. ��Y—Ñ]�
  53. ��ÍèÓ¯´������J���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php§ ��Y—Ñ]§ ��›VØ´������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ConstraintInterface.php¼��Y—Ñ]¼��ÿ Qœ´������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/EnumConstraint.php]��Y—Ñ]]��VŽU<´������G���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.phpã ��Y—Ñ]ã ��á0;´������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/FormatConstraint.php…��Y—Ñ]…��“TœÚ´������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/NumberConstraint.php‡ ��Y—Ñ]‡ ��ï›(´������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.phpÃ��Y—Ñ]Ã��©Å¼x´������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/SchemaConstraint.php0 ��Y—Ñ]0 ��×j´˜´������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/StringConstraint.php��Y—Ñ]��¥wš‡´������X���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.phpa��Y—Ñ]a�� qô������Y���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.php—��Y—Ñ]—��4~¾ ´������\���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php‰��Y—Ñ]‰��“µ+j´������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeConstraint.php&��Y—Ñ]&��4˜©T´������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/UndefinedConstraint.phpa"��Y—Ñ]a"���MÙë´������F���vendor/justinrainbow/json-schema/src/JsonSchema/Entity/JsonPointer.phpè��Y—Ñ]è��{N–´������P���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ExceptionInterface.phpI���Y—Ñ]I���%|°´������V���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidArgumentException.php•���Y—Ñ]•���‹àG´������T���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidConfigException.phpl���Y—Ñ]l���A!L×´������T���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaException.phpl���Y—Ñ]l���è2÷þ´������]���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaMediaTypeException.phpu���Y—Ñ]u���=hç´������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSourceUriException.phpw���Y—Ñ]w���N-ò[´������S���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/JsonDecodingException.phpÞ��Y—Ñ]Þ��\¸
  54. ´������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ResourceNotFoundException.phpo���Y—Ñ]o���píÛù´������N���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/RuntimeException.php…���Y—Ñ]…���%…—´������^���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UnresolvableJsonPointerException.php€���Y—Ñ]€���u-#1´������R���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UriResolverException.phpj���Y—Ñ]j���å>�´������Q���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ValidationException.phpf���Y—Ñ]f���¬¤„þ´������K���vendor/justinrainbow/json-schema/src/JsonSchema/Iterator/ObjectIterator.phpþ��Y—Ñ]þ��M�„õ´������;���vendor/justinrainbow/json-schema/src/JsonSchema/Rfc3339.php ��Y—Ñ] ��f4÷³´������A���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorage.phpœ ��Y—Ñ]œ ��åfO´������J���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorageInterface.php��Y—Ñ]��oŠ+}´������T���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/AbstractRetriever.phpá���Y—Ñ]á���[þA�´������G���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/Curl.php¥��Y—Ñ]¥��Ô§Lb´������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/FileGetContents.php%��Y—Ñ]%��5" ´������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/PredefinedArray.php,��Y—Ñ],��1•5þ´������X���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/UriRetrieverInterface.php®���Y—Ñ]®���ÿ‹Áå´������C���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriResolver.php ��Y—Ñ] ��£Ÿ)à´������D���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriRetriever.phpF��Y—Ñ]F��¨IaD´������H���vendor/justinrainbow/json-schema/src/JsonSchema/UriResolverInterface.phpƒ���Y—Ñ]ƒ���J€´������I���vendor/justinrainbow/json-schema/src/JsonSchema/UriRetrieverInterface.php…���Y—Ñ]…���íæe´������=���vendor/justinrainbow/json-schema/src/JsonSchema/Validator.phpv��Y—Ñ]v��õÍg´������%���vendor/composer/spdx-licenses/LICENSE��Y—Ñ]��Bhí´������2���vendor/composer/spdx-licenses/src/SpdxLicenses.phpH��Y—Ñ]H��͉T´���������vendor/composer/semver/LICENSE��Y—Ñ]��Bhí´������)���vendor/composer/semver/src/Comparator.php��Y—Ñ]��wlƒï´������<���vendor/composer/semver/src/Constraint/AbstractConstraint.phpî��Y—Ñ]î��Õ­w-´������4���vendor/composer/semver/src/Constraint/Constraint.phpª ��Y—Ñ]ª ��ÇO7²´������=���vendor/composer/semver/src/Constraint/ConstraintInterface.phpß���Y—Ñ]ß���0C,‡´������9���vendor/composer/semver/src/Constraint/EmptyConstraint.phpé��Y—Ñ]é��!-Ø™´������9���vendor/composer/semver/src/Constraint/MultiConstraint.php1��Y—Ñ]1��í xU´������%���vendor/composer/semver/src/Semver.phpv��Y—Ñ]v��‹×È›´������,���vendor/composer/semver/src/VersionParser.php¯*��Y—Ñ]¯*��ZÒ“´������!���vendor/composer/ca-bundle/LICENSE��Y—Ñ]��*!^`´������*���vendor/composer/ca-bundle/src/CaBundle.php±��Y—Ñ]±��à “´������&���vendor/composer/xdebug-handler/LICENSE)��Y—Ñ])��#Ô;^´������0���vendor/composer/xdebug-handler/src/PhpConfig.php´��Y—Ñ]´��*D’�´������.���vendor/composer/xdebug-handler/src/Process.php ��Y—Ñ] ��`çîÈ´������-���vendor/composer/xdebug-handler/src/Status.php
  55. ��Y—Ñ]
  56. ��²‚²´������4���vendor/composer/xdebug-handler/src/XdebugHandler.php!��Y—Ñ]!��2|¿C´���������vendor/psr/log/LICENSE=��Y—Ñ]=��p±ŽO´������)���vendor/psr/log/Psr/Log/AbstractLogger.php;��Y—Ñ];��ñ>3[´������3���vendor/psr/log/Psr/Log/InvalidArgumentException.php`���Y—Ñ]`��� ˆX1´������#���vendor/psr/log/Psr/Log/LogLevel.phpû���Y—Ñ]û���jðñ8´������/���vendor/psr/log/Psr/Log/LoggerAwareInterface.php|���Y—Ñ]|���$£ˆ´������+���vendor/psr/log/Psr/Log/LoggerAwareTrait.php§���Y—Ñ]§���T½úB´������*���vendor/psr/log/Psr/Log/LoggerInterface.phpÈ��Y—Ñ]È��šx´������&���vendor/psr/log/Psr/Log/LoggerTrait.phpk��Y—Ñ]k��£}‰’´������%���vendor/psr/log/Psr/Log/NullLogger.php ���Y—Ñ] ���ÆDi¯´������3���vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.phpj ��Y—Ñ]j ��Nÿt´������*���vendor/psr/log/Psr/Log/Test/TestLogger.php<��Y—Ñ]<��þ(åI´���������vendor/autoload.php‚���Y—Ñ]‚���¡[UÌ´������'���vendor/composer/autoload_namespaces.phpd���Y—Ñ]d���Z¡¦H´������!���vendor/composer/autoload_psr4.php÷��Y—Ñ]÷��Å*š´������%���vendor/composer/autoload_classmap.phpd���Y—Ñ]d���Z¡¦H´������"���vendor/composer/autoload_files.php��Y—Ñ]��¥� ®´������!���vendor/composer/autoload_real.phpL��Y—Ñ]L��·u~´������#���vendor/composer/autoload_static.php§
  57. ��Y—Ñ]§
  58. ��y[Nµ´���������vendor/composer/ClassLoader.php¨��Y—Ñ]¨��xää`´������(���vendor/composer/ca-bundle/res/cacert.pemUk�Y—Ñ]Uk�”J̸´������ ���bin/composerÊ��Y—Ñ]Ê���4K´���������LICENSE.��Y—Ñ].�� Õ´������<?php
  59. namespace Composer\Autoload;
  60. use Composer\Config;
  61. use Composer\EventDispatcher\EventDispatcher;
  62. use Composer\Installer\InstallationManager;
  63. use Composer\IO\IOInterface;
  64. use Composer\Package\AliasPackage;
  65. use Composer\Package\PackageInterface;
  66. use Composer\Repository\InstalledRepositoryInterface;
  67. use Composer\Util\Filesystem;
  68. use Composer\Script\ScriptEvents;
  69. use Composer\Util\PackageSorter;
  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. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist, $namespace, $group['type'], $classMap);
  213. }
  214. }
  215. }
  216. }
  217. foreach ($autoloads['classmap'] as $dir) {
  218. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist, null, null, $classMap);
  219. }
  220. ksort($classMap);
  221. foreach ($classMap as $class => $code) {
  222. $classmapFile .= ' '.var_export($class, true).' => '.$code;
  223. }
  224. $classmapFile .= ");\n";
  225. if (!$suffix) {
  226. if (!$config->get('autoloader-suffix') && is_readable($vendorPath.'/autoload.php')) {
  227. $content = file_get_contents($vendorPath.'/autoload.php');
  228. if (preg_match('{ComposerAutoloaderInit([^:\s]+)::}', $content, $match)) {
  229. $suffix = $match[1];
  230. }
  231. }
  232. if (!$suffix) {
  233. $suffix = $config->get('autoloader-suffix') ?: md5(uniqid('', true));
  234. }
  235. }
  236. file_put_contents($targetDir.'/autoload_namespaces.php', $namespacesFile);
  237. file_put_contents($targetDir.'/autoload_psr4.php', $psr4File);
  238. file_put_contents($targetDir.'/autoload_classmap.php', $classmapFile);
  239. $includePathFilePath = $targetDir.'/include_paths.php';
  240. if ($includePathFileContents = $this->getIncludePathsFile($packageMap, $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  241. file_put_contents($includePathFilePath, $includePathFileContents);
  242. } elseif (file_exists($includePathFilePath)) {
  243. unlink($includePathFilePath);
  244. }
  245. $includeFilesFilePath = $targetDir.'/autoload_files.php';
  246. if ($includeFilesFileContents = $this->getIncludeFilesFile($autoloads['files'], $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  247. file_put_contents($includeFilesFilePath, $includeFilesFileContents);
  248. } elseif (file_exists($includeFilesFilePath)) {
  249. unlink($includeFilesFilePath);
  250. }
  251. file_put_contents($targetDir.'/autoload_static.php', $this->getStaticFile($suffix, $targetDir, $vendorPath, $basePath, $staticPhpVersion));
  252. file_put_contents($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
  253. file_put_contents($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, (bool) $includePathFileContents, $targetDirLoader, (bool) $includeFilesFileContents, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion));
  254. $this->safeCopy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
  255. $this->safeCopy(__DIR__.'/../../../LICENSE', $targetDir.'/LICENSE');
  256. if ($this->runScripts) {
  257. $this->eventDispatcher->dispatchScript(ScriptEvents::POST_AUTOLOAD_DUMP, $this->devMode, array(), array(
  258. 'optimize' => (bool) $scanPsr0Packages,
  259. ));
  260. }
  261. return count($classMap);
  262. }
  263. private function addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist = null, $namespaceFilter = null, $autoloadType = null, array $classMap = array())
  264. {
  265. foreach ($this->generateClassMap($dir, $blacklist, $namespaceFilter, $autoloadType) 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, $autoloadType = null, $showAmbiguousWarning = true)
  279. {
  280. return ClassMapGenerator::createMap($dir, $blacklist, $showAmbiguousWarning ? $this->io : null, $namespaceFilter, $autoloadType);
  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, 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 (strpos($path, '.phar') !== false) {
  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. /**
  468. * @return \Composer\Autoload\ClassLoader
  469. */
  470. public static function getLoader()
  471. {
  472. if (null !== self::\$loader) {
  473. return self::\$loader;
  474. }
  475. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'), true, $prependAutoloader);
  476. self::\$loader = \$loader = new \\Composer\\Autoload\\ClassLoader();
  477. spl_autoload_unregister(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'));
  478. HEADER;
  479. if ($useIncludePath) {
  480. $file .= <<<'INCLUDE_PATH'
  481. $includePaths = require __DIR__ . '/include_paths.php';
  482. $includePaths[] = get_include_path();
  483. set_include_path(implode(PATH_SEPARATOR, $includePaths));
  484. INCLUDE_PATH;
  485. }
  486. $file .= <<<STATIC_INIT
  487. \$useStaticLoader = PHP_VERSION_ID >= $staticPhpVersion && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
  488. if (\$useStaticLoader) {
  489. require_once __DIR__ . '/autoload_static.php';
  490. call_user_func(\Composer\Autoload\ComposerStaticInit$suffix::getInitializer(\$loader));
  491. } else {
  492. STATIC_INIT;
  493. if (!$this->classMapAuthoritative) {
  494. $file .= <<<'PSR04'
  495. $map = require __DIR__ . '/autoload_namespaces.php';
  496. foreach ($map as $namespace => $path) {
  497. $loader->set($namespace, $path);
  498. }
  499. $map = require __DIR__ . '/autoload_psr4.php';
  500. foreach ($map as $namespace => $path) {
  501. $loader->setPsr4($namespace, $path);
  502. }
  503. PSR04;
  504. }
  505. if ($useClassMap) {
  506. $file .= <<<'CLASSMAP'
  507. $classMap = require __DIR__ . '/autoload_classmap.php';
  508. if ($classMap) {
  509. $loader->addClassMap($classMap);
  510. }
  511. CLASSMAP;
  512. }
  513. $file .= " }\n\n";
  514. if ($this->classMapAuthoritative) {
  515. $file .= <<<'CLASSMAPAUTHORITATIVE'
  516. $loader->setClassMapAuthoritative(true);
  517. CLASSMAPAUTHORITATIVE;
  518. }
  519. if ($this->apcu) {
  520. $apcuPrefix = substr(base64_encode(md5(uniqid('', true), true)), 0, -3);
  521. $file .= <<<APCU
  522. \$loader->setApcuPrefix('$apcuPrefix');
  523. APCU;
  524. }
  525. if ($useGlobalIncludePath) {
  526. $file .= <<<'INCLUDEPATH'
  527. $loader->setUseIncludePath(true);
  528. INCLUDEPATH;
  529. }
  530. if ($targetDirLoader) {
  531. $file .= <<<REGISTER_TARGET_DIR_AUTOLOAD
  532. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'autoload'), true, true);
  533. REGISTER_TARGET_DIR_AUTOLOAD;
  534. }
  535. $file .= <<<REGISTER_LOADER
  536. \$loader->register($prependAutoloader);
  537. REGISTER_LOADER;
  538. if ($useIncludeFiles) {
  539. $file .= <<<INCLUDE_FILES
  540. if (\$useStaticLoader) {
  541. \$includeFiles = Composer\Autoload\ComposerStaticInit$suffix::\$files;
  542. } else {
  543. \$includeFiles = require __DIR__ . '/autoload_files.php';
  544. }
  545. foreach (\$includeFiles as \$fileIdentifier => \$file) {
  546. composerRequire$suffix(\$fileIdentifier, \$file);
  547. }
  548. INCLUDE_FILES;
  549. }
  550. $file .= <<<METHOD_FOOTER
  551. return \$loader;
  552. }
  553. METHOD_FOOTER;
  554. $file .= $targetDirLoader;
  555. if ($useIncludeFiles) {
  556. return $file . <<<FOOTER
  557. }
  558. function composerRequire$suffix(\$fileIdentifier, \$file)
  559. {
  560. if (empty(\$GLOBALS['__composer_autoload_files'][\$fileIdentifier])) {
  561. require \$file;
  562. \$GLOBALS['__composer_autoload_files'][\$fileIdentifier] = true;
  563. }
  564. }
  565. FOOTER;
  566. }
  567. return $file . <<<FOOTER
  568. }
  569. FOOTER;
  570. }
  571. protected function getStaticFile($suffix, $targetDir, $vendorPath, $basePath, &$staticPhpVersion)
  572. {
  573. $staticPhpVersion = 50600;
  574. $file = <<<HEADER
  575. <?php
  576. // autoload_static.php @generated by Composer
  577. namespace Composer\Autoload;
  578. class ComposerStaticInit$suffix
  579. {
  580. HEADER;
  581. $loader = new ClassLoader();
  582. $map = require $targetDir . '/autoload_namespaces.php';
  583. foreach ($map as $namespace => $path) {
  584. $loader->set($namespace, $path);
  585. }
  586. $map = require $targetDir . '/autoload_psr4.php';
  587. foreach ($map as $namespace => $path) {
  588. $loader->setPsr4($namespace, $path);
  589. }
  590. $classMap = require $targetDir . '/autoload_classmap.php';
  591. if ($classMap) {
  592. $loader->addClassMap($classMap);
  593. }
  594. $filesystem = new Filesystem();
  595. $vendorPathCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";
  596. $vendorPharPathCode = ' => \'phar://\' . ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";
  597. $appBaseDirCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
  598. $appBaseDirPharCode = ' => \'phar://\' . ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
  599. $absoluteVendorPathCode = ' => ' . substr(var_export(rtrim($vendorDir, '\\/') . '/', true), 0, -1);
  600. $absoluteVendorPharPathCode = ' => ' . substr(var_export(rtrim('phar://' . $vendorDir, '\\/') . '/', true), 0, -1);
  601. $absoluteAppBaseDirCode = ' => ' . substr(var_export(rtrim($baseDir, '\\/') . '/', true), 0, -1);
  602. $absoluteAppBaseDirPharCode = ' => ' . substr(var_export(rtrim('phar://' . $baseDir, '\\/') . '/', true), 0, -1);
  603. $initializer = '';
  604. $prefix = "\0Composer\Autoload\ClassLoader\0";
  605. $prefixLen = strlen($prefix);
  606. if (file_exists($targetDir . '/autoload_files.php')) {
  607. $maps = array('files' => require $targetDir . '/autoload_files.php');
  608. } else {
  609. $maps = array();
  610. }
  611. foreach ((array) $loader as $prop => $value) {
  612. if ($value && 0 === strpos($prop, $prefix)) {
  613. $maps[substr($prop, $prefixLen)] = $value;
  614. }
  615. }
  616. foreach ($maps as $prop => $value) {
  617. if (count($value) > 32767) {
  618. $staticPhpVersion = 70000;
  619. }
  620. $value = strtr(
  621. var_export($value, true),
  622. array(
  623. $absoluteVendorPathCode => $vendorPathCode,
  624. $absoluteVendorPharPathCode => $vendorPharPathCode,
  625. $absoluteAppBaseDirCode => $appBaseDirCode,
  626. $absoluteAppBaseDirPharCode => $appBaseDirPharCode,
  627. )
  628. );
  629. $value = ltrim(preg_replace('/^ */m', ' $0$0', $value));
  630. $file .= sprintf(" public static $%s = %s;\n\n", $prop, $value);
  631. if ('files' !== $prop) {
  632. $initializer .= " \$loader->$prop = ComposerStaticInit$suffix::\$$prop;\n";
  633. }
  634. }
  635. return $file . <<<INITIALIZER
  636. public static function getInitializer(ClassLoader \$loader)
  637. {
  638. return \Closure::bind(function () use (\$loader) {
  639. $initializer
  640. }, null, ClassLoader::class);
  641. }
  642. }
  643. INITIALIZER;
  644. }
  645. protected function parseAutoloadsType(array $packageMap, $type, PackageInterface $mainPackage)
  646. {
  647. $autoloads = array();
  648. foreach ($packageMap as $item) {
  649. list($package, $installPath) = $item;
  650. $autoload = $package->getAutoload();
  651. if ($this->devMode && $package === $mainPackage) {
  652. $autoload = array_merge_recursive($autoload, $package->getDevAutoload());
  653. }
  654. if (!isset($autoload[$type]) || !is_array($autoload[$type])) {
  655. continue;
  656. }
  657. if (null !== $package->getTargetDir() && $package !== $mainPackage) {
  658. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  659. }
  660. foreach ($autoload[$type] as $namespace => $paths) {
  661. foreach ((array) $paths as $path) {
  662. if (($type === 'files' || $type === 'classmap' || $type === 'exclude-from-classmap') && $package->getTargetDir() && !is_readable($installPath.'/'.$path)) {
  663. if ($package === $mainPackage) {
  664. $targetDir = str_replace('\\<dirsep\\>', '[\\\\/]', preg_quote(str_replace(array('/', '\\'), '<dirsep>', $package->getTargetDir())));
  665. $path = ltrim(preg_replace('{^'.$targetDir.'}', '', ltrim($path, '\\/')), '\\/');
  666. } else {
  667. $path = $package->getTargetDir() . '/' . $path;
  668. }
  669. }
  670. if ($type === 'exclude-from-classmap') {
  671. $path = preg_replace('{/+}', '/', preg_quote(trim(strtr($path, '\\', '/'), '/')));
  672. $path = str_replace('\\*\\*', '.+?', $path);
  673. $path = str_replace('\\*', '[^/]+?', $path);
  674. $updir = null;
  675. $path = preg_replace_callback(
  676. '{^((?:(?:\\\\\\.){1,2}+/)+)}',
  677. function ($matches) use (&$updir) {
  678. if (isset($matches[1])) {
  679. $updir = str_replace('\\.', '.', $matches[1]);
  680. }
  681. return '';
  682. },
  683. $path
  684. );
  685. if (empty($installPath)) {
  686. $installPath = strtr(getcwd(), '\\', '/');
  687. }
  688. $resolvedPath = realpath($installPath . '/' . $updir);
  689. $autoloads[] = preg_quote(strtr($resolvedPath, '\\', '/')) . '/' . $path;
  690. continue;
  691. }
  692. $relativePath = empty($installPath) ? (empty($path) ? '.' : $path) : $installPath.'/'.$path;
  693. if ($type === 'files') {
  694. $autoloads[$this->getFileIdentifier($package, $path)] = $relativePath;
  695. continue;
  696. } elseif ($type === 'classmap') {
  697. $autoloads[] = $relativePath;
  698. continue;
  699. }
  700. $autoloads[$namespace][] = $relativePath;
  701. }
  702. }
  703. }
  704. return $autoloads;
  705. }
  706. protected function getFileIdentifier(PackageInterface $package, $path)
  707. {
  708. return md5($package->getName() . ':' . $path);
  709. }
  710. protected function filterPackageMap(array $packageMap, PackageInterface $mainPackage)
  711. {
  712. $packages = array();
  713. $include = array();
  714. foreach ($packageMap as $item) {
  715. $package = $item[0];
  716. $name = $package->getName();
  717. $packages[$name] = $package;
  718. }
  719. $add = function (PackageInterface $package) use (&$add, $packages, &$include) {
  720. foreach ($package->getRequires() as $link) {
  721. $target = $link->getTarget();
  722. if (!isset($include[$target])) {
  723. $include[$target] = true;
  724. if (isset($packages[$target])) {
  725. $add($packages[$target]);
  726. }
  727. }
  728. }
  729. };
  730. $add($mainPackage);
  731. return array_filter(
  732. $packageMap,
  733. function ($item) use ($include) {
  734. $package = $item[0];
  735. foreach ($package->getNames() as $name) {
  736. if (isset($include[$name])) {
  737. return true;
  738. }
  739. }
  740. return false;
  741. }
  742. );
  743. }
  744. protected function sortPackageMap(array $packageMap)
  745. {
  746. $packages = array();
  747. $paths = array();
  748. foreach ($packageMap as $item) {
  749. list($package, $path) = $item;
  750. $name = $package->getName();
  751. $packages[$name] = $package;
  752. $paths[$name] = $path;
  753. }
  754. $sortedPackages = PackageSorter::sortPackages($packages);
  755. $sortedPackageMap = array();
  756. foreach ($sortedPackages as $package) {
  757. $name = $package->getName();
  758. $sortedPackageMap[] = array($packages[$name], $paths[$name]);
  759. }
  760. return $sortedPackageMap;
  761. }
  762. protected function safeCopy($source, $target)
  763. {
  764. $source = fopen($source, 'r');
  765. $target = fopen($target, 'w+');
  766. stream_copy_to_stream($source, $target);
  767. fclose($source);
  768. fclose($target);
  769. }
  770. }
  771. <?php
  772. namespace Composer\Autoload;
  773. use Symfony\Component\Finder\Finder;
  774. use Composer\IO\IOInterface;
  775. use Composer\Util\Filesystem;
  776. class ClassMapGenerator
  777. {
  778. public static function dump($dirs, $file)
  779. {
  780. $maps = array();
  781. foreach ($dirs as $dir) {
  782. $maps = array_merge($maps, static::createMap($dir));
  783. }
  784. file_put_contents($file, sprintf('<?php return %s;', var_export($maps, true)));
  785. }
  786. public static function createMap($path, $blacklist = null, IOInterface $io = null, $namespace = null, $autoloadType = null)
  787. {
  788. if (is_string($path)) {
  789. $basePath = $path;
  790. if (is_file($path)) {
  791. $path = array(new \SplFileInfo($path));
  792. } elseif (is_dir($path)) {
  793. $path = Finder::create()->files()->followLinks()->name('/\.(php|inc|hh)$/')->in($path);
  794. } else {
  795. throw new \RuntimeException(
  796. 'Could not scan for classes inside "'.$path.
  797. '" which does not appear to be a file nor a folder'
  798. );
  799. }
  800. } elseif (null !== $autoloadType) {
  801. throw new \RuntimeException('Path must be a string when specifying an autoload type');
  802. }
  803. $map = array();
  804. $filesystem = new Filesystem();
  805. $cwd = realpath(getcwd());
  806. foreach ($path as $file) {
  807. $filePath = $file->getPathname();
  808. if (!in_array(pathinfo($filePath, PATHINFO_EXTENSION), array('php', 'inc', 'hh'))) {
  809. continue;
  810. }
  811. if (!$filesystem->isAbsolutePath($filePath)) {
  812. $filePath = $cwd . '/' . $filePath;
  813. $filePath = $filesystem->normalizePath($filePath);
  814. } else {
  815. $filePath = preg_replace('{[\\\\/]{2,}}', '/', $filePath);
  816. }
  817. if ($blacklist && preg_match($blacklist, strtr(realpath($filePath), '\\', '/'))) {
  818. continue;
  819. }
  820. if ($blacklist && preg_match($blacklist, strtr($filePath, '\\', '/'))) {
  821. continue;
  822. }
  823. $classes = self::findClasses($filePath);
  824. if (null !== $autoloadType) {
  825. $classes = self::filterByNamespace($classes, $filePath, $namespace, $autoloadType, $basePath, $io);
  826. }
  827. foreach ($classes as $class) {
  828. if ( null !== $namespace && '' !== $namespace && 0 !== strpos($class, $namespace)) {
  829. continue;
  830. }
  831. if (!isset($map[$class])) {
  832. $map[$class] = $filePath;
  833. } elseif ($io && $map[$class] !== $filePath && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($map[$class].' '.$filePath, '\\', '/'))) {
  834. $io->writeError(
  835. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  836. ' was found in both "'.$map[$class].'" and "'.$filePath.'", the first will be used.</warning>'
  837. );
  838. }
  839. }
  840. }
  841. return $map;
  842. }
  843. private static function filterByNamespace($classes, $filePath, $baseNamespace, $namespaceType, $basePath, $io)
  844. {
  845. $validClasses = array();
  846. $rejectedClasses = array();
  847. $realSubPath = substr($filePath, strlen($basePath) + 1);
  848. $realSubPath = substr($realSubPath, 0, strrpos($realSubPath, '.'));
  849. foreach ($classes as $class) {
  850. if ('' !== $baseNamespace && 0 !== strpos($class, $baseNamespace)) {
  851. continue;
  852. }
  853. if ('psr-0' === $namespaceType) {
  854. $namespaceLength = strrpos($class, '\\');
  855. if (false !== $namespaceLength) {
  856. $namespace = substr($class, 0, $namespaceLength + 1);
  857. $className = substr($class, $namespaceLength + 1);
  858. $subPath = str_replace('\\', DIRECTORY_SEPARATOR, $namespace)
  859. . str_replace('_', DIRECTORY_SEPARATOR, $className);
  860. }
  861. else {
  862. $subPath = str_replace('_', DIRECTORY_SEPARATOR, $class);
  863. }
  864. } elseif ('psr-4' === $namespaceType) {
  865. $subNamespace = ('' !== $baseNamespace) ? substr($class, strlen($baseNamespace)) : $class;
  866. $subPath = str_replace('\\', DIRECTORY_SEPARATOR, $subNamespace);
  867. } else {
  868. throw new \RuntimeException("namespaceType must be psr-0 or psr-4, $namespaceType given");
  869. }
  870. if ($subPath === $realSubPath) {
  871. $validClasses[] = $class;
  872. } else {
  873. $rejectedClasses[] = $class;
  874. }
  875. }
  876. if (empty($validClasses)) {
  877. foreach ($rejectedClasses as $class) {
  878. trigger_error(
  879. "Class $class located in ".preg_replace('{^'.preg_quote(getcwd()).'}', '.', $filePath, 1)." does not comply with $namespaceType autoloading standard. It will not autoload anymore in Composer v1.11+.",
  880. E_USER_DEPRECATED
  881. );
  882. }
  883. }
  884. return $classes;
  885. }
  886. private static function findClasses($path)
  887. {
  888. $extraTypes = PHP_VERSION_ID < 50400 ? '' : '|trait';
  889. if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '3.3', '>=')) {
  890. $extraTypes .= '|enum';
  891. }
  892. $contents = @php_strip_whitespace($path);
  893. if (!$contents) {
  894. if (!file_exists($path)) {
  895. $message = 'File at "%s" does not exist, check your classmap definitions';
  896. } elseif (!is_readable($path)) {
  897. $message = 'File at "%s" is not readable, check its permissions';
  898. } elseif ('' === trim(file_get_contents($path))) {
  899. return array();
  900. } else {
  901. $message = 'File at "%s" could not be parsed as PHP, it may be binary or corrupted';
  902. }
  903. $error = error_get_last();
  904. if (isset($error['message'])) {
  905. $message .= PHP_EOL . 'The following message may be helpful:' . PHP_EOL . $error['message'];
  906. }
  907. throw new \RuntimeException(sprintf($message, $path));
  908. }
  909. if (!preg_match('{\b(?:class|interface'.$extraTypes.')\s}i', $contents)) {
  910. return array();
  911. }
  912. $contents = preg_replace('{<<<[ \t]*([\'"]?)(\w+)\\1(?:\r\n|\n|\r)(?:.*?)(?:\r\n|\n|\r)(?:\s*)\\2(?=\s+|[;,.)])}s', 'null', $contents);
  913. $contents = preg_replace('{"[^"\\\\]*+(\\\\.[^"\\\\]*+)*+"|\'[^\'\\\\]*+(\\\\.[^\'\\\\]*+)*+\'}s', 'null', $contents);
  914. if (substr($contents, 0, 2) !== '<?') {
  915. $contents = preg_replace('{^.+?<\?}s', '<?', $contents, 1, $replacements);
  916. if ($replacements === 0) {
  917. return array();
  918. }
  919. }
  920. $contents = preg_replace('{\?>(?:[^<]++|<(?!\?))*+<\?}s', '?><?', $contents);
  921. $pos = strrpos($contents, '?>');
  922. if (false !== $pos && false === strpos(substr($contents, $pos), '<?')) {
  923. $contents = substr($contents, 0, $pos);
  924. }
  925. if (preg_match('{(<\?)(?!(php|hh))}i', $contents)) {
  926. $contents = preg_replace('{//.* | /\*(?:[^*]++|\*(?!/))*\*/}x', '', $contents);
  927. }
  928. preg_match_all('{
  929. (?:
  930. \b(?<![\$:>])(?P<type>class|interface'.$extraTypes.') \s++ (?P<name>[a-zA-Z_\x7f-\xff:][a-zA-Z0-9_\x7f-\xff:\-]*+)
  931. | \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*+ [\{;]
  932. )
  933. }ix', $contents, $matches);
  934. $classes = array();
  935. $namespace = '';
  936. for ($i = 0, $len = count($matches['type']); $i < $len; $i++) {
  937. if (!empty($matches['ns'][$i])) {
  938. $namespace = str_replace(array(' ', "\t", "\r", "\n"), '', $matches['nsname'][$i]) . '\\';
  939. } else {
  940. $name = $matches['name'][$i];
  941. if ($name === 'extends' || $name === 'implements') {
  942. continue;
  943. }
  944. if ($name[0] === ':') {
  945. $name = 'xhp'.substr(str_replace(array('-', ':'), array('_', '__'), $name), 1);
  946. } elseif ($matches['type'][$i] === 'enum') {
  947. $name = rtrim($name, ':');
  948. }
  949. $classes[] = ltrim($namespace . $name, '\\');
  950. }
  951. }
  952. return $classes;
  953. }
  954. }
  955. <?php
  956. namespace Composer;
  957. use Composer\IO\IOInterface;
  958. use Composer\Util\Filesystem;
  959. use Composer\Util\Silencer;
  960. use Symfony\Component\Finder\Finder;
  961. class Cache
  962. {
  963. private static $cacheCollected = false;
  964. private $io;
  965. private $root;
  966. private $enabled = true;
  967. private $whitelist;
  968. private $filesystem;
  969. public function __construct(IOInterface $io, $cacheDir, $whitelist = 'a-z0-9.', Filesystem $filesystem = null)
  970. {
  971. $this->io = $io;
  972. $this->root = rtrim($cacheDir, '/\\') . '/';
  973. $this->whitelist = $whitelist;
  974. $this->filesystem = $filesystem ?: new Filesystem();
  975. if (!self::isUsable($cacheDir)) {
  976. $this->enabled = false;
  977. return;
  978. }
  979. if (
  980. (!is_dir($this->root) && !Silencer::call('mkdir', $this->root, 0777, true))
  981. || !is_writable($this->root)
  982. ) {
  983. $this->io->writeError('<warning>Cannot create cache directory ' . $this->root . ', or directory is not writable. Proceeding without cache</warning>');
  984. $this->enabled = false;
  985. }
  986. }
  987. public static function isUsable($path)
  988. {
  989. return !preg_match('{(^|[\\\\/])(\$null|nul|NUL|/dev/null)([\\\\/]|$)}', $path);
  990. }
  991. public function isEnabled()
  992. {
  993. return $this->enabled;
  994. }
  995. public function getRoot()
  996. {
  997. return $this->root;
  998. }
  999. public function read($file)
  1000. {
  1001. if ($this->enabled) {
  1002. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1003. if (file_exists($this->root . $file)) {
  1004. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  1005. return file_get_contents($this->root . $file);
  1006. }
  1007. }
  1008. return false;
  1009. }
  1010. public function write($file, $contents)
  1011. {
  1012. if ($this->enabled) {
  1013. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1014. $this->io->writeError('Writing '.$this->root . $file.' into cache', true, IOInterface::DEBUG);
  1015. try {
  1016. return file_put_contents($this->root . $file, $contents);
  1017. } catch (\ErrorException $e) {
  1018. $this->io->writeError('<warning>Failed to write into cache: '.$e->getMessage().'</warning>', true, IOInterface::DEBUG);
  1019. if (preg_match('{^file_put_contents\(\): Only ([0-9]+) of ([0-9]+) bytes written}', $e->getMessage(), $m)) {
  1020. unlink($this->root . $file);
  1021. $message = sprintf(
  1022. '<warning>Writing %1$s into cache failed after %2$u of %3$u bytes written, only %4$u bytes of free space available</warning>',
  1023. $this->root . $file,
  1024. $m[1],
  1025. $m[2],
  1026. @disk_free_space($this->root . dirname($file))
  1027. );
  1028. $this->io->writeError($message);
  1029. return false;
  1030. }
  1031. throw $e;
  1032. }
  1033. }
  1034. return false;
  1035. }
  1036. public function copyFrom($file, $source)
  1037. {
  1038. if ($this->enabled) {
  1039. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1040. $this->filesystem->ensureDirectoryExists(dirname($this->root . $file));
  1041. if (!file_exists($source)) {
  1042. $this->io->writeError('<error>'.$source.' does not exist, can not write into cache</error>');
  1043. } elseif ($this->io->isDebug()) {
  1044. $this->io->writeError('Writing '.$this->root . $file.' into cache from '.$source);
  1045. }
  1046. return copy($source, $this->root . $file);
  1047. }
  1048. return false;
  1049. }
  1050. public function copyTo($file, $target)
  1051. {
  1052. if ($this->enabled) {
  1053. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1054. if (file_exists($this->root . $file)) {
  1055. try {
  1056. touch($this->root . $file, filemtime($this->root . $file), time());
  1057. } catch (\ErrorException $e) {
  1058. Silencer::call('touch', $this->root . $file);
  1059. }
  1060. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  1061. return copy($this->root . $file, $target);
  1062. }
  1063. }
  1064. return false;
  1065. }
  1066. public function gcIsNecessary()
  1067. {
  1068. return (!self::$cacheCollected && !mt_rand(0, 50));
  1069. }
  1070. public function remove($file)
  1071. {
  1072. if ($this->enabled) {
  1073. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1074. if (file_exists($this->root . $file)) {
  1075. return $this->filesystem->unlink($this->root . $file);
  1076. }
  1077. }
  1078. return false;
  1079. }
  1080. public function clear()
  1081. {
  1082. if ($this->enabled) {
  1083. $this->filesystem->emptyDirectory($this->root);
  1084. return true;
  1085. }
  1086. return false;
  1087. }
  1088. public function gc($ttl, $maxSize)
  1089. {
  1090. if ($this->enabled) {
  1091. $expire = new \DateTime();
  1092. $expire->modify('-'.$ttl.' seconds');
  1093. $finder = $this->getFinder()->date('until '.$expire->format('Y-m-d H:i:s'));
  1094. foreach ($finder as $file) {
  1095. $this->filesystem->unlink($file->getPathname());
  1096. }
  1097. $totalSize = $this->filesystem->size($this->root);
  1098. if ($totalSize > $maxSize) {
  1099. $iterator = $this->getFinder()->sortByAccessedTime()->getIterator();
  1100. while ($totalSize > $maxSize && $iterator->valid()) {
  1101. $filepath = $iterator->current()->getPathname();
  1102. $totalSize -= $this->filesystem->size($filepath);
  1103. $this->filesystem->unlink($filepath);
  1104. $iterator->next();
  1105. }
  1106. }
  1107. self::$cacheCollected = true;
  1108. return true;
  1109. }
  1110. return false;
  1111. }
  1112. public function sha1($file)
  1113. {
  1114. if ($this->enabled) {
  1115. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1116. if (file_exists($this->root . $file)) {
  1117. return sha1_file($this->root . $file);
  1118. }
  1119. }
  1120. return false;
  1121. }
  1122. public function sha256($file)
  1123. {
  1124. if ($this->enabled) {
  1125. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1126. if (file_exists($this->root . $file)) {
  1127. return hash_file('sha256', $this->root . $file);
  1128. }
  1129. }
  1130. return false;
  1131. }
  1132. protected function getFinder()
  1133. {
  1134. return Finder::create()->in($this->root)->files();
  1135. }
  1136. }
  1137. <?php
  1138. namespace Composer\Command;
  1139. use Symfony\Component\Console\Input\InputInterface;
  1140. use Symfony\Component\Console\Output\OutputInterface;
  1141. class AboutCommand extends BaseCommand
  1142. {
  1143. protected function configure()
  1144. {
  1145. $this
  1146. ->setName('about')
  1147. ->setDescription('Shows the short information about Composer.')
  1148. ->setHelp(
  1149. <<<EOT
  1150. <info>php composer.phar about</info>
  1151. EOT
  1152. )
  1153. ;
  1154. }
  1155. protected function execute(InputInterface $input, OutputInterface $output)
  1156. {
  1157. $this->getIO()->write(
  1158. <<<EOT
  1159. <info>Composer - Dependency Manager for PHP</info>
  1160. <comment>Composer is a dependency manager tracking local dependencies of your projects and libraries.
  1161. See https://getcomposer.org/ for more information.</comment>
  1162. EOT
  1163. );
  1164. return 0;
  1165. }
  1166. }
  1167. <?php
  1168. namespace Composer\Command;
  1169. use Composer\Factory;
  1170. use Composer\IO\IOInterface;
  1171. use Composer\Config;
  1172. use Composer\Composer;
  1173. use Composer\Repository\CompositeRepository;
  1174. use Composer\Repository\RepositoryFactory;
  1175. use Composer\Script\ScriptEvents;
  1176. use Composer\Plugin\CommandEvent;
  1177. use Composer\Plugin\PluginEvents;
  1178. use Composer\Util\Filesystem;
  1179. use Symfony\Component\Console\Input\InputArgument;
  1180. use Symfony\Component\Console\Input\InputInterface;
  1181. use Symfony\Component\Console\Input\InputOption;
  1182. use Symfony\Component\Console\Output\OutputInterface;
  1183. class ArchiveCommand extends BaseCommand
  1184. {
  1185. protected function configure()
  1186. {
  1187. $this
  1188. ->setName('archive')
  1189. ->setDescription('Creates an archive of this composer package.')
  1190. ->setDefinition(array(
  1191. new InputArgument('package', InputArgument::OPTIONAL, 'The package to archive instead of the current project'),
  1192. new InputArgument('version', InputArgument::OPTIONAL, 'A version constraint to find the package to archive'),
  1193. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the resulting archive: tar or zip'),
  1194. new InputOption('dir', null, InputOption::VALUE_REQUIRED, 'Write the archive to this directory'),
  1195. new InputOption('file', null, InputOption::VALUE_REQUIRED, 'Write the archive with the given file name.'
  1196. .' Note that the format will be appended.'),
  1197. new InputOption('ignore-filters', false, InputOption::VALUE_NONE, 'Ignore filters when saving package'),
  1198. ))
  1199. ->setHelp(
  1200. <<<EOT
  1201. The <info>archive</info> command creates an archive of the specified format
  1202. containing the files and directories of the Composer project or the specified
  1203. package in the specified version and writes it to the specified directory.
  1204. <info>php composer.phar archive [--format=zip] [--dir=/foo] [package [version]]</info>
  1205. Read more at https://getcomposer.org/doc/03-cli.md#archive
  1206. EOT
  1207. )
  1208. ;
  1209. }
  1210. protected function execute(InputInterface $input, OutputInterface $output)
  1211. {
  1212. $config = Factory::createConfig();
  1213. $composer = $this->getComposer(false);
  1214. if ($composer) {
  1215. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'archive', $input, $output);
  1216. $eventDispatcher = $composer->getEventDispatcher();
  1217. $eventDispatcher->dispatch($commandEvent->getName(), $commandEvent);
  1218. $eventDispatcher->dispatchScript(ScriptEvents::PRE_ARCHIVE_CMD);
  1219. }
  1220. if (null === $input->getOption('format')) {
  1221. $input->setOption('format', $config->get('archive-format'));
  1222. }
  1223. if (null === $input->getOption('dir')) {
  1224. $input->setOption('dir', $config->get('archive-dir'));
  1225. }
  1226. $returnCode = $this->archive(
  1227. $this->getIO(),
  1228. $config,
  1229. $input->getArgument('package'),
  1230. $input->getArgument('version'),
  1231. $input->getOption('format'),
  1232. $input->getOption('dir'),
  1233. $input->getOption('file'),
  1234. $input->getOption('ignore-filters'),
  1235. $composer
  1236. );
  1237. if (0 === $returnCode && $composer) {
  1238. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ARCHIVE_CMD);
  1239. }
  1240. return $returnCode;
  1241. }
  1242. protected function archive(IOInterface $io, Config $config, $packageName = null, $version = null, $format = 'tar', $dest = '.', $fileName = null, $ignoreFilters = false, Composer $composer = null)
  1243. {
  1244. if ($composer) {
  1245. $archiveManager = $composer->getArchiveManager();
  1246. } else {
  1247. $factory = new Factory;
  1248. $downloadManager = $factory->createDownloadManager($io, $config);
  1249. $archiveManager = $factory->createArchiveManager($config, $downloadManager);
  1250. }
  1251. if ($packageName) {
  1252. $package = $this->selectPackage($io, $packageName, $version);
  1253. if (!$package) {
  1254. return 1;
  1255. }
  1256. } else {
  1257. $package = $this->getComposer()->getPackage();
  1258. }
  1259. $io->writeError('<info>Creating the archive into "'.$dest.'".</info>');
  1260. $packagePath = $archiveManager->archive($package, $format, $dest, $fileName, $ignoreFilters);
  1261. $fs = new Filesystem;
  1262. $shortPath = $fs->findShortestPath(getcwd(), $packagePath, true);
  1263. $io->writeError('Created: ', false);
  1264. $io->write(strlen($shortPath) < strlen($packagePath) ? $shortPath : $packagePath);
  1265. return 0;
  1266. }
  1267. protected function selectPackage(IOInterface $io, $packageName, $version = null)
  1268. {
  1269. $io->writeError('<info>Searching for the specified package.</info>');
  1270. if ($composer = $this->getComposer(false)) {
  1271. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  1272. $repo = new CompositeRepository(array_merge(array($localRepo), $composer->getRepositoryManager()->getRepositories()));
  1273. } else {
  1274. $defaultRepos = RepositoryFactory::defaultRepos($this->getIO());
  1275. $io->writeError('No composer.json found in the current directory, searching packages from ' . implode(', ', array_keys($defaultRepos)));
  1276. $repo = new CompositeRepository($defaultRepos);
  1277. }
  1278. $packages = $repo->findPackages($packageName, $version);
  1279. if (count($packages) > 1) {
  1280. $package = reset($packages);
  1281. $io->writeError('<info>Found multiple matches, selected '.$package->getPrettyString().'.</info>');
  1282. $io->writeError('Alternatives were '.implode(', ', array_map(function ($p) {
  1283. return $p->getPrettyString();
  1284. }, $packages)).'.');
  1285. $io->writeError('<comment>Please use a more specific constraint to pick a different package.</comment>');
  1286. } elseif ($packages) {
  1287. $package = reset($packages);
  1288. $io->writeError('<info>Found an exact match '.$package->getPrettyString().'.</info>');
  1289. } else {
  1290. $io->writeError('<error>Could not find a package matching '.$packageName.'.</error>');
  1291. return false;
  1292. }
  1293. return $package;
  1294. }
  1295. }
  1296. <?php
  1297. namespace Composer\Command;
  1298. use Composer\Composer;
  1299. use Composer\Config;
  1300. use Composer\Console\Application;
  1301. use Composer\Factory;
  1302. use Composer\IO\IOInterface;
  1303. use Composer\IO\NullIO;
  1304. use Composer\Plugin\PreCommandRunEvent;
  1305. use Composer\Plugin\PluginEvents;
  1306. use Symfony\Component\Console\Input\InputInterface;
  1307. use Symfony\Component\Console\Output\OutputInterface;
  1308. use Symfony\Component\Console\Command\Command;
  1309. abstract class BaseCommand extends Command
  1310. {
  1311. private $composer;
  1312. private $io;
  1313. public function getComposer($required = true, $disablePlugins = null)
  1314. {
  1315. if (null === $this->composer) {
  1316. $application = $this->getApplication();
  1317. if ($application instanceof Application) {
  1318. $this->composer = $application->getComposer($required, $disablePlugins);
  1319. } elseif ($required) {
  1320. throw new \RuntimeException(
  1321. 'Could not create a Composer\Composer instance, you must inject '.
  1322. 'one if this command is not used with a Composer\Console\Application instance'
  1323. );
  1324. }
  1325. }
  1326. return $this->composer;
  1327. }
  1328. public function setComposer(Composer $composer)
  1329. {
  1330. $this->composer = $composer;
  1331. }
  1332. public function resetComposer()
  1333. {
  1334. $this->composer = null;
  1335. $this->getApplication()->resetComposer();
  1336. }
  1337. public function isProxyCommand()
  1338. {
  1339. return false;
  1340. }
  1341. public function getIO()
  1342. {
  1343. if (null === $this->io) {
  1344. $application = $this->getApplication();
  1345. if ($application instanceof Application) {
  1346. $this->io = $application->getIO();
  1347. } else {
  1348. $this->io = new NullIO();
  1349. }
  1350. }
  1351. return $this->io;
  1352. }
  1353. public function setIO(IOInterface $io)
  1354. {
  1355. $this->io = $io;
  1356. }
  1357. protected function initialize(InputInterface $input, OutputInterface $output)
  1358. {
  1359. $disablePlugins = $input->hasParameterOption('--no-plugins');
  1360. $composer = $this->getComposer(false, $disablePlugins);
  1361. if (null === $composer) {
  1362. $composer = Factory::createGlobal($this->getIO(), $disablePlugins);
  1363. }
  1364. if ($composer) {
  1365. $preCommandRunEvent = new PreCommandRunEvent(PluginEvents::PRE_COMMAND_RUN, $input, $this->getName());
  1366. $composer->getEventDispatcher()->dispatch($preCommandRunEvent->getName(), $preCommandRunEvent);
  1367. }
  1368. if (true === $input->hasParameterOption(array('--no-ansi')) && $input->hasOption('no-progress')) {
  1369. $input->setOption('no-progress', true);
  1370. }
  1371. parent::initialize($input, $output);
  1372. }
  1373. protected function getPreferredInstallOptions(Config $config, InputInterface $input, $keepVcsRequiresPreferSource = false)
  1374. {
  1375. $preferSource = false;
  1376. $preferDist = false;
  1377. switch ($config->get('preferred-install')) {
  1378. case 'source':
  1379. $preferSource = true;
  1380. break;
  1381. case 'dist':
  1382. $preferDist = true;
  1383. break;
  1384. case 'auto':
  1385. default:
  1386. break;
  1387. }
  1388. if ($input->getOption('prefer-source') || $input->getOption('prefer-dist') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'))) {
  1389. $preferSource = $input->getOption('prefer-source') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'));
  1390. $preferDist = $input->getOption('prefer-dist');
  1391. }
  1392. return array($preferSource, $preferDist);
  1393. }
  1394. }
  1395. <?php
  1396. namespace Composer\Command;
  1397. use Composer\DependencyResolver\Pool;
  1398. use Composer\Package\Link;
  1399. use Composer\Package\PackageInterface;
  1400. use Composer\Repository\ArrayRepository;
  1401. use Composer\Repository\CompositeRepository;
  1402. use Composer\Repository\PlatformRepository;
  1403. use Composer\Repository\RepositoryFactory;
  1404. use Composer\Plugin\CommandEvent;
  1405. use Composer\Plugin\PluginEvents;
  1406. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  1407. use Composer\Package\Version\VersionParser;
  1408. use Symfony\Component\Console\Helper\Table;
  1409. use Symfony\Component\Console\Input\InputArgument;
  1410. use Symfony\Component\Console\Input\InputInterface;
  1411. use Symfony\Component\Console\Input\InputOption;
  1412. use Symfony\Component\Console\Output\OutputInterface;
  1413. class BaseDependencyCommand extends BaseCommand
  1414. {
  1415. const ARGUMENT_PACKAGE = 'package';
  1416. const ARGUMENT_CONSTRAINT = 'constraint';
  1417. const OPTION_RECURSIVE = 'recursive';
  1418. const OPTION_TREE = 'tree';
  1419. protected $colors;
  1420. protected function configure()
  1421. {
  1422. $this->setDefinition(array(
  1423. new InputArgument(self::ARGUMENT_PACKAGE, InputArgument::REQUIRED, 'Package to inspect'),
  1424. new InputArgument(self::ARGUMENT_CONSTRAINT, InputArgument::OPTIONAL, 'Optional version constraint', '*'),
  1425. new InputOption(self::OPTION_RECURSIVE, 'r', InputOption::VALUE_NONE, 'Recursively resolves up to the root package'),
  1426. new InputOption(self::OPTION_TREE, 't', InputOption::VALUE_NONE, 'Prints the results as a nested tree'),
  1427. ));
  1428. }
  1429. protected function doExecute(InputInterface $input, OutputInterface $output, $inverted = false)
  1430. {
  1431. $composer = $this->getComposer();
  1432. $commandEvent = new CommandEvent(PluginEvents::COMMAND, $this->getName(), $input, $output);
  1433. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  1434. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  1435. $repository = new CompositeRepository(array(
  1436. new ArrayRepository(array($composer->getPackage())),
  1437. $composer->getRepositoryManager()->getLocalRepository(),
  1438. new PlatformRepository(array(), $platformOverrides),
  1439. ));
  1440. $pool = new Pool();
  1441. $pool->addRepository($repository);
  1442. list($needle, $textConstraint) = array_pad(
  1443. explode(':', $input->getArgument(self::ARGUMENT_PACKAGE)),
  1444. 2,
  1445. $input->getArgument(self::ARGUMENT_CONSTRAINT)
  1446. );
  1447. $packages = $pool->whatProvides(strtolower($needle));
  1448. if (empty($packages)) {
  1449. throw new \InvalidArgumentException(sprintf('Could not find package "%s" in your project', $needle));
  1450. }
  1451. if (!$repository->findPackage($needle, $textConstraint)) {
  1452. $defaultRepos = new CompositeRepository(RepositoryFactory::defaultRepos($this->getIO()));
  1453. if ($match = $defaultRepos->findPackage($needle, $textConstraint)) {
  1454. $repository->addRepository(new ArrayRepository(array(clone $match)));
  1455. }
  1456. }
  1457. $needles = array($needle);
  1458. if ($inverted) {
  1459. foreach ($packages as $package) {
  1460. $needles = array_merge($needles, array_map(function (Link $link) {
  1461. return $link->getTarget();
  1462. }, $package->getReplaces()));
  1463. }
  1464. }
  1465. if ('*' !== $textConstraint) {
  1466. $versionParser = new VersionParser();
  1467. $constraint = $versionParser->parseConstraints($textConstraint);
  1468. } else {
  1469. $constraint = null;
  1470. }
  1471. $renderTree = $input->getOption(self::OPTION_TREE);
  1472. $recursive = $renderTree || $input->getOption(self::OPTION_RECURSIVE);
  1473. $results = $repository->getDependents($needles, $constraint, $inverted, $recursive);
  1474. if (empty($results)) {
  1475. $extra = (null !== $constraint) ? sprintf(' in versions %smatching %s', $inverted ? 'not ' : '', $textConstraint) : '';
  1476. $this->getIO()->writeError(sprintf(
  1477. '<info>There is no installed package depending on "%s"%s</info>',
  1478. $needle,
  1479. $extra
  1480. ));
  1481. } elseif ($renderTree) {
  1482. $this->initStyles($output);
  1483. $root = $packages[0];
  1484. $this->getIO()->write(sprintf('<info>%s</info> %s %s', $root->getPrettyName(), $root->getPrettyVersion(), $root->getDescription()));
  1485. $this->printTree($results);
  1486. } else {
  1487. $this->printTable($output, $results);
  1488. }
  1489. return 0;
  1490. }
  1491. protected function printTable(OutputInterface $output, $results)
  1492. {
  1493. $table = array();
  1494. $doubles = array();
  1495. do {
  1496. $queue = array();
  1497. $rows = array();
  1498. foreach ($results as $result) {
  1499. list($package, $link, $children) = $result;
  1500. $unique = (string) $link;
  1501. if (isset($doubles[$unique])) {
  1502. continue;
  1503. }
  1504. $doubles[$unique] = true;
  1505. $version = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '-' : $package->getPrettyVersion();
  1506. $rows[] = array($package->getPrettyName(), $version, $link->getDescription(), sprintf('%s (%s)', $link->getTarget(), $link->getPrettyConstraint()));
  1507. if ($children) {
  1508. $queue = array_merge($queue, $children);
  1509. }
  1510. }
  1511. $results = $queue;
  1512. $table = array_merge($rows, $table);
  1513. } while (!empty($results));
  1514. $renderer = new Table($output);
  1515. $renderer->setStyle('compact');
  1516. $rendererStyle = $renderer->getStyle();
  1517. $rendererStyle->setVerticalBorderChar('');
  1518. $rendererStyle->setCellRowContentFormat('%s ');
  1519. $renderer->setRows($table)->render();
  1520. }
  1521. protected function initStyles(OutputInterface $output)
  1522. {
  1523. $this->colors = array(
  1524. 'green',
  1525. 'yellow',
  1526. 'cyan',
  1527. 'magenta',
  1528. 'blue',
  1529. );
  1530. foreach ($this->colors as $color) {
  1531. $style = new OutputFormatterStyle($color);
  1532. $output->getFormatter()->setStyle($color, $style);
  1533. }
  1534. }
  1535. protected function printTree($results, $prefix = '', $level = 1)
  1536. {
  1537. $count = count($results);
  1538. $idx = 0;
  1539. foreach ($results as $result) {
  1540. list($package, $link, $children) = $result;
  1541. $color = $this->colors[$level % count($this->colors)];
  1542. $prevColor = $this->colors[($level - 1) % count($this->colors)];
  1543. $isLast = (++$idx == $count);
  1544. $versionText = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '' : $package->getPrettyVersion();
  1545. $packageText = rtrim(sprintf('<%s>%s</%1$s> %s', $color, $package->getPrettyName(), $versionText));
  1546. $linkText = sprintf('%s <%s>%s</%2$s> %s', $link->getDescription(), $prevColor, $link->getTarget(), $link->getPrettyConstraint());
  1547. $circularWarn = $children === false ? '(circular dependency aborted here)' : '';
  1548. $this->writeTreeLine(rtrim(sprintf("%s%s%s (%s) %s", $prefix, $isLast ? '└──' : '├──', $packageText, $linkText, $circularWarn)));
  1549. if ($children) {
  1550. $this->printTree($children, $prefix . ($isLast ? ' ' : '│ '), $level + 1);
  1551. }
  1552. }
  1553. }
  1554. private function writeTreeLine($line)
  1555. {
  1556. $io = $this->getIO();
  1557. if (!$io->isDecorated()) {
  1558. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  1559. }
  1560. $io->write($line);
  1561. }
  1562. }
  1563. <?php
  1564. namespace Composer\Command;
  1565. use Composer\Package\Link;
  1566. use Composer\Package\PackageInterface;
  1567. use Composer\Semver\Constraint\Constraint;
  1568. use Symfony\Component\Console\Helper\Table;
  1569. use Symfony\Component\Console\Input\InputInterface;
  1570. use Symfony\Component\Console\Input\InputOption;
  1571. use Symfony\Component\Console\Output\OutputInterface;
  1572. use Composer\Repository\PlatformRepository;
  1573. class CheckPlatformReqsCommand extends BaseCommand
  1574. {
  1575. protected function configure()
  1576. {
  1577. $this->setName('check-platform-reqs')
  1578. ->setDescription('Check that platform requirements are satisfied.')
  1579. ->setDefinition(array(
  1580. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables checking of require-dev packages requirements.'),
  1581. ))
  1582. ->setHelp(
  1583. <<<EOT
  1584. Checks that your PHP and extensions versions match the platform requirements of the installed packages.
  1585. Unlike update/install, this command will ignore config.platform settings and check the real platform packages so you can be certain you have the required platform dependencies.
  1586. <info>php composer.phar check-platform-reqs</info>
  1587. EOT
  1588. );
  1589. }
  1590. protected function execute(InputInterface $input, OutputInterface $output)
  1591. {
  1592. $composer = $this->getComposer();
  1593. $requires = $composer->getPackage()->getRequires();
  1594. if ($input->getOption('no-dev')) {
  1595. $dependencies = $composer->getLocker()->getLockedRepository(!$input->getOption('no-dev'))->getPackages();
  1596. } else {
  1597. $dependencies = $composer->getRepositoryManager()->getLocalRepository()->getPackages();
  1598. if (!$dependencies) {
  1599. $dependencies = $composer->getLocker()->getLockedRepository(true)->getPackages();
  1600. }
  1601. $requires += $composer->getPackage()->getDevRequires();
  1602. }
  1603. foreach ($requires as $require => $link) {
  1604. $requires[$require] = array($link);
  1605. }
  1606. foreach ($dependencies as $package) {
  1607. foreach ($package->getRequires() as $require => $link) {
  1608. $requires[$require][] = $link;
  1609. }
  1610. }
  1611. ksort($requires);
  1612. $platformRepo = new PlatformRepository(array(), array());
  1613. $currentPlatformPackages = $platformRepo->getPackages();
  1614. $currentPlatformPackageMap = array();
  1615. foreach ($currentPlatformPackages as $currentPlatformPackage) {
  1616. $currentPlatformPackageMap[$currentPlatformPackage->getName()] = $currentPlatformPackage;
  1617. }
  1618. $results = array();
  1619. $exitCode = 0;
  1620. foreach ($requires as $require => $links) {
  1621. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $require)) {
  1622. if (isset($currentPlatformPackageMap[$require])) {
  1623. $pass = true;
  1624. $version = $currentPlatformPackageMap[$require]->getVersion();
  1625. foreach ($links as $link) {
  1626. if (!$link->getConstraint()->matches(new Constraint('=', $version))) {
  1627. $results[] = array(
  1628. $currentPlatformPackageMap[$require]->getPrettyName(),
  1629. $currentPlatformPackageMap[$require]->getPrettyVersion(),
  1630. $link,
  1631. '<error>failed</error>',
  1632. );
  1633. $pass = false;
  1634. $exitCode = max($exitCode, 1);
  1635. }
  1636. }
  1637. if ($pass) {
  1638. $results[] = array(
  1639. $currentPlatformPackageMap[$require]->getPrettyName(),
  1640. $currentPlatformPackageMap[$require]->getPrettyVersion(),
  1641. null,
  1642. '<info>success</info>',
  1643. );
  1644. }
  1645. } else {
  1646. $results[] = array(
  1647. $require,
  1648. 'n/a',
  1649. $links[0],
  1650. '<error>missing</error>',
  1651. );
  1652. $exitCode = max($exitCode, 2);
  1653. }
  1654. }
  1655. }
  1656. $this->printTable($output, $results);
  1657. return $exitCode;
  1658. }
  1659. protected function printTable(OutputInterface $output, $results)
  1660. {
  1661. $table = array();
  1662. $rows = array();
  1663. foreach ($results as $result) {
  1664. list($platformPackage, $version, $link, $status) = $result;
  1665. $rows[] = array(
  1666. $platformPackage,
  1667. $version,
  1668. $link ? sprintf('%s %s %s (%s)', $link->getSource(), $link->getDescription(), $link->getTarget(), $link->getPrettyConstraint()) : '',
  1669. $status,
  1670. );
  1671. }
  1672. $table = array_merge($rows, $table);
  1673. $renderer = new Table($output);
  1674. $renderer->setStyle('compact');
  1675. $rendererStyle = $renderer->getStyle();
  1676. $rendererStyle->setVerticalBorderChar('');
  1677. $rendererStyle->setCellRowContentFormat('%s ');
  1678. $renderer->setRows($table)->render();
  1679. }
  1680. }
  1681. <?php
  1682. namespace Composer\Command;
  1683. use Composer\Cache;
  1684. use Composer\Factory;
  1685. use Symfony\Component\Console\Input\InputInterface;
  1686. use Symfony\Component\Console\Output\OutputInterface;
  1687. class ClearCacheCommand extends BaseCommand
  1688. {
  1689. protected function configure()
  1690. {
  1691. $this
  1692. ->setName('clear-cache')
  1693. ->setAliases(array('clearcache'))
  1694. ->setDescription('Clears composer\'s internal package cache.')
  1695. ->setHelp(
  1696. <<<EOT
  1697. The <info>clear-cache</info> deletes all cached packages from composer's
  1698. cache directory.
  1699. Read more at https://getcomposer.org/doc/03-cli.md#clear-cache-clearcache-
  1700. EOT
  1701. )
  1702. ;
  1703. }
  1704. protected function execute(InputInterface $input, OutputInterface $output)
  1705. {
  1706. $config = Factory::createConfig();
  1707. $io = $this->getIO();
  1708. $cachePaths = array(
  1709. 'cache-vcs-dir' => $config->get('cache-vcs-dir'),
  1710. 'cache-repo-dir' => $config->get('cache-repo-dir'),
  1711. 'cache-files-dir' => $config->get('cache-files-dir'),
  1712. 'cache-dir' => $config->get('cache-dir'),
  1713. );
  1714. foreach ($cachePaths as $key => $cachePath) {
  1715. $cachePath = realpath($cachePath);
  1716. if (!$cachePath) {
  1717. $io->writeError("<info>Cache directory does not exist ($key): $cachePath</info>");
  1718. continue;
  1719. }
  1720. $cache = new Cache($io, $cachePath);
  1721. if (!$cache->isEnabled()) {
  1722. $io->writeError("<info>Cache is not enabled ($key): $cachePath</info>");
  1723. continue;
  1724. }
  1725. $io->writeError("<info>Clearing cache ($key): $cachePath</info>");
  1726. $cache->clear();
  1727. }
  1728. $io->writeError('<info>All caches cleared.</info>');
  1729. return 0;
  1730. }
  1731. }
  1732. <?php
  1733. namespace Composer\Command;
  1734. use Composer\Util\Platform;
  1735. use Composer\Util\Silencer;
  1736. use Symfony\Component\Console\Input\InputInterface;
  1737. use Symfony\Component\Console\Input\InputArgument;
  1738. use Symfony\Component\Console\Input\InputOption;
  1739. use Symfony\Component\Console\Output\OutputInterface;
  1740. use Composer\Config;
  1741. use Composer\Config\JsonConfigSource;
  1742. use Composer\Factory;
  1743. use Composer\IO\IOInterface;
  1744. use Composer\Json\JsonFile;
  1745. use Composer\Semver\VersionParser;
  1746. use Composer\Package\BasePackage;
  1747. class ConfigCommand extends BaseCommand
  1748. {
  1749. protected $config;
  1750. protected $configFile;
  1751. protected $configSource;
  1752. protected $authConfigFile;
  1753. protected $authConfigSource;
  1754. protected function configure()
  1755. {
  1756. $this
  1757. ->setName('config')
  1758. ->setDescription('Sets config options.')
  1759. ->setDefinition(array(
  1760. new InputOption('global', 'g', InputOption::VALUE_NONE, 'Apply command to the global config file'),
  1761. new InputOption('editor', 'e', InputOption::VALUE_NONE, 'Open editor'),
  1762. new InputOption('auth', 'a', InputOption::VALUE_NONE, 'Affect auth config file (only used for --editor)'),
  1763. new InputOption('unset', null, InputOption::VALUE_NONE, 'Unset the given setting-key'),
  1764. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List configuration settings'),
  1765. new InputOption('file', 'f', InputOption::VALUE_REQUIRED, 'If you want to choose a different composer.json or config.json'),
  1766. new InputOption('absolute', null, InputOption::VALUE_NONE, 'Returns absolute paths when fetching *-dir config values instead of relative'),
  1767. new InputArgument('setting-key', null, 'Setting key'),
  1768. new InputArgument('setting-value', InputArgument::IS_ARRAY, 'Setting value'),
  1769. ))
  1770. ->setHelp(
  1771. <<<EOT
  1772. This command allows you to edit composer config settings and repositories
  1773. in either the local composer.json file or the global config.json file.
  1774. Additionally it lets you edit most properties in the local composer.json.
  1775. To set a config setting:
  1776. <comment>%command.full_name% bin-dir bin/</comment>
  1777. To read a config setting:
  1778. <comment>%command.full_name% bin-dir</comment>
  1779. Outputs: <info>bin</info>
  1780. To edit the global config.json file:
  1781. <comment>%command.full_name% --global</comment>
  1782. To add a repository:
  1783. <comment>%command.full_name% repositories.foo vcs https://bar.com</comment>
  1784. To remove a repository (repo is a short alias for repositories):
  1785. <comment>%command.full_name% --unset repo.foo</comment>
  1786. To disable packagist:
  1787. <comment>%command.full_name% repo.packagist false</comment>
  1788. You can alter repositories in the global config.json file by passing in the
  1789. <info>--global</info> option.
  1790. To edit the file in an external editor:
  1791. <comment>%command.full_name% --editor</comment>
  1792. To choose your editor you can set the "EDITOR" env variable.
  1793. To get a list of configuration values in the file:
  1794. <comment>%command.full_name% --list</comment>
  1795. You can always pass more than one option. As an example, if you want to edit the
  1796. global config.json file.
  1797. <comment>%command.full_name% --editor --global</comment>
  1798. Read more at https://getcomposer.org/doc/03-cli.md#config
  1799. EOT
  1800. )
  1801. ;
  1802. }
  1803. protected function initialize(InputInterface $input, OutputInterface $output)
  1804. {
  1805. parent::initialize($input, $output);
  1806. if ($input->getOption('global') && null !== $input->getOption('file')) {
  1807. throw new \RuntimeException('--file and --global can not be combined');
  1808. }
  1809. $io = $this->getIO();
  1810. $this->config = Factory::createConfig($io);
  1811. $configFile = $input->getOption('global')
  1812. ? ($this->config->get('home') . '/config.json')
  1813. : ($input->getOption('file') ?: Factory::getComposerFile());
  1814. if (
  1815. ($configFile === 'composer.json' || $configFile === './composer.json')
  1816. && !file_exists($configFile)
  1817. && realpath(getcwd()) === realpath($this->config->get('home'))
  1818. ) {
  1819. file_put_contents($configFile, "{\n}\n");
  1820. }
  1821. $this->configFile = new JsonFile($configFile, null, $io);
  1822. $this->configSource = new JsonConfigSource($this->configFile);
  1823. $authConfigFile = $input->getOption('global')
  1824. ? ($this->config->get('home') . '/auth.json')
  1825. : dirname(realpath($configFile)) . '/auth.json';
  1826. $this->authConfigFile = new JsonFile($authConfigFile, null, $io);
  1827. $this->authConfigSource = new JsonConfigSource($this->authConfigFile, true);
  1828. if ($input->getOption('global') && !$this->configFile->exists()) {
  1829. touch($this->configFile->getPath());
  1830. $this->configFile->write(array('config' => new \ArrayObject));
  1831. Silencer::call('chmod', $this->configFile->getPath(), 0600);
  1832. }
  1833. if ($input->getOption('global') && !$this->authConfigFile->exists()) {
  1834. touch($this->authConfigFile->getPath());
  1835. $this->authConfigFile->write(array('bitbucket-oauth' => new \ArrayObject, 'github-oauth' => new \ArrayObject, 'gitlab-oauth' => new \ArrayObject, 'gitlab-token' => new \ArrayObject, 'http-basic' => new \ArrayObject));
  1836. Silencer::call('chmod', $this->authConfigFile->getPath(), 0600);
  1837. }
  1838. if (!$this->configFile->exists()) {
  1839. throw new \RuntimeException(sprintf('File "%s" cannot be found in the current directory', $configFile));
  1840. }
  1841. }
  1842. protected function execute(InputInterface $input, OutputInterface $output)
  1843. {
  1844. if ($input->getOption('editor')) {
  1845. $editor = escapeshellcmd(getenv('EDITOR'));
  1846. if (!$editor) {
  1847. if (Platform::isWindows()) {
  1848. $editor = 'notepad';
  1849. } else {
  1850. foreach (array('editor', 'vim', 'vi', 'nano', 'pico', 'ed') as $candidate) {
  1851. if (exec('which '.$candidate)) {
  1852. $editor = $candidate;
  1853. break;
  1854. }
  1855. }
  1856. }
  1857. }
  1858. $file = $input->getOption('auth') ? $this->authConfigFile->getPath() : $this->configFile->getPath();
  1859. system($editor . ' ' . $file . (Platform::isWindows() ? '' : ' > `tty`'));
  1860. return 0;
  1861. }
  1862. if (!$input->getOption('global')) {
  1863. $this->config->merge($this->configFile->read());
  1864. $this->config->merge(array('config' => $this->authConfigFile->exists() ? $this->authConfigFile->read() : array()));
  1865. }
  1866. if ($input->getOption('list')) {
  1867. $this->listConfiguration($this->config->all(), $this->config->raw(), $output);
  1868. return 0;
  1869. }
  1870. $settingKey = $input->getArgument('setting-key');
  1871. if (!$settingKey) {
  1872. return 0;
  1873. }
  1874. if (array() !== $input->getArgument('setting-value') && $input->getOption('unset')) {
  1875. throw new \RuntimeException('You can not combine a setting value with --unset');
  1876. }
  1877. if (array() === $input->getArgument('setting-value') && !$input->getOption('unset')) {
  1878. $properties = array('name', 'type', 'description', 'homepage', 'version', 'minimum-stability', 'prefer-stable', 'keywords', 'license', 'extra');
  1879. $rawData = $this->configFile->read();
  1880. $data = $this->config->all();
  1881. if (preg_match('/^repos?(?:itories)?(?:\.(.+))?/', $settingKey, $matches)) {
  1882. if (!isset($matches[1]) || $matches[1] === '') {
  1883. $value = isset($data['repositories']) ? $data['repositories'] : array();
  1884. } else {
  1885. if (!isset($data['repositories'][$matches[1]])) {
  1886. throw new \InvalidArgumentException('There is no '.$matches[1].' repository defined');
  1887. }
  1888. $value = $data['repositories'][$matches[1]];
  1889. }
  1890. } elseif (strpos($settingKey, '.')) {
  1891. $bits = explode('.', $settingKey);
  1892. if ($bits[0] === 'extra') {
  1893. $data = $rawData;
  1894. } else {
  1895. $data = $data['config'];
  1896. }
  1897. $match = false;
  1898. foreach ($bits as $bit) {
  1899. $key = isset($key) ? $key.'.'.$bit : $bit;
  1900. $match = false;
  1901. if (isset($data[$key])) {
  1902. $match = true;
  1903. $data = $data[$key];
  1904. unset($key);
  1905. }
  1906. }
  1907. if (!$match) {
  1908. throw new \RuntimeException($settingKey.' is not defined.');
  1909. }
  1910. $value = $data;
  1911. } elseif (isset($data['config'][$settingKey])) {
  1912. $value = $this->config->get($settingKey, $input->getOption('absolute') ? 0 : Config::RELATIVE_PATHS);
  1913. } elseif (in_array($settingKey, $properties, true) && isset($rawData[$settingKey])) {
  1914. $value = $rawData[$settingKey];
  1915. } else {
  1916. throw new \RuntimeException($settingKey.' is not defined');
  1917. }
  1918. if (is_array($value)) {
  1919. $value = json_encode($value);
  1920. }
  1921. $this->getIO()->write($value, true, IOInterface::QUIET);
  1922. return 0;
  1923. }
  1924. $values = $input->getArgument('setting-value');
  1925. $booleanValidator = function ($val) {
  1926. return in_array($val, array('true', 'false', '1', '0'), true);
  1927. };
  1928. $booleanNormalizer = function ($val) {
  1929. return $val !== 'false' && (bool) $val;
  1930. };
  1931. $uniqueConfigValues = array(
  1932. 'process-timeout' => array('is_numeric', 'intval'),
  1933. 'use-include-path' => array($booleanValidator, $booleanNormalizer),
  1934. 'use-github-api' => array($booleanValidator, $booleanNormalizer),
  1935. 'preferred-install' => array(
  1936. function ($val) {
  1937. return in_array($val, array('auto', 'source', 'dist'), true);
  1938. },
  1939. function ($val) {
  1940. return $val;
  1941. },
  1942. ),
  1943. 'store-auths' => array(
  1944. function ($val) {
  1945. return in_array($val, array('true', 'false', 'prompt'), true);
  1946. },
  1947. function ($val) {
  1948. if ('prompt' === $val) {
  1949. return 'prompt';
  1950. }
  1951. return $val !== 'false' && (bool) $val;
  1952. },
  1953. ),
  1954. 'notify-on-install' => array($booleanValidator, $booleanNormalizer),
  1955. 'vendor-dir' => array('is_string', function ($val) {
  1956. return $val;
  1957. }),
  1958. 'bin-dir' => array('is_string', function ($val) {
  1959. return $val;
  1960. }),
  1961. 'archive-dir' => array('is_string', function ($val) {
  1962. return $val;
  1963. }),
  1964. 'archive-format' => array('is_string', function ($val) {
  1965. return $val;
  1966. }),
  1967. 'data-dir' => array('is_string', function ($val) {
  1968. return $val;
  1969. }),
  1970. 'cache-dir' => array('is_string', function ($val) {
  1971. return $val;
  1972. }),
  1973. 'cache-files-dir' => array('is_string', function ($val) {
  1974. return $val;
  1975. }),
  1976. 'cache-repo-dir' => array('is_string', function ($val) {
  1977. return $val;
  1978. }),
  1979. 'cache-vcs-dir' => array('is_string', function ($val) {
  1980. return $val;
  1981. }),
  1982. 'cache-ttl' => array('is_numeric', 'intval'),
  1983. 'cache-files-ttl' => array('is_numeric', 'intval'),
  1984. 'cache-files-maxsize' => array(
  1985. function ($val) {
  1986. return preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $val) > 0;
  1987. },
  1988. function ($val) {
  1989. return $val;
  1990. },
  1991. ),
  1992. 'bin-compat' => array(
  1993. function ($val) {
  1994. return in_array($val, array('auto', 'full'));
  1995. },
  1996. function ($val) {
  1997. return $val;
  1998. },
  1999. ),
  2000. 'discard-changes' => array(
  2001. function ($val) {
  2002. return in_array($val, array('stash', 'true', 'false', '1', '0'), true);
  2003. },
  2004. function ($val) {
  2005. if ('stash' === $val) {
  2006. return 'stash';
  2007. }
  2008. return $val !== 'false' && (bool) $val;
  2009. },
  2010. ),
  2011. 'autoloader-suffix' => array('is_string', function ($val) {
  2012. return $val === 'null' ? null : $val;
  2013. }),
  2014. 'sort-packages' => array($booleanValidator, $booleanNormalizer),
  2015. 'optimize-autoloader' => array($booleanValidator, $booleanNormalizer),
  2016. 'classmap-authoritative' => array($booleanValidator, $booleanNormalizer),
  2017. 'apcu-autoloader' => array($booleanValidator, $booleanNormalizer),
  2018. 'prepend-autoloader' => array($booleanValidator, $booleanNormalizer),
  2019. 'disable-tls' => array($booleanValidator, $booleanNormalizer),
  2020. 'secure-http' => array($booleanValidator, $booleanNormalizer),
  2021. 'cafile' => array(
  2022. function ($val) {
  2023. return file_exists($val) && is_readable($val);
  2024. },
  2025. function ($val) {
  2026. return $val === 'null' ? null : $val;
  2027. },
  2028. ),
  2029. 'capath' => array(
  2030. function ($val) {
  2031. return is_dir($val) && is_readable($val);
  2032. },
  2033. function ($val) {
  2034. return $val === 'null' ? null : $val;
  2035. },
  2036. ),
  2037. 'github-expose-hostname' => array($booleanValidator, $booleanNormalizer),
  2038. 'htaccess-protect' => array($booleanValidator, $booleanNormalizer),
  2039. 'lock' => array($booleanValidator, $booleanNormalizer),
  2040. );
  2041. $multiConfigValues = array(
  2042. 'github-protocols' => array(
  2043. function ($vals) {
  2044. if (!is_array($vals)) {
  2045. return 'array expected';
  2046. }
  2047. foreach ($vals as $val) {
  2048. if (!in_array($val, array('git', 'https', 'ssh'))) {
  2049. return 'valid protocols include: git, https, ssh';
  2050. }
  2051. }
  2052. return true;
  2053. },
  2054. function ($vals) {
  2055. return $vals;
  2056. },
  2057. ),
  2058. 'github-domains' => array(
  2059. function ($vals) {
  2060. if (!is_array($vals)) {
  2061. return 'array expected';
  2062. }
  2063. return true;
  2064. },
  2065. function ($vals) {
  2066. return $vals;
  2067. },
  2068. ),
  2069. 'gitlab-domains' => array(
  2070. function ($vals) {
  2071. if (!is_array($vals)) {
  2072. return 'array expected';
  2073. }
  2074. return true;
  2075. },
  2076. function ($vals) {
  2077. return $vals;
  2078. },
  2079. ),
  2080. );
  2081. if ($input->getOption('unset') && (isset($uniqueConfigValues[$settingKey]) || isset($multiConfigValues[$settingKey]))) {
  2082. if ($settingKey === 'disable-tls' && $this->config->get('disable-tls')) {
  2083. $this->getIO()->writeError('<info>You are now running Composer with SSL/TLS protection enabled.</info>');
  2084. }
  2085. $this->configSource->removeConfigSetting($settingKey);
  2086. return 0;
  2087. }
  2088. if (isset($uniqueConfigValues[$settingKey])) {
  2089. $this->handleSingleValue($settingKey, $uniqueConfigValues[$settingKey], $values, 'addConfigSetting');
  2090. return 0;
  2091. }
  2092. if (isset($multiConfigValues[$settingKey])) {
  2093. $this->handleMultiValue($settingKey, $multiConfigValues[$settingKey], $values, 'addConfigSetting');
  2094. return 0;
  2095. }
  2096. $uniqueProps = array(
  2097. 'name' => array('is_string', function ($val) {
  2098. return $val;
  2099. }),
  2100. 'type' => array('is_string', function ($val) {
  2101. return $val;
  2102. }),
  2103. 'description' => array('is_string', function ($val) {
  2104. return $val;
  2105. }),
  2106. 'homepage' => array('is_string', function ($val) {
  2107. return $val;
  2108. }),
  2109. 'version' => array('is_string', function ($val) {
  2110. return $val;
  2111. }),
  2112. 'minimum-stability' => array(
  2113. function ($val) {
  2114. return isset(BasePackage::$stabilities[VersionParser::normalizeStability($val)]);
  2115. },
  2116. function ($val) {
  2117. return VersionParser::normalizeStability($val);
  2118. },
  2119. ),
  2120. 'prefer-stable' => array($booleanValidator, $booleanNormalizer),
  2121. );
  2122. $multiProps = array(
  2123. 'keywords' => array(
  2124. function ($vals) {
  2125. if (!is_array($vals)) {
  2126. return 'array expected';
  2127. }
  2128. return true;
  2129. },
  2130. function ($vals) {
  2131. return $vals;
  2132. },
  2133. ),
  2134. 'license' => array(
  2135. function ($vals) {
  2136. if (!is_array($vals)) {
  2137. return 'array expected';
  2138. }
  2139. return true;
  2140. },
  2141. function ($vals) {
  2142. return $vals;
  2143. },
  2144. ),
  2145. );
  2146. if ($input->getOption('global') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]) || substr($settingKey, 0, 6) === 'extra.')) {
  2147. 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');
  2148. }
  2149. if ($input->getOption('unset') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]))) {
  2150. $this->configSource->removeProperty($settingKey);
  2151. return 0;
  2152. }
  2153. if (isset($uniqueProps[$settingKey])) {
  2154. $this->handleSingleValue($settingKey, $uniqueProps[$settingKey], $values, 'addProperty');
  2155. return 0;
  2156. }
  2157. if (isset($multiProps[$settingKey])) {
  2158. $this->handleMultiValue($settingKey, $multiProps[$settingKey], $values, 'addProperty');
  2159. return 0;
  2160. }
  2161. if (preg_match('/^repos?(?:itories)?\.(.+)/', $settingKey, $matches)) {
  2162. if ($input->getOption('unset')) {
  2163. $this->configSource->removeRepository($matches[1]);
  2164. return 0;
  2165. }
  2166. if (2 === count($values)) {
  2167. $this->configSource->addRepository($matches[1], array(
  2168. 'type' => $values[0],
  2169. 'url' => $values[1],
  2170. ));
  2171. return 0;
  2172. }
  2173. if (1 === count($values)) {
  2174. $value = strtolower($values[0]);
  2175. if (true === $booleanValidator($value)) {
  2176. if (false === $booleanNormalizer($value)) {
  2177. $this->configSource->addRepository($matches[1], false);
  2178. return 0;
  2179. }
  2180. } else {
  2181. $value = JsonFile::parseJson($values[0]);
  2182. $this->configSource->addRepository($matches[1], $value);
  2183. return 0;
  2184. }
  2185. }
  2186. throw new \RuntimeException('You must pass the type and a url. Example: php composer.phar config repositories.foo vcs https://bar.com');
  2187. }
  2188. if (preg_match('/^extra\.(.+)/', $settingKey, $matches)) {
  2189. if ($input->getOption('unset')) {
  2190. $this->configSource->removeProperty($settingKey);
  2191. return 0;
  2192. }
  2193. $this->configSource->addProperty($settingKey, $values[0]);
  2194. return 0;
  2195. }
  2196. if (preg_match('/^platform\.(.+)/', $settingKey, $matches)) {
  2197. if ($input->getOption('unset')) {
  2198. $this->configSource->removeConfigSetting($settingKey);
  2199. return 0;
  2200. }
  2201. $this->configSource->addConfigSetting($settingKey, $values[0]);
  2202. return 0;
  2203. }
  2204. if ($settingKey === 'platform' && $input->getOption('unset')) {
  2205. $this->configSource->removeConfigSetting($settingKey);
  2206. return 0;
  2207. }
  2208. if (preg_match('/^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic)\.(.+)/', $settingKey, $matches)) {
  2209. if ($input->getOption('unset')) {
  2210. $this->authConfigSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2211. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2212. return 0;
  2213. }
  2214. if ($matches[1] === 'bitbucket-oauth') {
  2215. if (2 !== count($values)) {
  2216. throw new \RuntimeException('Expected two arguments (consumer-key, consumer-secret), got '.count($values));
  2217. }
  2218. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2219. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('consumer-key' => $values[0], 'consumer-secret' => $values[1]));
  2220. } elseif (in_array($matches[1], array('github-oauth', 'gitlab-oauth', 'gitlab-token'), true)) {
  2221. if (1 !== count($values)) {
  2222. throw new \RuntimeException('Too many arguments, expected only one token');
  2223. }
  2224. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2225. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], $values[0]);
  2226. } elseif ($matches[1] === 'http-basic') {
  2227. if (2 !== count($values)) {
  2228. throw new \RuntimeException('Expected two arguments (username, password), got '.count($values));
  2229. }
  2230. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2231. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('username' => $values[0], 'password' => $values[1]));
  2232. }
  2233. return 0;
  2234. }
  2235. if (preg_match('/^scripts\.(.+)/', $settingKey, $matches)) {
  2236. if ($input->getOption('unset')) {
  2237. $this->configSource->removeProperty($settingKey);
  2238. return 0;
  2239. }
  2240. $this->configSource->addProperty($settingKey, count($values) > 1 ? $values : $values[0]);
  2241. return 0;
  2242. }
  2243. throw new \InvalidArgumentException('Setting '.$settingKey.' does not exist or is not supported by this command');
  2244. }
  2245. protected function handleSingleValue($key, array $callbacks, array $values, $method)
  2246. {
  2247. list($validator, $normalizer) = $callbacks;
  2248. if (1 !== count($values)) {
  2249. throw new \RuntimeException('You can only pass one value. Example: php composer.phar config process-timeout 300');
  2250. }
  2251. if (true !== $validation = $validator($values[0])) {
  2252. throw new \RuntimeException(sprintf(
  2253. '"%s" is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  2254. $values[0]
  2255. ));
  2256. }
  2257. $normalizedValue = $normalizer($values[0]);
  2258. if ($key === 'disable-tls') {
  2259. if (!$normalizedValue && $this->config->get('disable-tls')) {
  2260. $this->getIO()->writeError('<info>You are now running Composer with SSL/TLS protection enabled.</info>');
  2261. } elseif ($normalizedValue && !$this->config->get('disable-tls')) {
  2262. $this->getIO()->writeError('<warning>You are now running Composer with SSL/TLS protection disabled.</warning>');
  2263. }
  2264. }
  2265. return call_user_func(array($this->configSource, $method), $key, $normalizedValue);
  2266. }
  2267. protected function handleMultiValue($key, array $callbacks, array $values, $method)
  2268. {
  2269. list($validator, $normalizer) = $callbacks;
  2270. if (true !== $validation = $validator($values)) {
  2271. throw new \RuntimeException(sprintf(
  2272. '%s is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  2273. json_encode($values)
  2274. ));
  2275. }
  2276. return call_user_func(array($this->configSource, $method), $key, $normalizer($values));
  2277. }
  2278. protected function listConfiguration(array $contents, array $rawContents, OutputInterface $output, $k = null)
  2279. {
  2280. $origK = $k;
  2281. $io = $this->getIO();
  2282. foreach ($contents as $key => $value) {
  2283. if ($k === null && !in_array($key, array('config', 'repositories'))) {
  2284. continue;
  2285. }
  2286. $rawVal = isset($rawContents[$key]) ? $rawContents[$key] : null;
  2287. if (is_array($value) && (!is_numeric(key($value)) || ($key === 'repositories' && null === $k))) {
  2288. $k .= preg_replace('{^config\.}', '', $key . '.');
  2289. $this->listConfiguration($value, $rawVal, $output, $k);
  2290. $k = $origK;
  2291. continue;
  2292. }
  2293. if (is_array($value)) {
  2294. $value = array_map(function ($val) {
  2295. return is_array($val) ? json_encode($val) : $val;
  2296. }, $value);
  2297. $value = '['.implode(', ', $value).']';
  2298. }
  2299. if (is_bool($value)) {
  2300. $value = var_export($value, true);
  2301. }
  2302. if (is_string($rawVal) && $rawVal != $value) {
  2303. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $rawVal . ' (' . $value . ')</info>', true, IOInterface::QUIET);
  2304. } else {
  2305. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $value . '</info>', true, IOInterface::QUIET);
  2306. }
  2307. }
  2308. }
  2309. }
  2310. <?php
  2311. namespace Composer\Command;
  2312. use Composer\Config;
  2313. use Composer\Factory;
  2314. use Composer\Installer;
  2315. use Composer\Installer\ProjectInstaller;
  2316. use Composer\Installer\InstallationManager;
  2317. use Composer\Installer\SuggestedPackagesReporter;
  2318. use Composer\IO\IOInterface;
  2319. use Composer\Package\BasePackage;
  2320. use Composer\DependencyResolver\Pool;
  2321. use Composer\DependencyResolver\Operation\InstallOperation;
  2322. use Composer\Package\Version\VersionSelector;
  2323. use Composer\Package\AliasPackage;
  2324. use Composer\Repository\RepositoryFactory;
  2325. use Composer\Repository\CompositeRepository;
  2326. use Composer\Repository\PlatformRepository;
  2327. use Composer\Repository\InstalledFilesystemRepository;
  2328. use Composer\Script\ScriptEvents;
  2329. use Composer\Util\Silencer;
  2330. use Symfony\Component\Console\Input\InputArgument;
  2331. use Symfony\Component\Console\Input\InputInterface;
  2332. use Symfony\Component\Console\Input\InputOption;
  2333. use Symfony\Component\Console\Output\OutputInterface;
  2334. use Symfony\Component\Finder\Finder;
  2335. use Composer\Json\JsonFile;
  2336. use Composer\Config\JsonConfigSource;
  2337. use Composer\Util\Filesystem;
  2338. use Composer\Package\Version\VersionParser;
  2339. class CreateProjectCommand extends BaseCommand
  2340. {
  2341. protected $suggestedPackagesReporter;
  2342. protected function configure()
  2343. {
  2344. $this
  2345. ->setName('create-project')
  2346. ->setDescription('Creates new project from a package into given directory.')
  2347. ->setDefinition(array(
  2348. new InputArgument('package', InputArgument::OPTIONAL, 'Package name to be installed'),
  2349. new InputArgument('directory', InputArgument::OPTIONAL, 'Directory where the files should be created'),
  2350. new InputArgument('version', InputArgument::OPTIONAL, 'Version, will default to latest'),
  2351. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum-stability allowed (unless a version is specified).'),
  2352. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  2353. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  2354. new InputOption('repository', null, InputOption::VALUE_REQUIRED, 'Pick a different repository (as url or json config) to look for the package.'),
  2355. new InputOption('repository-url', null, InputOption::VALUE_REQUIRED, 'DEPRECATED: Use --repository instead.'),
  2356. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  2357. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  2358. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  2359. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Whether to prevent execution of all defined scripts in the root package.'),
  2360. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  2361. 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.'),
  2362. new InputOption('keep-vcs', null, InputOption::VALUE_NONE, 'Whether to prevent deleting the vcs folder.'),
  2363. new InputOption('remove-vcs', null, InputOption::VALUE_NONE, 'Whether to force deletion of the vcs folder without prompting.'),
  2364. new InputOption('no-install', null, InputOption::VALUE_NONE, 'Whether to skip installation of the package dependencies.'),
  2365. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  2366. ))
  2367. ->setHelp(
  2368. <<<EOT
  2369. The <info>create-project</info> command creates a new project from a given
  2370. package into a new directory. If executed without params and in a directory
  2371. with a composer.json file it installs the packages for the current project.
  2372. You can use this command to bootstrap new projects or setup a clean
  2373. version-controlled installation for developers of your project.
  2374. <info>php composer.phar create-project vendor/project target-directory [version]</info>
  2375. You can also specify the version with the package name using = or : as separator.
  2376. <info>php composer.phar create-project vendor/project:version target-directory</info>
  2377. To install unstable packages, either specify the version you want, or use the
  2378. --stability=dev (where dev can be one of RC, beta, alpha or dev).
  2379. To setup a developer workable version you should create the project using the source
  2380. controlled code by appending the <info>'--prefer-source'</info> flag.
  2381. To install a package from another repository than the default one you
  2382. can pass the <info>'--repository=https://myrepository.org'</info> flag.
  2383. Read more at https://getcomposer.org/doc/03-cli.md#create-project
  2384. EOT
  2385. )
  2386. ;
  2387. }
  2388. protected function execute(InputInterface $input, OutputInterface $output)
  2389. {
  2390. $config = Factory::createConfig();
  2391. $io = $this->getIO();
  2392. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input, true);
  2393. if ($input->getOption('dev')) {
  2394. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  2395. }
  2396. if ($input->getOption('no-custom-installers')) {
  2397. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  2398. $input->setOption('no-plugins', true);
  2399. }
  2400. return $this->installProject(
  2401. $io,
  2402. $config,
  2403. $input,
  2404. $input->getArgument('package'),
  2405. $input->getArgument('directory'),
  2406. $input->getArgument('version'),
  2407. $input->getOption('stability'),
  2408. $preferSource,
  2409. $preferDist,
  2410. !$input->getOption('no-dev'),
  2411. $input->getOption('repository') ?: $input->getOption('repository-url'),
  2412. $input->getOption('no-plugins'),
  2413. $input->getOption('no-scripts'),
  2414. $input->getOption('no-progress'),
  2415. $input->getOption('no-install'),
  2416. $input->getOption('ignore-platform-reqs'),
  2417. !$input->getOption('no-secure-http')
  2418. );
  2419. }
  2420. 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)
  2421. {
  2422. $oldCwd = getcwd();
  2423. $io->loadConfiguration($config);
  2424. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($io);
  2425. if ($packageName !== null) {
  2426. $installedFromVcs = $this->installRootPackage($io, $config, $packageName, $directory, $packageVersion, $stability, $preferSource, $preferDist, $installDevPackages, $repository, $disablePlugins, $noScripts, $noProgress, $ignorePlatformReqs, $secureHttp);
  2427. } else {
  2428. $installedFromVcs = false;
  2429. }
  2430. $composer = Factory::create($io, null, $disablePlugins);
  2431. $composer->getDownloadManager()->setOutputProgress(!$noProgress);
  2432. $fs = new Filesystem();
  2433. if ($noScripts === false) {
  2434. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ROOT_PACKAGE_INSTALL, $installDevPackages);
  2435. }
  2436. $config = $composer->getConfig();
  2437. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  2438. if ($noInstall === false) {
  2439. $installer = Installer::create($io, $composer);
  2440. $installer->setPreferSource($preferSource)
  2441. ->setPreferDist($preferDist)
  2442. ->setDevMode($installDevPackages)
  2443. ->setRunScripts(!$noScripts)
  2444. ->setIgnorePlatformRequirements($ignorePlatformReqs)
  2445. ->setSuggestedPackagesReporter($this->suggestedPackagesReporter)
  2446. ->setOptimizeAutoloader($config->get('optimize-autoloader'))
  2447. ->setClassMapAuthoritative($config->get('classmap-authoritative'))
  2448. ->setApcuAutoloader($config->get('apcu-autoloader'));
  2449. if ($disablePlugins) {
  2450. $installer->disablePlugins();
  2451. }
  2452. $status = $installer->run();
  2453. if (0 !== $status) {
  2454. return $status;
  2455. }
  2456. }
  2457. $hasVcs = $installedFromVcs;
  2458. if (
  2459. !$input->getOption('keep-vcs')
  2460. && $installedFromVcs
  2461. && (
  2462. $input->getOption('remove-vcs')
  2463. || !$io->isInteractive()
  2464. || $io->askConfirmation('<info>Do you want to remove the existing VCS (.git, .svn..) history?</info> [<comment>Y,n</comment>]? ', true)
  2465. )
  2466. ) {
  2467. $finder = new Finder();
  2468. $finder->depth(0)->directories()->in(getcwd())->ignoreVCS(false)->ignoreDotFiles(false);
  2469. foreach (array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg', '.fslckout', '_FOSSIL_') as $vcsName) {
  2470. $finder->name($vcsName);
  2471. }
  2472. try {
  2473. $dirs = iterator_to_array($finder);
  2474. unset($finder);
  2475. foreach ($dirs as $dir) {
  2476. if (!$fs->removeDirectory($dir)) {
  2477. throw new \RuntimeException('Could not remove '.$dir);
  2478. }
  2479. }
  2480. } catch (\Exception $e) {
  2481. $io->writeError('<error>An error occurred while removing the VCS metadata: '.$e->getMessage().'</error>');
  2482. }
  2483. $hasVcs = false;
  2484. }
  2485. if (!$hasVcs) {
  2486. $package = $composer->getPackage();
  2487. $configSource = new JsonConfigSource(new JsonFile('composer.json'));
  2488. foreach (BasePackage::$supportedLinkTypes as $type => $meta) {
  2489. foreach ($package->{'get'.$meta['method']}() as $link) {
  2490. if ($link->getPrettyConstraint() === 'self.version') {
  2491. $configSource->addLink($type, $link->getTarget(), $package->getPrettyVersion());
  2492. }
  2493. }
  2494. }
  2495. }
  2496. if ($noScripts === false) {
  2497. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_CREATE_PROJECT_CMD, $installDevPackages);
  2498. }
  2499. chdir($oldCwd);
  2500. $vendorComposerDir = $config->get('vendor-dir').'/composer';
  2501. if (is_dir($vendorComposerDir) && $fs->isDirEmpty($vendorComposerDir)) {
  2502. Silencer::call('rmdir', $vendorComposerDir);
  2503. $vendorDir = $config->get('vendor-dir');
  2504. if (is_dir($vendorDir) && $fs->isDirEmpty($vendorDir)) {
  2505. Silencer::call('rmdir', $vendorDir);
  2506. }
  2507. }
  2508. return 0;
  2509. }
  2510. 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)
  2511. {
  2512. if (!$secureHttp) {
  2513. $config->merge(array('config' => array('secure-http' => false)));
  2514. }
  2515. if (null === $repository) {
  2516. $sourceRepo = new CompositeRepository(RepositoryFactory::defaultRepos($io, $config));
  2517. } else {
  2518. $sourceRepo = RepositoryFactory::fromString($io, $config, $repository, true);
  2519. }
  2520. $parser = new VersionParser();
  2521. $requirements = $parser->parseNameVersionPairs(array($packageName));
  2522. $name = strtolower($requirements[0]['name']);
  2523. if (!$packageVersion && isset($requirements[0]['version'])) {
  2524. $packageVersion = $requirements[0]['version'];
  2525. }
  2526. if (null === $stability) {
  2527. if (preg_match('{^[^,\s]*?@('.implode('|', array_keys(BasePackage::$stabilities)).')$}i', $packageVersion, $match)) {
  2528. $stability = $match[1];
  2529. } else {
  2530. $stability = VersionParser::parseStability($packageVersion);
  2531. }
  2532. }
  2533. $stability = VersionParser::normalizeStability($stability);
  2534. if (!isset(BasePackage::$stabilities[$stability])) {
  2535. throw new \InvalidArgumentException('Invalid stability provided ('.$stability.'), must be one of: '.implode(', ', array_keys(BasePackage::$stabilities)));
  2536. }
  2537. $pool = new Pool($stability);
  2538. $pool->addRepository($sourceRepo);
  2539. $phpVersion = null;
  2540. $prettyPhpVersion = null;
  2541. if (!$ignorePlatformReqs) {
  2542. $platformOverrides = $config->get('platform') ?: array();
  2543. $platform = new PlatformRepository(array(), $platformOverrides);
  2544. $phpPackage = $platform->findPackage('php', '*');
  2545. $phpVersion = $phpPackage->getVersion();
  2546. $prettyPhpVersion = $phpPackage->getPrettyVersion();
  2547. }
  2548. $versionSelector = new VersionSelector($pool);
  2549. $package = $versionSelector->findBestCandidate($name, $packageVersion, $phpVersion, $stability);
  2550. if (!$package) {
  2551. $errorMessage = "Could not find package $name with " . ($packageVersion ? "version $packageVersion" : "stability $stability");
  2552. if ($phpVersion && $versionSelector->findBestCandidate($name, $packageVersion, null, $stability)) {
  2553. throw new \InvalidArgumentException($errorMessage .' in a version installable using your PHP version '.$prettyPhpVersion.'.');
  2554. }
  2555. throw new \InvalidArgumentException($errorMessage .'.');
  2556. }
  2557. if (null === $directory) {
  2558. $parts = explode("/", $name, 2);
  2559. $directory = getcwd() . DIRECTORY_SEPARATOR . array_pop($parts);
  2560. }
  2561. if (function_exists('pcntl_async_signals')) {
  2562. @mkdir($directory, 0777, true);
  2563. if ($realDir = realpath($directory)) {
  2564. pcntl_async_signals(true);
  2565. pcntl_signal(SIGINT, function () use ($realDir) {
  2566. $fs = new Filesystem();
  2567. $fs->removeDirectory($realDir);
  2568. exit(130);
  2569. });
  2570. }
  2571. }
  2572. $io->writeError('<info>Installing ' . $package->getName() . ' (' . $package->getFullPrettyVersion(false) . ')</info>');
  2573. if ($disablePlugins) {
  2574. $io->writeError('<info>Plugins have been disabled.</info>');
  2575. }
  2576. if ($package instanceof AliasPackage) {
  2577. $package = $package->getAliasOf();
  2578. }
  2579. $dm = $this->createDownloadManager($io, $config);
  2580. $dm->setPreferSource($preferSource)
  2581. ->setPreferDist($preferDist)
  2582. ->setOutputProgress(!$noProgress);
  2583. $projectInstaller = new ProjectInstaller($directory, $dm);
  2584. $im = $this->createInstallationManager();
  2585. $im->addInstaller($projectInstaller);
  2586. $im->install(new InstalledFilesystemRepository(new JsonFile('php://memory')), new InstallOperation($package));
  2587. $im->notifyInstalls($io);
  2588. $this->suggestedPackagesReporter->addSuggestionsFromPackage($package);
  2589. $installedFromVcs = 'source' === $package->getInstallationSource();
  2590. $io->writeError('<info>Created project in ' . $directory . '</info>');
  2591. chdir($directory);
  2592. $_SERVER['COMPOSER_ROOT_VERSION'] = $package->getPrettyVersion();
  2593. putenv('COMPOSER_ROOT_VERSION='.$_SERVER['COMPOSER_ROOT_VERSION']);
  2594. return $installedFromVcs;
  2595. }
  2596. protected function createDownloadManager(IOInterface $io, Config $config)
  2597. {
  2598. $factory = new Factory();
  2599. return $factory->createDownloadManager($io, $config);
  2600. }
  2601. protected function createInstallationManager()
  2602. {
  2603. return new InstallationManager();
  2604. }
  2605. }
  2606. <?php
  2607. namespace Composer\Command;
  2608. use Symfony\Component\Console\Input\InputInterface;
  2609. use Symfony\Component\Console\Output\OutputInterface;
  2610. class DependsCommand extends BaseDependencyCommand
  2611. {
  2612. protected function configure()
  2613. {
  2614. parent::configure();
  2615. $this
  2616. ->setName('depends')
  2617. ->setAliases(array('why'))
  2618. ->setDescription('Shows which packages cause the given package to be installed.')
  2619. ->setHelp(
  2620. <<<EOT
  2621. Displays detailed information about where a package is referenced.
  2622. <info>php composer.phar depends composer/composer</info>
  2623. Read more at https://getcomposer.org/doc/03-cli.md#depends-why-
  2624. EOT
  2625. )
  2626. ;
  2627. }
  2628. protected function execute(InputInterface $input, OutputInterface $output)
  2629. {
  2630. return parent::doExecute($input, $output, false);
  2631. }
  2632. }
  2633. <?php
  2634. namespace Composer\Command;
  2635. use Composer\Composer;
  2636. use Composer\Factory;
  2637. use Composer\Config;
  2638. use Composer\Downloader\TransportException;
  2639. use Composer\Repository\PlatformRepository;
  2640. use Composer\Plugin\CommandEvent;
  2641. use Composer\Plugin\PluginEvents;
  2642. use Composer\Util\ConfigValidator;
  2643. use Composer\Util\IniHelper;
  2644. use Composer\Util\ProcessExecutor;
  2645. use Composer\Util\RemoteFilesystem;
  2646. use Composer\Util\StreamContextFactory;
  2647. use Composer\SelfUpdate\Keys;
  2648. use Composer\SelfUpdate\Versions;
  2649. use Composer\IO\NullIO;
  2650. use Symfony\Component\Console\Input\InputInterface;
  2651. use Symfony\Component\Console\Output\OutputInterface;
  2652. class DiagnoseCommand extends BaseCommand
  2653. {
  2654. protected $rfs;
  2655. protected $process;
  2656. protected $exitCode = 0;
  2657. protected function configure()
  2658. {
  2659. $this
  2660. ->setName('diagnose')
  2661. ->setDescription('Diagnoses the system to identify common errors.')
  2662. ->setHelp(
  2663. <<<EOT
  2664. The <info>diagnose</info> command checks common errors to help debugging problems.
  2665. The process exit code will be 1 in case of warnings and 2 for errors.
  2666. Read more at https://getcomposer.org/doc/03-cli.md#diagnose
  2667. EOT
  2668. )
  2669. ;
  2670. }
  2671. protected function execute(InputInterface $input, OutputInterface $output)
  2672. {
  2673. $composer = $this->getComposer(false);
  2674. $io = $this->getIO();
  2675. if ($composer) {
  2676. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'diagnose', $input, $output);
  2677. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  2678. $io->write('Checking composer.json: ', false);
  2679. $this->outputResult($this->checkComposerSchema());
  2680. }
  2681. if ($composer) {
  2682. $config = $composer->getConfig();
  2683. } else {
  2684. $config = Factory::createConfig();
  2685. }
  2686. $config->merge(array('config' => array('secure-http' => false)));
  2687. $config->prohibitUrlByConfig('http://repo.packagist.org', new NullIO);
  2688. $this->rfs = Factory::createRemoteFilesystem($io, $config);
  2689. $this->process = new ProcessExecutor($io);
  2690. $io->write('Checking platform settings: ', false);
  2691. $this->outputResult($this->checkPlatform());
  2692. $io->write('Checking git settings: ', false);
  2693. $this->outputResult($this->checkGit());
  2694. $io->write('Checking http connectivity to packagist: ', false);
  2695. $this->outputResult($this->checkHttp('http', $config));
  2696. $io->write('Checking https connectivity to packagist: ', false);
  2697. $this->outputResult($this->checkHttp('https', $config));
  2698. $opts = stream_context_get_options(StreamContextFactory::getContext('http://example.org'));
  2699. if (!empty($opts['http']['proxy'])) {
  2700. $io->write('Checking HTTP proxy: ', false);
  2701. $this->outputResult($this->checkHttpProxy());
  2702. $io->write('Checking HTTP proxy support for request_fulluri: ', false);
  2703. $this->outputResult($this->checkHttpProxyFullUriRequestParam());
  2704. $io->write('Checking HTTPS proxy support for request_fulluri: ', false);
  2705. $this->outputResult($this->checkHttpsProxyFullUriRequestParam());
  2706. }
  2707. if ($oauth = $config->get('github-oauth')) {
  2708. foreach ($oauth as $domain => $token) {
  2709. $io->write('Checking '.$domain.' oauth access: ', false);
  2710. $this->outputResult($this->checkGithubOauth($domain, $token));
  2711. }
  2712. } else {
  2713. $io->write('Checking github.com rate limit: ', false);
  2714. try {
  2715. $rate = $this->getGithubRateLimit('github.com');
  2716. if (!is_array($rate)) {
  2717. $this->outputResult($rate);
  2718. } elseif (10 > $rate['remaining']) {
  2719. $io->write('<warning>WARNING</warning>');
  2720. $io->write(sprintf(
  2721. '<comment>Github has a rate limit on their API. '
  2722. . 'You currently have <options=bold>%u</options=bold> '
  2723. . 'out of <options=bold>%u</options=bold> requests left.' . PHP_EOL
  2724. . 'See https://developer.github.com/v3/#rate-limiting and also' . PHP_EOL
  2725. . ' https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens</comment>',
  2726. $rate['remaining'],
  2727. $rate['limit']
  2728. ));
  2729. } else {
  2730. $this->outputResult(true);
  2731. }
  2732. } catch (\Exception $e) {
  2733. if ($e instanceof TransportException && $e->getCode() === 401) {
  2734. $this->outputResult('<comment>The oauth token for github.com seems invalid, run "composer config --global --unset github-oauth.github.com" to remove it</comment>');
  2735. } else {
  2736. $this->outputResult($e);
  2737. }
  2738. }
  2739. }
  2740. $io->write('Checking disk free space: ', false);
  2741. $this->outputResult($this->checkDiskSpace($config));
  2742. if ('phar:' === substr(__FILE__, 0, 5)) {
  2743. $io->write('Checking pubkeys: ', false);
  2744. $this->outputResult($this->checkPubKeys($config));
  2745. $io->write('Checking composer version: ', false);
  2746. $this->outputResult($this->checkVersion($config));
  2747. }
  2748. $io->write(sprintf('Composer version: <comment>%s</comment>', Composer::VERSION));
  2749. $platformOverrides = $config->get('platform') ?: array();
  2750. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  2751. $phpPkg = $platformRepo->findPackage('php', '*');
  2752. $phpVersion = $phpPkg->getPrettyVersion();
  2753. if (false !== strpos($phpPkg->getDescription(), 'overridden')) {
  2754. $phpVersion .= ' - ' . $phpPkg->getDescription();
  2755. }
  2756. $io->write(sprintf('PHP version: <comment>%s</comment>', $phpVersion));
  2757. if (defined('PHP_BINARY')) {
  2758. $io->write(sprintf('PHP binary path: <comment>%s</comment>', PHP_BINARY));
  2759. }
  2760. return $this->exitCode;
  2761. }
  2762. private function checkComposerSchema()
  2763. {
  2764. $validator = new ConfigValidator($this->getIO());
  2765. list($errors, , $warnings) = $validator->validate(Factory::getComposerFile());
  2766. if ($errors || $warnings) {
  2767. $messages = array(
  2768. 'error' => $errors,
  2769. 'warning' => $warnings,
  2770. );
  2771. $output = '';
  2772. foreach ($messages as $style => $msgs) {
  2773. foreach ($msgs as $msg) {
  2774. $output .= '<' . $style . '>' . $msg . '</' . $style . '>' . PHP_EOL;
  2775. }
  2776. }
  2777. return rtrim($output);
  2778. }
  2779. return true;
  2780. }
  2781. private function checkGit()
  2782. {
  2783. $this->process->execute('git config color.ui', $output);
  2784. if (strtolower(trim($output)) === 'always') {
  2785. 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>';
  2786. }
  2787. return true;
  2788. }
  2789. private function checkHttp($proto, Config $config)
  2790. {
  2791. $result = $this->checkConnectivity();
  2792. if ($result !== true) {
  2793. return $result;
  2794. }
  2795. $disableTls = false;
  2796. $result = array();
  2797. if ($proto === 'https' && $config->get('disable-tls') === true) {
  2798. $disableTls = true;
  2799. $result[] = '<warning>Composer is configured to disable SSL/TLS protection. This will leave remote HTTPS requests vulnerable to Man-In-The-Middle attacks.</warning>';
  2800. }
  2801. if ($proto === 'https' && !extension_loaded('openssl') && !$disableTls) {
  2802. $result[] = '<error>Composer is configured to use SSL/TLS protection but the openssl extension is not available.</error>';
  2803. }
  2804. try {
  2805. $this->rfs->getContents('packagist.org', $proto . '://repo.packagist.org/packages.json', false);
  2806. } catch (TransportException $e) {
  2807. if (false !== strpos($e->getMessage(), 'cafile')) {
  2808. $result[] = '<error>[' . get_class($e) . '] ' . $e->getMessage() . '</error>';
  2809. $result[] = '<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>';
  2810. $result[] = '<error>You can alternatively disable this error, at your own risk, by enabling the \'disable-tls\' option.</error>';
  2811. } else {
  2812. array_unshift($result, '[' . get_class($e) . '] ' . $e->getMessage());
  2813. }
  2814. }
  2815. if (count($result) > 0) {
  2816. return $result;
  2817. }
  2818. return true;
  2819. }
  2820. private function checkHttpProxy()
  2821. {
  2822. $result = $this->checkConnectivity();
  2823. if ($result !== true) {
  2824. return $result;
  2825. }
  2826. $protocol = extension_loaded('openssl') ? 'https' : 'http';
  2827. try {
  2828. $json = json_decode($this->rfs->getContents('packagist.org', $protocol . '://repo.packagist.org/packages.json', false), true);
  2829. $hash = reset($json['provider-includes']);
  2830. $hash = $hash['sha256'];
  2831. $path = str_replace('%hash%', $hash, key($json['provider-includes']));
  2832. $provider = $this->rfs->getContents('packagist.org', $protocol . '://repo.packagist.org/'.$path, false);
  2833. if (hash('sha256', $provider) !== $hash) {
  2834. return 'It seems that your proxy is modifying http traffic on the fly';
  2835. }
  2836. } catch (\Exception $e) {
  2837. return $e;
  2838. }
  2839. return true;
  2840. }
  2841. private function checkHttpProxyFullUriRequestParam()
  2842. {
  2843. $result = $this->checkConnectivity();
  2844. if ($result !== true) {
  2845. return $result;
  2846. }
  2847. $url = 'http://repo.packagist.org/packages.json';
  2848. try {
  2849. $this->rfs->getContents('packagist.org', $url, false);
  2850. } catch (TransportException $e) {
  2851. try {
  2852. $this->rfs->getContents('packagist.org', $url, false, array('http' => array('request_fulluri' => false)));
  2853. } catch (TransportException $e) {
  2854. return 'Unable to assess the situation, maybe packagist.org is down ('.$e->getMessage().')';
  2855. }
  2856. 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"';
  2857. }
  2858. return true;
  2859. }
  2860. private function checkHttpsProxyFullUriRequestParam()
  2861. {
  2862. $result = $this->checkConnectivity();
  2863. if ($result !== true) {
  2864. return $result;
  2865. }
  2866. if (!extension_loaded('openssl')) {
  2867. return 'You need the openssl extension installed for this check';
  2868. }
  2869. $url = 'https://api.github.com/repos/Seldaek/jsonlint/zipball/1.0.0';
  2870. try {
  2871. $this->rfs->getContents('github.com', $url, false);
  2872. } catch (TransportException $e) {
  2873. try {
  2874. $this->rfs->getContents('github.com', $url, false, array('http' => array('request_fulluri' => false)));
  2875. } catch (TransportException $e) {
  2876. return 'Unable to assess the situation, maybe github is down ('.$e->getMessage().')';
  2877. }
  2878. return 'It seems there is a problem with your proxy server, try setting the "HTTPS_PROXY_REQUEST_FULLURI" environment variable to "false"';
  2879. }
  2880. return true;
  2881. }
  2882. private function checkGithubOauth($domain, $token)
  2883. {
  2884. $result = $this->checkConnectivity();
  2885. if ($result !== true) {
  2886. return $result;
  2887. }
  2888. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  2889. try {
  2890. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/' : 'https://'.$domain.'/api/v3/';
  2891. return $this->rfs->getContents($domain, $url, false, array(
  2892. 'retry-auth-failure' => false,
  2893. )) ? true : 'Unexpected error';
  2894. } catch (\Exception $e) {
  2895. if ($e instanceof TransportException && $e->getCode() === 401) {
  2896. return '<comment>The oauth token for '.$domain.' seems invalid, run "composer config --global --unset github-oauth.'.$domain.'" to remove it</comment>';
  2897. }
  2898. return $e;
  2899. }
  2900. }
  2901. private function getGithubRateLimit($domain, $token = null)
  2902. {
  2903. $result = $this->checkConnectivity();
  2904. if ($result !== true) {
  2905. return $result;
  2906. }
  2907. if ($token) {
  2908. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  2909. }
  2910. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/rate_limit' : 'https://'.$domain.'/api/rate_limit';
  2911. $json = $this->rfs->getContents($domain, $url, false, array('retry-auth-failure' => false));
  2912. $data = json_decode($json, true);
  2913. return $data['resources']['core'];
  2914. }
  2915. private function checkDiskSpace($config)
  2916. {
  2917. $minSpaceFree = 1024 * 1024;
  2918. if ((($df = @disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  2919. || (($df = @disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  2920. ) {
  2921. return '<error>The disk hosting '.$dir.' is full</error>';
  2922. }
  2923. return true;
  2924. }
  2925. private function checkPubKeys($config)
  2926. {
  2927. $home = $config->get('home');
  2928. $errors = array();
  2929. $io = $this->getIO();
  2930. if (file_exists($home.'/keys.tags.pub') && file_exists($home.'/keys.dev.pub')) {
  2931. $io->write('');
  2932. }
  2933. if (file_exists($home.'/keys.tags.pub')) {
  2934. $io->write('Tags Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.tags.pub'));
  2935. } else {
  2936. $errors[] = '<error>Missing pubkey for tags verification</error>';
  2937. }
  2938. if (file_exists($home.'/keys.dev.pub')) {
  2939. $io->write('Dev Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.dev.pub'));
  2940. } else {
  2941. $errors[] = '<error>Missing pubkey for dev verification</error>';
  2942. }
  2943. if ($errors) {
  2944. $errors[] = '<error>Run composer self-update --update-keys to set them up</error>';
  2945. }
  2946. return $errors ?: true;
  2947. }
  2948. private function checkVersion($config)
  2949. {
  2950. $result = $this->checkConnectivity();
  2951. if ($result !== true) {
  2952. return $result;
  2953. }
  2954. $versionsUtil = new Versions($config, $this->rfs);
  2955. $latest = $versionsUtil->getLatest();
  2956. if (Composer::VERSION !== $latest['version'] && Composer::VERSION !== '@package_version@') {
  2957. return '<comment>You are not running the latest '.$versionsUtil->getChannel().' version, run `composer self-update` to update ('.Composer::VERSION.' => '.$latest['version'].')</comment>';
  2958. }
  2959. return true;
  2960. }
  2961. private function outputResult($result)
  2962. {
  2963. $io = $this->getIO();
  2964. if (true === $result) {
  2965. $io->write('<info>OK</info>');
  2966. return;
  2967. }
  2968. $hadError = false;
  2969. $hadWarning = false;
  2970. if ($result instanceof \Exception) {
  2971. $result = '<error>['.get_class($result).'] '.$result->getMessage().'</error>';
  2972. }
  2973. if (!$result) {
  2974. $hadError = true;
  2975. } else {
  2976. if (!is_array($result)) {
  2977. $result = array($result);
  2978. }
  2979. foreach ($result as $message) {
  2980. if (false !== strpos($message, '<error>')) {
  2981. $hadError = true;
  2982. } elseif (false !== strpos($message, '<warning>')) {
  2983. $hadWarning = true;
  2984. }
  2985. }
  2986. }
  2987. if ($hadError) {
  2988. $io->write('<error>FAIL</error>');
  2989. $this->exitCode = max($this->exitCode, 2);
  2990. } elseif ($hadWarning) {
  2991. $io->write('<warning>WARNING</warning>');
  2992. $this->exitCode = max($this->exitCode, 1);
  2993. }
  2994. if ($result) {
  2995. foreach ($result as $message) {
  2996. $io->write($message);
  2997. }
  2998. }
  2999. }
  3000. private function checkPlatform()
  3001. {
  3002. $output = '';
  3003. $out = function ($msg, $style) use (&$output) {
  3004. $output .= '<'.$style.'>'.$msg.'</'.$style.'>'.PHP_EOL;
  3005. };
  3006. $errors = array();
  3007. $warnings = array();
  3008. $displayIniMessage = false;
  3009. $iniMessage = PHP_EOL.PHP_EOL.IniHelper::getMessage();
  3010. $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.';
  3011. if (!function_exists('json_decode')) {
  3012. $errors['json'] = true;
  3013. }
  3014. if (!extension_loaded('Phar')) {
  3015. $errors['phar'] = true;
  3016. }
  3017. if (!extension_loaded('filter')) {
  3018. $errors['filter'] = true;
  3019. }
  3020. if (!extension_loaded('hash')) {
  3021. $errors['hash'] = true;
  3022. }
  3023. if (!extension_loaded('iconv') && !extension_loaded('mbstring')) {
  3024. $errors['iconv_mbstring'] = true;
  3025. }
  3026. if (!filter_var(ini_get('allow_url_fopen'), FILTER_VALIDATE_BOOLEAN)) {
  3027. $errors['allow_url_fopen'] = true;
  3028. }
  3029. if (extension_loaded('ionCube Loader') && ioncube_loader_iversion() < 40009) {
  3030. $errors['ioncube'] = ioncube_loader_version();
  3031. }
  3032. if (PHP_VERSION_ID < 50302) {
  3033. $errors['php'] = PHP_VERSION;
  3034. }
  3035. if (!isset($errors['php']) && PHP_VERSION_ID < 50304) {
  3036. $warnings['php'] = PHP_VERSION;
  3037. }
  3038. if (!extension_loaded('openssl')) {
  3039. $errors['openssl'] = true;
  3040. }
  3041. if (extension_loaded('openssl') && OPENSSL_VERSION_NUMBER < 0x1000100f) {
  3042. $warnings['openssl_version'] = true;
  3043. }
  3044. if (!defined('HHVM_VERSION') && !extension_loaded('apcu') && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) {
  3045. $warnings['apc_cli'] = true;
  3046. }
  3047. if (!extension_loaded('zlib')) {
  3048. $warnings['zlib'] = true;
  3049. }
  3050. ob_start();
  3051. phpinfo(INFO_GENERAL);
  3052. $phpinfo = ob_get_clean();
  3053. if (preg_match('{Configure Command(?: *</td><td class="v">| *=> *)(.*?)(?:</td>|$)}m', $phpinfo, $match)) {
  3054. $configure = $match[1];
  3055. if (false !== strpos($configure, '--enable-sigchild')) {
  3056. $warnings['sigchild'] = true;
  3057. }
  3058. if (false !== strpos($configure, '--with-curlwrappers')) {
  3059. $warnings['curlwrappers'] = true;
  3060. }
  3061. }
  3062. if (filter_var(ini_get('xdebug.profiler_enabled'), FILTER_VALIDATE_BOOLEAN)) {
  3063. $warnings['xdebug_profile'] = true;
  3064. } elseif (extension_loaded('xdebug')) {
  3065. $warnings['xdebug_loaded'] = true;
  3066. }
  3067. if (!empty($errors)) {
  3068. foreach ($errors as $error => $current) {
  3069. switch ($error) {
  3070. case 'json':
  3071. $text = PHP_EOL."The json extension is missing.".PHP_EOL;
  3072. $text .= "Install it or recompile php without --disable-json";
  3073. break;
  3074. case 'phar':
  3075. $text = PHP_EOL."The phar extension is missing.".PHP_EOL;
  3076. $text .= "Install it or recompile php without --disable-phar";
  3077. break;
  3078. case 'filter':
  3079. $text = PHP_EOL."The filter extension is missing.".PHP_EOL;
  3080. $text .= "Install it or recompile php without --disable-filter";
  3081. break;
  3082. case 'hash':
  3083. $text = PHP_EOL."The hash extension is missing.".PHP_EOL;
  3084. $text .= "Install it or recompile php without --disable-hash";
  3085. break;
  3086. case 'iconv_mbstring':
  3087. $text = PHP_EOL."The iconv OR mbstring extension is required and both are missing.".PHP_EOL;
  3088. $text .= "Install either of them or recompile php without --disable-iconv";
  3089. break;
  3090. case 'unicode':
  3091. $text = PHP_EOL."The detect_unicode setting must be disabled.".PHP_EOL;
  3092. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  3093. $text .= " detect_unicode = Off";
  3094. $displayIniMessage = true;
  3095. break;
  3096. case 'suhosin':
  3097. $text = PHP_EOL."The suhosin.executor.include.whitelist setting is incorrect.".PHP_EOL;
  3098. $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;
  3099. $text .= " suhosin.executor.include.whitelist = phar ".$current;
  3100. $displayIniMessage = true;
  3101. break;
  3102. case 'php':
  3103. $text = PHP_EOL."Your PHP ({$current}) is too old, you must upgrade to PHP 5.3.2 or higher.";
  3104. break;
  3105. case 'allow_url_fopen':
  3106. $text = PHP_EOL."The allow_url_fopen setting is incorrect.".PHP_EOL;
  3107. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  3108. $text .= " allow_url_fopen = On";
  3109. $displayIniMessage = true;
  3110. break;
  3111. case 'ioncube':
  3112. $text = PHP_EOL."Your ionCube Loader extension ($current) is incompatible with Phar files.".PHP_EOL;
  3113. $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;
  3114. $text .= " zend_extension = /usr/lib/php5/20090626+lfs/ioncube_loader_lin_5.3.so";
  3115. $displayIniMessage = true;
  3116. break;
  3117. case 'openssl':
  3118. $text = PHP_EOL."The openssl extension is missing, which means that secure HTTPS transfers are impossible.".PHP_EOL;
  3119. $text .= "If possible you should enable it or recompile php with --with-openssl";
  3120. break;
  3121. }
  3122. $out($text, 'error');
  3123. }
  3124. $output .= PHP_EOL;
  3125. }
  3126. if (!empty($warnings)) {
  3127. foreach ($warnings as $warning => $current) {
  3128. switch ($warning) {
  3129. case 'apc_cli':
  3130. $text = "The apc.enable_cli setting is incorrect.".PHP_EOL;
  3131. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  3132. $text .= " apc.enable_cli = Off";
  3133. $displayIniMessage = true;
  3134. break;
  3135. case 'zlib':
  3136. $text = 'The zlib extension is not loaded, this can slow down Composer a lot.'.PHP_EOL;
  3137. $text .= 'If possible, enable it or recompile php with --with-zlib'.PHP_EOL;
  3138. $displayIniMessage = true;
  3139. break;
  3140. case 'sigchild':
  3141. $text = "PHP was compiled with --enable-sigchild which can cause issues on some platforms.".PHP_EOL;
  3142. $text .= "Recompile it without this flag if possible, see also:".PHP_EOL;
  3143. $text .= " https://bugs.php.net/bug.php?id=22999";
  3144. break;
  3145. case 'curlwrappers':
  3146. $text = "PHP was compiled with --with-curlwrappers which will cause issues with HTTP authentication and GitHub.".PHP_EOL;
  3147. $text .= " Recompile it without this flag if possible";
  3148. break;
  3149. case 'php':
  3150. $text = "Your PHP ({$current}) is quite old, upgrading to PHP 5.3.4 or higher is recommended.".PHP_EOL;
  3151. $text .= " Composer works with 5.3.2+ for most people, but there might be edge case issues.";
  3152. break;
  3153. case 'openssl_version':
  3154. $opensslVersion = strstr(trim(strstr(OPENSSL_VERSION_TEXT, ' ')), ' ', true);
  3155. $opensslVersion = $opensslVersion ?: OPENSSL_VERSION_TEXT;
  3156. $text = "The OpenSSL library ({$opensslVersion}) used by PHP does not support TLSv1.2 or TLSv1.1.".PHP_EOL;
  3157. $text .= "If possible you should upgrade OpenSSL to version 1.0.1 or above.";
  3158. break;
  3159. case 'xdebug_loaded':
  3160. $text = "The xdebug extension is loaded, this can slow down Composer a little.".PHP_EOL;
  3161. $text .= " Disabling it when using Composer is recommended.";
  3162. break;
  3163. case 'xdebug_profile':
  3164. $text = "The xdebug.profiler_enabled setting is enabled, this can slow down Composer a lot.".PHP_EOL;
  3165. $text .= "Add the following to the end of your `php.ini` to disable it:".PHP_EOL;
  3166. $text .= " xdebug.profiler_enabled = 0";
  3167. $displayIniMessage = true;
  3168. break;
  3169. }
  3170. $out($text, 'comment');
  3171. }
  3172. }
  3173. if ($displayIniMessage) {
  3174. $out($iniMessage, 'comment');
  3175. }
  3176. return !$warnings && !$errors ? true : $output;
  3177. }
  3178. private function checkConnectivity()
  3179. {
  3180. if (!ini_get('allow_url_fopen')) {
  3181. $result = '<info>Skipped because allow_url_fopen is missing.</info>';
  3182. return $result;
  3183. }
  3184. return true;
  3185. }
  3186. }
  3187. <?php
  3188. namespace Composer\Command;
  3189. use Composer\Plugin\CommandEvent;
  3190. use Composer\Plugin\PluginEvents;
  3191. use Symfony\Component\Console\Input\InputInterface;
  3192. use Symfony\Component\Console\Input\InputOption;
  3193. use Symfony\Component\Console\Output\OutputInterface;
  3194. class DumpAutoloadCommand extends BaseCommand
  3195. {
  3196. protected function configure()
  3197. {
  3198. $this
  3199. ->setName('dump-autoload')
  3200. ->setAliases(array('dumpautoload'))
  3201. ->setDescription('Dumps the autoloader.')
  3202. ->setDefinition(array(
  3203. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  3204. new InputOption('optimize', 'o', InputOption::VALUE_NONE, 'Optimizes PSR0 and PSR4 packages to be loaded with classmaps too, good for production.'),
  3205. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize`.'),
  3206. new InputOption('apcu', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  3207. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables autoload-dev rules.'),
  3208. ))
  3209. ->setHelp(
  3210. <<<EOT
  3211. <info>php composer.phar dump-autoload</info>
  3212. Read more at https://getcomposer.org/doc/03-cli.md#dump-autoload-dumpautoload-
  3213. EOT
  3214. )
  3215. ;
  3216. }
  3217. protected function execute(InputInterface $input, OutputInterface $output)
  3218. {
  3219. $composer = $this->getComposer();
  3220. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'dump-autoload', $input, $output);
  3221. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3222. $installationManager = $composer->getInstallationManager();
  3223. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  3224. $package = $composer->getPackage();
  3225. $config = $composer->getConfig();
  3226. $optimize = $input->getOption('optimize') || $config->get('optimize-autoloader');
  3227. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  3228. $apcu = $input->getOption('apcu') || $config->get('apcu-autoloader');
  3229. if ($authoritative) {
  3230. $this->getIO()->write('<info>Generating optimized autoload files (authoritative)</info>');
  3231. } elseif ($optimize) {
  3232. $this->getIO()->write('<info>Generating optimized autoload files</info>');
  3233. } else {
  3234. $this->getIO()->write('<info>Generating autoload files</info>');
  3235. }
  3236. $generator = $composer->getAutoloadGenerator();
  3237. $generator->setDevMode(!$input->getOption('no-dev'));
  3238. $generator->setClassMapAuthoritative($authoritative);
  3239. $generator->setApcu($apcu);
  3240. $generator->setRunScripts(!$input->getOption('no-scripts'));
  3241. $numberOfClasses = $generator->dump($config, $localRepo, $package, $installationManager, 'composer', $optimize);
  3242. if ($authoritative) {
  3243. $this->getIO()->write('<info>Generated optimized autoload files (authoritative) containing '. $numberOfClasses .' classes</info>');
  3244. } elseif ($optimize) {
  3245. $this->getIO()->write('<info>Generated optimized autoload files containing '. $numberOfClasses .' classes</info>');
  3246. } else {
  3247. $this->getIO()->write('<info>Generated autoload files containing '. $numberOfClasses .' classes</info>');
  3248. }
  3249. return 0;
  3250. }
  3251. }
  3252. <?php
  3253. namespace Composer\Command;
  3254. use Symfony\Component\Console\Input\InputInterface;
  3255. use Symfony\Component\Console\Input\InputOption;
  3256. use Symfony\Component\Console\Output\OutputInterface;
  3257. use Symfony\Component\Console\Input\InputArgument;
  3258. class ExecCommand extends BaseCommand
  3259. {
  3260. protected function configure()
  3261. {
  3262. $this
  3263. ->setName('exec')
  3264. ->setDescription('Executes a vendored binary/script.')
  3265. ->setDefinition(array(
  3266. new InputOption('list', 'l', InputOption::VALUE_NONE),
  3267. new InputArgument('binary', InputArgument::OPTIONAL, 'The binary to run, e.g. phpunit'),
  3268. new InputArgument(
  3269. 'args',
  3270. InputArgument::IS_ARRAY | InputArgument::OPTIONAL,
  3271. 'Arguments to pass to the binary. Use <info>--</info> to separate from composer arguments'
  3272. ),
  3273. ))
  3274. ->setHelp(
  3275. <<<EOT
  3276. Executes a vendored binary/script.
  3277. Read more at https://getcomposer.org/doc/03-cli.md#exec
  3278. EOT
  3279. )
  3280. ;
  3281. }
  3282. protected function execute(InputInterface $input, OutputInterface $output)
  3283. {
  3284. $composer = $this->getComposer();
  3285. $binDir = $composer->getConfig()->get('bin-dir');
  3286. if ($input->getOption('list') || !$input->getArgument('binary')) {
  3287. $bins = glob($binDir . '/*');
  3288. $bins = array_merge($bins, array_map(function ($e) {
  3289. return "$e (local)";
  3290. }, $composer->getPackage()->getBinaries()));
  3291. if (!$bins) {
  3292. throw new \RuntimeException("No binaries found in composer.json or in bin-dir ($binDir)");
  3293. }
  3294. $this->getIO()->write(
  3295. <<<EOT
  3296. <comment>Available binaries:</comment>
  3297. EOT
  3298. );
  3299. foreach ($bins as $bin) {
  3300. if (isset($previousBin) && $bin === $previousBin.'.bat') {
  3301. continue;
  3302. }
  3303. $previousBin = $bin;
  3304. $bin = basename($bin);
  3305. $this->getIO()->write(
  3306. <<<EOT
  3307. <info>- $bin</info>
  3308. EOT
  3309. );
  3310. }
  3311. return 0;
  3312. }
  3313. $binary = $input->getArgument('binary');
  3314. $dispatcher = $composer->getEventDispatcher();
  3315. $dispatcher->addListener('__exec_command', $binary);
  3316. if ($output->getVerbosity() === OutputInterface::VERBOSITY_NORMAL) {
  3317. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  3318. }
  3319. return $dispatcher->dispatchScript('__exec_command', true, $input->getArgument('args'));
  3320. }
  3321. }
  3322. <?php
  3323. namespace Composer\Command;
  3324. use Composer\Factory;
  3325. use Composer\Util\Filesystem;
  3326. use Symfony\Component\Console\Input\InputInterface;
  3327. use Symfony\Component\Console\Input\InputArgument;
  3328. use Symfony\Component\Console\Input\StringInput;
  3329. use Symfony\Component\Console\Output\OutputInterface;
  3330. class GlobalCommand extends BaseCommand
  3331. {
  3332. protected function configure()
  3333. {
  3334. $this
  3335. ->setName('global')
  3336. ->setDescription('Allows running commands in the global composer dir ($COMPOSER_HOME).')
  3337. ->setDefinition(array(
  3338. new InputArgument('command-name', InputArgument::REQUIRED, ''),
  3339. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  3340. ))
  3341. ->setHelp(
  3342. <<<EOT
  3343. Use this command as a wrapper to run other Composer commands
  3344. within the global context of COMPOSER_HOME.
  3345. You can use this to install CLI utilities globally, all you need
  3346. is to add the COMPOSER_HOME/vendor/bin dir to your PATH env var.
  3347. COMPOSER_HOME is c:\Users\<user>\AppData\Roaming\Composer on Windows
  3348. and /home/<user>/.composer on unix systems.
  3349. If your system uses freedesktop.org standards, then it will first check
  3350. XDG_CONFIG_HOME or default to /home/<user>/.config/composer
  3351. Note: This path may vary depending on customizations to bin-dir in
  3352. composer.json or the environmental variable COMPOSER_BIN_DIR.
  3353. Read more at https://getcomposer.org/doc/03-cli.md#global
  3354. EOT
  3355. )
  3356. ;
  3357. }
  3358. public function run(InputInterface $input, OutputInterface $output)
  3359. {
  3360. $tokens = preg_split('{\s+}', $input->__toString());
  3361. $args = array();
  3362. foreach ($tokens as $token) {
  3363. if ($token && $token[0] !== '-') {
  3364. $args[] = $token;
  3365. if (count($args) >= 2) {
  3366. break;
  3367. }
  3368. }
  3369. }
  3370. if (count($args) < 2) {
  3371. return parent::run($input, $output);
  3372. }
  3373. $config = Factory::createConfig();
  3374. $home = $config->get('home');
  3375. if (!is_dir($home)) {
  3376. $fs = new Filesystem();
  3377. $fs->ensureDirectoryExists($home);
  3378. if (!is_dir($home)) {
  3379. throw new \RuntimeException('Could not create home directory');
  3380. }
  3381. }
  3382. try {
  3383. chdir($home);
  3384. } catch (\Exception $e) {
  3385. throw new \RuntimeException('Could not switch to home directory "'.$home.'"', 0, $e);
  3386. }
  3387. $this->getIO()->writeError('<info>Changed current directory to '.$home.'</info>');
  3388. $input = new StringInput(preg_replace('{\bg(?:l(?:o(?:b(?:a(?:l)?)?)?)?)?\b}', '', $input->__toString(), 1));
  3389. $this->getApplication()->resetComposer();
  3390. return $this->getApplication()->run($input, $output);
  3391. }
  3392. public function isProxyCommand()
  3393. {
  3394. return true;
  3395. }
  3396. }
  3397. <?php
  3398. namespace Composer\Command;
  3399. use Composer\Package\CompletePackageInterface;
  3400. use Composer\Repository\RepositoryInterface;
  3401. use Composer\Repository\ArrayRepository;
  3402. use Composer\Repository\RepositoryFactory;
  3403. use Composer\Util\Platform;
  3404. use Composer\Util\ProcessExecutor;
  3405. use Symfony\Component\Console\Input\InputArgument;
  3406. use Symfony\Component\Console\Input\InputOption;
  3407. use Symfony\Component\Console\Input\InputInterface;
  3408. use Symfony\Component\Console\Output\OutputInterface;
  3409. class HomeCommand extends BaseCommand
  3410. {
  3411. protected function configure()
  3412. {
  3413. $this
  3414. ->setName('browse')
  3415. ->setAliases(array('home'))
  3416. ->setDescription('Opens the package\'s repository URL or homepage in your browser.')
  3417. ->setDefinition(array(
  3418. new InputArgument('packages', InputArgument::IS_ARRAY, 'Package(s) to browse to.'),
  3419. new InputOption('homepage', 'H', InputOption::VALUE_NONE, 'Open the homepage instead of the repository URL.'),
  3420. new InputOption('show', 's', InputOption::VALUE_NONE, 'Only show the homepage or repository URL.'),
  3421. ))
  3422. ->setHelp(
  3423. <<<EOT
  3424. The home command opens or shows a package's repository URL or
  3425. homepage in your default browser.
  3426. To open the homepage by default, use -H or --homepage.
  3427. To show instead of open the repository or homepage URL, use -s or --show.
  3428. Read more at https://getcomposer.org/doc/03-cli.md#browse-home
  3429. EOT
  3430. );
  3431. }
  3432. protected function execute(InputInterface $input, OutputInterface $output)
  3433. {
  3434. $repos = $this->initializeRepos();
  3435. $io = $this->getIO();
  3436. $return = 0;
  3437. $packages = $input->getArgument('packages');
  3438. if (!$packages) {
  3439. $io->writeError('No package specified, opening homepage for the root package');
  3440. $packages = array($this->getComposer()->getPackage()->getName());
  3441. }
  3442. foreach ($packages as $packageName) {
  3443. $handled = false;
  3444. $packageExists = false;
  3445. foreach ($repos as $repo) {
  3446. foreach ($repo->findPackages($packageName) as $package) {
  3447. $packageExists = true;
  3448. if ($package instanceof CompletePackageInterface && $this->handlePackage($package, $input->getOption('homepage'), $input->getOption('show'))) {
  3449. $handled = true;
  3450. break 2;
  3451. }
  3452. }
  3453. }
  3454. if (!$packageExists) {
  3455. $return = 1;
  3456. $io->writeError('<warning>Package '.$packageName.' not found</warning>');
  3457. }
  3458. if (!$handled) {
  3459. $return = 1;
  3460. $io->writeError('<warning>'.($input->getOption('homepage') ? 'Invalid or missing homepage' : 'Invalid or missing repository URL').' for '.$packageName.'</warning>');
  3461. }
  3462. }
  3463. return $return;
  3464. }
  3465. private function handlePackage(CompletePackageInterface $package, $showHomepage, $showOnly)
  3466. {
  3467. $support = $package->getSupport();
  3468. $url = isset($support['source']) ? $support['source'] : $package->getSourceUrl();
  3469. if (!$url || $showHomepage) {
  3470. $url = $package->getHomepage();
  3471. }
  3472. if (!$url || !filter_var($url, FILTER_VALIDATE_URL)) {
  3473. return false;
  3474. }
  3475. if ($showOnly) {
  3476. $this->getIO()->write(sprintf('<info>%s</info>', $url));
  3477. } else {
  3478. $this->openBrowser($url);
  3479. }
  3480. return true;
  3481. }
  3482. private function openBrowser($url)
  3483. {
  3484. $url = ProcessExecutor::escape($url);
  3485. $process = new ProcessExecutor($this->getIO());
  3486. if (Platform::isWindows()) {
  3487. return $process->execute('start "web" explorer "' . $url . '"', $output);
  3488. }
  3489. $linux = $process->execute('which xdg-open', $output);
  3490. $osx = $process->execute('which open', $output);
  3491. if (0 === $linux) {
  3492. $process->execute('xdg-open ' . $url, $output);
  3493. } elseif (0 === $osx) {
  3494. $process->execute('open ' . $url, $output);
  3495. } else {
  3496. $this->getIO()->writeError('No suitable browser opening command found, open yourself: ' . $url);
  3497. }
  3498. }
  3499. private function initializeRepos()
  3500. {
  3501. $composer = $this->getComposer(false);
  3502. if ($composer) {
  3503. return array_merge(
  3504. array(new ArrayRepository(array($composer->getPackage()))),
  3505. array($composer->getRepositoryManager()->getLocalRepository()),
  3506. $composer->getRepositoryManager()->getRepositories()
  3507. );
  3508. }
  3509. return RepositoryFactory::defaultRepos($this->getIO());
  3510. }
  3511. }
  3512. <?php
  3513. namespace Composer\Command;
  3514. use Composer\DependencyResolver\Pool;
  3515. use Composer\Factory;
  3516. use Composer\Json\JsonFile;
  3517. use Composer\Package\BasePackage;
  3518. use Composer\Package\Version\VersionParser;
  3519. use Composer\Package\Version\VersionSelector;
  3520. use Composer\Repository\CompositeRepository;
  3521. use Composer\Repository\PlatformRepository;
  3522. use Composer\Repository\RepositoryFactory;
  3523. use Composer\Util\ProcessExecutor;
  3524. use Symfony\Component\Console\Input\ArrayInput;
  3525. use Symfony\Component\Console\Input\InputInterface;
  3526. use Symfony\Component\Console\Input\InputOption;
  3527. use Symfony\Component\Console\Output\OutputInterface;
  3528. use Symfony\Component\Process\ExecutableFinder;
  3529. use Symfony\Component\Process\Process;
  3530. class InitCommand extends BaseCommand
  3531. {
  3532. protected $repos;
  3533. private $gitConfig;
  3534. private $pools;
  3535. protected function configure()
  3536. {
  3537. $this
  3538. ->setName('init')
  3539. ->setDescription('Creates a basic composer.json file in current directory.')
  3540. ->setDefinition(array(
  3541. new InputOption('name', null, InputOption::VALUE_REQUIRED, 'Name of the package'),
  3542. new InputOption('description', null, InputOption::VALUE_REQUIRED, 'Description of package'),
  3543. new InputOption('author', null, InputOption::VALUE_REQUIRED, 'Author name of package'),
  3544. new InputOption('type', null, InputOption::VALUE_OPTIONAL, 'Type of package (e.g. library, project, metapackage, composer-plugin)'),
  3545. new InputOption('homepage', null, InputOption::VALUE_REQUIRED, 'Homepage of package'),
  3546. 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"'),
  3547. 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"'),
  3548. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum stability (empty or one of: '.implode(', ', array_keys(BasePackage::$stabilities)).')'),
  3549. new InputOption('license', 'l', InputOption::VALUE_REQUIRED, 'License of package'),
  3550. new InputOption('repository', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Add custom repositories, either by URL or using JSON arrays'),
  3551. ))
  3552. ->setHelp(
  3553. <<<EOT
  3554. The <info>init</info> command creates a basic composer.json file
  3555. in the current directory.
  3556. <info>php composer.phar init</info>
  3557. Read more at https://getcomposer.org/doc/03-cli.md#init
  3558. EOT
  3559. )
  3560. ;
  3561. }
  3562. protected function execute(InputInterface $input, OutputInterface $output)
  3563. {
  3564. $io = $this->getIO();
  3565. $whitelist = array('name', 'description', 'author', 'type', 'homepage', 'require', 'require-dev', 'stability', 'license');
  3566. $options = array_filter(array_intersect_key($input->getOptions(), array_flip($whitelist)));
  3567. if (isset($options['author'])) {
  3568. $options['authors'] = $this->formatAuthors($options['author']);
  3569. unset($options['author']);
  3570. }
  3571. $repositories = $input->getOption('repository');
  3572. if ($repositories) {
  3573. $config = Factory::createConfig($io);
  3574. foreach ($repositories as $repo) {
  3575. $options['repositories'][] = RepositoryFactory::configFromString($io, $config, $repo);
  3576. }
  3577. }
  3578. if (isset($options['stability'])) {
  3579. $options['minimum-stability'] = $options['stability'];
  3580. unset($options['stability']);
  3581. }
  3582. $options['require'] = isset($options['require']) ? $this->formatRequirements($options['require']) : new \stdClass;
  3583. if (array() === $options['require']) {
  3584. $options['require'] = new \stdClass;
  3585. }
  3586. if (isset($options['require-dev'])) {
  3587. $options['require-dev'] = $this->formatRequirements($options['require-dev']);
  3588. if (array() === $options['require-dev']) {
  3589. $options['require-dev'] = new \stdClass;
  3590. }
  3591. }
  3592. $file = new JsonFile(Factory::getComposerFile());
  3593. $json = $file->encode($options);
  3594. if ($input->isInteractive()) {
  3595. $io->writeError(array('', $json, ''));
  3596. if (!$io->askConfirmation('Do you confirm generation [<comment>yes</comment>]? ', true)) {
  3597. $io->writeError('<error>Command aborted</error>');
  3598. return 1;
  3599. }
  3600. }
  3601. $file->write($options);
  3602. if ($input->isInteractive() && is_dir('.git')) {
  3603. $ignoreFile = realpath('.gitignore');
  3604. if (false === $ignoreFile) {
  3605. $ignoreFile = realpath('.') . '/.gitignore';
  3606. }
  3607. if (!$this->hasVendorIgnore($ignoreFile)) {
  3608. $question = 'Would you like the <info>vendor</info> directory added to your <info>.gitignore</info> [<comment>yes</comment>]? ';
  3609. if ($io->askConfirmation($question, true)) {
  3610. $this->addVendorIgnore($ignoreFile);
  3611. }
  3612. }
  3613. }
  3614. $question = 'Would you like to install dependencies now [<comment>yes</comment>]? ';
  3615. if ($input->isInteractive() && $this->hasDependencies($options) && $io->askConfirmation($question, true)) {
  3616. $this->installDependencies($output);
  3617. }
  3618. return 0;
  3619. }
  3620. protected function interact(InputInterface $input, OutputInterface $output)
  3621. {
  3622. $git = $this->getGitConfig();
  3623. $io = $this->getIO();
  3624. $formatter = $this->getHelperSet()->get('formatter');
  3625. $repositories = $input->getOption('repository');
  3626. if ($repositories) {
  3627. $config = Factory::createConfig($io);
  3628. $repos = array(new PlatformRepository);
  3629. $createDefaultPackagistRepo = true;
  3630. foreach ($repositories as $repo) {
  3631. $repoConfig = RepositoryFactory::configFromString($io, $config, $repo);
  3632. if (
  3633. (isset($repoConfig['packagist']) && $repoConfig === array('packagist' => false))
  3634. || (isset($repoConfig['packagist.org']) && $repoConfig === array('packagist.org' => false))
  3635. ) {
  3636. $createDefaultPackagistRepo = false;
  3637. continue;
  3638. }
  3639. $repos[] = RepositoryFactory::createRepo($io, $config, $repoConfig);
  3640. }
  3641. if ($createDefaultPackagistRepo) {
  3642. $repos[] = RepositoryFactory::createRepo($io, $config, array(
  3643. 'type' => 'composer',
  3644. 'url' => 'https://repo.packagist.org',
  3645. ));
  3646. }
  3647. $this->repos = new CompositeRepository($repos);
  3648. unset($repos, $config, $repositories);
  3649. }
  3650. $io->writeError(array(
  3651. '',
  3652. $formatter->formatBlock('Welcome to the Composer config generator', 'bg=blue;fg=white', true),
  3653. '',
  3654. ));
  3655. $io->writeError(array(
  3656. '',
  3657. 'This command will guide you through creating your composer.json config.',
  3658. '',
  3659. ));
  3660. $cwd = realpath(".");
  3661. if (!$name = $input->getOption('name')) {
  3662. $name = basename($cwd);
  3663. $name = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
  3664. $name = strtolower($name);
  3665. if (!empty($_SERVER['COMPOSER_DEFAULT_VENDOR'])) {
  3666. $name = $_SERVER['COMPOSER_DEFAULT_VENDOR'] . '/' . $name;
  3667. } elseif (isset($git['github.user'])) {
  3668. $name = $git['github.user'] . '/' . $name;
  3669. } elseif (!empty($_SERVER['USERNAME'])) {
  3670. $name = $_SERVER['USERNAME'] . '/' . $name;
  3671. } elseif (!empty($_SERVER['USER'])) {
  3672. $name = $_SERVER['USER'] . '/' . $name;
  3673. } elseif (get_current_user()) {
  3674. $name = get_current_user() . '/' . $name;
  3675. } else {
  3676. $name .= '/' . $name;
  3677. }
  3678. $name = strtolower($name);
  3679. } else {
  3680. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}D', $name)) {
  3681. throw new \InvalidArgumentException(
  3682. '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_.-]+'
  3683. );
  3684. }
  3685. }
  3686. $name = $io->askAndValidate(
  3687. 'Package name (<vendor>/<name>) [<comment>'.$name.'</comment>]: ',
  3688. function ($value) use ($name) {
  3689. if (null === $value) {
  3690. return $name;
  3691. }
  3692. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}D', $value)) {
  3693. throw new \InvalidArgumentException(
  3694. '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_.-]+'
  3695. );
  3696. }
  3697. return $value;
  3698. },
  3699. null,
  3700. $name
  3701. );
  3702. $input->setOption('name', $name);
  3703. $description = $input->getOption('description') ?: false;
  3704. $description = $io->ask(
  3705. 'Description [<comment>'.$description.'</comment>]: ',
  3706. $description
  3707. );
  3708. $input->setOption('description', $description);
  3709. if (null === $author = $input->getOption('author')) {
  3710. if (!empty($_SERVER['COMPOSER_DEFAULT_AUTHOR'])) {
  3711. $author_name = $_SERVER['COMPOSER_DEFAULT_AUTHOR'];
  3712. } elseif (isset($git['user.name'])) {
  3713. $author_name = $git['user.name'];
  3714. }
  3715. if (!empty($_SERVER['COMPOSER_DEFAULT_EMAIL'])) {
  3716. $author_email = $_SERVER['COMPOSER_DEFAULT_EMAIL'];
  3717. } elseif (isset($git['user.email'])) {
  3718. $author_email = $git['user.email'];
  3719. }
  3720. if (isset($author_name) && isset($author_email)) {
  3721. $author = sprintf('%s <%s>', $author_name, $author_email);
  3722. }
  3723. }
  3724. $self = $this;
  3725. $author = $io->askAndValidate(
  3726. 'Author [<comment>'.$author.'</comment>, n to skip]: ',
  3727. function ($value) use ($self, $author) {
  3728. if ($value === 'n' || $value === 'no') {
  3729. return;
  3730. }
  3731. $value = $value ?: $author;
  3732. $author = $self->parseAuthorString($value);
  3733. return sprintf('%s <%s>', $author['name'], $author['email']);
  3734. },
  3735. null,
  3736. $author
  3737. );
  3738. $input->setOption('author', $author);
  3739. $minimumStability = $input->getOption('stability') ?: null;
  3740. $minimumStability = $io->askAndValidate(
  3741. 'Minimum Stability [<comment>'.$minimumStability.'</comment>]: ',
  3742. function ($value) use ($minimumStability) {
  3743. if (null === $value) {
  3744. return $minimumStability;
  3745. }
  3746. if (!isset(BasePackage::$stabilities[$value])) {
  3747. throw new \InvalidArgumentException(
  3748. 'Invalid minimum stability "'.$value.'". Must be empty or one of: '.
  3749. implode(', ', array_keys(BasePackage::$stabilities))
  3750. );
  3751. }
  3752. return $value;
  3753. },
  3754. null,
  3755. $minimumStability
  3756. );
  3757. $input->setOption('stability', $minimumStability);
  3758. $type = $input->getOption('type') ?: false;
  3759. $type = $io->ask(
  3760. 'Package Type (e.g. library, project, metapackage, composer-plugin) [<comment>'.$type.'</comment>]: ',
  3761. $type
  3762. );
  3763. $input->setOption('type', $type);
  3764. if (null === $license = $input->getOption('license')) {
  3765. if (!empty($_SERVER['COMPOSER_DEFAULT_LICENSE'])) {
  3766. $license = $_SERVER['COMPOSER_DEFAULT_LICENSE'];
  3767. }
  3768. }
  3769. $license = $io->ask(
  3770. 'License [<comment>'.$license.'</comment>]: ',
  3771. $license
  3772. );
  3773. $input->setOption('license', $license);
  3774. $io->writeError(array('', 'Define your dependencies.', ''));
  3775. $repos = $this->getRepos();
  3776. $preferredStability = $minimumStability ?: 'stable';
  3777. $phpVersion = $repos->findPackage('php', '*')->getPrettyVersion();
  3778. $question = 'Would you like to define your dependencies (require) interactively [<comment>yes</comment>]? ';
  3779. $require = $input->getOption('require');
  3780. $requirements = array();
  3781. if ($require || $io->askConfirmation($question, true)) {
  3782. $requirements = $this->determineRequirements($input, $output, $require, $phpVersion, $preferredStability);
  3783. }
  3784. $input->setOption('require', $requirements);
  3785. $question = 'Would you like to define your dev dependencies (require-dev) interactively [<comment>yes</comment>]? ';
  3786. $requireDev = $input->getOption('require-dev');
  3787. $devRequirements = array();
  3788. if ($requireDev || $io->askConfirmation($question, true)) {
  3789. $devRequirements = $this->determineRequirements($input, $output, $requireDev, $phpVersion, $preferredStability);
  3790. }
  3791. $input->setOption('require-dev', $devRequirements);
  3792. }
  3793. public function parseAuthorString($author)
  3794. {
  3795. if (preg_match('/^(?P<name>[- .,\p{L}\p{N}\p{Mn}\'’"()]+) <(?P<email>.+?)>$/u', $author, $match)) {
  3796. if ($this->isValidEmail($match['email'])) {
  3797. return array(
  3798. 'name' => trim($match['name']),
  3799. 'email' => $match['email'],
  3800. );
  3801. }
  3802. }
  3803. throw new \InvalidArgumentException(
  3804. 'Invalid author string. Must be in the format: '.
  3805. 'John Smith <john@example.com>'
  3806. );
  3807. }
  3808. protected function findPackages($name)
  3809. {
  3810. return $this->getRepos()->search($name);
  3811. }
  3812. protected function getRepos()
  3813. {
  3814. if (!$this->repos) {
  3815. $this->repos = new CompositeRepository(array_merge(
  3816. array(new PlatformRepository),
  3817. RepositoryFactory::defaultRepos($this->getIO())
  3818. ));
  3819. }
  3820. return $this->repos;
  3821. }
  3822. final protected function determineRequirements(InputInterface $input, OutputInterface $output, $requires = array(), $phpVersion = null, $preferredStability = 'stable', $checkProvidedVersions = true, $fixed = false)
  3823. {
  3824. if ($requires) {
  3825. $requires = $this->normalizeRequirements($requires);
  3826. $result = array();
  3827. $io = $this->getIO();
  3828. foreach ($requires as $requirement) {
  3829. if (!isset($requirement['version'])) {
  3830. list($name, $version) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $phpVersion, $preferredStability, null, null, $fixed);
  3831. $requirement['version'] = $version;
  3832. $requirement['name'] = $name;
  3833. $io->writeError(sprintf(
  3834. 'Using version <info>%s</info> for <info>%s</info>',
  3835. $requirement['version'],
  3836. $requirement['name']
  3837. ));
  3838. } else {
  3839. list($name, $version) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $phpVersion, $preferredStability, $checkProvidedVersions ? $requirement['version'] : null, 'dev', $fixed);
  3840. $requirement['name'] = $name;
  3841. }
  3842. $result[] = $requirement['name'] . ' ' . $requirement['version'];
  3843. }
  3844. return $result;
  3845. }
  3846. $versionParser = new VersionParser();
  3847. $io = $this->getIO();
  3848. while (null !== $package = $io->ask('Search for a package: ')) {
  3849. $matches = $this->findPackages($package);
  3850. if (count($matches)) {
  3851. $exactMatch = null;
  3852. $choices = array();
  3853. foreach ($matches as $position => $foundPackage) {
  3854. $abandoned = '';
  3855. if (isset($foundPackage['abandoned'])) {
  3856. if (is_string($foundPackage['abandoned'])) {
  3857. $replacement = sprintf('Use %s instead', $foundPackage['abandoned']);
  3858. } else {
  3859. $replacement = 'No replacement was suggested';
  3860. }
  3861. $abandoned = sprintf('<warning>Abandoned. %s.</warning>', $replacement);
  3862. }
  3863. $choices[] = sprintf(' <info>%5s</info> %s %s', "[$position]", $foundPackage['name'], $abandoned);
  3864. if ($foundPackage['name'] === $package) {
  3865. $exactMatch = true;
  3866. break;
  3867. }
  3868. }
  3869. if (!$exactMatch) {
  3870. $io->writeError(array(
  3871. '',
  3872. sprintf('Found <info>%s</info> packages matching <info>%s</info>', count($matches), $package),
  3873. '',
  3874. ));
  3875. $io->writeError($choices);
  3876. $io->writeError('');
  3877. $validator = function ($selection) use ($matches, $versionParser) {
  3878. if ('' === $selection) {
  3879. return false;
  3880. }
  3881. if (is_numeric($selection) && isset($matches[(int) $selection])) {
  3882. $package = $matches[(int) $selection];
  3883. return $package['name'];
  3884. }
  3885. if (preg_match('{^\s*(?P<name>[\S/]+)(?:\s+(?P<version>\S+))?\s*$}', $selection, $packageMatches)) {
  3886. if (isset($packageMatches['version'])) {
  3887. $versionParser->parseConstraints($packageMatches['version']);
  3888. return $packageMatches['name'].' '.$packageMatches['version'];
  3889. }
  3890. return $packageMatches['name'];
  3891. }
  3892. throw new \Exception('Not a valid selection');
  3893. };
  3894. $package = $io->askAndValidate(
  3895. 'Enter package # to add, or the complete package name if it is not listed: ',
  3896. $validator,
  3897. 3,
  3898. false
  3899. );
  3900. }
  3901. if (false !== $package && false === strpos($package, ' ')) {
  3902. $validator = function ($input) {
  3903. $input = trim($input);
  3904. return $input ?: false;
  3905. };
  3906. $constraint = $io->askAndValidate(
  3907. 'Enter the version constraint to require (or leave blank to use the latest version): ',
  3908. $validator,
  3909. 3,
  3910. false
  3911. );
  3912. if (false === $constraint) {
  3913. list($name, $constraint) = $this->findBestVersionAndNameForPackage($input, $package, $phpVersion, $preferredStability);
  3914. $io->writeError(sprintf(
  3915. 'Using version <info>%s</info> for <info>%s</info>',
  3916. $constraint,
  3917. $package
  3918. ));
  3919. }
  3920. $package .= ' '.$constraint;
  3921. }
  3922. if (false !== $package) {
  3923. $requires[] = $package;
  3924. }
  3925. }
  3926. }
  3927. return $requires;
  3928. }
  3929. protected function formatAuthors($author)
  3930. {
  3931. return array($this->parseAuthorString($author));
  3932. }
  3933. protected function formatRequirements(array $requirements)
  3934. {
  3935. $requires = array();
  3936. $requirements = $this->normalizeRequirements($requirements);
  3937. foreach ($requirements as $requirement) {
  3938. $requires[$requirement['name']] = $requirement['version'];
  3939. }
  3940. return $requires;
  3941. }
  3942. protected function getGitConfig()
  3943. {
  3944. if (null !== $this->gitConfig) {
  3945. return $this->gitConfig;
  3946. }
  3947. $finder = new ExecutableFinder();
  3948. $gitBin = $finder->find('git');
  3949. if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
  3950. $cmd = new Process(array($gitBin, 'config', '-l'));
  3951. } else {
  3952. $cmd = new Process(sprintf('%s config -l', ProcessExecutor::escape($gitBin)));
  3953. }
  3954. $cmd->run();
  3955. if ($cmd->isSuccessful()) {
  3956. $this->gitConfig = array();
  3957. preg_match_all('{^([^=]+)=(.*)$}m', $cmd->getOutput(), $matches, PREG_SET_ORDER);
  3958. foreach ($matches as $match) {
  3959. $this->gitConfig[$match[1]] = $match[2];
  3960. }
  3961. return $this->gitConfig;
  3962. }
  3963. return $this->gitConfig = array();
  3964. }
  3965. protected function hasVendorIgnore($ignoreFile, $vendor = 'vendor')
  3966. {
  3967. if (!file_exists($ignoreFile)) {
  3968. return false;
  3969. }
  3970. $pattern = sprintf('{^/?%s(/\*?)?$}', preg_quote($vendor));
  3971. $lines = file($ignoreFile, FILE_IGNORE_NEW_LINES);
  3972. foreach ($lines as $line) {
  3973. if (preg_match($pattern, $line)) {
  3974. return true;
  3975. }
  3976. }
  3977. return false;
  3978. }
  3979. protected function normalizeRequirements(array $requirements)
  3980. {
  3981. $parser = new VersionParser();
  3982. return $parser->parseNameVersionPairs($requirements);
  3983. }
  3984. protected function addVendorIgnore($ignoreFile, $vendor = '/vendor/')
  3985. {
  3986. $contents = "";
  3987. if (file_exists($ignoreFile)) {
  3988. $contents = file_get_contents($ignoreFile);
  3989. if ("\n" !== substr($contents, 0, -1)) {
  3990. $contents .= "\n";
  3991. }
  3992. }
  3993. file_put_contents($ignoreFile, $contents . $vendor. "\n");
  3994. }
  3995. protected function isValidEmail($email)
  3996. {
  3997. if (!function_exists('filter_var')) {
  3998. return true;
  3999. }
  4000. if (PHP_VERSION_ID < 50303) {
  4001. return true;
  4002. }
  4003. return false !== filter_var($email, FILTER_VALIDATE_EMAIL);
  4004. }
  4005. private function getPool(InputInterface $input, $minimumStability = null)
  4006. {
  4007. $key = $minimumStability ?: 'default';
  4008. if (!isset($this->pools[$key])) {
  4009. $this->pools[$key] = $pool = new Pool($minimumStability ?: $this->getMinimumStability($input));
  4010. $pool->addRepository($this->getRepos());
  4011. }
  4012. return $this->pools[$key];
  4013. }
  4014. private function getMinimumStability(InputInterface $input)
  4015. {
  4016. if ($input->hasOption('stability')) {
  4017. return $input->getOption('stability') ?: 'stable';
  4018. }
  4019. $file = Factory::getComposerFile();
  4020. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  4021. if (!empty($composer['minimum-stability'])) {
  4022. return $composer['minimum-stability'];
  4023. }
  4024. }
  4025. return 'stable';
  4026. }
  4027. private function findBestVersionAndNameForPackage(InputInterface $input, $name, $phpVersion, $preferredStability = 'stable', $requiredVersion = null, $minimumStability = null, $fixed = null)
  4028. {
  4029. $versionSelector = new VersionSelector($this->getPool($input, $minimumStability));
  4030. $ignorePlatformReqs = $input->hasOption('ignore-platform-reqs') && $input->getOption('ignore-platform-reqs');
  4031. if ($ignorePlatformReqs) {
  4032. $phpVersion = null;
  4033. }
  4034. $package = $versionSelector->findBestCandidate($name, $requiredVersion, $phpVersion, $preferredStability);
  4035. if (!$package) {
  4036. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  4037. return array($name, $requiredVersion ?: '*');
  4038. }
  4039. if ($phpVersion && $versionSelector->findBestCandidate($name, $requiredVersion, null, $preferredStability)) {
  4040. throw new \InvalidArgumentException(sprintf(
  4041. 'Package %s at version %s has a PHP requirement incompatible with your PHP version (%s)',
  4042. $name,
  4043. $requiredVersion,
  4044. $phpVersion
  4045. ));
  4046. }
  4047. if ($requiredVersion && $versionSelector->findBestCandidate($name, null, $phpVersion, $preferredStability)) {
  4048. throw new \InvalidArgumentException(sprintf(
  4049. 'Could not find package %s in a version matching %s',
  4050. $name,
  4051. $requiredVersion
  4052. ));
  4053. }
  4054. if ($phpVersion && $versionSelector->findBestCandidate($name)) {
  4055. throw new \InvalidArgumentException(sprintf(
  4056. 'Could not find package %s in any version matching your PHP version (%s)',
  4057. $name,
  4058. $phpVersion
  4059. ));
  4060. }
  4061. $similar = $this->findSimilar($name);
  4062. if ($similar) {
  4063. if ($requiredVersion === null && in_array($name, $similar, true)) {
  4064. throw new \InvalidArgumentException(sprintf(
  4065. 'Could not find a version of package %s matching your minimum-stability (%s). Require it with an explicit version constraint allowing its desired stability.',
  4066. $name,
  4067. $this->getMinimumStability($input)
  4068. ));
  4069. }
  4070. throw new \InvalidArgumentException(sprintf(
  4071. "Could not find package %s.\n\nDid you mean " . (count($similar) > 1 ? 'one of these' : 'this') . "?\n %s",
  4072. $name,
  4073. implode("\n ", $similar)
  4074. ));
  4075. }
  4076. throw new \InvalidArgumentException(sprintf(
  4077. '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).',
  4078. $name,
  4079. $this->getMinimumStability($input)
  4080. ));
  4081. }
  4082. return array(
  4083. $package->getPrettyName(),
  4084. $fixed ? $package->getPrettyVersion() : $versionSelector->findRecommendedRequireVersion($package),
  4085. );
  4086. }
  4087. private function findSimilar($package)
  4088. {
  4089. try {
  4090. $results = $this->repos->search($package);
  4091. } catch (\Exception $e) {
  4092. return array();
  4093. }
  4094. $similarPackages = array();
  4095. foreach ($results as $result) {
  4096. $similarPackages[$result['name']] = levenshtein($package, $result['name']);
  4097. }
  4098. asort($similarPackages);
  4099. return array_keys(array_slice($similarPackages, 0, 5));
  4100. }
  4101. private function installDependencies($output)
  4102. {
  4103. try {
  4104. $installCommand = $this->getApplication()->find('install');
  4105. $installCommand->run(new ArrayInput(array()), $output);
  4106. } catch (\Exception $e) {
  4107. $this->getIO()->writeError('Could not install dependencies. Run `composer install` to see more information.');
  4108. }
  4109. }
  4110. private function hasDependencies($options)
  4111. {
  4112. $requires = (array) $options['require'];
  4113. $devRequires = isset($options['require-dev']) ? (array) $options['require-dev'] : array();
  4114. return !empty($requires) || !empty($devRequires);
  4115. }
  4116. }
  4117. <?php
  4118. namespace Composer\Command;
  4119. use Composer\Installer;
  4120. use Composer\Plugin\CommandEvent;
  4121. use Composer\Plugin\PluginEvents;
  4122. use Symfony\Component\Console\Input\InputInterface;
  4123. use Symfony\Component\Console\Input\InputOption;
  4124. use Symfony\Component\Console\Input\InputArgument;
  4125. use Symfony\Component\Console\Output\OutputInterface;
  4126. class InstallCommand extends BaseCommand
  4127. {
  4128. protected function configure()
  4129. {
  4130. $this
  4131. ->setName('install')
  4132. ->setAliases(array('i'))
  4133. ->setDescription('Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.')
  4134. ->setDefinition(array(
  4135. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  4136. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  4137. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  4138. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  4139. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  4140. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  4141. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  4142. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4143. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4144. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  4145. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  4146. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4147. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4148. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4149. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4150. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Should not be provided, use composer require instead to add a given package to composer.json.'),
  4151. ))
  4152. ->setHelp(
  4153. <<<EOT
  4154. The <info>install</info> command reads the composer.lock file from
  4155. the current directory, processes it, and downloads and installs all the
  4156. libraries and dependencies outlined in that file. If the file does not
  4157. exist it will look for composer.json and do the same.
  4158. <info>php composer.phar install</info>
  4159. Read more at https://getcomposer.org/doc/03-cli.md#install-i
  4160. EOT
  4161. )
  4162. ;
  4163. }
  4164. protected function execute(InputInterface $input, OutputInterface $output)
  4165. {
  4166. $io = $this->getIO();
  4167. if ($args = $input->getArgument('packages')) {
  4168. $io->writeError('<error>Invalid argument '.implode(' ', $args).'. Use "composer require '.implode(' ', $args).'" instead to add packages to your composer.json.</error>');
  4169. return 1;
  4170. }
  4171. if ($input->getOption('no-custom-installers')) {
  4172. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  4173. $input->setOption('no-plugins', true);
  4174. }
  4175. if ($input->getOption('dev')) {
  4176. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  4177. }
  4178. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4179. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4180. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'install', $input, $output);
  4181. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4182. $install = Installer::create($io, $composer);
  4183. $config = $composer->getConfig();
  4184. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  4185. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  4186. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  4187. $apcu = $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  4188. $install
  4189. ->setDryRun($input->getOption('dry-run'))
  4190. ->setVerbose($input->getOption('verbose'))
  4191. ->setPreferSource($preferSource)
  4192. ->setPreferDist($preferDist)
  4193. ->setDevMode(!$input->getOption('no-dev'))
  4194. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  4195. ->setRunScripts(!$input->getOption('no-scripts'))
  4196. ->setSkipSuggest($input->getOption('no-suggest'))
  4197. ->setOptimizeAutoloader($optimize)
  4198. ->setClassMapAuthoritative($authoritative)
  4199. ->setApcuAutoloader($apcu)
  4200. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4201. ;
  4202. if ($input->getOption('no-plugins')) {
  4203. $install->disablePlugins();
  4204. }
  4205. return $install->run();
  4206. }
  4207. }
  4208. <?php
  4209. namespace Composer\Command;
  4210. use Composer\Json\JsonFile;
  4211. use Composer\Plugin\CommandEvent;
  4212. use Composer\Plugin\PluginEvents;
  4213. use Composer\Package\PackageInterface;
  4214. use Composer\Repository\RepositoryInterface;
  4215. use Symfony\Component\Console\Helper\Table;
  4216. use Symfony\Component\Console\Input\InputInterface;
  4217. use Symfony\Component\Console\Input\InputOption;
  4218. use Symfony\Component\Console\Output\OutputInterface;
  4219. class LicensesCommand extends BaseCommand
  4220. {
  4221. protected function configure()
  4222. {
  4223. $this
  4224. ->setName('licenses')
  4225. ->setDescription('Shows information about licenses of dependencies.')
  4226. ->setDefinition(array(
  4227. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  4228. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables search in require-dev packages.'),
  4229. ))
  4230. ->setHelp(
  4231. <<<EOT
  4232. The license command displays detailed information about the licenses of
  4233. the installed dependencies.
  4234. Read more at https://getcomposer.org/doc/03-cli.md#licenses
  4235. EOT
  4236. )
  4237. ;
  4238. }
  4239. protected function execute(InputInterface $input, OutputInterface $output)
  4240. {
  4241. $composer = $this->getComposer();
  4242. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'licenses', $input, $output);
  4243. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4244. $root = $composer->getPackage();
  4245. $repo = $composer->getRepositoryManager()->getLocalRepository();
  4246. if ($input->getOption('no-dev')) {
  4247. $packages = $this->filterRequiredPackages($repo, $root);
  4248. } else {
  4249. $packages = $this->appendPackages($repo->getPackages(), array());
  4250. }
  4251. ksort($packages);
  4252. $io = $this->getIO();
  4253. switch ($format = $input->getOption('format')) {
  4254. case 'text':
  4255. $io->write('Name: <comment>'.$root->getPrettyName().'</comment>');
  4256. $io->write('Version: <comment>'.$root->getFullPrettyVersion().'</comment>');
  4257. $io->write('Licenses: <comment>'.(implode(', ', $root->getLicense()) ?: 'none').'</comment>');
  4258. $io->write('Dependencies:');
  4259. $io->write('');
  4260. $table = new Table($output);
  4261. $table->setStyle('compact');
  4262. $tableStyle = $table->getStyle();
  4263. $tableStyle->setVerticalBorderChar('');
  4264. $tableStyle->setCellRowContentFormat('%s ');
  4265. $table->setHeaders(array('Name', 'Version', 'License'));
  4266. foreach ($packages as $package) {
  4267. $table->addRow(array(
  4268. $package->getPrettyName(),
  4269. $package->getFullPrettyVersion(),
  4270. implode(', ', $package->getLicense()) ?: 'none',
  4271. ));
  4272. }
  4273. $table->render();
  4274. break;
  4275. case 'json':
  4276. $dependencies = array();
  4277. foreach ($packages as $package) {
  4278. $dependencies[$package->getPrettyName()] = array(
  4279. 'version' => $package->getFullPrettyVersion(),
  4280. 'license' => $package->getLicense(),
  4281. );
  4282. }
  4283. $io->write(JsonFile::encode(array(
  4284. 'name' => $root->getPrettyName(),
  4285. 'version' => $root->getFullPrettyVersion(),
  4286. 'license' => $root->getLicense(),
  4287. 'dependencies' => $dependencies,
  4288. )));
  4289. break;
  4290. default:
  4291. throw new \RuntimeException(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  4292. }
  4293. return 0;
  4294. }
  4295. private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, $bucket = array())
  4296. {
  4297. $requires = array_keys($package->getRequires());
  4298. $packageListNames = array_keys($bucket);
  4299. $packages = array_filter(
  4300. $repo->getPackages(),
  4301. function ($package) use ($requires, $packageListNames) {
  4302. return in_array($package->getName(), $requires) && !in_array($package->getName(), $packageListNames);
  4303. }
  4304. );
  4305. $bucket = $this->appendPackages($packages, $bucket);
  4306. foreach ($packages as $package) {
  4307. $bucket = $this->filterRequiredPackages($repo, $package, $bucket);
  4308. }
  4309. return $bucket;
  4310. }
  4311. public function appendPackages(array $packages, array $bucket)
  4312. {
  4313. foreach ($packages as $package) {
  4314. $bucket[$package->getName()] = $package;
  4315. }
  4316. return $bucket;
  4317. }
  4318. }
  4319. <?php
  4320. namespace Composer\Command;
  4321. use Symfony\Component\Console\Input\InputInterface;
  4322. use Symfony\Component\Console\Input\InputArgument;
  4323. use Symfony\Component\Console\Input\ArrayInput;
  4324. use Symfony\Component\Console\Input\InputOption;
  4325. use Symfony\Component\Console\Output\OutputInterface;
  4326. class OutdatedCommand extends ShowCommand
  4327. {
  4328. protected function configure()
  4329. {
  4330. $this
  4331. ->setName('outdated')
  4332. ->setDescription('Shows a list of installed packages that have updates available, including their latest version.')
  4333. ->setDefinition(array(
  4334. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  4335. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show only packages that are outdated (this is the default, but present here for compat with `show`'),
  4336. new InputOption('all', 'a', InputOption::VALUE_NONE, 'Show all installed packages with their latest versions'),
  4337. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  4338. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  4339. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
  4340. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  4341. new InputOption('ignore', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore specified package(s). Use it with the --outdated option if you don\'t want to be informed about new versions of some packages.'),
  4342. ))
  4343. ->setHelp(
  4344. <<<EOT
  4345. The outdated command is just a proxy for `composer show -l`
  4346. The color coding (or signage if you have ANSI colors disabled) for dependency versions is as such:
  4347. - <info>green</info> (=): Dependency is in the latest version and is up to date.
  4348. - <comment>yellow</comment> (~): Dependency has a new version available that includes backwards
  4349. compatibility breaks according to semver, so upgrade when you can but it
  4350. may involve work.
  4351. - <highlight>red</highlight> (!): Dependency has a new version that is semver-compatible and you should upgrade it.
  4352. Read more at https://getcomposer.org/doc/03-cli.md#outdated
  4353. EOT
  4354. )
  4355. ;
  4356. }
  4357. protected function execute(InputInterface $input, OutputInterface $output)
  4358. {
  4359. $args = array(
  4360. 'command' => 'show',
  4361. '--latest' => true,
  4362. );
  4363. if (!$input->getOption('all')) {
  4364. $args['--outdated'] = true;
  4365. }
  4366. if ($input->getOption('direct')) {
  4367. $args['--direct'] = true;
  4368. }
  4369. if ($input->getArgument('package')) {
  4370. $args['package'] = $input->getArgument('package');
  4371. }
  4372. if ($input->getOption('strict')) {
  4373. $args['--strict'] = true;
  4374. }
  4375. if ($input->getOption('minor-only')) {
  4376. $args['--minor-only'] = true;
  4377. }
  4378. $args['--format'] = $input->getOption('format');
  4379. $args['--ignore'] = $input->getOption('ignore');
  4380. $input = new ArrayInput($args);
  4381. return $this->getApplication()->run($input, $output);
  4382. }
  4383. public function isProxyCommand()
  4384. {
  4385. return true;
  4386. }
  4387. }
  4388. <?php
  4389. namespace Composer\Command;
  4390. use Symfony\Component\Console\Input\InputInterface;
  4391. use Symfony\Component\Console\Output\OutputInterface;
  4392. class ProhibitsCommand extends BaseDependencyCommand
  4393. {
  4394. protected function configure()
  4395. {
  4396. parent::configure();
  4397. $this
  4398. ->setName('prohibits')
  4399. ->setAliases(array('why-not'))
  4400. ->setDescription('Shows which packages prevent the given package from being installed.')
  4401. ->setHelp(
  4402. <<<EOT
  4403. Displays detailed information about why a package cannot be installed.
  4404. <info>php composer.phar prohibits composer/composer</info>
  4405. Read more at https://getcomposer.org/doc/03-cli.md#prohibits-why-not-
  4406. EOT
  4407. )
  4408. ;
  4409. }
  4410. protected function execute(InputInterface $input, OutputInterface $output)
  4411. {
  4412. return parent::doExecute($input, $output, true);
  4413. }
  4414. }
  4415. <?php
  4416. namespace Composer\Command;
  4417. use Composer\Config\JsonConfigSource;
  4418. use Composer\Installer;
  4419. use Composer\Plugin\CommandEvent;
  4420. use Composer\Plugin\PluginEvents;
  4421. use Composer\Json\JsonFile;
  4422. use Composer\Factory;
  4423. use Symfony\Component\Console\Input\InputInterface;
  4424. use Symfony\Component\Console\Input\InputOption;
  4425. use Symfony\Component\Console\Input\InputArgument;
  4426. use Symfony\Component\Console\Output\OutputInterface;
  4427. use Composer\Package\BasePackage;
  4428. class RemoveCommand extends BaseCommand
  4429. {
  4430. protected function configure()
  4431. {
  4432. $this
  4433. ->setName('remove')
  4434. ->setDescription('Removes a package from the require or require-dev.')
  4435. ->setDefinition(array(
  4436. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'Packages that should be removed.'),
  4437. new InputOption('dev', null, InputOption::VALUE_NONE, 'Removes a package from the require-dev section.'),
  4438. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4439. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  4440. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4441. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  4442. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated with explicit dependencies. (Deprecrated, is now default behavior)'),
  4443. new InputOption('no-update-with-dependencies', null, InputOption::VALUE_NONE, 'Does not allow inherited dependencies to be updated with explicit dependencies.'),
  4444. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4445. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4446. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4447. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4448. ))
  4449. ->setHelp(
  4450. <<<EOT
  4451. The <info>remove</info> command removes a package from the current
  4452. list of installed packages
  4453. <info>php composer.phar remove</info>
  4454. Read more at https://getcomposer.org/doc/03-cli.md#remove
  4455. EOT
  4456. )
  4457. ;
  4458. }
  4459. protected function execute(InputInterface $input, OutputInterface $output)
  4460. {
  4461. $packages = $input->getArgument('packages');
  4462. $packages = array_map('strtolower', $packages);
  4463. $file = Factory::getComposerFile();
  4464. $jsonFile = new JsonFile($file);
  4465. $composer = $jsonFile->read();
  4466. $composerBackup = file_get_contents($jsonFile->getPath());
  4467. $json = new JsonConfigSource($jsonFile);
  4468. $type = $input->getOption('dev') ? 'require-dev' : 'require';
  4469. $altType = !$input->getOption('dev') ? 'require-dev' : 'require';
  4470. $io = $this->getIO();
  4471. if ($input->getOption('update-with-dependencies')) {
  4472. $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>');
  4473. }
  4474. foreach (array('require', 'require-dev') as $linkType) {
  4475. if (isset($composer[$linkType])) {
  4476. foreach ($composer[$linkType] as $name => $version) {
  4477. $composer[$linkType][strtolower($name)] = $name;
  4478. }
  4479. }
  4480. }
  4481. foreach ($packages as $package) {
  4482. if (isset($composer[$type][$package])) {
  4483. $json->removeLink($type, $composer[$type][$package]);
  4484. } elseif (isset($composer[$altType][$package])) {
  4485. $io->writeError('<warning>' . $composer[$altType][$package] . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>');
  4486. if ($io->isInteractive()) {
  4487. if ($io->askConfirmation('Do you want to remove it from ' . $altType . ' [<comment>yes</comment>]? ', true)) {
  4488. $json->removeLink($altType, $composer[$altType][$package]);
  4489. }
  4490. }
  4491. } elseif (isset($composer[$type]) && $matches = preg_grep(BasePackage::packageNameToRegexp($package), array_keys($composer[$type]))) {
  4492. foreach ($matches as $matchedPackage) {
  4493. $json->removeLink($type, $matchedPackage);
  4494. }
  4495. } elseif (isset($composer[$altType]) && $matches = preg_grep(BasePackage::packageNameToRegexp($package), array_keys($composer[$altType]))) {
  4496. foreach ($matches as $matchedPackage) {
  4497. $io->writeError('<warning>' . $matchedPackage . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>');
  4498. if ($io->isInteractive()) {
  4499. if ($io->askConfirmation('Do you want to remove it from ' . $altType . ' [<comment>yes</comment>]? ', true)) {
  4500. $json->removeLink($altType, $matchedPackage);
  4501. }
  4502. }
  4503. }
  4504. } else {
  4505. $io->writeError('<warning>'.$package.' is not required in your composer.json and has not been removed</warning>');
  4506. }
  4507. }
  4508. if ($input->getOption('no-update')) {
  4509. return 0;
  4510. }
  4511. $this->resetComposer();
  4512. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4513. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4514. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'remove', $input, $output);
  4515. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4516. $install = Installer::create($io, $composer);
  4517. $updateDevMode = !$input->getOption('update-no-dev');
  4518. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  4519. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  4520. $apcu = $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  4521. $install
  4522. ->setVerbose($input->getOption('verbose'))
  4523. ->setDevMode($updateDevMode)
  4524. ->setOptimizeAutoloader($optimize)
  4525. ->setClassMapAuthoritative($authoritative)
  4526. ->setApcuAutoloader($apcu)
  4527. ->setUpdate(true)
  4528. ->setUpdateWhitelist($packages)
  4529. ->setWhitelistTransitiveDependencies(!$input->getOption('no-update-with-dependencies'))
  4530. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4531. ->setRunScripts(!$input->getOption('no-scripts'))
  4532. ;
  4533. $status = $install->run();
  4534. if ($status !== 0) {
  4535. $io->writeError("\n".'<error>Removal failed, reverting '.$file.' to its original content.</error>');
  4536. file_put_contents($jsonFile->getPath(), $composerBackup);
  4537. }
  4538. return $status;
  4539. }
  4540. }
  4541. <?php
  4542. namespace Composer\Command;
  4543. use Symfony\Component\Console\Input\InputInterface;
  4544. use Symfony\Component\Console\Input\InputArgument;
  4545. use Symfony\Component\Console\Input\InputOption;
  4546. use Symfony\Component\Console\Output\OutputInterface;
  4547. use Composer\Factory;
  4548. use Composer\Installer;
  4549. use Composer\Json\JsonFile;
  4550. use Composer\Json\JsonManipulator;
  4551. use Composer\Package\Version\VersionParser;
  4552. use Composer\Plugin\CommandEvent;
  4553. use Composer\Plugin\PluginEvents;
  4554. use Composer\Repository\CompositeRepository;
  4555. use Composer\Repository\PlatformRepository;
  4556. use Composer\IO\IOInterface;
  4557. use Composer\Util\Silencer;
  4558. class RequireCommand extends InitCommand
  4559. {
  4560. private $newlyCreated;
  4561. private $json;
  4562. private $file;
  4563. private $composerBackup;
  4564. protected function configure()
  4565. {
  4566. $this
  4567. ->setName('require')
  4568. ->setDescription('Adds required packages to your composer.json and installs them.')
  4569. ->setDefinition(array(
  4570. 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"'),
  4571. new InputOption('dev', null, InputOption::VALUE_NONE, 'Add requirement to require-dev.'),
  4572. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  4573. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  4574. new InputOption('fixed', null, InputOption::VALUE_NONE, 'Write fixed version to the composer.json.'),
  4575. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4576. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  4577. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  4578. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4579. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  4580. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated, except those that are root requirements.'),
  4581. new InputOption('update-with-all-dependencies', null, InputOption::VALUE_NONE, 'Allows all inherited dependencies to be updated, including those that are root requirements.'),
  4582. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4583. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  4584. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  4585. new InputOption('sort-packages', null, InputOption::VALUE_NONE, 'Sorts packages when adding/updating a new dependency'),
  4586. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4587. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4588. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4589. ))
  4590. ->setHelp(
  4591. <<<EOT
  4592. The require command adds required packages to your composer.json and installs them.
  4593. If you do not specify a package, composer will prompt you to search for a package, and given results, provide a list of
  4594. matches to require.
  4595. If you do not specify a version constraint, composer will choose a suitable one based on the available package versions.
  4596. If you do not want to install the new dependencies immediately you can call it with --no-update
  4597. Read more at https://getcomposer.org/doc/03-cli.md#require
  4598. EOT
  4599. )
  4600. ;
  4601. }
  4602. protected function execute(InputInterface $input, OutputInterface $output)
  4603. {
  4604. if (function_exists('pcntl_async_signals')) {
  4605. pcntl_async_signals(true);
  4606. pcntl_signal(SIGINT, array($this, 'revertComposerFile'));
  4607. pcntl_signal(SIGTERM, array($this, 'revertComposerFile'));
  4608. pcntl_signal(SIGHUP, array($this, 'revertComposerFile'));
  4609. }
  4610. $this->file = Factory::getComposerFile();
  4611. $io = $this->getIO();
  4612. $this->newlyCreated = !file_exists($this->file);
  4613. if ($this->newlyCreated && !file_put_contents($this->file, "{\n}\n")) {
  4614. $io->writeError('<error>'.$this->file.' could not be created.</error>');
  4615. return 1;
  4616. }
  4617. if (!is_readable($this->file) && false === Silencer::call('file_get_contents', $this->file)) {
  4618. $io->writeError('<error>'.$this->file.' is not readable.</error>');
  4619. return 1;
  4620. }
  4621. if (filesize($this->file) === 0) {
  4622. file_put_contents($this->file, "{\n}\n");
  4623. }
  4624. $this->json = new JsonFile($this->file);
  4625. $this->composerBackup = file_get_contents($this->json->getPath());
  4626. if (!is_writable($this->file) && !Silencer::call('file_put_contents', $this->file, $this->composerBackup)) {
  4627. $io->writeError('<error>'.$this->file.' is not writable.</error>');
  4628. return 1;
  4629. }
  4630. if ($input->getOption('fixed') === true) {
  4631. $config = $this->json->read();
  4632. $packageType = empty($config['type']) ? 'library' : $config['type'];
  4633. if ($packageType !== 'project') {
  4634. $io->writeError('<error>"--fixed" option is allowed for "project" package types only to prevent possible misuses.</error>');
  4635. if (empty($config['type'])) {
  4636. $io->writeError('<error>If your package is not library, you should explicitly specify "type" parameter in composer.json.</error>');
  4637. }
  4638. return 1;
  4639. }
  4640. }
  4641. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4642. $repos = $composer->getRepositoryManager()->getRepositories();
  4643. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  4644. $this->repos = new CompositeRepository(array_merge(
  4645. array(new PlatformRepository(array(), $platformOverrides)),
  4646. $repos
  4647. ));
  4648. if ($composer->getPackage()->getPreferStable()) {
  4649. $preferredStability = 'stable';
  4650. } else {
  4651. $preferredStability = $composer->getPackage()->getMinimumStability();
  4652. }
  4653. $phpVersion = $this->repos->findPackage('php', '*')->getPrettyVersion();
  4654. try {
  4655. $requirements = $this->determineRequirements($input, $output, $input->getArgument('packages'), $phpVersion, $preferredStability, !$input->getOption('no-update'), $input->getOption('fixed'));
  4656. } catch (\Exception $e) {
  4657. if ($this->newlyCreated) {
  4658. throw new \RuntimeException('No composer.json present in the current directory, this may be the cause of the following exception.', 0, $e);
  4659. }
  4660. throw $e;
  4661. }
  4662. $requireKey = $input->getOption('dev') ? 'require-dev' : 'require';
  4663. $removeKey = $input->getOption('dev') ? 'require' : 'require-dev';
  4664. $requirements = $this->formatRequirements($requirements);
  4665. $versionParser = new VersionParser();
  4666. foreach ($requirements as $package => $constraint) {
  4667. if (strtolower($package) === $composer->getPackage()->getName()) {
  4668. $io->writeError(sprintf('<error>Root package \'%s\' cannot require itself in its composer.json</error>', $package));
  4669. return 1;
  4670. }
  4671. $versionParser->parseConstraints($constraint);
  4672. }
  4673. $sortPackages = $input->getOption('sort-packages') || $composer->getConfig()->get('sort-packages');
  4674. if (!$this->updateFileCleanly($this->json, $requirements, $requireKey, $removeKey, $sortPackages)) {
  4675. $composerDefinition = $this->json->read();
  4676. foreach ($requirements as $package => $version) {
  4677. $composerDefinition[$requireKey][$package] = $version;
  4678. unset($composerDefinition[$removeKey][$package]);
  4679. }
  4680. $this->json->write($composerDefinition);
  4681. }
  4682. $io->writeError('<info>'.$this->file.' has been '.($this->newlyCreated ? 'created' : 'updated').'</info>');
  4683. if ($input->getOption('no-update')) {
  4684. return 0;
  4685. }
  4686. try {
  4687. return $this->doUpdate($input, $output, $io, $requirements);
  4688. } catch (\Exception $e) {
  4689. $this->revertComposerFile(false);
  4690. throw $e;
  4691. }
  4692. }
  4693. private function doUpdate(InputInterface $input, OutputInterface $output, IOInterface $io, array $requirements)
  4694. {
  4695. $this->resetComposer();
  4696. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4697. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4698. $updateDevMode = !$input->getOption('update-no-dev');
  4699. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  4700. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  4701. $apcu = $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  4702. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'require', $input, $output);
  4703. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4704. $install = Installer::create($io, $composer);
  4705. $install
  4706. ->setVerbose($input->getOption('verbose'))
  4707. ->setPreferSource($input->getOption('prefer-source'))
  4708. ->setPreferDist($input->getOption('prefer-dist'))
  4709. ->setDevMode($updateDevMode)
  4710. ->setRunScripts(!$input->getOption('no-scripts'))
  4711. ->setSkipSuggest($input->getOption('no-suggest'))
  4712. ->setOptimizeAutoloader($optimize)
  4713. ->setClassMapAuthoritative($authoritative)
  4714. ->setApcuAutoloader($apcu)
  4715. ->setUpdate(true)
  4716. ->setUpdateWhitelist(array_keys($requirements))
  4717. ->setWhitelistTransitiveDependencies($input->getOption('update-with-dependencies'))
  4718. ->setWhitelistAllDependencies($input->getOption('update-with-all-dependencies'))
  4719. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4720. ->setPreferStable($input->getOption('prefer-stable'))
  4721. ->setPreferLowest($input->getOption('prefer-lowest'))
  4722. ;
  4723. $status = $install->run();
  4724. if ($status !== 0) {
  4725. $this->revertComposerFile(false);
  4726. }
  4727. return $status;
  4728. }
  4729. private function updateFileCleanly($json, array $new, $requireKey, $removeKey, $sortPackages)
  4730. {
  4731. $contents = file_get_contents($json->getPath());
  4732. $manipulator = new JsonManipulator($contents);
  4733. foreach ($new as $package => $constraint) {
  4734. if (!$manipulator->addLink($requireKey, $package, $constraint, $sortPackages)) {
  4735. return false;
  4736. }
  4737. if (!$manipulator->removeSubNode($removeKey, $package)) {
  4738. return false;
  4739. }
  4740. }
  4741. file_put_contents($json->getPath(), $manipulator->getContents());
  4742. return true;
  4743. }
  4744. protected function interact(InputInterface $input, OutputInterface $output)
  4745. {
  4746. return;
  4747. }
  4748. public function revertComposerFile($hardExit = true)
  4749. {
  4750. $io = $this->getIO();
  4751. if ($this->newlyCreated) {
  4752. $io->writeError("\n".'<error>Installation failed, deleting '.$this->file.'.</error>');
  4753. unlink($this->json->getPath());
  4754. } else {
  4755. $io->writeError("\n".'<error>Installation failed, reverting '.$this->file.' to its original content.</error>');
  4756. file_put_contents($this->json->getPath(), $this->composerBackup);
  4757. }
  4758. if ($hardExit) {
  4759. exit(1);
  4760. }
  4761. }
  4762. }
  4763. <?php
  4764. namespace Composer\Command;
  4765. use Composer\Script\Event as ScriptEvent;
  4766. use Composer\Script\ScriptEvents;
  4767. use Composer\Util\ProcessExecutor;
  4768. use Symfony\Component\Console\Input\InputInterface;
  4769. use Symfony\Component\Console\Input\InputOption;
  4770. use Symfony\Component\Console\Input\InputArgument;
  4771. use Symfony\Component\Console\Output\OutputInterface;
  4772. use Symfony\Component\Console\Helper\Table;
  4773. class RunScriptCommand extends BaseCommand
  4774. {
  4775. protected $scriptEvents = array(
  4776. ScriptEvents::PRE_INSTALL_CMD,
  4777. ScriptEvents::POST_INSTALL_CMD,
  4778. ScriptEvents::PRE_UPDATE_CMD,
  4779. ScriptEvents::POST_UPDATE_CMD,
  4780. ScriptEvents::PRE_STATUS_CMD,
  4781. ScriptEvents::POST_STATUS_CMD,
  4782. ScriptEvents::POST_ROOT_PACKAGE_INSTALL,
  4783. ScriptEvents::POST_CREATE_PROJECT_CMD,
  4784. ScriptEvents::PRE_ARCHIVE_CMD,
  4785. ScriptEvents::POST_ARCHIVE_CMD,
  4786. ScriptEvents::PRE_AUTOLOAD_DUMP,
  4787. ScriptEvents::POST_AUTOLOAD_DUMP,
  4788. );
  4789. protected function configure()
  4790. {
  4791. $this
  4792. ->setName('run-script')
  4793. ->setAliases(array('run'))
  4794. ->setDescription('Runs the scripts defined in composer.json.')
  4795. ->setDefinition(array(
  4796. new InputArgument('script', InputArgument::OPTIONAL, 'Script name to run.'),
  4797. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  4798. new InputOption('timeout', null, InputOption::VALUE_REQUIRED, 'Sets script timeout in seconds, or 0 for never.'),
  4799. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  4800. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  4801. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List scripts.'),
  4802. ))
  4803. ->setHelp(
  4804. <<<EOT
  4805. The <info>run-script</info> command runs scripts defined in composer.json:
  4806. <info>php composer.phar run-script post-update-cmd</info>
  4807. Read more at https://getcomposer.org/doc/03-cli.md#run-script
  4808. EOT
  4809. )
  4810. ;
  4811. }
  4812. protected function execute(InputInterface $input, OutputInterface $output)
  4813. {
  4814. if ($input->getOption('list')) {
  4815. return $this->listScripts($output);
  4816. } elseif (!$input->getArgument('script')) {
  4817. throw new \RuntimeException('Missing required argument "script"');
  4818. }
  4819. $script = $input->getArgument('script');
  4820. if (!in_array($script, $this->scriptEvents)) {
  4821. if (defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  4822. throw new \InvalidArgumentException(sprintf('Script "%s" cannot be run with this command', $script));
  4823. }
  4824. }
  4825. $composer = $this->getComposer();
  4826. $devMode = $input->getOption('dev') || !$input->getOption('no-dev');
  4827. $event = new ScriptEvent($script, $composer, $this->getIO(), $devMode);
  4828. $hasListeners = $composer->getEventDispatcher()->hasEventListeners($event);
  4829. if (!$hasListeners) {
  4830. throw new \InvalidArgumentException(sprintf('Script "%s" is not defined in this package', $script));
  4831. }
  4832. $args = $input->getArgument('args');
  4833. if (null !== $timeout = $input->getOption('timeout')) {
  4834. if (!ctype_digit($timeout)) {
  4835. throw new \RuntimeException('Timeout value must be numeric and positive if defined, or 0 for forever');
  4836. }
  4837. ProcessExecutor::setTimeout((int) $timeout);
  4838. }
  4839. return $composer->getEventDispatcher()->dispatchScript($script, $devMode, $args);
  4840. }
  4841. protected function listScripts(OutputInterface $output)
  4842. {
  4843. $scripts = $this->getComposer()->getPackage()->getScripts();
  4844. if (!count($scripts)) {
  4845. return 0;
  4846. }
  4847. $io = $this->getIO();
  4848. $io->writeError('<info>scripts:</info>');
  4849. $table = array();
  4850. foreach ($scripts as $name => $script) {
  4851. $description = '';
  4852. try {
  4853. $cmd = $this->getApplication()->find($name);
  4854. if ($cmd instanceof ScriptAliasCommand) {
  4855. $description = $cmd->getDescription();
  4856. }
  4857. } catch (\Symfony\Component\Console\Exception\CommandNotFoundException $e) {
  4858. }
  4859. $table[] = array(' '.$name, $description);
  4860. }
  4861. $renderer = new Table($output);
  4862. $renderer->setStyle('compact');
  4863. $rendererStyle = $renderer->getStyle();
  4864. $rendererStyle->setVerticalBorderChar('');
  4865. $rendererStyle->setCellRowContentFormat('%s ');
  4866. $renderer->setRows($table)->render();
  4867. return 0;
  4868. }
  4869. }
  4870. <?php
  4871. namespace Composer\Command;
  4872. use Symfony\Component\Console\Input\InputInterface;
  4873. use Symfony\Component\Console\Input\InputOption;
  4874. use Symfony\Component\Console\Input\InputArgument;
  4875. use Symfony\Component\Console\Output\OutputInterface;
  4876. class ScriptAliasCommand extends BaseCommand
  4877. {
  4878. private $script;
  4879. private $description;
  4880. public function __construct($script, $description)
  4881. {
  4882. $this->script = $script;
  4883. $this->description = empty($description) ? 'Runs the '.$script.' script as defined in composer.json.' : $description;
  4884. parent::__construct();
  4885. }
  4886. protected function configure()
  4887. {
  4888. $this
  4889. ->setName($this->script)
  4890. ->setDescription($this->description)
  4891. ->setDefinition(array(
  4892. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  4893. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  4894. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  4895. ))
  4896. ->setHelp(
  4897. <<<EOT
  4898. The <info>run-script</info> command runs scripts defined in composer.json:
  4899. <info>php composer.phar run-script post-update-cmd</info>
  4900. Read more at https://getcomposer.org/doc/03-cli.md#run-script
  4901. EOT
  4902. )
  4903. ;
  4904. }
  4905. protected function execute(InputInterface $input, OutputInterface $output)
  4906. {
  4907. $composer = $this->getComposer();
  4908. $args = $input->getArguments();
  4909. return $composer->getEventDispatcher()->dispatchScript($this->script, $input->getOption('dev') || !$input->getOption('no-dev'), $args['args']);
  4910. }
  4911. }
  4912. <?php
  4913. namespace Composer\Command;
  4914. use Composer\Factory;
  4915. use Symfony\Component\Console\Input\InputInterface;
  4916. use Symfony\Component\Console\Input\InputArgument;
  4917. use Symfony\Component\Console\Input\InputOption;
  4918. use Symfony\Component\Console\Output\OutputInterface;
  4919. use Composer\Repository\CompositeRepository;
  4920. use Composer\Repository\PlatformRepository;
  4921. use Composer\Repository\RepositoryInterface;
  4922. use Composer\Plugin\CommandEvent;
  4923. use Composer\Plugin\PluginEvents;
  4924. class SearchCommand extends BaseCommand
  4925. {
  4926. protected $matches;
  4927. protected $lowMatches = array();
  4928. protected $tokens;
  4929. protected $output;
  4930. protected $onlyName;
  4931. protected function configure()
  4932. {
  4933. $this
  4934. ->setName('search')
  4935. ->setDescription('Searches for packages.')
  4936. ->setDefinition(array(
  4937. new InputOption('only-name', 'N', InputOption::VALUE_NONE, 'Search only in name'),
  4938. new InputOption('type', 't', InputOption::VALUE_REQUIRED, 'Search for a specific package type'),
  4939. new InputArgument('tokens', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'tokens to search for'),
  4940. ))
  4941. ->setHelp(
  4942. <<<EOT
  4943. The search command searches for packages by its name
  4944. <info>php composer.phar search symfony composer</info>
  4945. Read more at https://getcomposer.org/doc/03-cli.md#search
  4946. EOT
  4947. )
  4948. ;
  4949. }
  4950. protected function execute(InputInterface $input, OutputInterface $output)
  4951. {
  4952. $platformRepo = new PlatformRepository;
  4953. $io = $this->getIO();
  4954. if (!($composer = $this->getComposer(false))) {
  4955. $composer = Factory::create($this->getIO(), array(), $input->hasParameterOption('--no-plugins'));
  4956. }
  4957. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  4958. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  4959. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  4960. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'search', $input, $output);
  4961. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4962. $onlyName = $input->getOption('only-name');
  4963. $type = $input->getOption('type') ?: null;
  4964. $flags = $onlyName ? RepositoryInterface::SEARCH_NAME : RepositoryInterface::SEARCH_FULLTEXT;
  4965. $results = $repos->search(implode(' ', $input->getArgument('tokens')), $flags, $type);
  4966. foreach ($results as $result) {
  4967. $io->write($result['name'] . (isset($result['description']) ? ' '. $result['description'] : ''));
  4968. }
  4969. return 0;
  4970. }
  4971. }
  4972. <?php
  4973. namespace Composer\Command;
  4974. use Composer\Composer;
  4975. use Composer\Factory;
  4976. use Composer\Config;
  4977. use Composer\Util\Filesystem;
  4978. use Composer\SelfUpdate\Keys;
  4979. use Composer\SelfUpdate\Versions;
  4980. use Composer\IO\IOInterface;
  4981. use Composer\Downloader\FilesystemException;
  4982. use Symfony\Component\Console\Input\InputInterface;
  4983. use Symfony\Component\Console\Input\InputOption;
  4984. use Symfony\Component\Console\Input\InputArgument;
  4985. use Symfony\Component\Console\Output\OutputInterface;
  4986. use Symfony\Component\Finder\Finder;
  4987. class SelfUpdateCommand extends BaseCommand
  4988. {
  4989. const HOMEPAGE = 'getcomposer.org';
  4990. const OLD_INSTALL_EXT = '-old.phar';
  4991. protected function configure()
  4992. {
  4993. $this
  4994. ->setName('self-update')
  4995. ->setAliases(array('selfupdate'))
  4996. ->setDescription('Updates composer.phar to the latest version.')
  4997. ->setDefinition(array(
  4998. new InputOption('rollback', 'r', InputOption::VALUE_NONE, 'Revert to an older installation of composer'),
  4999. 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'),
  5000. new InputArgument('version', InputArgument::OPTIONAL, 'The version to update to'),
  5001. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  5002. new InputOption('update-keys', null, InputOption::VALUE_NONE, 'Prompt user for a key update'),
  5003. new InputOption('stable', null, InputOption::VALUE_NONE, 'Force an update to the stable channel'),
  5004. new InputOption('preview', null, InputOption::VALUE_NONE, 'Force an update to the preview channel'),
  5005. new InputOption('snapshot', null, InputOption::VALUE_NONE, 'Force an update to the snapshot channel'),
  5006. new InputOption('set-channel-only', null, InputOption::VALUE_NONE, 'Only store the channel as the default one and then exit'),
  5007. ))
  5008. ->setHelp(
  5009. <<<EOT
  5010. The <info>self-update</info> command checks getcomposer.org for newer
  5011. versions of composer and if found, installs the latest.
  5012. <info>php composer.phar self-update</info>
  5013. Read more at https://getcomposer.org/doc/03-cli.md#self-update-selfupdate-
  5014. EOT
  5015. )
  5016. ;
  5017. }
  5018. protected function execute(InputInterface $input, OutputInterface $output)
  5019. {
  5020. $config = Factory::createConfig();
  5021. if ($config->get('disable-tls') === true) {
  5022. $baseUrl = 'http://' . self::HOMEPAGE;
  5023. } else {
  5024. $baseUrl = 'https://' . self::HOMEPAGE;
  5025. }
  5026. $io = $this->getIO();
  5027. $remoteFilesystem = Factory::createRemoteFilesystem($io, $config);
  5028. $versionsUtil = new Versions($config, $remoteFilesystem);
  5029. foreach (array('stable', 'preview', 'snapshot') as $channel) {
  5030. if ($input->getOption($channel)) {
  5031. $versionsUtil->setChannel($channel);
  5032. }
  5033. }
  5034. if ($input->getOption('set-channel-only')) {
  5035. return 0;
  5036. }
  5037. $cacheDir = $config->get('cache-dir');
  5038. $rollbackDir = $config->get('data-dir');
  5039. $home = $config->get('home');
  5040. $localFilename = realpath($_SERVER['argv'][0]) ?: $_SERVER['argv'][0];
  5041. if ($input->getOption('update-keys')) {
  5042. return $this->fetchKeys($io, $config);
  5043. }
  5044. $tmpDir = is_writable(dirname($localFilename)) ? dirname($localFilename) : $cacheDir;
  5045. if (!is_writable($tmpDir)) {
  5046. throw new FilesystemException('Composer update failed: the "'.$tmpDir.'" directory used to download the temp file could not be written');
  5047. }
  5048. if (function_exists('posix_getpwuid') && function_exists('posix_geteuid')) {
  5049. $composeUser = posix_getpwuid(posix_geteuid());
  5050. $homeOwner = posix_getpwuid(fileowner($home));
  5051. if (isset($composeUser['name']) && isset($homeOwner['name']) && $composeUser['name'] !== $homeOwner['name']) {
  5052. $io->writeError('<warning>You are running composer as "'.$composeUser['name'].'", while "'.$home.'" is owned by "'.$homeOwner['name'].'"</warning>');
  5053. }
  5054. }
  5055. if ($input->getOption('rollback')) {
  5056. return $this->rollback($output, $rollbackDir, $localFilename);
  5057. }
  5058. $latest = $versionsUtil->getLatest();
  5059. $latestVersion = $latest['version'];
  5060. $updateVersion = $input->getArgument('version') ?: $latestVersion;
  5061. if (preg_match('{^[0-9a-f]{40}$}', $updateVersion) && $updateVersion !== $latestVersion) {
  5062. $io->writeError('<error>You can not update to a specific SHA-1 as those phars are not available for download</error>');
  5063. return 1;
  5064. }
  5065. if (Composer::VERSION === $updateVersion) {
  5066. $io->writeError(sprintf('<info>You are already using composer version %s (%s channel).</info>', $updateVersion, $versionsUtil->getChannel()));
  5067. if ($input->getOption('clean-backups')) {
  5068. $this->cleanBackups($rollbackDir, $this->getLastBackupVersion($rollbackDir));
  5069. }
  5070. return 0;
  5071. }
  5072. $tempFilename = $tmpDir . '/' . basename($localFilename, '.phar').'-temp.phar';
  5073. $backupFile = sprintf(
  5074. '%s/%s-%s%s',
  5075. $rollbackDir,
  5076. strtr(Composer::RELEASE_DATE, ' :', '_-'),
  5077. preg_replace('{^([0-9a-f]{7})[0-9a-f]{33}$}', '$1', Composer::VERSION),
  5078. self::OLD_INSTALL_EXT
  5079. );
  5080. $updatingToTag = !preg_match('{^[0-9a-f]{40}$}', $updateVersion);
  5081. $io->write(sprintf("Updating to version <info>%s</info> (%s channel).", $updateVersion, $versionsUtil->getChannel()));
  5082. $remoteFilename = $baseUrl . ($updatingToTag ? "/download/{$updateVersion}/composer.phar" : '/composer.phar');
  5083. $signature = $remoteFilesystem->getContents(self::HOMEPAGE, $remoteFilename.'.sig', false);
  5084. $io->writeError(' ', false);
  5085. $remoteFilesystem->copy(self::HOMEPAGE, $remoteFilename, $tempFilename, !$input->getOption('no-progress'));
  5086. $io->writeError('');
  5087. if (!file_exists($tempFilename) || !$signature) {
  5088. $io->writeError('<error>The download of the new composer version failed for an unexpected reason</error>');
  5089. return 1;
  5090. }
  5091. if (!extension_loaded('openssl') && $config->get('disable-tls')) {
  5092. $io->writeError('<warning>Skipping phar signature verification as you have disabled OpenSSL via config.disable-tls</warning>');
  5093. } else {
  5094. if (!extension_loaded('openssl')) {
  5095. throw new \RuntimeException('The openssl extension is required for phar signatures to be verified but it is not available. '
  5096. . '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.');
  5097. }
  5098. $sigFile = 'file://'.$home.'/' . ($updatingToTag ? 'keys.tags.pub' : 'keys.dev.pub');
  5099. if (!file_exists($sigFile)) {
  5100. file_put_contents(
  5101. $home.'/keys.dev.pub',
  5102. <<<DEVPUBKEY
  5103. -----BEGIN PUBLIC KEY-----
  5104. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnBDHjZS6e0ZMoK3xTD7f
  5105. FNCzlXjX/Aie2dit8QXA03pSrOTbaMnxON3hUL47Lz3g1SC6YJEMVHr0zYq4elWi
  5106. i3ecFEgzLcj+pZM5X6qWu2Ozz4vWx3JYo1/a/HYdOuW9e3lwS8VtS0AVJA+U8X0A
  5107. hZnBmGpltHhO8hPKHgkJtkTUxCheTcbqn4wGHl8Z2SediDcPTLwqezWKUfrYzu1f
  5108. o/j3WFwFs6GtK4wdYtiXr+yspBZHO3y1udf8eFFGcb2V3EaLOrtfur6XQVizjOuk
  5109. 8lw5zzse1Qp/klHqbDRsjSzJ6iL6F4aynBc6Euqt/8ccNAIz0rLjLhOraeyj4eNn
  5110. 8iokwMKiXpcrQLTKH+RH1JCuOVxQ436bJwbSsp1VwiqftPQieN+tzqy+EiHJJmGf
  5111. TBAbWcncicCk9q2md+AmhNbvHO4PWbbz9TzC7HJb460jyWeuMEvw3gNIpEo2jYa9
  5112. pMV6cVqnSa+wOc0D7pC9a6bne0bvLcm3S+w6I5iDB3lZsb3A9UtRiSP7aGSo7D72
  5113. 8tC8+cIgZcI7k9vjvOqH+d7sdOU2yPCnRY6wFh62/g8bDnUpr56nZN1G89GwM4d4
  5114. r/TU7BQQIzsZgAiqOGXvVklIgAMiV0iucgf3rNBLjjeNEwNSTTG9F0CtQ+7JLwaE
  5115. wSEuAuRm+pRqi8BRnQ/GKUcCAwEAAQ==
  5116. -----END PUBLIC KEY-----
  5117. DEVPUBKEY
  5118. );
  5119. file_put_contents(
  5120. $home.'/keys.tags.pub',
  5121. <<<TAGSPUBKEY
  5122. -----BEGIN PUBLIC KEY-----
  5123. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0Vi/2K6apCVj76nCnCl2
  5124. MQUPdK+A9eqkYBacXo2wQBYmyVlXm2/n/ZsX6pCLYPQTHyr5jXbkQzBw8SKqPdlh
  5125. vA7NpbMeNCz7wP/AobvUXM8xQuXKbMDTY2uZ4O7sM+PfGbptKPBGLe8Z8d2sUnTO
  5126. bXtX6Lrj13wkRto7st/w/Yp33RHe9SlqkiiS4MsH1jBkcIkEHsRaveZzedUaxY0M
  5127. mba0uPhGUInpPzEHwrYqBBEtWvP97t2vtfx8I5qv28kh0Y6t+jnjL1Urid2iuQZf
  5128. noCMFIOu4vksK5HxJxxrN0GOmGmwVQjOOtxkwikNiotZGPR4KsVj8NnBrLX7oGuM
  5129. nQvGciiu+KoC2r3HDBrpDeBVdOWxDzT5R4iI0KoLzFh2pKqwbY+obNPS2bj+2dgJ
  5130. rV3V5Jjry42QOCBN3c88wU1PKftOLj2ECpewY6vnE478IipiEu7EAdK8Zwj2LmTr
  5131. RKQUSa9k7ggBkYZWAeO/2Ag0ey3g2bg7eqk+sHEq5ynIXd5lhv6tC5PBdHlWipDK
  5132. tl2IxiEnejnOmAzGVivE1YGduYBjN+mjxDVy8KGBrjnz1JPgAvgdwJ2dYw4Rsc/e
  5133. TzCFWGk/HM6a4f0IzBWbJ5ot0PIi4amk07IotBXDWwqDiQTwyuGCym5EqWQ2BD95
  5134. RGv89BPD+2DLnJysngsvVaUCAwEAAQ==
  5135. -----END PUBLIC KEY-----
  5136. TAGSPUBKEY
  5137. );
  5138. }
  5139. $pubkeyid = openssl_pkey_get_public($sigFile);
  5140. $algo = defined('OPENSSL_ALGO_SHA384') ? OPENSSL_ALGO_SHA384 : 'SHA384';
  5141. if (!in_array('sha384', array_map('strtolower', openssl_get_md_methods()))) {
  5142. throw new \RuntimeException('SHA384 is not supported by your openssl extension, could not verify the phar file integrity');
  5143. }
  5144. $signature = json_decode($signature, true);
  5145. $signature = base64_decode($signature['sha384']);
  5146. $verified = 1 === openssl_verify(file_get_contents($tempFilename), $signature, $pubkeyid, $algo);
  5147. openssl_free_key($pubkeyid);
  5148. if (!$verified) {
  5149. 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');
  5150. }
  5151. }
  5152. if ($input->getOption('clean-backups')) {
  5153. $this->cleanBackups($rollbackDir);
  5154. }
  5155. if ($err = $this->setLocalPhar($localFilename, $tempFilename, $backupFile)) {
  5156. @unlink($tempFilename);
  5157. $io->writeError('<error>The file is corrupted ('.$err->getMessage().').</error>');
  5158. $io->writeError('<error>Please re-run the self-update command to try again.</error>');
  5159. return 1;
  5160. }
  5161. if (file_exists($backupFile)) {
  5162. $io->writeError(sprintf(
  5163. 'Use <info>composer self-update --rollback</info> to return to version <comment>%s</comment>',
  5164. Composer::VERSION
  5165. ));
  5166. } else {
  5167. $io->writeError('<warning>A backup of the current version could not be written to '.$backupFile.', no rollback possible</warning>');
  5168. }
  5169. return 0;
  5170. }
  5171. protected function fetchKeys(IOInterface $io, Config $config)
  5172. {
  5173. if (!$io->isInteractive()) {
  5174. throw new \RuntimeException('Public keys can not be fetched in non-interactive mode, please run Composer interactively');
  5175. }
  5176. $io->write('Open <info>https://composer.github.io/pubkeys.html</info> to find the latest keys');
  5177. $validator = function ($value) {
  5178. if (!preg_match('{^-----BEGIN PUBLIC KEY-----$}', trim($value))) {
  5179. throw new \UnexpectedValueException('Invalid input');
  5180. }
  5181. return trim($value)."\n";
  5182. };
  5183. $devKey = '';
  5184. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $devKey, $match)) {
  5185. $devKey = $io->askAndValidate('Enter Dev / Snapshot Public Key (including lines with -----): ', $validator);
  5186. while ($line = $io->ask('')) {
  5187. $devKey .= trim($line)."\n";
  5188. if (trim($line) === '-----END PUBLIC KEY-----') {
  5189. break;
  5190. }
  5191. }
  5192. }
  5193. file_put_contents($keyPath = $config->get('home').'/keys.dev.pub', $match[0]);
  5194. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  5195. $tagsKey = '';
  5196. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $tagsKey, $match)) {
  5197. $tagsKey = $io->askAndValidate('Enter Tags Public Key (including lines with -----): ', $validator);
  5198. while ($line = $io->ask('')) {
  5199. $tagsKey .= trim($line)."\n";
  5200. if (trim($line) === '-----END PUBLIC KEY-----') {
  5201. break;
  5202. }
  5203. }
  5204. }
  5205. file_put_contents($keyPath = $config->get('home').'/keys.tags.pub', $match[0]);
  5206. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  5207. $io->write('Public keys stored in '.$config->get('home'));
  5208. }
  5209. protected function rollback(OutputInterface $output, $rollbackDir, $localFilename)
  5210. {
  5211. $rollbackVersion = $this->getLastBackupVersion($rollbackDir);
  5212. if (!$rollbackVersion) {
  5213. throw new \UnexpectedValueException('Composer rollback failed: no installation to roll back to in "'.$rollbackDir.'"');
  5214. }
  5215. $oldFile = $rollbackDir . '/' . $rollbackVersion . self::OLD_INSTALL_EXT;
  5216. if (!is_file($oldFile)) {
  5217. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be found');
  5218. }
  5219. if (!is_readable($oldFile)) {
  5220. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be read');
  5221. }
  5222. $io = $this->getIO();
  5223. $io->writeError(sprintf("Rolling back to version <info>%s</info>.", $rollbackVersion));
  5224. if ($err = $this->setLocalPhar($localFilename, $oldFile)) {
  5225. $io->writeError('<error>The backup file was corrupted ('.$err->getMessage().').</error>');
  5226. return 1;
  5227. }
  5228. return 0;
  5229. }
  5230. protected function setLocalPhar($localFilename, $newFilename, $backupTarget = null)
  5231. {
  5232. try {
  5233. @chmod($newFilename, fileperms($localFilename));
  5234. if (!ini_get('phar.readonly')) {
  5235. $phar = new \Phar($newFilename);
  5236. unset($phar);
  5237. }
  5238. if ($backupTarget && file_exists($localFilename)) {
  5239. @copy($localFilename, $backupTarget);
  5240. }
  5241. rename($newFilename, $localFilename);
  5242. return null;
  5243. } catch (\Exception $e) {
  5244. if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) {
  5245. throw $e;
  5246. }
  5247. return $e;
  5248. }
  5249. }
  5250. protected function cleanBackups($rollbackDir, $except = null)
  5251. {
  5252. $finder = $this->getOldInstallationFinder($rollbackDir);
  5253. $io = $this->getIO();
  5254. $fs = new Filesystem;
  5255. foreach ($finder as $file) {
  5256. if ($except && $file->getBasename(self::OLD_INSTALL_EXT) === $except) {
  5257. continue;
  5258. }
  5259. $file = (string) $file;
  5260. $io->writeError('<info>Removing: '.$file.'</info>');
  5261. $fs->remove($file);
  5262. }
  5263. }
  5264. protected function getLastBackupVersion($rollbackDir)
  5265. {
  5266. $finder = $this->getOldInstallationFinder($rollbackDir);
  5267. $finder->sortByName();
  5268. $files = iterator_to_array($finder);
  5269. if (count($files)) {
  5270. return basename(end($files), self::OLD_INSTALL_EXT);
  5271. }
  5272. return false;
  5273. }
  5274. protected function getOldInstallationFinder($rollbackDir)
  5275. {
  5276. $finder = Finder::create()
  5277. ->depth(0)
  5278. ->files()
  5279. ->name('*' . self::OLD_INSTALL_EXT)
  5280. ->in($rollbackDir);
  5281. return $finder;
  5282. }
  5283. }
  5284. <?php
  5285. namespace Composer\Command;
  5286. use Composer\Composer;
  5287. use Composer\DependencyResolver\DefaultPolicy;
  5288. use Composer\DependencyResolver\Pool;
  5289. use Composer\Json\JsonFile;
  5290. use Composer\Package\BasePackage;
  5291. use Composer\Package\CompletePackageInterface;
  5292. use Composer\Package\PackageInterface;
  5293. use Composer\Package\Version\VersionParser;
  5294. use Composer\Package\Version\VersionSelector;
  5295. use Composer\Plugin\CommandEvent;
  5296. use Composer\Plugin\PluginEvents;
  5297. use Composer\Repository\ArrayRepository;
  5298. use Composer\Repository\ComposerRepository;
  5299. use Composer\Repository\CompositeRepository;
  5300. use Composer\Repository\PlatformRepository;
  5301. use Composer\Repository\RepositoryFactory;
  5302. use Composer\Repository\RepositoryInterface;
  5303. use Composer\Semver\Constraint\ConstraintInterface;
  5304. use Composer\Semver\Semver;
  5305. use Composer\Spdx\SpdxLicenses;
  5306. use Composer\Util\Platform;
  5307. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  5308. use Symfony\Component\Console\Input\InputArgument;
  5309. use Symfony\Component\Console\Input\InputInterface;
  5310. use Symfony\Component\Console\Input\InputOption;
  5311. use Symfony\Component\Console\Output\OutputInterface;
  5312. use Symfony\Component\Console\Terminal;
  5313. class ShowCommand extends BaseCommand
  5314. {
  5315. protected $versionParser;
  5316. protected $colors;
  5317. private $pool;
  5318. protected function configure()
  5319. {
  5320. $this
  5321. ->setName('show')
  5322. ->setAliases(array('info'))
  5323. ->setDescription('Shows information about packages.')
  5324. ->setDefinition(array(
  5325. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  5326. new InputArgument('version', InputArgument::OPTIONAL, 'Version or version constraint to inspect'),
  5327. new InputOption('all', null, InputOption::VALUE_NONE, 'List all packages'),
  5328. new InputOption('installed', 'i', InputOption::VALUE_NONE, 'List installed packages only (enabled by default, only present for BC).'),
  5329. new InputOption('platform', 'p', InputOption::VALUE_NONE, 'List platform packages only'),
  5330. new InputOption('available', 'a', InputOption::VALUE_NONE, 'List available packages only'),
  5331. new InputOption('self', 's', InputOption::VALUE_NONE, 'Show the root package information'),
  5332. new InputOption('name-only', 'N', InputOption::VALUE_NONE, 'List package names only'),
  5333. new InputOption('path', 'P', InputOption::VALUE_NONE, 'Show package paths'),
  5334. new InputOption('tree', 't', InputOption::VALUE_NONE, 'List the dependencies as a tree'),
  5335. new InputOption('latest', 'l', InputOption::VALUE_NONE, 'Show the latest version'),
  5336. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show the latest version but only for packages that are outdated'),
  5337. new InputOption('ignore', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore specified package(s). Use it with the --outdated option if you don\'t want to be informed about new versions of some packages.'),
  5338. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
  5339. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  5340. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  5341. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  5342. ))
  5343. ->setHelp(
  5344. <<<EOT
  5345. The show command displays detailed information about a package, or
  5346. lists all packages available.
  5347. Read more at https://getcomposer.org/doc/03-cli.md#show
  5348. EOT
  5349. )
  5350. ;
  5351. }
  5352. protected function execute(InputInterface $input, OutputInterface $output)
  5353. {
  5354. $this->versionParser = new VersionParser;
  5355. if ($input->getOption('tree')) {
  5356. $this->initStyles($output);
  5357. }
  5358. $composer = $this->getComposer(false);
  5359. $io = $this->getIO();
  5360. if ($input->getOption('installed')) {
  5361. $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>');
  5362. }
  5363. if ($input->getOption('outdated')) {
  5364. $input->setOption('latest', true);
  5365. } elseif ($input->getOption('ignore')) {
  5366. $io->writeError('<warning>You are using the option "ignore" for action other than "outdated", it will be ignored.</warning>');
  5367. }
  5368. if ($input->getOption('direct') && ($input->getOption('all') || $input->getOption('available') || $input->getOption('platform'))) {
  5369. $io->writeError('The --direct (-D) option is not usable in combination with --all, --platform (-p) or --available (-a)');
  5370. return 1;
  5371. }
  5372. if ($input->getOption('tree') && ($input->getOption('all') || $input->getOption('available'))) {
  5373. $io->writeError('The --tree (-t) option is not usable in combination with --all or --available (-a)');
  5374. return 1;
  5375. }
  5376. if ($input->getOption('tree') && $input->getOption('latest')) {
  5377. $io->writeError('The --tree (-t) option is not usable in combination with --latest (-l)');
  5378. return 1;
  5379. }
  5380. if ($input->getOption('tree') && $input->getOption('path')) {
  5381. $io->writeError('The --tree (-t) option is not usable in combination with --path (-P)');
  5382. return 1;
  5383. }
  5384. $format = $input->getOption('format');
  5385. if (!in_array($format, array('text', 'json'))) {
  5386. $io->writeError(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  5387. return 1;
  5388. }
  5389. $platformOverrides = array();
  5390. if ($composer) {
  5391. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  5392. }
  5393. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  5394. $phpVersion = $platformRepo->findPackage('php', '*')->getVersion();
  5395. if ($input->getOption('self')) {
  5396. $package = $this->getComposer()->getPackage();
  5397. $repos = $installedRepo = new ArrayRepository(array($package));
  5398. } elseif ($input->getOption('platform')) {
  5399. $repos = $installedRepo = $platformRepo;
  5400. } elseif ($input->getOption('available')) {
  5401. $installedRepo = $platformRepo;
  5402. if ($composer) {
  5403. $repos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
  5404. } else {
  5405. $defaultRepos = RepositoryFactory::defaultRepos($io);
  5406. $repos = new CompositeRepository($defaultRepos);
  5407. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  5408. }
  5409. } elseif ($input->getOption('all') && $composer) {
  5410. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  5411. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  5412. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  5413. } elseif ($input->getOption('all')) {
  5414. $defaultRepos = RepositoryFactory::defaultRepos($io);
  5415. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  5416. $installedRepo = $platformRepo;
  5417. $repos = new CompositeRepository(array_merge(array($installedRepo), $defaultRepos));
  5418. } else {
  5419. $repos = $installedRepo = $this->getComposer()->getRepositoryManager()->getLocalRepository();
  5420. $rootPkg = $this->getComposer()->getPackage();
  5421. if (!$installedRepo->getPackages() && ($rootPkg->getRequires() || $rootPkg->getDevRequires())) {
  5422. $io->writeError('<warning>No dependencies installed. Try running composer install or update.</warning>');
  5423. }
  5424. }
  5425. if ($composer) {
  5426. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'show', $input, $output);
  5427. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5428. }
  5429. if ($input->getOption('latest') && null === $composer) {
  5430. $io->writeError('No composer.json found in the current directory, disabling "latest" option');
  5431. $input->setOption('latest', false);
  5432. }
  5433. $packageFilter = $input->getArgument('package');
  5434. if (($packageFilter && false === strpos($packageFilter, '*')) || !empty($package)) {
  5435. if (empty($package)) {
  5436. list($package, $versions) = $this->getPackage($installedRepo, $repos, $input->getArgument('package'), $input->getArgument('version'));
  5437. if (empty($package)) {
  5438. $options = $input->getOptions();
  5439. if (!isset($options['working-dir']) || !file_exists('composer.json')) {
  5440. throw new \InvalidArgumentException('Package ' . $packageFilter . ' not found');
  5441. }
  5442. $io->writeError('Package ' . $packageFilter . ' not found in ' . $options['working-dir'] . '/composer.json');
  5443. return 1;
  5444. }
  5445. } else {
  5446. $versions = array($package->getPrettyVersion() => $package->getVersion());
  5447. }
  5448. $exitCode = 0;
  5449. if ($input->getOption('tree')) {
  5450. $arrayTree = $this->generatePackageTree($package, $installedRepo, $repos);
  5451. if ('json' === $format) {
  5452. $io->write(JsonFile::encode(array('installed' => array($arrayTree))));
  5453. } else {
  5454. $this->displayPackageTree(array($arrayTree));
  5455. }
  5456. } else {
  5457. $latestPackage = null;
  5458. if ($input->getOption('latest')) {
  5459. $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion);
  5460. }
  5461. if ($input->getOption('outdated') && $input->getOption('strict') && $latestPackage && $latestPackage->getFullPrettyVersion() !== $package->getFullPrettyVersion() && !$latestPackage->isAbandoned()) {
  5462. $exitCode = 1;
  5463. }
  5464. if ($input->getOption('path')) {
  5465. $io->write($package->getName(), false);
  5466. $io->write(' ' . strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n"));
  5467. return $exitCode;
  5468. }
  5469. $this->printMeta($package, $versions, $installedRepo, $latestPackage ?: null);
  5470. $this->printLinks($package, 'requires');
  5471. $this->printLinks($package, 'devRequires', 'requires (dev)');
  5472. if ($package->getSuggests()) {
  5473. $io->write("\n<info>suggests</info>");
  5474. foreach ($package->getSuggests() as $suggested => $reason) {
  5475. $io->write($suggested . ' <comment>' . $reason . '</comment>');
  5476. }
  5477. }
  5478. $this->printLinks($package, 'provides');
  5479. $this->printLinks($package, 'conflicts');
  5480. $this->printLinks($package, 'replaces');
  5481. }
  5482. return $exitCode;
  5483. }
  5484. if ($input->getOption('tree')) {
  5485. $rootRequires = $this->getRootRequires();
  5486. $packages = $installedRepo->getPackages();
  5487. usort($packages, 'strcmp');
  5488. $arrayTree = array();
  5489. foreach ($packages as $package) {
  5490. if (in_array($package->getName(), $rootRequires, true)) {
  5491. $arrayTree[] = $this->generatePackageTree($package, $installedRepo, $repos);
  5492. }
  5493. }
  5494. if ('json' === $format) {
  5495. $io->write(JsonFile::encode(array('installed' => $arrayTree)));
  5496. } else {
  5497. $this->displayPackageTree($arrayTree);
  5498. }
  5499. return 0;
  5500. }
  5501. if ($repos instanceof CompositeRepository) {
  5502. $repos = $repos->getRepositories();
  5503. } elseif (!is_array($repos)) {
  5504. $repos = array($repos);
  5505. }
  5506. $packages = array();
  5507. if (null !== $packageFilter) {
  5508. $packageFilter = '{^'.str_replace('\\*', '.*?', preg_quote($packageFilter)).'$}i';
  5509. }
  5510. $packageListFilter = array();
  5511. if ($input->getOption('direct')) {
  5512. $packageListFilter = $this->getRootRequires();
  5513. }
  5514. if (class_exists('Symfony\Component\Console\Terminal')) {
  5515. $terminal = new Terminal();
  5516. $width = $terminal->getWidth();
  5517. } else {
  5518. list($width) = $this->getApplication()->getTerminalDimensions();
  5519. }
  5520. if (null === $width) {
  5521. $width = PHP_INT_MAX;
  5522. }
  5523. if (Platform::isWindows()) {
  5524. $width--;
  5525. } else {
  5526. $width = max(80, $width);
  5527. }
  5528. if ($input->getOption('path') && null === $composer) {
  5529. $io->writeError('No composer.json found in the current directory, disabling "path" option');
  5530. $input->setOption('path', false);
  5531. }
  5532. foreach ($repos as $repo) {
  5533. if ($repo === $platformRepo) {
  5534. $type = 'platform';
  5535. } elseif (
  5536. $repo === $installedRepo
  5537. || ($installedRepo instanceof CompositeRepository && in_array($repo, $installedRepo->getRepositories(), true))
  5538. ) {
  5539. $type = 'installed';
  5540. } else {
  5541. $type = 'available';
  5542. }
  5543. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  5544. foreach ($repo->getProviderNames() as $name) {
  5545. if (!$packageFilter || preg_match($packageFilter, $name)) {
  5546. $packages[$type][$name] = $name;
  5547. }
  5548. }
  5549. } else {
  5550. foreach ($repo->getPackages() as $package) {
  5551. if (!isset($packages[$type][$package->getName()])
  5552. || !is_object($packages[$type][$package->getName()])
  5553. || version_compare($packages[$type][$package->getName()]->getVersion(), $package->getVersion(), '<')
  5554. ) {
  5555. if (!$packageFilter || preg_match($packageFilter, $package->getName())) {
  5556. if (!$packageListFilter || in_array($package->getName(), $packageListFilter, true)) {
  5557. $packages[$type][$package->getName()] = $package;
  5558. }
  5559. }
  5560. }
  5561. }
  5562. }
  5563. }
  5564. $showAllTypes = $input->getOption('all');
  5565. $showLatest = $input->getOption('latest');
  5566. $showMinorOnly = $input->getOption('minor-only');
  5567. $ignoredPackages = array_map('strtolower', $input->getOption('ignore'));
  5568. $indent = $showAllTypes ? ' ' : '';
  5569. $latestPackages = array();
  5570. $exitCode = 0;
  5571. $viewData = array();
  5572. $viewMetaData = array();
  5573. foreach (array('platform' => true, 'available' => false, 'installed' => true) as $type => $showVersion) {
  5574. if (isset($packages[$type])) {
  5575. ksort($packages[$type]);
  5576. $nameLength = $versionLength = $latestLength = 0;
  5577. if ($showLatest && $showVersion) {
  5578. foreach ($packages[$type] as $package) {
  5579. if (is_object($package)) {
  5580. $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion, $showMinorOnly);
  5581. if ($latestPackage === false) {
  5582. continue;
  5583. }
  5584. $latestPackages[$package->getPrettyName()] = $latestPackage;
  5585. }
  5586. }
  5587. }
  5588. $writePath = !$input->getOption('name-only') && $input->getOption('path');
  5589. $writeVersion = !$input->getOption('name-only') && !$input->getOption('path') && $showVersion;
  5590. $writeLatest = $writeVersion && $showLatest;
  5591. $writeDescription = !$input->getOption('name-only') && !$input->getOption('path');
  5592. $hasOutdatedPackages = false;
  5593. $viewData[$type] = array();
  5594. foreach ($packages[$type] as $package) {
  5595. $packageViewData = array();
  5596. if (is_object($package)) {
  5597. $latestPackage = null;
  5598. if ($showLatest && isset($latestPackages[$package->getPrettyName()])) {
  5599. $latestPackage = $latestPackages[$package->getPrettyName()];
  5600. }
  5601. $packageIsUpToDate = $latestPackage && $latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion() && !$latestPackage->isAbandoned();
  5602. $packageIsIgnored = \in_array($package->getPrettyName(), $ignoredPackages, true);
  5603. if ($input->getOption('outdated') && ($packageIsUpToDate || $packageIsIgnored)) {
  5604. continue;
  5605. } elseif ($input->getOption('outdated') || $input->getOption('strict')) {
  5606. $hasOutdatedPackages = true;
  5607. }
  5608. $packageViewData['name'] = $package->getPrettyName();
  5609. $nameLength = max($nameLength, strlen($package->getPrettyName()));
  5610. if ($writeVersion) {
  5611. $packageViewData['version'] = $package->getFullPrettyVersion();
  5612. $versionLength = max($versionLength, strlen($package->getFullPrettyVersion()));
  5613. }
  5614. if ($writeLatest && $latestPackage) {
  5615. $packageViewData['latest'] = $latestPackage->getFullPrettyVersion();
  5616. $packageViewData['latest-status'] = $this->getUpdateStatus($latestPackage, $package);
  5617. $latestLength = max($latestLength, strlen($latestPackage->getFullPrettyVersion()));
  5618. }
  5619. if ($writeDescription) {
  5620. $packageViewData['description'] = $package->getDescription();
  5621. }
  5622. if ($writePath) {
  5623. $packageViewData['path'] = strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n");
  5624. }
  5625. if ($latestPackage && $latestPackage->isAbandoned()) {
  5626. $replacement = is_string($latestPackage->getReplacementPackage())
  5627. ? 'Use ' . $latestPackage->getReplacementPackage() . ' instead'
  5628. : 'No replacement was suggested';
  5629. $packageWarning = sprintf(
  5630. 'Package %s is abandoned, you should avoid using it. %s.',
  5631. $package->getPrettyName(),
  5632. $replacement
  5633. );
  5634. $packageViewData['warning'] = $packageWarning;
  5635. }
  5636. } else {
  5637. $packageViewData['name'] = $package;
  5638. $nameLength = max($nameLength, strlen($package));
  5639. }
  5640. $viewData[$type][] = $packageViewData;
  5641. }
  5642. $viewMetaData[$type] = array(
  5643. 'nameLength' => $nameLength,
  5644. 'versionLength' => $versionLength,
  5645. 'latestLength' => $latestLength,
  5646. );
  5647. if ($input->getOption('strict') && $hasOutdatedPackages) {
  5648. $exitCode = 1;
  5649. break;
  5650. }
  5651. }
  5652. }
  5653. if ('json' === $format) {
  5654. $io->write(JsonFile::encode($viewData));
  5655. } else {
  5656. foreach ($viewData as $type => $packages) {
  5657. $nameLength = $viewMetaData[$type]['nameLength'];
  5658. $versionLength = $viewMetaData[$type]['versionLength'];
  5659. $latestLength = $viewMetaData[$type]['latestLength'];
  5660. $writeVersion = $nameLength + $versionLength + 3 <= $width;
  5661. $writeLatest = $nameLength + $versionLength + $latestLength + 3 <= $width;
  5662. $writeDescription = $nameLength + $versionLength + $latestLength + 24 <= $width;
  5663. if ($writeLatest && !$io->isDecorated()) {
  5664. $latestLength += 2;
  5665. }
  5666. if ($showAllTypes) {
  5667. if ('available' === $type) {
  5668. $io->write('<comment>' . $type . '</comment>:');
  5669. } else {
  5670. $io->write('<info>' . $type . '</info>:');
  5671. }
  5672. }
  5673. foreach ($packages as $package) {
  5674. $io->write($indent . str_pad($package['name'], $nameLength, ' '), false);
  5675. if (isset($package['version']) && $writeVersion) {
  5676. $io->write(' ' . str_pad($package['version'], $versionLength, ' '), false);
  5677. }
  5678. if (isset($package['latest']) && $writeLatest) {
  5679. $latestVersion = $package['latest'];
  5680. $updateStatus = $package['latest-status'];
  5681. $style = $this->updateStatusToVersionStyle($updateStatus);
  5682. if (!$io->isDecorated()) {
  5683. $latestVersion = str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('=', '!', '~'), $updateStatus) . ' ' . $latestVersion;
  5684. }
  5685. $io->write(' <' . $style . '>' . str_pad($latestVersion, $latestLength, ' ') . '</' . $style . '>', false);
  5686. }
  5687. if (isset($package['description']) && $writeDescription) {
  5688. $description = strtok($package['description'], "\r\n");
  5689. $remaining = $width - $nameLength - $versionLength - 4;
  5690. if ($writeLatest) {
  5691. $remaining -= $latestLength;
  5692. }
  5693. if (strlen($description) > $remaining) {
  5694. $description = substr($description, 0, $remaining - 3) . '...';
  5695. }
  5696. $io->write(' ' . $description, false);
  5697. }
  5698. if (isset($package['path'])) {
  5699. $io->write(' ' . $package['path'], false);
  5700. }
  5701. $io->write('');
  5702. if (isset($package['warning'])) {
  5703. $io->writeError('<warning>' . $package['warning'] . '</warning>');
  5704. }
  5705. }
  5706. if ($showAllTypes) {
  5707. $io->write('');
  5708. }
  5709. }
  5710. }
  5711. return $exitCode;
  5712. }
  5713. protected function getRootRequires()
  5714. {
  5715. $rootPackage = $this->getComposer()->getPackage();
  5716. return array_map(
  5717. 'strtolower',
  5718. array_keys(array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()))
  5719. );
  5720. }
  5721. protected function getVersionStyle(PackageInterface $latestPackage, PackageInterface $package)
  5722. {
  5723. return $this->updateStatusToVersionStyle($this->getUpdateStatus($latestPackage, $package));
  5724. }
  5725. protected function getPackage(RepositoryInterface $installedRepo, RepositoryInterface $repos, $name, $version = null)
  5726. {
  5727. $name = strtolower($name);
  5728. $constraint = is_string($version) ? $this->versionParser->parseConstraints($version) : $version;
  5729. $policy = new DefaultPolicy();
  5730. $pool = new Pool('dev');
  5731. $pool->addRepository($repos);
  5732. $matchedPackage = null;
  5733. $versions = array();
  5734. $matches = $pool->whatProvides($name, $constraint);
  5735. foreach ($matches as $index => $package) {
  5736. if ($package->getName() !== $name) {
  5737. unset($matches[$index]);
  5738. continue;
  5739. }
  5740. if (null === $version && $installedRepo->hasPackage($package)) {
  5741. $matchedPackage = $package;
  5742. }
  5743. $versions[$package->getPrettyVersion()] = $package->getVersion();
  5744. $matches[$index] = $package->getId();
  5745. }
  5746. if (!$matchedPackage && $matches && $preferred = $policy->selectPreferredPackages($pool, array(), $matches)) {
  5747. $matchedPackage = $pool->literalToPackage($preferred[0]);
  5748. }
  5749. return array($matchedPackage, $versions);
  5750. }
  5751. protected function printMeta(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo, PackageInterface $latestPackage = null)
  5752. {
  5753. $io = $this->getIO();
  5754. $io->write('<info>name</info> : ' . $package->getPrettyName());
  5755. $io->write('<info>descrip.</info> : ' . $package->getDescription());
  5756. $io->write('<info>keywords</info> : ' . implode(', ', $package->getKeywords() ?: array()));
  5757. $this->printVersions($package, $versions, $installedRepo);
  5758. if ($latestPackage) {
  5759. $style = $this->getVersionStyle($latestPackage, $package);
  5760. $io->write('<info>latest</info> : <'.$style.'>' . $latestPackage->getPrettyVersion() . '</'.$style.'>');
  5761. } else {
  5762. $latestPackage = $package;
  5763. }
  5764. $io->write('<info>type</info> : ' . $package->getType());
  5765. $this->printLicenses($package);
  5766. $io->write('<info>homepage</info> : ' . $package->getHomepage());
  5767. $io->write('<info>source</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getSourceType(), $package->getSourceUrl(), $package->getSourceReference()));
  5768. $io->write('<info>dist</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getDistType(), $package->getDistUrl(), $package->getDistReference()));
  5769. if ($installedRepo->hasPackage($package)) {
  5770. $io->write('<info>path</info> : ' . sprintf('%s', realpath($this->getComposer()->getInstallationManager()->getInstallPath($package))));
  5771. }
  5772. $io->write('<info>names</info> : ' . implode(', ', $package->getNames()));
  5773. if ($latestPackage->isAbandoned()) {
  5774. $replacement = ($latestPackage->getReplacementPackage() !== null)
  5775. ? ' The author suggests using the ' . $latestPackage->getReplacementPackage(). ' package instead.'
  5776. : null;
  5777. $io->writeError(
  5778. sprintf('<warning>Attention: This package is abandoned and no longer maintained.%s</warning>', $replacement)
  5779. );
  5780. }
  5781. if ($package->getSupport()) {
  5782. $io->write("\n<info>support</info>");
  5783. foreach ($package->getSupport() as $type => $value) {
  5784. $io->write('<comment>' . $type . '</comment> : '.$value);
  5785. }
  5786. }
  5787. if ($package->getAutoload()) {
  5788. $io->write("\n<info>autoload</info>");
  5789. foreach ($package->getAutoload() as $type => $autoloads) {
  5790. $io->write('<comment>' . $type . '</comment>');
  5791. if ($type === 'psr-0') {
  5792. foreach ($autoloads as $name => $path) {
  5793. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  5794. }
  5795. } elseif ($type === 'psr-4') {
  5796. foreach ($autoloads as $name => $path) {
  5797. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  5798. }
  5799. } elseif ($type === 'classmap') {
  5800. $io->write(implode(', ', $autoloads));
  5801. }
  5802. }
  5803. if ($package->getIncludePaths()) {
  5804. $io->write('<comment>include-path</comment>');
  5805. $io->write(implode(', ', $package->getIncludePaths()));
  5806. }
  5807. }
  5808. }
  5809. protected function printVersions(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo)
  5810. {
  5811. uasort($versions, 'version_compare');
  5812. $versions = array_keys(array_reverse($versions));
  5813. if ($installedRepo->hasPackage($package)) {
  5814. $installedVersion = $package->getPrettyVersion();
  5815. $key = array_search($installedVersion, $versions);
  5816. if (false !== $key) {
  5817. $versions[$key] = '<info>* ' . $installedVersion . '</info>';
  5818. }
  5819. }
  5820. $versions = implode(', ', $versions);
  5821. $this->getIO()->write('<info>versions</info> : ' . $versions);
  5822. }
  5823. protected function printLinks(CompletePackageInterface $package, $linkType, $title = null)
  5824. {
  5825. $title = $title ?: $linkType;
  5826. $io = $this->getIO();
  5827. if ($links = $package->{'get'.ucfirst($linkType)}()) {
  5828. $io->write("\n<info>" . $title . "</info>");
  5829. foreach ($links as $link) {
  5830. $io->write($link->getTarget() . ' <comment>' . $link->getPrettyConstraint() . '</comment>');
  5831. }
  5832. }
  5833. }
  5834. protected function printLicenses(CompletePackageInterface $package)
  5835. {
  5836. $spdxLicenses = new SpdxLicenses();
  5837. $licenses = $package->getLicense();
  5838. $io = $this->getIO();
  5839. foreach ($licenses as $licenseId) {
  5840. $license = $spdxLicenses->getLicenseByIdentifier($licenseId);
  5841. if (!$license) {
  5842. $out = $licenseId;
  5843. } else {
  5844. if ($license[1] === true) {
  5845. $out = sprintf('%s (%s) (OSI approved) %s', $license[0], $licenseId, $license[2]);
  5846. } else {
  5847. $out = sprintf('%s (%s) %s', $license[0], $licenseId, $license[2]);
  5848. }
  5849. }
  5850. $io->write('<info>license</info> : ' . $out);
  5851. }
  5852. }
  5853. protected function initStyles(OutputInterface $output)
  5854. {
  5855. $this->colors = array(
  5856. 'green',
  5857. 'yellow',
  5858. 'cyan',
  5859. 'magenta',
  5860. 'blue',
  5861. );
  5862. foreach ($this->colors as $color) {
  5863. $style = new OutputFormatterStyle($color);
  5864. $output->getFormatter()->setStyle($color, $style);
  5865. }
  5866. }
  5867. protected function displayPackageTree(array $arrayTree)
  5868. {
  5869. $io = $this->getIO();
  5870. foreach ($arrayTree as $package) {
  5871. $io->write(sprintf('<info>%s</info>', $package['name']), false);
  5872. $io->write(' ' . $package['version'], false);
  5873. $io->write(' ' . strtok($package['description'], "\r\n"));
  5874. if (isset($package['requires'])) {
  5875. $requires = $package['requires'];
  5876. $treeBar = '├';
  5877. $j = 0;
  5878. $total = count($requires);
  5879. foreach ($requires as $require) {
  5880. $requireName = $require['name'];
  5881. $j++;
  5882. if ($j === $total) {
  5883. $treeBar = 'â””';
  5884. }
  5885. $level = 1;
  5886. $color = $this->colors[$level];
  5887. $info = sprintf(
  5888. '%s──<%s>%s</%s> %s',
  5889. $treeBar,
  5890. $color,
  5891. $requireName,
  5892. $color,
  5893. $require['version']
  5894. );
  5895. $this->writeTreeLine($info);
  5896. $treeBar = str_replace('â””', ' ', $treeBar);
  5897. $packagesInTree = array($package['name'], $requireName);
  5898. $this->displayTree($require, $packagesInTree, $treeBar, $level + 1);
  5899. }
  5900. }
  5901. }
  5902. }
  5903. protected function generatePackageTree(
  5904. PackageInterface $package,
  5905. RepositoryInterface $installedRepo,
  5906. RepositoryInterface $distantRepos
  5907. ) {
  5908. $requires = $package->getRequires();
  5909. ksort($requires);
  5910. $children = array();
  5911. foreach ($requires as $requireName => $require) {
  5912. $packagesInTree = array($package->getName(), $requireName);
  5913. $treeChildDesc = array(
  5914. 'name' => $requireName,
  5915. 'version' => $require->getPrettyConstraint(),
  5916. );
  5917. $deepChildren = $this->addTree($requireName, $require, $installedRepo, $distantRepos, $packagesInTree);
  5918. if ($deepChildren) {
  5919. $treeChildDesc['requires'] = $deepChildren;
  5920. }
  5921. $children[] = $treeChildDesc;
  5922. }
  5923. $tree = array(
  5924. 'name' => $package->getPrettyName(),
  5925. 'version' => $package->getPrettyVersion(),
  5926. 'description' => $package->getDescription(),
  5927. );
  5928. if ($children) {
  5929. $tree['requires'] = $children;
  5930. }
  5931. return $tree;
  5932. }
  5933. protected function displayTree(
  5934. $package,
  5935. array $packagesInTree,
  5936. $previousTreeBar = '├',
  5937. $level = 1
  5938. ) {
  5939. $previousTreeBar = str_replace('├', '│', $previousTreeBar);
  5940. if (isset($package['requires'])) {
  5941. $requires = $package['requires'];
  5942. $treeBar = $previousTreeBar . ' ├';
  5943. $i = 0;
  5944. $total = count($requires);
  5945. foreach ($requires as $require) {
  5946. $currentTree = $packagesInTree;
  5947. $i++;
  5948. if ($i === $total) {
  5949. $treeBar = $previousTreeBar . ' â””';
  5950. }
  5951. $colorIdent = $level % count($this->colors);
  5952. $color = $this->colors[$colorIdent];
  5953. $circularWarn = in_array(
  5954. $require['name'],
  5955. $currentTree,
  5956. true
  5957. ) ? '(circular dependency aborted here)' : '';
  5958. $info = rtrim(sprintf(
  5959. '%s──<%s>%s</%s> %s %s',
  5960. $treeBar,
  5961. $color,
  5962. $require['name'],
  5963. $color,
  5964. $require['version'],
  5965. $circularWarn
  5966. ));
  5967. $this->writeTreeLine($info);
  5968. $treeBar = str_replace('â””', ' ', $treeBar);
  5969. $currentTree[] = $require['name'];
  5970. $this->displayTree($require, $currentTree, $treeBar, $level + 1);
  5971. }
  5972. }
  5973. }
  5974. protected function addTree(
  5975. $name,
  5976. $package,
  5977. RepositoryInterface $installedRepo,
  5978. RepositoryInterface $distantRepos,
  5979. array $packagesInTree
  5980. ) {
  5981. $children = array();
  5982. list($package, $versions) = $this->getPackage(
  5983. $installedRepo,
  5984. $distantRepos,
  5985. $name,
  5986. $package->getPrettyConstraint() === 'self.version' ? $package->getConstraint() : $package->getPrettyConstraint()
  5987. );
  5988. if (is_object($package)) {
  5989. $requires = $package->getRequires();
  5990. ksort($requires);
  5991. foreach ($requires as $requireName => $require) {
  5992. $currentTree = $packagesInTree;
  5993. $treeChildDesc = array(
  5994. 'name' => $requireName,
  5995. 'version' => $require->getPrettyConstraint(),
  5996. );
  5997. if (!in_array($requireName, $currentTree, true)) {
  5998. $currentTree[] = $requireName;
  5999. $deepChildren = $this->addTree($requireName, $require, $installedRepo, $distantRepos, $currentTree);
  6000. if ($deepChildren) {
  6001. $treeChildDesc['requires'] = $deepChildren;
  6002. }
  6003. }
  6004. $children[] = $treeChildDesc;
  6005. }
  6006. }
  6007. return $children;
  6008. }
  6009. private function updateStatusToVersionStyle($updateStatus)
  6010. {
  6011. return str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('info', 'highlight', 'comment'), $updateStatus);
  6012. }
  6013. private function getUpdateStatus(PackageInterface $latestPackage, PackageInterface $package)
  6014. {
  6015. if ($latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion()) {
  6016. return 'up-to-date';
  6017. }
  6018. $constraint = $package->getVersion();
  6019. if (0 !== strpos($constraint, 'dev-')) {
  6020. $constraint = '^'.$constraint;
  6021. }
  6022. if ($latestPackage->getVersion() && Semver::satisfies($latestPackage->getVersion(), $constraint)) {
  6023. return 'semver-safe-update';
  6024. }
  6025. return 'update-possible';
  6026. }
  6027. private function writeTreeLine($line)
  6028. {
  6029. $io = $this->getIO();
  6030. if (!$io->isDecorated()) {
  6031. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  6032. }
  6033. $io->write($line);
  6034. }
  6035. private function findLatestPackage(PackageInterface $package, Composer $composer, $phpVersion, $minorOnly = false)
  6036. {
  6037. $name = $package->getName();
  6038. $versionSelector = new VersionSelector($this->getPool($composer));
  6039. $stability = $composer->getPackage()->getMinimumStability();
  6040. $flags = $composer->getPackage()->getStabilityFlags();
  6041. if (isset($flags[$name])) {
  6042. $stability = array_search($flags[$name], BasePackage::$stabilities, true);
  6043. }
  6044. $bestStability = $stability;
  6045. if ($composer->getPackage()->getPreferStable()) {
  6046. $bestStability = $package->getStability();
  6047. }
  6048. $targetVersion = null;
  6049. if (0 === strpos($package->getVersion(), 'dev-')) {
  6050. $targetVersion = $package->getVersion();
  6051. }
  6052. if ($targetVersion === null && $minorOnly) {
  6053. $targetVersion = '^' . $package->getVersion();
  6054. }
  6055. return $versionSelector->findBestCandidate($name, $targetVersion, $phpVersion, $bestStability);
  6056. }
  6057. private function getPool(Composer $composer)
  6058. {
  6059. if (!$this->pool) {
  6060. $this->pool = new Pool($composer->getPackage()->getMinimumStability(), $composer->getPackage()->getStabilityFlags());
  6061. $this->pool->addRepository(new CompositeRepository($composer->getRepositoryManager()->getRepositories()));
  6062. }
  6063. return $this->pool;
  6064. }
  6065. }
  6066. <?php
  6067. namespace Composer\Command;
  6068. use Symfony\Component\Console\Input\InputInterface;
  6069. use Symfony\Component\Console\Input\InputOption;
  6070. use Symfony\Component\Console\Output\OutputInterface;
  6071. use Composer\Downloader\ChangeReportInterface;
  6072. use Composer\Downloader\DvcsDownloaderInterface;
  6073. use Composer\Downloader\VcsCapableDownloaderInterface;
  6074. use Composer\Package\Dumper\ArrayDumper;
  6075. use Composer\Package\Version\VersionGuesser;
  6076. use Composer\Package\Version\VersionParser;
  6077. use Composer\Plugin\CommandEvent;
  6078. use Composer\Plugin\PluginEvents;
  6079. use Composer\Script\ScriptEvents;
  6080. use Composer\Util\ProcessExecutor;
  6081. class StatusCommand extends BaseCommand
  6082. {
  6083. const EXIT_CODE_ERRORS = 1;
  6084. const EXIT_CODE_UNPUSHED_CHANGES = 2;
  6085. const EXIT_CODE_VERSION_CHANGES = 4;
  6086. protected function configure()
  6087. {
  6088. $this
  6089. ->setName('status')
  6090. ->setDescription('Shows a list of locally modified packages, for packages installed from source.')
  6091. ->setDefinition(array(
  6092. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Show modified files for each directory that contains changes.'),
  6093. ))
  6094. ->setHelp(
  6095. <<<EOT
  6096. The status command displays a list of dependencies that have
  6097. been modified locally.
  6098. Read more at https://getcomposer.org/doc/03-cli.md#status
  6099. EOT
  6100. )
  6101. ;
  6102. }
  6103. protected function execute(InputInterface $input, OutputInterface $output)
  6104. {
  6105. $composer = $this->getComposer();
  6106. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'status', $input, $output);
  6107. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  6108. $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
  6109. $dm = $composer->getDownloadManager();
  6110. $im = $composer->getInstallationManager();
  6111. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::PRE_STATUS_CMD, true);
  6112. $errors = array();
  6113. $io = $this->getIO();
  6114. $unpushedChanges = array();
  6115. $vcsVersionChanges = array();
  6116. $parser = new VersionParser;
  6117. $guesser = new VersionGuesser($composer->getConfig(), new ProcessExecutor($io), $parser);
  6118. $dumper = new ArrayDumper;
  6119. foreach ($installedRepo->getCanonicalPackages() as $package) {
  6120. $downloader = $dm->getDownloaderForInstalledPackage($package);
  6121. $targetDir = $im->getInstallPath($package);
  6122. if ($downloader instanceof ChangeReportInterface) {
  6123. if (is_link($targetDir)) {
  6124. $errors[$targetDir] = $targetDir . ' is a symbolic link.';
  6125. }
  6126. if ($changes = $downloader->getLocalChanges($package, $targetDir)) {
  6127. $errors[$targetDir] = $changes;
  6128. }
  6129. }
  6130. if ($downloader instanceof VcsCapableDownloaderInterface) {
  6131. if ($currentRef = $downloader->getVcsReference($package, $targetDir)) {
  6132. switch ($package->getInstallationSource()) {
  6133. case 'source':
  6134. $previousRef = $package->getSourceReference();
  6135. break;
  6136. case 'dist':
  6137. $previousRef = $package->getDistReference();
  6138. break;
  6139. default:
  6140. $previousRef = null;
  6141. }
  6142. $currentVersion = $guesser->guessVersion($dumper->dump($package), $targetDir);
  6143. if ($previousRef && $currentVersion && $currentVersion['commit'] !== $previousRef) {
  6144. $vcsVersionChanges[$targetDir] = array(
  6145. 'previous' => array(
  6146. 'version' => $package->getPrettyVersion(),
  6147. 'ref' => $previousRef,
  6148. ),
  6149. 'current' => array(
  6150. 'version' => $currentVersion['pretty_version'],
  6151. 'ref' => $currentVersion['commit'],
  6152. ),
  6153. );
  6154. }
  6155. }
  6156. }
  6157. if ($downloader instanceof DvcsDownloaderInterface) {
  6158. if ($unpushed = $downloader->getUnpushedChanges($package, $targetDir)) {
  6159. $unpushedChanges[$targetDir] = $unpushed;
  6160. }
  6161. }
  6162. }
  6163. if (!$errors && !$unpushedChanges && !$vcsVersionChanges) {
  6164. $io->writeError('<info>No local changes</info>');
  6165. return 0;
  6166. }
  6167. if ($errors) {
  6168. $io->writeError('<error>You have changes in the following dependencies:</error>');
  6169. foreach ($errors as $path => $changes) {
  6170. if ($input->getOption('verbose')) {
  6171. $indentedChanges = implode("\n", array_map(function ($line) {
  6172. return ' ' . ltrim($line);
  6173. }, explode("\n", $changes)));
  6174. $io->write('<info>'.$path.'</info>:');
  6175. $io->write($indentedChanges);
  6176. } else {
  6177. $io->write($path);
  6178. }
  6179. }
  6180. }
  6181. if ($unpushedChanges) {
  6182. $io->writeError('<warning>You have unpushed changes on the current branch in the following dependencies:</warning>');
  6183. foreach ($unpushedChanges as $path => $changes) {
  6184. if ($input->getOption('verbose')) {
  6185. $indentedChanges = implode("\n", array_map(function ($line) {
  6186. return ' ' . ltrim($line);
  6187. }, explode("\n", $changes)));
  6188. $io->write('<info>'.$path.'</info>:');
  6189. $io->write($indentedChanges);
  6190. } else {
  6191. $io->write($path);
  6192. }
  6193. }
  6194. }
  6195. if ($vcsVersionChanges) {
  6196. $io->writeError('<warning>You have version variations in the following dependencies:</warning>');
  6197. foreach ($vcsVersionChanges as $path => $changes) {
  6198. if ($input->getOption('verbose')) {
  6199. $currentVersion = $changes['current']['version'] ?: $changes['current']['ref'];
  6200. $previousVersion = $changes['previous']['version'] ?: $changes['previous']['ref'];
  6201. if ($io->isVeryVerbose()) {
  6202. $currentVersion .= sprintf(' (%s)', $changes['current']['ref']);
  6203. $previousVersion .= sprintf(' (%s)', $changes['previous']['ref']);
  6204. }
  6205. $io->write('<info>'.$path.'</info>:');
  6206. $io->write(sprintf(' From <comment>%s</comment> to <comment>%s</comment>', $previousVersion, $currentVersion));
  6207. } else {
  6208. $io->write($path);
  6209. }
  6210. }
  6211. }
  6212. if (($errors || $unpushedChanges || $vcsVersionChanges) && !$input->getOption('verbose')) {
  6213. $io->writeError('Use --verbose (-v) to see a list of files');
  6214. }
  6215. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_STATUS_CMD, true);
  6216. return ($errors ? self::EXIT_CODE_ERRORS : 0) + ($unpushedChanges ? self::EXIT_CODE_UNPUSHED_CHANGES : 0) + ($vcsVersionChanges ? self::EXIT_CODE_VERSION_CHANGES : 0);
  6217. }
  6218. }
  6219. <?php
  6220. namespace Composer\Command;
  6221. use Composer\Repository\PlatformRepository;
  6222. use Symfony\Component\Console\Input\InputArgument;
  6223. use Symfony\Component\Console\Input\InputInterface;
  6224. use Symfony\Component\Console\Input\InputOption;
  6225. use Symfony\Component\Console\Output\OutputInterface;
  6226. class SuggestsCommand extends BaseCommand
  6227. {
  6228. protected function configure()
  6229. {
  6230. $this
  6231. ->setName('suggests')
  6232. ->setDescription('Shows package suggestions.')
  6233. ->setDefinition(array(
  6234. new InputOption('by-package', null, InputOption::VALUE_NONE, 'Groups output by suggesting package'),
  6235. new InputOption('by-suggestion', null, InputOption::VALUE_NONE, 'Groups output by suggested package'),
  6236. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Exclude suggestions from require-dev packages'),
  6237. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that you want to list suggestions from.'),
  6238. ))
  6239. ->setHelp(
  6240. <<<EOT
  6241. The <info>%command.name%</info> command shows a sorted list of suggested packages.
  6242. Enabling <info>-v</info> implies <info>--by-package --by-suggestion</info>, showing both lists.
  6243. Read more at https://getcomposer.org/doc/03-cli.md#suggests
  6244. EOT
  6245. )
  6246. ;
  6247. }
  6248. protected function execute(InputInterface $input, OutputInterface $output)
  6249. {
  6250. $lock = $this->getComposer()->getLocker()->getLockData();
  6251. if (empty($lock)) {
  6252. throw new \RuntimeException('Lockfile seems to be empty?');
  6253. }
  6254. $packages = $lock['packages'];
  6255. if (!$input->getOption('no-dev')) {
  6256. $packages += $lock['packages-dev'];
  6257. }
  6258. $filter = $input->getArgument('packages');
  6259. $installed = array();
  6260. foreach ($packages as $package) {
  6261. $installed[] = $package['name'];
  6262. if (!empty($package['provide'])) {
  6263. $installed = array_merge($installed, array_keys($package['provide']));
  6264. }
  6265. if (!empty($package['replace'])) {
  6266. $installed = array_merge($installed, array_keys($package['replace']));
  6267. }
  6268. }
  6269. $installed = array_flip($installed);
  6270. ksort($installed);
  6271. $platform = new PlatformRepository(array(), $this->getComposer()->getConfig()->get('platform') ?: array());
  6272. $suggesters = array();
  6273. $suggested = array();
  6274. foreach ($packages as $package) {
  6275. $packageName = $package['name'];
  6276. if ((!empty($filter) && !in_array($packageName, $filter)) || empty($package['suggest'])) {
  6277. continue;
  6278. }
  6279. foreach ($package['suggest'] as $suggestion => $reason) {
  6280. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $suggestion) && null !== $platform->findPackage($suggestion, '*')) {
  6281. continue;
  6282. }
  6283. if (!isset($installed[$suggestion])) {
  6284. $suggesters[$packageName][$suggestion] = $reason;
  6285. $suggested[$suggestion][$packageName] = $reason;
  6286. }
  6287. }
  6288. }
  6289. ksort($suggesters);
  6290. ksort($suggested);
  6291. $mode = 0;
  6292. $io = $this->getIO();
  6293. if ($input->getOption('by-package') || $io->isVerbose()) {
  6294. $mode |= 1;
  6295. }
  6296. if ($input->getOption('by-suggestion')) {
  6297. $mode |= 2;
  6298. }
  6299. if ($mode === 0) {
  6300. foreach (array_keys($suggested) as $suggestion) {
  6301. $io->write(sprintf('<info>%s</info>', $suggestion));
  6302. }
  6303. return 0;
  6304. }
  6305. if ($mode & 1) {
  6306. foreach ($suggesters as $suggester => $suggestions) {
  6307. $io->write(sprintf('<comment>%s</comment> suggests:', $suggester));
  6308. foreach ($suggestions as $suggestion => $reason) {
  6309. $io->write(sprintf(' - <info>%s</info>: %s', $suggestion, $reason ?: '*'));
  6310. }
  6311. $io->write('');
  6312. }
  6313. }
  6314. if ($mode & 2) {
  6315. if ($mode & 1) {
  6316. $io->write(str_repeat('-', 78));
  6317. }
  6318. foreach ($suggested as $suggestion => $suggesters) {
  6319. $io->write(sprintf('<comment>%s</comment> is suggested by:', $suggestion));
  6320. foreach ($suggesters as $suggester => $reason) {
  6321. $io->write(sprintf(' - <info>%s</info>: %s', $suggester, $reason ?: '*'));
  6322. }
  6323. $io->write('');
  6324. }
  6325. }
  6326. return 0;
  6327. }
  6328. }
  6329. <?php
  6330. namespace Composer\Command;
  6331. use Composer\Composer;
  6332. use Composer\Installer;
  6333. use Composer\IO\IOInterface;
  6334. use Composer\Plugin\CommandEvent;
  6335. use Composer\Plugin\PluginEvents;
  6336. use Symfony\Component\Console\Helper\Table;
  6337. use Symfony\Component\Console\Input\InputInterface;
  6338. use Symfony\Component\Console\Input\InputOption;
  6339. use Symfony\Component\Console\Input\InputArgument;
  6340. use Symfony\Component\Console\Output\OutputInterface;
  6341. use Symfony\Component\Console\Question\Question;
  6342. class UpdateCommand extends BaseCommand
  6343. {
  6344. protected function configure()
  6345. {
  6346. $this
  6347. ->setName('update')
  6348. ->setAliases(array('u', 'upgrade'))
  6349. ->setDescription('Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file.')
  6350. ->setDefinition(array(
  6351. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that should be updated, if not provided all packages are.'),
  6352. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  6353. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  6354. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  6355. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  6356. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  6357. new InputOption('lock', null, InputOption::VALUE_NONE, 'Only updates the lock file hash to suppress warning about the lock file being out of date.'),
  6358. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  6359. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  6360. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  6361. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  6362. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  6363. new InputOption('with-dependencies', null, InputOption::VALUE_NONE, 'Add also dependencies of whitelisted packages to the whitelist, except those defined in root package.'),
  6364. 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.'),
  6365. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  6366. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump.'),
  6367. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  6368. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  6369. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  6370. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  6371. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  6372. new InputOption('interactive', 'i', InputOption::VALUE_NONE, 'Interactive interface with autocompletion to select the packages to update.'),
  6373. new InputOption('root-reqs', null, InputOption::VALUE_NONE, 'Restricts the update to your first degree dependencies.'),
  6374. ))
  6375. ->setHelp(
  6376. <<<EOT
  6377. The <info>update</info> command reads the composer.json file from the
  6378. current directory, processes it, and updates, removes or installs all the
  6379. dependencies.
  6380. <info>php composer.phar update</info>
  6381. To limit the update operation to a few packages, you can list the package(s)
  6382. you want to update as such:
  6383. <info>php composer.phar update vendor/package1 foo/mypackage [...]</info>
  6384. You may also use an asterisk (*) pattern to limit the update operation to package(s)
  6385. from a specific vendor:
  6386. <info>php composer.phar update vendor/package1 foo/* [...]</info>
  6387. To select packages names interactively with auto-completion use <info>-i</info>.
  6388. Read more at https://getcomposer.org/doc/03-cli.md#update-u
  6389. EOT
  6390. )
  6391. ;
  6392. }
  6393. protected function execute(InputInterface $input, OutputInterface $output)
  6394. {
  6395. $io = $this->getIO();
  6396. if ($input->getOption('no-custom-installers')) {
  6397. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  6398. $input->setOption('no-plugins', true);
  6399. }
  6400. if ($input->getOption('dev')) {
  6401. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  6402. }
  6403. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  6404. $packages = $input->getArgument('packages');
  6405. if ($input->getOption('interactive')) {
  6406. $packages = $this->getPackagesInteractively($io, $input, $output, $composer, $packages);
  6407. }
  6408. if ($input->getOption('root-reqs')) {
  6409. $require = array_keys($composer->getPackage()->getRequires());
  6410. if (!$input->getOption('no-dev')) {
  6411. $requireDev = array_keys($composer->getPackage()->getDevRequires());
  6412. $require = array_merge($require, $requireDev);
  6413. }
  6414. if (!empty($packages)) {
  6415. $packages = array_intersect($packages, $require);
  6416. } else {
  6417. $packages = $require;
  6418. }
  6419. }
  6420. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  6421. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'update', $input, $output);
  6422. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  6423. $install = Installer::create($io, $composer);
  6424. $config = $composer->getConfig();
  6425. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  6426. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  6427. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  6428. $apcu = $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  6429. $install
  6430. ->setDryRun($input->getOption('dry-run'))
  6431. ->setVerbose($input->getOption('verbose'))
  6432. ->setPreferSource($preferSource)
  6433. ->setPreferDist($preferDist)
  6434. ->setDevMode(!$input->getOption('no-dev'))
  6435. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  6436. ->setRunScripts(!$input->getOption('no-scripts'))
  6437. ->setSkipSuggest($input->getOption('no-suggest'))
  6438. ->setOptimizeAutoloader($optimize)
  6439. ->setClassMapAuthoritative($authoritative)
  6440. ->setApcuAutoloader($apcu)
  6441. ->setUpdate(true)
  6442. ->setUpdateWhitelist($input->getOption('lock') ? array('lock') : $packages)
  6443. ->setWhitelistTransitiveDependencies($input->getOption('with-dependencies'))
  6444. ->setWhitelistAllDependencies($input->getOption('with-all-dependencies'))
  6445. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  6446. ->setPreferStable($input->getOption('prefer-stable'))
  6447. ->setPreferLowest($input->getOption('prefer-lowest'))
  6448. ;
  6449. if ($input->getOption('no-plugins')) {
  6450. $install->disablePlugins();
  6451. }
  6452. return $install->run();
  6453. }
  6454. private function getPackagesInteractively(IOInterface $io, InputInterface $input, OutputInterface $output, Composer $composer, array $packages)
  6455. {
  6456. if (!$input->isInteractive()) {
  6457. throw new \InvalidArgumentException('--interactive cannot be used in non-interactive terminals.');
  6458. }
  6459. $requires = array_merge(
  6460. $composer->getPackage()->getRequires(),
  6461. $composer->getPackage()->getDevRequires()
  6462. );
  6463. $autocompleterValues = array();
  6464. foreach ($requires as $require) {
  6465. $target = $require->getTarget();
  6466. $autocompleterValues[strtolower($target)] = $target;
  6467. }
  6468. $installedPackages = $composer->getRepositoryManager()->getLocalRepository()->getPackages();
  6469. foreach ($installedPackages as $package) {
  6470. $autocompleterValues[$package->getName()] = $package->getPrettyName();
  6471. }
  6472. $helper = $this->getHelper('question');
  6473. $question = new Question('<comment>Enter package name: </comment>', null);
  6474. $io->writeError('<info>Press enter without value to end submission</info>');
  6475. do {
  6476. $autocompleterValues = array_diff($autocompleterValues, $packages);
  6477. $question->setAutocompleterValues($autocompleterValues);
  6478. $addedPackage = $helper->ask($input, $output, $question);
  6479. if (!is_string($addedPackage) || empty($addedPackage)) {
  6480. break;
  6481. }
  6482. $addedPackage = strtolower($addedPackage);
  6483. if (!in_array($addedPackage, $packages)) {
  6484. $packages[] = $addedPackage;
  6485. }
  6486. } while (true);
  6487. $packages = array_filter($packages);
  6488. if (!$packages) {
  6489. throw new \InvalidArgumentException('You must enter minimum one package.');
  6490. }
  6491. $table = new Table($output);
  6492. $table->setHeaders(array('Selected packages'));
  6493. foreach ($packages as $package) {
  6494. $table->addRow(array($package));
  6495. }
  6496. $table->render();
  6497. if ($io->askConfirmation(sprintf(
  6498. 'Would you like to continue and update the above package%s [<comment>yes</comment>]? ',
  6499. 1 === count($packages) ? '' : 's'
  6500. ), true)) {
  6501. return $packages;
  6502. }
  6503. throw new \RuntimeException('Installation aborted.');
  6504. }
  6505. }
  6506. <?php
  6507. namespace Composer\Command;
  6508. use Composer\Factory;
  6509. use Composer\Package\Loader\ValidatingArrayLoader;
  6510. use Composer\Plugin\CommandEvent;
  6511. use Composer\Plugin\PluginEvents;
  6512. use Composer\Util\ConfigValidator;
  6513. use Symfony\Component\Console\Input\InputArgument;
  6514. use Symfony\Component\Console\Input\InputInterface;
  6515. use Symfony\Component\Console\Input\InputOption;
  6516. use Symfony\Component\Console\Output\OutputInterface;
  6517. class ValidateCommand extends BaseCommand
  6518. {
  6519. protected function configure()
  6520. {
  6521. $this
  6522. ->setName('validate')
  6523. ->setDescription('Validates a composer.json and composer.lock.')
  6524. ->setDefinition(array(
  6525. new InputOption('no-check-all', null, InputOption::VALUE_NONE, 'Do not validate requires for overly strict/loose constraints'),
  6526. new InputOption('no-check-lock', null, InputOption::VALUE_NONE, 'Do not check if lock file is up to date'),
  6527. new InputOption('no-check-publish', null, InputOption::VALUE_NONE, 'Do not check for publish errors'),
  6528. new InputOption('with-dependencies', 'A', InputOption::VALUE_NONE, 'Also validate the composer.json of all installed dependencies'),
  6529. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code for warnings as well as errors'),
  6530. new InputArgument('file', InputArgument::OPTIONAL, 'path to composer.json file'),
  6531. ))
  6532. ->setHelp(
  6533. <<<EOT
  6534. The validate command validates a given composer.json and composer.lock
  6535. Exit codes in case of errors are:
  6536. 1 validation warning(s), only when --strict is given
  6537. 2 validation error(s)
  6538. 3 file unreadable or missing
  6539. Read more at https://getcomposer.org/doc/03-cli.md#validate
  6540. EOT
  6541. );
  6542. }
  6543. protected function execute(InputInterface $input, OutputInterface $output)
  6544. {
  6545. $file = $input->getArgument('file') ?: Factory::getComposerFile();
  6546. $io = $this->getIO();
  6547. if (!file_exists($file)) {
  6548. $io->writeError('<error>' . $file . ' not found.</error>');
  6549. return 3;
  6550. }
  6551. if (!is_readable($file)) {
  6552. $io->writeError('<error>' . $file . ' is not readable.</error>');
  6553. return 3;
  6554. }
  6555. $validator = new ConfigValidator($io);
  6556. $checkAll = $input->getOption('no-check-all') ? 0 : ValidatingArrayLoader::CHECK_ALL;
  6557. $checkPublish = !$input->getOption('no-check-publish');
  6558. $checkLock = !$input->getOption('no-check-lock');
  6559. $isStrict = $input->getOption('strict');
  6560. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  6561. $lockErrors = array();
  6562. $composer = Factory::create($io, $file, $input->hasParameterOption('--no-plugins'));
  6563. $locker = $composer->getLocker();
  6564. if ($locker->isLocked() && !$locker->isFresh()) {
  6565. $lockErrors[] = 'The lock file is not up to date with the latest changes in composer.json, it is recommended that you run `composer update`.';
  6566. }
  6567. $this->outputResult($io, $file, $errors, $warnings, $checkPublish, $publishErrors, $checkLock, $lockErrors, true, $isStrict);
  6568. $exitCode = $errors ? 2 : ($isStrict && $warnings ? 1 : 0);
  6569. if ($input->getOption('with-dependencies')) {
  6570. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  6571. foreach ($localRepo->getPackages() as $package) {
  6572. $path = $composer->getInstallationManager()->getInstallPath($package);
  6573. $file = $path . '/composer.json';
  6574. if (is_dir($path) && file_exists($file)) {
  6575. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  6576. $this->outputResult($io, $package->getPrettyName(), $errors, $warnings, $checkPublish, $publishErrors);
  6577. $depCode = $errors ? 2 : ($isStrict && $warnings ? 1 : 0);
  6578. $exitCode = max($depCode, $exitCode);
  6579. }
  6580. }
  6581. }
  6582. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'validate', $input, $output);
  6583. $eventCode = $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  6584. $exitCode = max($eventCode, $exitCode);
  6585. return $exitCode;
  6586. }
  6587. private function outputResult($io, $name, &$errors, &$warnings, $checkPublish = false, $publishErrors = array(), $checkLock = false, $lockErrors = array(), $printSchemaUrl = false, $isStrict = false)
  6588. {
  6589. if (!$errors && !$publishErrors && !$warnings) {
  6590. $io->write('<info>' . $name . ' is valid</info>');
  6591. } elseif (!$errors && !$publishErrors) {
  6592. $io->writeError('<info>' . $name . ' is valid, but with a few warnings</info>');
  6593. if ($printSchemaUrl) {
  6594. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  6595. }
  6596. } elseif (!$errors) {
  6597. $io->writeError('<info>' . $name . ' is valid for simple usage with composer but has</info>');
  6598. $io->writeError('<info>strict errors that make it unable to be published as a package:</info>');
  6599. if ($printSchemaUrl) {
  6600. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  6601. }
  6602. } else {
  6603. $io->writeError('<error>' . $name . ' is invalid, the following errors/warnings were found:</error>');
  6604. }
  6605. if ($checkPublish) {
  6606. $errors = array_merge($errors, $publishErrors);
  6607. } elseif (!$isStrict) {
  6608. $warnings = array_merge($warnings, $publishErrors);
  6609. }
  6610. if ($checkLock) {
  6611. $errors = array_merge($errors, $lockErrors);
  6612. } elseif (!$isStrict) {
  6613. $warnings = array_merge($warnings, $lockErrors);
  6614. }
  6615. $messages = array(
  6616. 'error' => $errors,
  6617. 'warning' => $warnings,
  6618. );
  6619. foreach ($messages as $style => $msgs) {
  6620. foreach ($msgs as $msg) {
  6621. $io->writeError('<' . $style . '>' . $msg . '</' . $style . '>');
  6622. }
  6623. }
  6624. }
  6625. }
  6626. <?php
  6627. namespace Composer;
  6628. use Composer\Package\RootPackageInterface;
  6629. use Composer\Package\Locker;
  6630. use Composer\Repository\RepositoryManager;
  6631. use Composer\Installer\InstallationManager;
  6632. use Composer\Plugin\PluginManager;
  6633. use Composer\Downloader\DownloadManager;
  6634. use Composer\EventDispatcher\EventDispatcher;
  6635. use Composer\Autoload\AutoloadGenerator;
  6636. use Composer\Package\Archiver\ArchiveManager;
  6637. class Composer
  6638. {
  6639. const VERSION = '6ffd3eb67c9052b2ede13b7eaa8b1a99bf3e6299';
  6640. const BRANCH_ALIAS_VERSION = '1.10-dev';
  6641. const RELEASE_DATE = '2019-11-17 18:54:17';
  6642. const SOURCE_VERSION = '';
  6643. public static function getVersion()
  6644. {
  6645. if (self::VERSION === '@package_version'.'@') {
  6646. return self::SOURCE_VERSION;
  6647. }
  6648. if (self::BRANCH_ALIAS_VERSION !== '' && preg_match('{^[a-f0-9]{40}$}', self::VERSION)) {
  6649. return self::BRANCH_ALIAS_VERSION.'+'.self::VERSION;
  6650. }
  6651. return self::VERSION;
  6652. }
  6653. private $package;
  6654. private $locker;
  6655. private $repositoryManager;
  6656. private $downloadManager;
  6657. private $installationManager;
  6658. private $pluginManager;
  6659. private $config;
  6660. private $eventDispatcher;
  6661. private $autoloadGenerator;
  6662. private $archiveManager;
  6663. public function setPackage(RootPackageInterface $package)
  6664. {
  6665. $this->package = $package;
  6666. }
  6667. public function getPackage()
  6668. {
  6669. return $this->package;
  6670. }
  6671. public function setConfig(Config $config)
  6672. {
  6673. $this->config = $config;
  6674. }
  6675. public function getConfig()
  6676. {
  6677. return $this->config;
  6678. }
  6679. public function setLocker(Locker $locker)
  6680. {
  6681. $this->locker = $locker;
  6682. }
  6683. public function getLocker()
  6684. {
  6685. return $this->locker;
  6686. }
  6687. public function setRepositoryManager(RepositoryManager $manager)
  6688. {
  6689. $this->repositoryManager = $manager;
  6690. }
  6691. public function getRepositoryManager()
  6692. {
  6693. return $this->repositoryManager;
  6694. }
  6695. public function setDownloadManager(DownloadManager $manager)
  6696. {
  6697. $this->downloadManager = $manager;
  6698. }
  6699. public function getDownloadManager()
  6700. {
  6701. return $this->downloadManager;
  6702. }
  6703. public function setArchiveManager(ArchiveManager $manager)
  6704. {
  6705. $this->archiveManager = $manager;
  6706. }
  6707. public function getArchiveManager()
  6708. {
  6709. return $this->archiveManager;
  6710. }
  6711. public function setInstallationManager(InstallationManager $manager)
  6712. {
  6713. $this->installationManager = $manager;
  6714. }
  6715. public function getInstallationManager()
  6716. {
  6717. return $this->installationManager;
  6718. }
  6719. public function setPluginManager(PluginManager $manager)
  6720. {
  6721. $this->pluginManager = $manager;
  6722. }
  6723. public function getPluginManager()
  6724. {
  6725. return $this->pluginManager;
  6726. }
  6727. public function setEventDispatcher(EventDispatcher $eventDispatcher)
  6728. {
  6729. $this->eventDispatcher = $eventDispatcher;
  6730. }
  6731. public function getEventDispatcher()
  6732. {
  6733. return $this->eventDispatcher;
  6734. }
  6735. public function setAutoloadGenerator(AutoloadGenerator $autoloadGenerator)
  6736. {
  6737. $this->autoloadGenerator = $autoloadGenerator;
  6738. }
  6739. public function getAutoloadGenerator()
  6740. {
  6741. return $this->autoloadGenerator;
  6742. }
  6743. }
  6744. <?php
  6745. namespace Composer;
  6746. use Composer\Config\ConfigSourceInterface;
  6747. use Composer\Downloader\TransportException;
  6748. use Composer\IO\IOInterface;
  6749. use Composer\Util\Platform;
  6750. use Composer\Util\ProcessExecutor;
  6751. class Config
  6752. {
  6753. const RELATIVE_PATHS = 1;
  6754. public static $defaultConfig = array(
  6755. 'process-timeout' => 300,
  6756. 'use-include-path' => false,
  6757. 'preferred-install' => 'auto',
  6758. 'notify-on-install' => true,
  6759. 'github-protocols' => array('https', 'ssh', 'git'),
  6760. 'vendor-dir' => 'vendor',
  6761. 'bin-dir' => '{$vendor-dir}/bin',
  6762. 'cache-dir' => '{$home}/cache',
  6763. 'data-dir' => '{$home}',
  6764. 'cache-files-dir' => '{$cache-dir}/files',
  6765. 'cache-repo-dir' => '{$cache-dir}/repo',
  6766. 'cache-vcs-dir' => '{$cache-dir}/vcs',
  6767. 'cache-ttl' => 15552000,
  6768. 'cache-files-ttl' => null,
  6769. 'cache-files-maxsize' => '300MiB',
  6770. 'bin-compat' => 'auto',
  6771. 'discard-changes' => false,
  6772. 'autoloader-suffix' => null,
  6773. 'sort-packages' => false,
  6774. 'optimize-autoloader' => false,
  6775. 'classmap-authoritative' => false,
  6776. 'apcu-autoloader' => false,
  6777. 'prepend-autoloader' => true,
  6778. 'github-domains' => array('github.com'),
  6779. 'bitbucket-expose-hostname' => true,
  6780. 'disable-tls' => false,
  6781. 'secure-http' => true,
  6782. 'cafile' => null,
  6783. 'capath' => null,
  6784. 'github-expose-hostname' => true,
  6785. 'gitlab-domains' => array('gitlab.com'),
  6786. 'store-auths' => 'prompt',
  6787. 'platform' => array(),
  6788. 'archive-format' => 'tar',
  6789. 'archive-dir' => '.',
  6790. 'htaccess-protect' => true,
  6791. 'use-github-api' => true,
  6792. 'lock' => true,
  6793. );
  6794. public static $defaultRepositories = array(
  6795. 'packagist.org' => array(
  6796. 'type' => 'composer',
  6797. 'url' => 'https?://repo.packagist.org',
  6798. 'allow_ssl_downgrade' => true,
  6799. ),
  6800. );
  6801. private $config;
  6802. private $baseDir;
  6803. private $repositories;
  6804. private $configSource;
  6805. private $authConfigSource;
  6806. private $useEnvironment;
  6807. private $warnedHosts = array();
  6808. public function __construct($useEnvironment = true, $baseDir = null)
  6809. {
  6810. $this->config = static::$defaultConfig;
  6811. $this->repositories = static::$defaultRepositories;
  6812. $this->useEnvironment = (bool) $useEnvironment;
  6813. $this->baseDir = $baseDir;
  6814. }
  6815. public function setConfigSource(ConfigSourceInterface $source)
  6816. {
  6817. $this->configSource = $source;
  6818. }
  6819. public function getConfigSource()
  6820. {
  6821. return $this->configSource;
  6822. }
  6823. public function setAuthConfigSource(ConfigSourceInterface $source)
  6824. {
  6825. $this->authConfigSource = $source;
  6826. }
  6827. public function getAuthConfigSource()
  6828. {
  6829. return $this->authConfigSource;
  6830. }
  6831. public function merge($config)
  6832. {
  6833. if (!empty($config['config']) && is_array($config['config'])) {
  6834. foreach ($config['config'] as $key => $val) {
  6835. if (in_array($key, array('bitbucket-oauth', 'github-oauth', 'gitlab-oauth', 'gitlab-token', 'http-basic')) && isset($this->config[$key])) {
  6836. $this->config[$key] = array_merge($this->config[$key], $val);
  6837. } elseif ('preferred-install' === $key && isset($this->config[$key])) {
  6838. if (is_array($val) || is_array($this->config[$key])) {
  6839. if (is_string($val)) {
  6840. $val = array('*' => $val);
  6841. }
  6842. if (is_string($this->config[$key])) {
  6843. $this->config[$key] = array('*' => $this->config[$key]);
  6844. }
  6845. $this->config[$key] = array_merge($this->config[$key], $val);
  6846. if (isset($this->config[$key]['*'])) {
  6847. $wildcard = $this->config[$key]['*'];
  6848. unset($this->config[$key]['*']);
  6849. $this->config[$key]['*'] = $wildcard;
  6850. }
  6851. } else {
  6852. $this->config[$key] = $val;
  6853. }
  6854. } else {
  6855. $this->config[$key] = $val;
  6856. }
  6857. }
  6858. }
  6859. if (!empty($config['repositories']) && is_array($config['repositories'])) {
  6860. $this->repositories = array_reverse($this->repositories, true);
  6861. $newRepos = array_reverse($config['repositories'], true);
  6862. foreach ($newRepos as $name => $repository) {
  6863. if (false === $repository) {
  6864. $this->disableRepoByName($name);
  6865. continue;
  6866. }
  6867. if (is_array($repository) && 1 === count($repository) && false === current($repository)) {
  6868. $this->disableRepoByName(key($repository));
  6869. continue;
  6870. }
  6871. if (is_int($name)) {
  6872. $this->repositories[] = $repository;
  6873. } else {
  6874. if ($name === 'packagist') {
  6875. $this->repositories[$name . '.org'] = $repository;
  6876. } else {
  6877. $this->repositories[$name] = $repository;
  6878. }
  6879. }
  6880. }
  6881. $this->repositories = array_reverse($this->repositories, true);
  6882. }
  6883. }
  6884. public function getRepositories()
  6885. {
  6886. return $this->repositories;
  6887. }
  6888. public function get($key, $flags = 0)
  6889. {
  6890. switch ($key) {
  6891. case 'vendor-dir':
  6892. case 'bin-dir':
  6893. case 'process-timeout':
  6894. case 'data-dir':
  6895. case 'cache-dir':
  6896. case 'cache-files-dir':
  6897. case 'cache-repo-dir':
  6898. case 'cache-vcs-dir':
  6899. case 'cafile':
  6900. case 'capath':
  6901. $env = 'COMPOSER_' . strtoupper(strtr($key, '-', '_'));
  6902. $val = $this->getComposerEnv($env);
  6903. $val = rtrim((string) $this->process(false !== $val ? $val : $this->config[$key], $flags), '/\\');
  6904. $val = Platform::expandPath($val);
  6905. if (substr($key, -4) !== '-dir') {
  6906. return $val;
  6907. }
  6908. return (($flags & self::RELATIVE_PATHS) == self::RELATIVE_PATHS) ? $val : $this->realpath($val);
  6909. case 'htaccess-protect':
  6910. $value = $this->getComposerEnv('COMPOSER_HTACCESS_PROTECT');
  6911. if (false === $value) {
  6912. $value = $this->config[$key];
  6913. }
  6914. return $value !== 'false' && (bool) $value;
  6915. case 'cache-ttl':
  6916. return (int) $this->config[$key];
  6917. case 'cache-files-maxsize':
  6918. if (!preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $this->config[$key], $matches)) {
  6919. throw new \RuntimeException(
  6920. "Could not parse the value of 'cache-files-maxsize': {$this->config[$key]}"
  6921. );
  6922. }
  6923. $size = $matches[1];
  6924. if (isset($matches[2])) {
  6925. switch (strtolower($matches[2])) {
  6926. case 'g':
  6927. $size *= 1024;
  6928. case 'm':
  6929. $size *= 1024;
  6930. case 'k':
  6931. $size *= 1024;
  6932. break;
  6933. }
  6934. }
  6935. return $size;
  6936. case 'cache-files-ttl':
  6937. if (isset($this->config[$key])) {
  6938. return (int) $this->config[$key];
  6939. }
  6940. return (int) $this->config['cache-ttl'];
  6941. case 'home':
  6942. $val = preg_replace('#^(\$HOME|~)(/|$)#', rtrim(getenv('HOME') ?: getenv('USERPROFILE'), '/\\') . '/', $this->config[$key]);
  6943. return rtrim($this->process($val, $flags), '/\\');
  6944. case 'bin-compat':
  6945. $value = $this->getComposerEnv('COMPOSER_BIN_COMPAT') ?: $this->config[$key];
  6946. if (!in_array($value, array('auto', 'full'))) {
  6947. throw new \RuntimeException(
  6948. "Invalid value for 'bin-compat': {$value}. Expected auto, full"
  6949. );
  6950. }
  6951. return $value;
  6952. case 'discard-changes':
  6953. if ($env = $this->getComposerEnv('COMPOSER_DISCARD_CHANGES')) {
  6954. if (!in_array($env, array('stash', 'true', 'false', '1', '0'), true)) {
  6955. throw new \RuntimeException(
  6956. "Invalid value for COMPOSER_DISCARD_CHANGES: {$env}. Expected 1, 0, true, false or stash"
  6957. );
  6958. }
  6959. if ('stash' === $env) {
  6960. return 'stash';
  6961. }
  6962. return $env !== 'false' && (bool) $env;
  6963. }
  6964. if (!in_array($this->config[$key], array(true, false, 'stash'), true)) {
  6965. throw new \RuntimeException(
  6966. "Invalid value for 'discard-changes': {$this->config[$key]}. Expected true, false or stash"
  6967. );
  6968. }
  6969. return $this->config[$key];
  6970. case 'github-protocols':
  6971. $protos = $this->config['github-protocols'];
  6972. if ($this->config['secure-http'] && false !== ($index = array_search('git', $protos))) {
  6973. unset($protos[$index]);
  6974. }
  6975. if (reset($protos) === 'http') {
  6976. throw new \RuntimeException('The http protocol for github is not available anymore, update your config\'s github-protocols to use "https", "git" or "ssh"');
  6977. }
  6978. return $protos;
  6979. case 'disable-tls':
  6980. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  6981. case 'secure-http':
  6982. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  6983. case 'use-github-api':
  6984. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  6985. case 'lock':
  6986. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  6987. default:
  6988. if (!isset($this->config[$key])) {
  6989. return null;
  6990. }
  6991. return $this->process($this->config[$key], $flags);
  6992. }
  6993. }
  6994. public function all($flags = 0)
  6995. {
  6996. $all = array(
  6997. 'repositories' => $this->getRepositories(),
  6998. );
  6999. foreach (array_keys($this->config) as $key) {
  7000. $all['config'][$key] = $this->get($key, $flags);
  7001. }
  7002. return $all;
  7003. }
  7004. public function raw()
  7005. {
  7006. return array(
  7007. 'repositories' => $this->getRepositories(),
  7008. 'config' => $this->config,
  7009. );
  7010. }
  7011. public function has($key)
  7012. {
  7013. return array_key_exists($key, $this->config);
  7014. }
  7015. private function process($value, $flags)
  7016. {
  7017. $config = $this;
  7018. if (!is_string($value)) {
  7019. return $value;
  7020. }
  7021. return preg_replace_callback('#\{\$(.+)\}#', function ($match) use ($config, $flags) {
  7022. return $config->get($match[1], $flags);
  7023. }, $value);
  7024. }
  7025. private function realpath($path)
  7026. {
  7027. if (preg_match('{^(?:/|[a-z]:|[a-z0-9.]+://)}i', $path)) {
  7028. return $path;
  7029. }
  7030. return $this->baseDir . '/' . $path;
  7031. }
  7032. private function getComposerEnv($var)
  7033. {
  7034. if ($this->useEnvironment) {
  7035. return getenv($var);
  7036. }
  7037. return false;
  7038. }
  7039. private function disableRepoByName($name)
  7040. {
  7041. if (isset($this->repositories[$name])) {
  7042. unset($this->repositories[$name]);
  7043. } elseif ($name === 'packagist') {
  7044. unset($this->repositories['packagist.org']);
  7045. }
  7046. }
  7047. public function prohibitUrlByConfig($url, IOInterface $io = null)
  7048. {
  7049. if (false === filter_var($url, FILTER_VALIDATE_URL)) {
  7050. return;
  7051. }
  7052. $scheme = parse_url($url, PHP_URL_SCHEME);
  7053. if (in_array($scheme, array('http', 'git', 'ftp', 'svn'))) {
  7054. if ($this->get('secure-http')) {
  7055. throw new TransportException("Your configuration does not allow connections to $url. See https://getcomposer.org/doc/06-config.md#secure-http for details.");
  7056. } elseif ($io) {
  7057. $host = parse_url($url, PHP_URL_HOST);
  7058. if (!isset($this->warnedHosts[$host])) {
  7059. $io->writeError("<warning>Warning: Accessing $host over $scheme which is an insecure protocol.</warning>");
  7060. }
  7061. $this->warnedHosts[$host] = true;
  7062. }
  7063. }
  7064. }
  7065. public static function disableProcessTimeout()
  7066. {
  7067. ProcessExecutor::setTimeout(0);
  7068. }
  7069. }
  7070. <?php
  7071. namespace Composer\Config;
  7072. interface ConfigSourceInterface
  7073. {
  7074. public function addRepository($name, $config);
  7075. public function removeRepository($name);
  7076. public function addConfigSetting($name, $value);
  7077. public function removeConfigSetting($name);
  7078. public function addProperty($name, $value);
  7079. public function removeProperty($name);
  7080. public function addLink($type, $name, $value);
  7081. public function removeLink($type, $name);
  7082. public function getName();
  7083. }
  7084. <?php
  7085. namespace Composer\Config;
  7086. use Composer\Json\JsonFile;
  7087. use Composer\Json\JsonManipulator;
  7088. use Composer\Util\Silencer;
  7089. class JsonConfigSource implements ConfigSourceInterface
  7090. {
  7091. private $file;
  7092. private $authConfig;
  7093. public function __construct(JsonFile $file, $authConfig = false)
  7094. {
  7095. $this->file = $file;
  7096. $this->authConfig = $authConfig;
  7097. }
  7098. public function getName()
  7099. {
  7100. return $this->file->getPath();
  7101. }
  7102. public function addRepository($name, $config)
  7103. {
  7104. $this->manipulateJson('addRepository', $name, $config, function (&$config, $repo, $repoConfig) {
  7105. if (isset($config['repositories'])) {
  7106. foreach ($config['repositories'] as $index => $val) {
  7107. if ($index === $repo) {
  7108. continue;
  7109. }
  7110. if (is_numeric($index) && ($val === array('packagist' => false) || $val === array('packagist.org' => false))) {
  7111. unset($config['repositories'][$index]);
  7112. $config['repositories']['packagist.org'] = false;
  7113. break;
  7114. }
  7115. }
  7116. }
  7117. $config['repositories'][$repo] = $repoConfig;
  7118. });
  7119. }
  7120. public function removeRepository($name)
  7121. {
  7122. $this->manipulateJson('removeRepository', $name, function (&$config, $repo) {
  7123. unset($config['repositories'][$repo]);
  7124. });
  7125. }
  7126. public function addConfigSetting($name, $value)
  7127. {
  7128. $authConfig = $this->authConfig;
  7129. $this->manipulateJson('addConfigSetting', $name, $value, function (&$config, $key, $val) use ($authConfig) {
  7130. if (preg_match('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic|platform)\.}', $key)) {
  7131. list($key, $host) = explode('.', $key, 2);
  7132. if ($authConfig) {
  7133. $config[$key][$host] = $val;
  7134. } else {
  7135. $config['config'][$key][$host] = $val;
  7136. }
  7137. } else {
  7138. $config['config'][$key] = $val;
  7139. }
  7140. });
  7141. }
  7142. public function removeConfigSetting($name)
  7143. {
  7144. $authConfig = $this->authConfig;
  7145. $this->manipulateJson('removeConfigSetting', $name, function (&$config, $key) use ($authConfig) {
  7146. if (preg_match('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic|platform)\.}', $key)) {
  7147. list($key, $host) = explode('.', $key, 2);
  7148. if ($authConfig) {
  7149. unset($config[$key][$host]);
  7150. } else {
  7151. unset($config['config'][$key][$host]);
  7152. }
  7153. } else {
  7154. unset($config['config'][$key]);
  7155. }
  7156. });
  7157. }
  7158. public function addProperty($name, $value)
  7159. {
  7160. $this->manipulateJson('addProperty', $name, $value, function (&$config, $key, $val) {
  7161. if (substr($key, 0, 6) === 'extra.' || substr($key, 0, 8) === 'scripts.') {
  7162. $bits = explode('.', $key);
  7163. $last = array_pop($bits);
  7164. $arr = &$config[reset($bits)];
  7165. foreach ($bits as $bit) {
  7166. if (!isset($arr[$bit])) {
  7167. $arr[$bit] = array();
  7168. }
  7169. $arr = &$arr[$bit];
  7170. }
  7171. $arr[$last] = $val;
  7172. } else {
  7173. $config[$key] = $val;
  7174. }
  7175. });
  7176. }
  7177. public function removeProperty($name)
  7178. {
  7179. $authConfig = $this->authConfig;
  7180. $this->manipulateJson('removeProperty', $name, function (&$config, $key) {
  7181. if (substr($key, 0, 6) === 'extra.' || substr($key, 0, 8) === 'scripts.') {
  7182. $bits = explode('.', $key);
  7183. $last = array_pop($bits);
  7184. $arr = &$config[reset($bits)];
  7185. foreach ($bits as $bit) {
  7186. if (!isset($arr[$bit])) {
  7187. return;
  7188. }
  7189. $arr = &$arr[$bit];
  7190. }
  7191. unset($arr[$last]);
  7192. } else {
  7193. unset($config[$key]);
  7194. }
  7195. });
  7196. }
  7197. public function addLink($type, $name, $value)
  7198. {
  7199. $this->manipulateJson('addLink', $type, $name, $value, function (&$config, $type, $name, $value) {
  7200. $config[$type][$name] = $value;
  7201. });
  7202. }
  7203. public function removeLink($type, $name)
  7204. {
  7205. $this->manipulateJson('removeSubNode', $type, $name, function (&$config, $type, $name) {
  7206. unset($config[$type][$name]);
  7207. if (0 === count($config[$type])) {
  7208. unset($config[$type]);
  7209. }
  7210. });
  7211. }
  7212. protected function manipulateJson($method, $args, $fallback)
  7213. {
  7214. $args = func_get_args();
  7215. array_shift($args);
  7216. $fallback = array_pop($args);
  7217. if ($this->file->exists()) {
  7218. if (!is_writable($this->file->getPath())) {
  7219. throw new \RuntimeException(sprintf('The file "%s" is not writable.', $this->file->getPath()));
  7220. }
  7221. if (!is_readable($this->file->getPath())) {
  7222. throw new \RuntimeException(sprintf('The file "%s" is not readable.', $this->file->getPath()));
  7223. }
  7224. $contents = file_get_contents($this->file->getPath());
  7225. } elseif ($this->authConfig) {
  7226. $contents = "{\n}\n";
  7227. } else {
  7228. $contents = "{\n \"config\": {\n }\n}\n";
  7229. }
  7230. $manipulator = new JsonManipulator($contents);
  7231. $newFile = !$this->file->exists();
  7232. if ($this->authConfig && $method === 'addConfigSetting') {
  7233. $method = 'addSubNode';
  7234. list($mainNode, $name) = explode('.', $args[0], 2);
  7235. $args = array($mainNode, $name, $args[1]);
  7236. } elseif ($this->authConfig && $method === 'removeConfigSetting') {
  7237. $method = 'removeSubNode';
  7238. list($mainNode, $name) = explode('.', $args[0], 2);
  7239. $args = array($mainNode, $name);
  7240. }
  7241. if (call_user_func_array(array($manipulator, $method), $args)) {
  7242. file_put_contents($this->file->getPath(), $manipulator->getContents());
  7243. } else {
  7244. $config = $this->file->read();
  7245. $this->arrayUnshiftRef($args, $config);
  7246. call_user_func_array($fallback, $args);
  7247. $this->file->write($config);
  7248. }
  7249. if ($newFile) {
  7250. Silencer::call('chmod', $this->file->getPath(), 0600);
  7251. }
  7252. }
  7253. private function arrayUnshiftRef(&$array, &$value)
  7254. {
  7255. $return = array_unshift($array, '');
  7256. $array[0] = &$value;
  7257. return $return;
  7258. }
  7259. }
  7260. <?php
  7261. namespace Composer\Console;
  7262. use Composer\IO\NullIO;
  7263. use Composer\Util\Platform;
  7264. use Composer\Util\Silencer;
  7265. use Symfony\Component\Console\Application as BaseApplication;
  7266. use Symfony\Component\Console\Exception\CommandNotFoundException;
  7267. use Symfony\Component\Console\Helper\HelperSet;
  7268. use Symfony\Component\Console\Helper\QuestionHelper;
  7269. use Symfony\Component\Console\Input\InputInterface;
  7270. use Symfony\Component\Console\Input\InputOption;
  7271. use Symfony\Component\Console\Output\OutputInterface;
  7272. use Composer\Command;
  7273. use Composer\Composer;
  7274. use Composer\Factory;
  7275. use Composer\IO\IOInterface;
  7276. use Composer\IO\ConsoleIO;
  7277. use Composer\Json\JsonValidationException;
  7278. use Composer\Util\ErrorHandler;
  7279. use Composer\EventDispatcher\ScriptExecutionException;
  7280. use Composer\Exception\NoSslException;
  7281. class Application extends BaseApplication
  7282. {
  7283. protected $composer;
  7284. protected $io;
  7285. private static $logo = ' ______
  7286. / ____/___ ____ ___ ____ ____ ________ _____
  7287. / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
  7288. / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
  7289. \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
  7290. /_/
  7291. ';
  7292. private $hasPluginCommands = false;
  7293. private $disablePluginsByDefault = false;
  7294. public function __construct()
  7295. {
  7296. static $shutdownRegistered = false;
  7297. if (function_exists('ini_set') && extension_loaded('xdebug')) {
  7298. ini_set('xdebug.show_exception_trace', false);
  7299. ini_set('xdebug.scream', false);
  7300. }
  7301. if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
  7302. date_default_timezone_set(Silencer::call('date_default_timezone_get'));
  7303. }
  7304. if (!$shutdownRegistered) {
  7305. $shutdownRegistered = true;
  7306. register_shutdown_function(function () {
  7307. $lastError = error_get_last();
  7308. if ($lastError && $lastError['message'] &&
  7309. (strpos($lastError['message'], 'Allowed memory') !== false ||
  7310. strpos($lastError['message'], 'exceeded memory') !== false )) {
  7311. echo "\n". 'Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.';
  7312. }
  7313. });
  7314. }
  7315. $this->io = new NullIO();
  7316. parent::__construct('Composer', Composer::getVersion());
  7317. }
  7318. public function run(InputInterface $input = null, OutputInterface $output = null)
  7319. {
  7320. if (null === $output) {
  7321. $output = Factory::createOutput();
  7322. }
  7323. return parent::run($input, $output);
  7324. }
  7325. public function doRun(InputInterface $input, OutputInterface $output)
  7326. {
  7327. $this->disablePluginsByDefault = $input->hasParameterOption('--no-plugins');
  7328. if (getenv('COMPOSER_NO_INTERACTION')) {
  7329. $input->setInteractive(false);
  7330. }
  7331. $io = $this->io = new ConsoleIO($input, $output, new HelperSet(array(
  7332. new QuestionHelper(),
  7333. )));
  7334. ErrorHandler::register($io);
  7335. if ($input->hasParameterOption('--no-cache')) {
  7336. $io->writeError('Disabling cache usage', true, IOInterface::DEBUG);
  7337. putenv('COMPOSER_CACHE_DIR='.(Platform::isWindows() ? 'nul' : '/dev/null'));
  7338. }
  7339. if ($newWorkDir = $this->getNewWorkingDir($input)) {
  7340. $oldWorkingDir = getcwd();
  7341. chdir($newWorkDir);
  7342. $io->writeError('Changed CWD to ' . getcwd(), true, IOInterface::DEBUG);
  7343. }
  7344. $commandName = '';
  7345. if ($name = $this->getCommandName($input)) {
  7346. try {
  7347. $commandName = $this->find($name)->getName();
  7348. } catch (CommandNotFoundException $e) {
  7349. $commandName = false;
  7350. } catch (\InvalidArgumentException $e) {
  7351. }
  7352. }
  7353. if ($io->isInteractive() && !$newWorkDir && !in_array($commandName, array('', 'list', 'init', 'about', 'help', 'diagnose', 'self-update', 'global', 'create-project'), true) && !file_exists(Factory::getComposerFile())) {
  7354. $dir = dirname(getcwd());
  7355. $home = realpath(getenv('HOME') ?: getenv('USERPROFILE') ?: '/');
  7356. while (dirname($dir) !== $dir && $dir !== $home) {
  7357. if (file_exists($dir.'/'.Factory::getComposerFile())) {
  7358. 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)) {
  7359. $oldWorkingDir = getcwd();
  7360. chdir($dir);
  7361. }
  7362. break;
  7363. }
  7364. $dir = dirname($dir);
  7365. }
  7366. }
  7367. if (!$this->disablePluginsByDefault && !$this->hasPluginCommands && 'global' !== $commandName) {
  7368. try {
  7369. foreach ($this->getPluginCommands() as $command) {
  7370. if ($this->has($command->getName())) {
  7371. $io->writeError('<warning>Plugin command '.$command->getName().' ('.get_class($command).') would override a Composer command and has been skipped</warning>');
  7372. } else {
  7373. $this->add($command);
  7374. }
  7375. }
  7376. } catch (NoSslException $e) {
  7377. }
  7378. $this->hasPluginCommands = true;
  7379. }
  7380. $isProxyCommand = false;
  7381. if ($name = $this->getCommandName($input)) {
  7382. try {
  7383. $command = $this->find($name);
  7384. $commandName = $command->getName();
  7385. $isProxyCommand = ($command instanceof Command\BaseCommand && $command->isProxyCommand());
  7386. } catch (\InvalidArgumentException $e) {
  7387. }
  7388. }
  7389. if (!$isProxyCommand) {
  7390. $io->writeError(sprintf(
  7391. 'Running %s (%s) with %s on %s',
  7392. Composer::getVersion(),
  7393. Composer::RELEASE_DATE,
  7394. defined('HHVM_VERSION') ? 'HHVM '.HHVM_VERSION : 'PHP '.PHP_VERSION,
  7395. function_exists('php_uname') ? php_uname('s') . ' / ' . php_uname('r') : 'Unknown OS'
  7396. ), true, IOInterface::DEBUG);
  7397. if (PHP_VERSION_ID < 50302) {
  7398. $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>');
  7399. }
  7400. if (extension_loaded('xdebug') && !getenv('COMPOSER_DISABLE_XDEBUG_WARN')) {
  7401. $io->writeError('<warning>You are running composer with Xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug</warning>');
  7402. }
  7403. if (defined('COMPOSER_DEV_WARNING_TIME') && $commandName !== 'self-update' && $commandName !== 'selfupdate' && time() > COMPOSER_DEV_WARNING_TIME) {
  7404. $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']));
  7405. }
  7406. if (!Platform::isWindows() && function_exists('exec') && !getenv('COMPOSER_ALLOW_SUPERUSER') && !file_exists('/.dockerenv')) {
  7407. if (function_exists('posix_getuid') && posix_getuid() === 0) {
  7408. if ($commandName !== 'self-update' && $commandName !== 'selfupdate') {
  7409. $io->writeError('<warning>Do not run Composer as root/super user! See https://getcomposer.org/root for details</warning>');
  7410. }
  7411. if ($uid = (int) getenv('SUDO_UID')) {
  7412. Silencer::call('exec', "sudo -u \\#{$uid} sudo -K > /dev/null 2>&1");
  7413. }
  7414. }
  7415. Silencer::call('exec', 'sudo -K > /dev/null 2>&1');
  7416. }
  7417. Silencer::call(function () use ($io) {
  7418. $tempfile = sys_get_temp_dir() . '/temp-' . md5(microtime());
  7419. if (!(file_put_contents($tempfile, __FILE__) && (file_get_contents($tempfile) == __FILE__) && unlink($tempfile) && !file_exists($tempfile))) {
  7420. $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()));
  7421. }
  7422. });
  7423. $file = Factory::getComposerFile();
  7424. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  7425. if (isset($composer['scripts']) && is_array($composer['scripts'])) {
  7426. foreach ($composer['scripts'] as $script => $dummy) {
  7427. if (!defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  7428. if ($this->has($script)) {
  7429. $io->writeError('<warning>A script named '.$script.' would override a Composer command and has been skipped</warning>');
  7430. } else {
  7431. $description = null;
  7432. if (isset($composer['scripts-descriptions'][$script])) {
  7433. $description = $composer['scripts-descriptions'][$script];
  7434. }
  7435. $this->add(new Command\ScriptAliasCommand($script, $description));
  7436. }
  7437. }
  7438. }
  7439. }
  7440. }
  7441. }
  7442. try {
  7443. if ($input->hasParameterOption('--profile')) {
  7444. $startTime = microtime(true);
  7445. $this->io->enableDebugging($startTime);
  7446. }
  7447. $result = parent::doRun($input, $output);
  7448. if (isset($oldWorkingDir)) {
  7449. chdir($oldWorkingDir);
  7450. }
  7451. if (isset($startTime)) {
  7452. $io->writeError('<info>Memory usage: '.round(memory_get_usage() / 1024 / 1024, 2).'MiB (peak: '.round(memory_get_peak_usage() / 1024 / 1024, 2).'MiB), time: '.round(microtime(true) - $startTime, 2).'s');
  7453. }
  7454. restore_error_handler();
  7455. return $result;
  7456. } catch (ScriptExecutionException $e) {
  7457. return $e->getCode();
  7458. } catch (\Exception $e) {
  7459. $this->hintCommonErrors($e);
  7460. restore_error_handler();
  7461. throw $e;
  7462. }
  7463. }
  7464. private function getNewWorkingDir(InputInterface $input)
  7465. {
  7466. $workingDir = $input->getParameterOption(array('--working-dir', '-d'));
  7467. if (false !== $workingDir && !is_dir($workingDir)) {
  7468. throw new \RuntimeException('Invalid working directory specified, '.$workingDir.' does not exist.');
  7469. }
  7470. return $workingDir;
  7471. }
  7472. private function hintCommonErrors($exception)
  7473. {
  7474. $io = $this->getIO();
  7475. Silencer::suppress();
  7476. try {
  7477. $composer = $this->getComposer(false, true);
  7478. if ($composer) {
  7479. $config = $composer->getConfig();
  7480. $minSpaceFree = 1024 * 1024;
  7481. if ((($df = disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  7482. || (($df = disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  7483. || (($df = disk_free_space($dir = sys_get_temp_dir())) !== false && $df < $minSpaceFree)
  7484. ) {
  7485. $io->writeError('<error>The disk hosting '.$dir.' is full, this may be the cause of the following exception</error>', true, IOInterface::QUIET);
  7486. }
  7487. }
  7488. } catch (\Exception $e) {
  7489. }
  7490. Silencer::restore();
  7491. if (Platform::isWindows() && false !== strpos($exception->getMessage(), 'The system cannot find the path specified')) {
  7492. $io->writeError('<error>The following exception may be caused by a stale entry in your cmd.exe AutoRun</error>', true, IOInterface::QUIET);
  7493. $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);
  7494. }
  7495. if (false !== strpos($exception->getMessage(), 'fork failed - Cannot allocate memory')) {
  7496. $io->writeError('<error>The following exception is caused by a lack of memory or swap, or not having swap configured</error>', true, IOInterface::QUIET);
  7497. $io->writeError('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details</error>', true, IOInterface::QUIET);
  7498. }
  7499. }
  7500. public function getComposer($required = true, $disablePlugins = null)
  7501. {
  7502. if (null === $disablePlugins) {
  7503. $disablePlugins = $this->disablePluginsByDefault;
  7504. }
  7505. if (null === $this->composer) {
  7506. try {
  7507. $this->composer = Factory::create($this->io, null, $disablePlugins);
  7508. } catch (\InvalidArgumentException $e) {
  7509. if ($required) {
  7510. $this->io->writeError($e->getMessage());
  7511. exit(1);
  7512. }
  7513. } catch (JsonValidationException $e) {
  7514. $errors = ' - ' . implode(PHP_EOL . ' - ', $e->getErrors());
  7515. $message = $e->getMessage() . ':' . PHP_EOL . $errors;
  7516. throw new JsonValidationException($message);
  7517. }
  7518. }
  7519. return $this->composer;
  7520. }
  7521. public function resetComposer()
  7522. {
  7523. $this->composer = null;
  7524. if ($this->getIO() && method_exists($this->getIO(), 'resetAuthentications')) {
  7525. $this->getIO()->resetAuthentications();
  7526. }
  7527. }
  7528. public function getIO()
  7529. {
  7530. return $this->io;
  7531. }
  7532. public function getHelp()
  7533. {
  7534. return self::$logo . parent::getHelp();
  7535. }
  7536. protected function getDefaultCommands()
  7537. {
  7538. $commands = array_merge(parent::getDefaultCommands(), array(
  7539. new Command\AboutCommand(),
  7540. new Command\ConfigCommand(),
  7541. new Command\DependsCommand(),
  7542. new Command\ProhibitsCommand(),
  7543. new Command\InitCommand(),
  7544. new Command\InstallCommand(),
  7545. new Command\CreateProjectCommand(),
  7546. new Command\UpdateCommand(),
  7547. new Command\SearchCommand(),
  7548. new Command\ValidateCommand(),
  7549. new Command\ShowCommand(),
  7550. new Command\SuggestsCommand(),
  7551. new Command\RequireCommand(),
  7552. new Command\DumpAutoloadCommand(),
  7553. new Command\StatusCommand(),
  7554. new Command\ArchiveCommand(),
  7555. new Command\DiagnoseCommand(),
  7556. new Command\RunScriptCommand(),
  7557. new Command\LicensesCommand(),
  7558. new Command\GlobalCommand(),
  7559. new Command\ClearCacheCommand(),
  7560. new Command\RemoveCommand(),
  7561. new Command\HomeCommand(),
  7562. new Command\ExecCommand(),
  7563. new Command\OutdatedCommand(),
  7564. new Command\CheckPlatformReqsCommand(),
  7565. ));
  7566. if ('phar:' === substr(__FILE__, 0, 5)) {
  7567. $commands[] = new Command\SelfUpdateCommand();
  7568. }
  7569. return $commands;
  7570. }
  7571. public function getLongVersion()
  7572. {
  7573. if (Composer::BRANCH_ALIAS_VERSION && Composer::BRANCH_ALIAS_VERSION !== '@package_branch_alias_version'.'@') {
  7574. return sprintf(
  7575. '<info>%s</info> version <comment>%s (%s)</comment> %s',
  7576. $this->getName(),
  7577. Composer::BRANCH_ALIAS_VERSION,
  7578. $this->getVersion(),
  7579. Composer::RELEASE_DATE
  7580. );
  7581. }
  7582. return parent::getLongVersion() . ' ' . Composer::RELEASE_DATE;
  7583. }
  7584. protected function getDefaultInputDefinition()
  7585. {
  7586. $definition = parent::getDefaultInputDefinition();
  7587. $definition->addOption(new InputOption('--profile', null, InputOption::VALUE_NONE, 'Display timing and memory usage information'));
  7588. $definition->addOption(new InputOption('--no-plugins', null, InputOption::VALUE_NONE, 'Whether to disable plugins.'));
  7589. $definition->addOption(new InputOption('--working-dir', '-d', InputOption::VALUE_REQUIRED, 'If specified, use the given directory as working directory.'));
  7590. $definition->addOption(new InputOption('--no-cache', null, InputOption::VALUE_NONE, 'Prevent use of the cache'));
  7591. return $definition;
  7592. }
  7593. private function getPluginCommands()
  7594. {
  7595. $commands = array();
  7596. $composer = $this->getComposer(false, false);
  7597. if (null === $composer) {
  7598. $composer = Factory::createGlobal($this->io, false);
  7599. }
  7600. if (null !== $composer) {
  7601. $pm = $composer->getPluginManager();
  7602. foreach ($pm->getPluginCapabilities('Composer\Plugin\Capability\CommandProvider', array('composer' => $composer, 'io' => $this->io)) as $capability) {
  7603. $newCommands = $capability->getCommands();
  7604. if (!is_array($newCommands)) {
  7605. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' failed to return an array from getCommands');
  7606. }
  7607. foreach ($newCommands as $command) {
  7608. if (!$command instanceof Command\BaseCommand) {
  7609. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' returned an invalid value, we expected an array of Composer\Command\BaseCommand objects');
  7610. }
  7611. }
  7612. $commands = array_merge($commands, $newCommands);
  7613. }
  7614. }
  7615. return $commands;
  7616. }
  7617. }
  7618. <?php
  7619. namespace Composer\Console;
  7620. use Symfony\Component\Console\Formatter\OutputFormatter;
  7621. class HtmlOutputFormatter extends OutputFormatter
  7622. {
  7623. private static $availableForegroundColors = array(
  7624. 30 => 'black',
  7625. 31 => 'red',
  7626. 32 => 'green',
  7627. 33 => 'yellow',
  7628. 34 => 'blue',
  7629. 35 => 'magenta',
  7630. 36 => 'cyan',
  7631. 37 => 'white',
  7632. );
  7633. private static $availableBackgroundColors = array(
  7634. 40 => 'black',
  7635. 41 => 'red',
  7636. 42 => 'green',
  7637. 43 => 'yellow',
  7638. 44 => 'blue',
  7639. 45 => 'magenta',
  7640. 46 => 'cyan',
  7641. 47 => 'white',
  7642. );
  7643. private static $availableOptions = array(
  7644. 1 => 'bold',
  7645. 4 => 'underscore',
  7646. );
  7647. public function __construct(array $styles = array())
  7648. {
  7649. parent::__construct(true, $styles);
  7650. }
  7651. public function format($message)
  7652. {
  7653. $formatted = parent::format($message);
  7654. $clearEscapeCodes = '(?:39|49|0|22|24|25|27|28)';
  7655. return preg_replace_callback("{\033\[([0-9;]+)m(.*?)\033\[(?:".$clearEscapeCodes.";)*?".$clearEscapeCodes."m}s", array($this, 'formatHtml'), $formatted);
  7656. }
  7657. private function formatHtml($matches)
  7658. {
  7659. $out = '<span style="';
  7660. foreach (explode(';', $matches[1]) as $code) {
  7661. if (isset(self::$availableForegroundColors[$code])) {
  7662. $out .= 'color:'.self::$availableForegroundColors[$code].';';
  7663. } elseif (isset(self::$availableBackgroundColors[$code])) {
  7664. $out .= 'background-color:'.self::$availableBackgroundColors[$code].';';
  7665. } elseif (isset(self::$availableOptions[$code])) {
  7666. switch (self::$availableOptions[$code]) {
  7667. case 'bold':
  7668. $out .= 'font-weight:bold;';
  7669. break;
  7670. case 'underscore':
  7671. $out .= 'text-decoration:underline;';
  7672. break;
  7673. }
  7674. }
  7675. }
  7676. return $out.'">'.$matches[2].'</span>';
  7677. }
  7678. }
  7679. <?php
  7680. namespace Composer\DependencyResolver;
  7681. class Decisions implements \Iterator, \Countable
  7682. {
  7683. const DECISION_LITERAL = 0;
  7684. const DECISION_REASON = 1;
  7685. protected $pool;
  7686. protected $decisionMap;
  7687. protected $decisionQueue = array();
  7688. public function __construct($pool)
  7689. {
  7690. $this->pool = $pool;
  7691. $this->decisionMap = array();
  7692. }
  7693. public function decide($literal, $level, $why)
  7694. {
  7695. $this->addDecision($literal, $level);
  7696. $this->decisionQueue[] = array(
  7697. self::DECISION_LITERAL => $literal,
  7698. self::DECISION_REASON => $why,
  7699. );
  7700. }
  7701. public function satisfy($literal)
  7702. {
  7703. $packageId = abs($literal);
  7704. return (
  7705. $literal > 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 ||
  7706. $literal < 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0
  7707. );
  7708. }
  7709. public function conflict($literal)
  7710. {
  7711. $packageId = abs($literal);
  7712. return (
  7713. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 && $literal < 0) ||
  7714. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0 && $literal > 0)
  7715. );
  7716. }
  7717. public function decided($literalOrPackageId)
  7718. {
  7719. return !empty($this->decisionMap[abs($literalOrPackageId)]);
  7720. }
  7721. public function undecided($literalOrPackageId)
  7722. {
  7723. return empty($this->decisionMap[abs($literalOrPackageId)]);
  7724. }
  7725. public function decidedInstall($literalOrPackageId)
  7726. {
  7727. $packageId = abs($literalOrPackageId);
  7728. return isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0;
  7729. }
  7730. public function decisionLevel($literalOrPackageId)
  7731. {
  7732. $packageId = abs($literalOrPackageId);
  7733. if (isset($this->decisionMap[$packageId])) {
  7734. return abs($this->decisionMap[$packageId]);
  7735. }
  7736. return 0;
  7737. }
  7738. public function decisionRule($literalOrPackageId)
  7739. {
  7740. $packageId = abs($literalOrPackageId);
  7741. foreach ($this->decisionQueue as $i => $decision) {
  7742. if ($packageId === abs($decision[self::DECISION_LITERAL])) {
  7743. return $decision[self::DECISION_REASON];
  7744. }
  7745. }
  7746. return null;
  7747. }
  7748. public function atOffset($queueOffset)
  7749. {
  7750. return $this->decisionQueue[$queueOffset];
  7751. }
  7752. public function validOffset($queueOffset)
  7753. {
  7754. return $queueOffset >= 0 && $queueOffset < count($this->decisionQueue);
  7755. }
  7756. public function lastReason()
  7757. {
  7758. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_REASON];
  7759. }
  7760. public function lastLiteral()
  7761. {
  7762. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_LITERAL];
  7763. }
  7764. public function reset()
  7765. {
  7766. while ($decision = array_pop($this->decisionQueue)) {
  7767. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  7768. }
  7769. }
  7770. public function resetToOffset($offset)
  7771. {
  7772. while (count($this->decisionQueue) > $offset + 1) {
  7773. $decision = array_pop($this->decisionQueue);
  7774. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  7775. }
  7776. }
  7777. public function revertLast()
  7778. {
  7779. $this->decisionMap[abs($this->lastLiteral())] = 0;
  7780. array_pop($this->decisionQueue);
  7781. }
  7782. public function count()
  7783. {
  7784. return count($this->decisionQueue);
  7785. }
  7786. public function rewind()
  7787. {
  7788. end($this->decisionQueue);
  7789. }
  7790. public function current()
  7791. {
  7792. return current($this->decisionQueue);
  7793. }
  7794. public function key()
  7795. {
  7796. return key($this->decisionQueue);
  7797. }
  7798. public function next()
  7799. {
  7800. return prev($this->decisionQueue);
  7801. }
  7802. public function valid()
  7803. {
  7804. return false !== current($this->decisionQueue);
  7805. }
  7806. public function isEmpty()
  7807. {
  7808. return count($this->decisionQueue) === 0;
  7809. }
  7810. protected function addDecision($literal, $level)
  7811. {
  7812. $packageId = abs($literal);
  7813. $previousDecision = isset($this->decisionMap[$packageId]) ? $this->decisionMap[$packageId] : null;
  7814. if ($previousDecision != 0) {
  7815. $literalString = $this->pool->literalToPrettyString($literal, array());
  7816. $package = $this->pool->literalToPackage($literal);
  7817. throw new SolverBugException(
  7818. "Trying to decide $literalString on level $level, even though $package was previously decided as ".(int) $previousDecision."."
  7819. );
  7820. }
  7821. if ($literal > 0) {
  7822. $this->decisionMap[$packageId] = $level;
  7823. } else {
  7824. $this->decisionMap[$packageId] = -$level;
  7825. }
  7826. }
  7827. public function __toString()
  7828. {
  7829. $decisionMap = $this->decisionMap;
  7830. ksort($decisionMap);
  7831. $str = '[';
  7832. foreach ($decisionMap as $packageId => $level) {
  7833. $str .= $packageId.':'.$level.',';
  7834. }
  7835. $str .= ']';
  7836. return $str;
  7837. }
  7838. }
  7839. <?php
  7840. namespace Composer\DependencyResolver;
  7841. use Composer\Package\PackageInterface;
  7842. use Composer\Package\AliasPackage;
  7843. use Composer\Package\BasePackage;
  7844. use Composer\Semver\Constraint\Constraint;
  7845. class DefaultPolicy implements PolicyInterface
  7846. {
  7847. private $preferStable;
  7848. private $preferLowest;
  7849. public function __construct($preferStable = false, $preferLowest = false)
  7850. {
  7851. $this->preferStable = $preferStable;
  7852. $this->preferLowest = $preferLowest;
  7853. }
  7854. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator)
  7855. {
  7856. if ($this->preferStable && ($stabA = $a->getStability()) !== ($stabB = $b->getStability())) {
  7857. return BasePackage::$stabilities[$stabA] < BasePackage::$stabilities[$stabB];
  7858. }
  7859. $constraint = new Constraint($operator, $b->getVersion());
  7860. $version = new Constraint('==', $a->getVersion());
  7861. return $constraint->matchSpecific($version, true);
  7862. }
  7863. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package, $mustMatchName = false)
  7864. {
  7865. $packages = array();
  7866. foreach ($pool->whatProvides($package->getName(), null, $mustMatchName) as $candidate) {
  7867. if ($candidate !== $package) {
  7868. $packages[] = $candidate;
  7869. }
  7870. }
  7871. return $packages;
  7872. }
  7873. public function getPriority(Pool $pool, PackageInterface $package)
  7874. {
  7875. return $pool->getPriority($package->getRepository());
  7876. }
  7877. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null)
  7878. {
  7879. $packages = $this->groupLiteralsByNamePreferInstalled($pool, $installedMap, $literals);
  7880. foreach ($packages as &$literals) {
  7881. $policy = $this;
  7882. usort($literals, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  7883. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage, true);
  7884. });
  7885. }
  7886. foreach ($packages as &$literals) {
  7887. $literals = $this->pruneToHighestPriorityOrInstalled($pool, $installedMap, $literals);
  7888. $literals = $this->pruneToBestVersion($pool, $literals);
  7889. $literals = $this->pruneRemoteAliases($pool, $literals);
  7890. }
  7891. $selected = call_user_func_array('array_merge', $packages);
  7892. usort($selected, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  7893. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage);
  7894. });
  7895. return $selected;
  7896. }
  7897. protected function groupLiteralsByNamePreferInstalled(Pool $pool, array $installedMap, $literals)
  7898. {
  7899. $packages = array();
  7900. foreach ($literals as $literal) {
  7901. $packageName = $pool->literalToPackage($literal)->getName();
  7902. if (!isset($packages[$packageName])) {
  7903. $packages[$packageName] = array();
  7904. }
  7905. if (isset($installedMap[abs($literal)])) {
  7906. array_unshift($packages[$packageName], $literal);
  7907. } else {
  7908. $packages[$packageName][] = $literal;
  7909. }
  7910. }
  7911. return $packages;
  7912. }
  7913. public function compareByPriorityPreferInstalled(Pool $pool, array $installedMap, PackageInterface $a, PackageInterface $b, $requiredPackage = null, $ignoreReplace = false)
  7914. {
  7915. if ($a->getRepository() === $b->getRepository()) {
  7916. if ($a->getName() === $b->getName()) {
  7917. $aAliased = $a instanceof AliasPackage;
  7918. $bAliased = $b instanceof AliasPackage;
  7919. if ($aAliased && !$bAliased) {
  7920. return -1;
  7921. }
  7922. if (!$aAliased && $bAliased) {
  7923. return 1;
  7924. }
  7925. }
  7926. if (!$ignoreReplace) {
  7927. if ($this->replaces($a, $b)) {
  7928. return 1;
  7929. }
  7930. if ($this->replaces($b, $a)) {
  7931. return -1;
  7932. }
  7933. if ($requiredPackage && false !== ($pos = strpos($requiredPackage, '/'))) {
  7934. $requiredVendor = substr($requiredPackage, 0, $pos);
  7935. $aIsSameVendor = substr($a->getName(), 0, $pos) === $requiredVendor;
  7936. $bIsSameVendor = substr($b->getName(), 0, $pos) === $requiredVendor;
  7937. if ($bIsSameVendor !== $aIsSameVendor) {
  7938. return $aIsSameVendor ? -1 : 1;
  7939. }
  7940. }
  7941. }
  7942. if ($a->id === $b->id) {
  7943. return 0;
  7944. }
  7945. return ($a->id < $b->id) ? -1 : 1;
  7946. }
  7947. if (isset($installedMap[$a->id])) {
  7948. return -1;
  7949. }
  7950. if (isset($installedMap[$b->id])) {
  7951. return 1;
  7952. }
  7953. return ($this->getPriority($pool, $a) > $this->getPriority($pool, $b)) ? -1 : 1;
  7954. }
  7955. protected function replaces(PackageInterface $source, PackageInterface $target)
  7956. {
  7957. foreach ($source->getReplaces() as $link) {
  7958. if ($link->getTarget() === $target->getName()
  7959. ) {
  7960. return true;
  7961. }
  7962. }
  7963. return false;
  7964. }
  7965. protected function pruneToBestVersion(Pool $pool, $literals)
  7966. {
  7967. $operator = $this->preferLowest ? '<' : '>';
  7968. $bestLiterals = array($literals[0]);
  7969. $bestPackage = $pool->literalToPackage($literals[0]);
  7970. foreach ($literals as $i => $literal) {
  7971. if (0 === $i) {
  7972. continue;
  7973. }
  7974. $package = $pool->literalToPackage($literal);
  7975. if ($this->versionCompare($package, $bestPackage, $operator)) {
  7976. $bestPackage = $package;
  7977. $bestLiterals = array($literal);
  7978. } elseif ($this->versionCompare($package, $bestPackage, '==')) {
  7979. $bestLiterals[] = $literal;
  7980. }
  7981. }
  7982. return $bestLiterals;
  7983. }
  7984. protected function pruneToHighestPriorityOrInstalled(Pool $pool, array $installedMap, array $literals)
  7985. {
  7986. $selected = array();
  7987. $priority = null;
  7988. foreach ($literals as $literal) {
  7989. $package = $pool->literalToPackage($literal);
  7990. if (isset($installedMap[$package->id])) {
  7991. $selected[] = $literal;
  7992. continue;
  7993. }
  7994. if (null === $priority) {
  7995. $priority = $this->getPriority($pool, $package);
  7996. }
  7997. if ($this->getPriority($pool, $package) != $priority) {
  7998. break;
  7999. }
  8000. $selected[] = $literal;
  8001. }
  8002. return $selected;
  8003. }
  8004. protected function pruneRemoteAliases(Pool $pool, array $literals)
  8005. {
  8006. $hasLocalAlias = false;
  8007. foreach ($literals as $literal) {
  8008. $package = $pool->literalToPackage($literal);
  8009. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  8010. $hasLocalAlias = true;
  8011. break;
  8012. }
  8013. }
  8014. if (!$hasLocalAlias) {
  8015. return $literals;
  8016. }
  8017. $selected = array();
  8018. foreach ($literals as $literal) {
  8019. $package = $pool->literalToPackage($literal);
  8020. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  8021. $selected[] = $literal;
  8022. }
  8023. }
  8024. return $selected;
  8025. }
  8026. }
  8027. <?php
  8028. namespace Composer\DependencyResolver;
  8029. use Composer\Package\PackageInterface;
  8030. use Composer\Package\Link;
  8031. class GenericRule extends Rule
  8032. {
  8033. protected $literals;
  8034. public function __construct(array $literals, $reason, $reasonData, $job = null)
  8035. {
  8036. parent::__construct($reason, $reasonData, $job);
  8037. sort($literals);
  8038. $this->literals = $literals;
  8039. }
  8040. public function getLiterals()
  8041. {
  8042. return $this->literals;
  8043. }
  8044. public function getHash()
  8045. {
  8046. $data = unpack('ihash', md5(implode(',', $this->literals), true));
  8047. return $data['hash'];
  8048. }
  8049. public function equals(Rule $rule)
  8050. {
  8051. return $this->literals === $rule->getLiterals();
  8052. }
  8053. public function isAssertion()
  8054. {
  8055. return 1 === count($this->literals);
  8056. }
  8057. public function __toString()
  8058. {
  8059. $result = $this->isDisabled() ? 'disabled(' : '(';
  8060. foreach ($this->literals as $i => $literal) {
  8061. if ($i != 0) {
  8062. $result .= '|';
  8063. }
  8064. $result .= $literal;
  8065. }
  8066. $result .= ')';
  8067. return $result;
  8068. }
  8069. }
  8070. <?php
  8071. namespace Composer\DependencyResolver\Operation;
  8072. use Composer\Package\PackageInterface;
  8073. class InstallOperation extends SolverOperation
  8074. {
  8075. protected $package;
  8076. public function __construct(PackageInterface $package, $reason = null)
  8077. {
  8078. parent::__construct($reason);
  8079. $this->package = $package;
  8080. }
  8081. public function getPackage()
  8082. {
  8083. return $this->package;
  8084. }
  8085. public function getJobType()
  8086. {
  8087. return 'install';
  8088. }
  8089. public function __toString()
  8090. {
  8091. return 'Installing '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  8092. }
  8093. }
  8094. <?php
  8095. namespace Composer\DependencyResolver\Operation;
  8096. use Composer\Package\AliasPackage;
  8097. use Composer\Package\PackageInterface;
  8098. class MarkAliasInstalledOperation extends SolverOperation
  8099. {
  8100. protected $package;
  8101. public function __construct(AliasPackage $package, $reason = null)
  8102. {
  8103. parent::__construct($reason);
  8104. $this->package = $package;
  8105. }
  8106. public function getPackage()
  8107. {
  8108. return $this->package;
  8109. }
  8110. public function getJobType()
  8111. {
  8112. return 'markAliasInstalled';
  8113. }
  8114. public function __toString()
  8115. {
  8116. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as installed, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  8117. }
  8118. }
  8119. <?php
  8120. namespace Composer\DependencyResolver\Operation;
  8121. use Composer\Package\AliasPackage;
  8122. use Composer\Package\PackageInterface;
  8123. class MarkAliasUninstalledOperation extends SolverOperation
  8124. {
  8125. protected $package;
  8126. public function __construct(AliasPackage $package, $reason = null)
  8127. {
  8128. parent::__construct($reason);
  8129. $this->package = $package;
  8130. }
  8131. public function getPackage()
  8132. {
  8133. return $this->package;
  8134. }
  8135. public function getJobType()
  8136. {
  8137. return 'markAliasUninstalled';
  8138. }
  8139. public function __toString()
  8140. {
  8141. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as uninstalled, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  8142. }
  8143. }
  8144. <?php
  8145. namespace Composer\DependencyResolver\Operation;
  8146. interface OperationInterface
  8147. {
  8148. public function getJobType();
  8149. public function getReason();
  8150. public function __toString();
  8151. }
  8152. <?php
  8153. namespace Composer\DependencyResolver\Operation;
  8154. use Composer\Package\PackageInterface;
  8155. abstract class SolverOperation implements OperationInterface
  8156. {
  8157. protected $reason;
  8158. public function __construct($reason = null)
  8159. {
  8160. $this->reason = $reason;
  8161. }
  8162. public function getReason()
  8163. {
  8164. return $this->reason;
  8165. }
  8166. protected function formatVersion(PackageInterface $package)
  8167. {
  8168. return $package->getFullPrettyVersion();
  8169. }
  8170. }
  8171. <?php
  8172. namespace Composer\DependencyResolver\Operation;
  8173. use Composer\Package\PackageInterface;
  8174. class UninstallOperation extends SolverOperation
  8175. {
  8176. protected $package;
  8177. public function __construct(PackageInterface $package, $reason = null)
  8178. {
  8179. parent::__construct($reason);
  8180. $this->package = $package;
  8181. }
  8182. public function getPackage()
  8183. {
  8184. return $this->package;
  8185. }
  8186. public function getJobType()
  8187. {
  8188. return 'uninstall';
  8189. }
  8190. public function __toString()
  8191. {
  8192. return 'Uninstalling '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  8193. }
  8194. }
  8195. <?php
  8196. namespace Composer\DependencyResolver\Operation;
  8197. use Composer\Package\PackageInterface;
  8198. class UpdateOperation extends SolverOperation
  8199. {
  8200. protected $initialPackage;
  8201. protected $targetPackage;
  8202. public function __construct(PackageInterface $initial, PackageInterface $target, $reason = null)
  8203. {
  8204. parent::__construct($reason);
  8205. $this->initialPackage = $initial;
  8206. $this->targetPackage = $target;
  8207. }
  8208. public function getInitialPackage()
  8209. {
  8210. return $this->initialPackage;
  8211. }
  8212. public function getTargetPackage()
  8213. {
  8214. return $this->targetPackage;
  8215. }
  8216. public function getJobType()
  8217. {
  8218. return 'update';
  8219. }
  8220. public function __toString()
  8221. {
  8222. return 'Updating '.$this->initialPackage->getPrettyName().' ('.$this->formatVersion($this->initialPackage).') to '.
  8223. $this->targetPackage->getPrettyName(). ' ('.$this->formatVersion($this->targetPackage).')';
  8224. }
  8225. }
  8226. <?php
  8227. namespace Composer\DependencyResolver;
  8228. use Composer\Package\PackageInterface;
  8229. interface PolicyInterface
  8230. {
  8231. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator);
  8232. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package);
  8233. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null);
  8234. }
  8235. <?php
  8236. namespace Composer\DependencyResolver;
  8237. use Composer\Package\BasePackage;
  8238. use Composer\Package\AliasPackage;
  8239. use Composer\Package\Version\VersionParser;
  8240. use Composer\Semver\Constraint\ConstraintInterface;
  8241. use Composer\Semver\Constraint\Constraint;
  8242. use Composer\Semver\Constraint\EmptyConstraint;
  8243. use Composer\Repository\RepositoryInterface;
  8244. use Composer\Repository\CompositeRepository;
  8245. use Composer\Repository\ComposerRepository;
  8246. use Composer\Repository\InstalledRepositoryInterface;
  8247. use Composer\Repository\PlatformRepository;
  8248. use Composer\Package\PackageInterface;
  8249. class Pool implements \Countable
  8250. {
  8251. const MATCH_NAME = -1;
  8252. const MATCH_NONE = 0;
  8253. const MATCH = 1;
  8254. const MATCH_PROVIDE = 2;
  8255. const MATCH_REPLACE = 3;
  8256. const MATCH_FILTERED = 4;
  8257. protected $repositories = array();
  8258. protected $providerRepos = array();
  8259. protected $packages = array();
  8260. protected $packageByName = array();
  8261. protected $packageByExactName = array();
  8262. protected $acceptableStabilities;
  8263. protected $stabilityFlags;
  8264. protected $versionParser;
  8265. protected $providerCache = array();
  8266. protected $filterRequires;
  8267. protected $whitelist = null;
  8268. protected $id = 1;
  8269. public function __construct($minimumStability = 'stable', array $stabilityFlags = array(), array $filterRequires = array())
  8270. {
  8271. $this->versionParser = new VersionParser;
  8272. $this->acceptableStabilities = array();
  8273. foreach (BasePackage::$stabilities as $stability => $value) {
  8274. if ($value <= BasePackage::$stabilities[$minimumStability]) {
  8275. $this->acceptableStabilities[$stability] = $value;
  8276. }
  8277. }
  8278. $this->stabilityFlags = $stabilityFlags;
  8279. $this->filterRequires = $filterRequires;
  8280. foreach ($filterRequires as $name => $constraint) {
  8281. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  8282. unset($this->filterRequires[$name]);
  8283. }
  8284. }
  8285. }
  8286. public function setWhitelist($whitelist)
  8287. {
  8288. $this->whitelist = $whitelist;
  8289. $this->providerCache = array();
  8290. }
  8291. public function addRepository(RepositoryInterface $repo, $rootAliases = array())
  8292. {
  8293. if ($repo instanceof CompositeRepository) {
  8294. $repos = $repo->getRepositories();
  8295. } else {
  8296. $repos = array($repo);
  8297. }
  8298. foreach ($repos as $repo) {
  8299. $this->repositories[] = $repo;
  8300. $exempt = $repo instanceof PlatformRepository || $repo instanceof InstalledRepositoryInterface;
  8301. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  8302. $this->providerRepos[] = $repo;
  8303. $repo->setRootAliases($rootAliases);
  8304. $repo->resetPackageIds();
  8305. } else {
  8306. foreach ($repo->getPackages() as $package) {
  8307. $names = $package->getNames();
  8308. $stability = $package->getStability();
  8309. if ($exempt || $this->isPackageAcceptable($names, $stability)) {
  8310. $package->setId($this->id++);
  8311. $this->packages[] = $package;
  8312. $this->packageByExactName[$package->getName()][$package->id] = $package;
  8313. foreach ($names as $provided) {
  8314. $this->packageByName[$provided][] = $package;
  8315. }
  8316. $name = $package->getName();
  8317. if (isset($rootAliases[$name][$package->getVersion()])) {
  8318. $alias = $rootAliases[$name][$package->getVersion()];
  8319. if ($package instanceof AliasPackage) {
  8320. $package = $package->getAliasOf();
  8321. }
  8322. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  8323. $aliasPackage->setRootPackageAlias(true);
  8324. $aliasPackage->setId($this->id++);
  8325. $package->getRepository()->addPackage($aliasPackage);
  8326. $this->packages[] = $aliasPackage;
  8327. $this->packageByExactName[$aliasPackage->getName()][$aliasPackage->id] = $aliasPackage;
  8328. foreach ($aliasPackage->getNames() as $name) {
  8329. $this->packageByName[$name][] = $aliasPackage;
  8330. }
  8331. }
  8332. }
  8333. }
  8334. }
  8335. }
  8336. }
  8337. public function getPriority(RepositoryInterface $repo)
  8338. {
  8339. $priority = array_search($repo, $this->repositories, true);
  8340. if (false === $priority) {
  8341. throw new \RuntimeException("Could not determine repository priority. The repository was not registered in the pool.");
  8342. }
  8343. return -$priority;
  8344. }
  8345. public function packageById($id)
  8346. {
  8347. return $this->packages[$id - 1];
  8348. }
  8349. public function count()
  8350. {
  8351. return count($this->packages);
  8352. }
  8353. public function whatProvides($name, ConstraintInterface $constraint = null, $mustMatchName = false, $bypassFilters = false)
  8354. {
  8355. if ($bypassFilters) {
  8356. return $this->computeWhatProvides($name, $constraint, $mustMatchName, true);
  8357. }
  8358. $key = ((int) $mustMatchName).$constraint;
  8359. if (isset($this->providerCache[$name][$key])) {
  8360. return $this->providerCache[$name][$key];
  8361. }
  8362. return $this->providerCache[$name][$key] = $this->computeWhatProvides($name, $constraint, $mustMatchName, $bypassFilters);
  8363. }
  8364. private function computeWhatProvides($name, $constraint, $mustMatchName = false, $bypassFilters = false)
  8365. {
  8366. $candidates = array();
  8367. foreach ($this->providerRepos as $repo) {
  8368. foreach ($repo->whatProvides($this, $name, $bypassFilters) as $candidate) {
  8369. $candidates[] = $candidate;
  8370. if ($candidate->id < 1) {
  8371. $candidate->setId($this->id++);
  8372. $this->packages[$this->id - 2] = $candidate;
  8373. }
  8374. }
  8375. }
  8376. if ($mustMatchName) {
  8377. $candidates = array_filter($candidates, function ($candidate) use ($name) {
  8378. return $candidate->getName() == $name;
  8379. });
  8380. if (isset($this->packageByExactName[$name])) {
  8381. $candidates = array_merge($candidates, $this->packageByExactName[$name]);
  8382. }
  8383. } elseif (isset($this->packageByName[$name])) {
  8384. $candidates = array_merge($candidates, $this->packageByName[$name]);
  8385. }
  8386. $matches = $provideMatches = array();
  8387. $nameMatch = false;
  8388. foreach ($candidates as $candidate) {
  8389. $aliasOfCandidate = null;
  8390. if ($candidate instanceof AliasPackage) {
  8391. $aliasOfCandidate = $candidate->getAliasOf();
  8392. }
  8393. if ($this->whitelist !== null && !$bypassFilters && (
  8394. (!($candidate instanceof AliasPackage) && !isset($this->whitelist[$candidate->id])) ||
  8395. ($candidate instanceof AliasPackage && !isset($this->whitelist[$aliasOfCandidate->id]))
  8396. )) {
  8397. continue;
  8398. }
  8399. switch ($this->match($candidate, $name, $constraint, $bypassFilters)) {
  8400. case self::MATCH_NONE:
  8401. break;
  8402. case self::MATCH_NAME:
  8403. $nameMatch = true;
  8404. break;
  8405. case self::MATCH:
  8406. $nameMatch = true;
  8407. $matches[] = $candidate;
  8408. break;
  8409. case self::MATCH_PROVIDE:
  8410. $provideMatches[] = $candidate;
  8411. break;
  8412. case self::MATCH_REPLACE:
  8413. $matches[] = $candidate;
  8414. break;
  8415. case self::MATCH_FILTERED:
  8416. break;
  8417. default:
  8418. throw new \UnexpectedValueException('Unexpected match type');
  8419. }
  8420. }
  8421. if ($nameMatch) {
  8422. return $matches;
  8423. }
  8424. return array_merge($matches, $provideMatches);
  8425. }
  8426. public function literalToPackage($literal)
  8427. {
  8428. $packageId = abs($literal);
  8429. return $this->packageById($packageId);
  8430. }
  8431. public function literalToPrettyString($literal, $installedMap)
  8432. {
  8433. $package = $this->literalToPackage($literal);
  8434. if (isset($installedMap[$package->id])) {
  8435. $prefix = ($literal > 0 ? 'keep' : 'remove');
  8436. } else {
  8437. $prefix = ($literal > 0 ? 'install' : 'don\'t install');
  8438. }
  8439. return $prefix.' '.$package->getPrettyString();
  8440. }
  8441. public function isPackageAcceptable($name, $stability)
  8442. {
  8443. foreach ((array) $name as $n) {
  8444. if (!isset($this->stabilityFlags[$n]) && isset($this->acceptableStabilities[$stability])) {
  8445. return true;
  8446. }
  8447. if (isset($this->stabilityFlags[$n]) && BasePackage::$stabilities[$stability] <= $this->stabilityFlags[$n]) {
  8448. return true;
  8449. }
  8450. }
  8451. return false;
  8452. }
  8453. public function match($candidate, $name, ConstraintInterface $constraint = null, $bypassFilters)
  8454. {
  8455. $candidateName = $candidate->getName();
  8456. $candidateVersion = $candidate->getVersion();
  8457. $isDev = $candidate->getStability() === 'dev';
  8458. $isAlias = $candidate instanceof AliasPackage;
  8459. if (!$bypassFilters && !$isDev && !$isAlias && isset($this->filterRequires[$name])) {
  8460. $requireFilter = $this->filterRequires[$name];
  8461. } else {
  8462. $requireFilter = new EmptyConstraint;
  8463. }
  8464. if ($candidateName === $name) {
  8465. $pkgConstraint = new Constraint('==', $candidateVersion);
  8466. if ($constraint === null || $constraint->matches($pkgConstraint)) {
  8467. return $requireFilter->matches($pkgConstraint) ? self::MATCH : self::MATCH_FILTERED;
  8468. }
  8469. return self::MATCH_NAME;
  8470. }
  8471. $provides = $candidate->getProvides();
  8472. $replaces = $candidate->getReplaces();
  8473. if (isset($replaces[0]) || isset($provides[0])) {
  8474. foreach ($provides as $link) {
  8475. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  8476. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  8477. }
  8478. }
  8479. foreach ($replaces as $link) {
  8480. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  8481. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  8482. }
  8483. }
  8484. return self::MATCH_NONE;
  8485. }
  8486. if (isset($provides[$name]) && ($constraint === null || $constraint->matches($provides[$name]->getConstraint()))) {
  8487. return $requireFilter->matches($provides[$name]->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  8488. }
  8489. if (isset($replaces[$name]) && ($constraint === null || $constraint->matches($replaces[$name]->getConstraint()))) {
  8490. return $requireFilter->matches($replaces[$name]->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  8491. }
  8492. return self::MATCH_NONE;
  8493. }
  8494. }
  8495. <?php
  8496. namespace Composer\DependencyResolver;
  8497. use Composer\Package\CompletePackageInterface;
  8498. class Problem
  8499. {
  8500. protected $reasonSeen;
  8501. protected $reasons = array();
  8502. protected $section = 0;
  8503. protected $pool;
  8504. public function __construct(Pool $pool)
  8505. {
  8506. $this->pool = $pool;
  8507. }
  8508. public function addRule(Rule $rule)
  8509. {
  8510. $this->addReason(spl_object_hash($rule), array(
  8511. 'rule' => $rule,
  8512. 'job' => $rule->getJob(),
  8513. ));
  8514. }
  8515. public function getReasons()
  8516. {
  8517. return $this->reasons;
  8518. }
  8519. public function getPrettyString(array $installedMap = array())
  8520. {
  8521. $reasons = call_user_func_array('array_merge', array_reverse($this->reasons));
  8522. if (count($reasons) === 1) {
  8523. reset($reasons);
  8524. $reason = current($reasons);
  8525. $job = $reason['job'];
  8526. $packageName = $job['packageName'];
  8527. $constraint = $job['constraint'];
  8528. if (isset($constraint)) {
  8529. $packages = $this->pool->whatProvides($packageName, $constraint);
  8530. } else {
  8531. $packages = array();
  8532. }
  8533. if ($job && $job['cmd'] === 'install' && empty($packages)) {
  8534. if ($packageName === 'php' || $packageName === 'php-64bit' || $packageName === 'hhvm') {
  8535. $version = phpversion();
  8536. $available = $this->pool->whatProvides($packageName);
  8537. if (count($available)) {
  8538. $firstAvailable = reset($available);
  8539. $version = $firstAvailable->getPrettyVersion();
  8540. $extra = $firstAvailable->getExtra();
  8541. if ($firstAvailable instanceof CompletePackageInterface && isset($extra['config.platform']) && $extra['config.platform'] === true) {
  8542. $version .= '; ' . $firstAvailable->getDescription();
  8543. }
  8544. }
  8545. $msg = "\n - This package requires ".$packageName.$this->constraintToText($constraint).' but ';
  8546. if (defined('HHVM_VERSION') || (count($available) && $packageName === 'hhvm')) {
  8547. return $msg . 'your HHVM version does not satisfy that requirement.';
  8548. }
  8549. if ($packageName === 'hhvm') {
  8550. return $msg . 'you are running this with PHP and not HHVM.';
  8551. }
  8552. return $msg . 'your PHP version ('. $version .') does not satisfy that requirement.';
  8553. }
  8554. if (0 === stripos($packageName, 'ext-')) {
  8555. if (false !== strpos($packageName, ' ')) {
  8556. return "\n - The requested PHP extension ".$packageName.' should be required as '.str_replace(' ', '-', $packageName).'.';
  8557. }
  8558. $ext = substr($packageName, 4);
  8559. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  8560. return "\n - The requested PHP extension ".$packageName.$this->constraintToText($constraint).' '.$error.'. Install or enable PHP\'s '.$ext.' extension.';
  8561. }
  8562. if (0 === stripos($packageName, 'lib-')) {
  8563. if (strtolower($packageName) === 'lib-icu') {
  8564. $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.';
  8565. return "\n - The requested linked library ".$packageName.$this->constraintToText($constraint).' '.$error;
  8566. }
  8567. return "\n - The requested linked library ".$packageName.$this->constraintToText($constraint).' has the wrong version installed or is missing from your system, make sure to load the extension providing it.';
  8568. }
  8569. if (!preg_match('{^[A-Za-z0-9_./-]+$}', $packageName)) {
  8570. $illegalChars = preg_replace('{[A-Za-z0-9_./-]+}', '', $packageName);
  8571. return "\n - The requested package ".$packageName.' could not be found, it looks like its name is invalid, "'.$illegalChars.'" is not allowed in package names.';
  8572. }
  8573. if ($providers = $this->pool->whatProvides($packageName, $constraint, true, true)) {
  8574. return "\n - The requested package ".$packageName.$this->constraintToText($constraint).' is satisfiable by '.$this->getPackageList($providers).' but these conflict with your requirements or minimum-stability.';
  8575. }
  8576. if ($providers = $this->pool->whatProvides($packageName, null, true, true)) {
  8577. return "\n - The requested package ".$packageName.$this->constraintToText($constraint).' exists as '.$this->getPackageList($providers).' but these are rejected by your constraint.';
  8578. }
  8579. return "\n - The requested package ".$packageName.' could not be found in any version, there may be a typo in the package name.';
  8580. }
  8581. }
  8582. $messages = array();
  8583. foreach ($reasons as $reason) {
  8584. $rule = $reason['rule'];
  8585. $job = $reason['job'];
  8586. if ($job) {
  8587. $messages[] = $this->jobToText($job);
  8588. } elseif ($rule) {
  8589. if ($rule instanceof Rule) {
  8590. $messages[] = $rule->getPrettyString($this->pool, $installedMap);
  8591. }
  8592. }
  8593. }
  8594. return "\n - ".implode("\n - ", $messages);
  8595. }
  8596. protected function addReason($id, $reason)
  8597. {
  8598. if (!isset($this->reasonSeen[$id])) {
  8599. $this->reasonSeen[$id] = true;
  8600. $this->reasons[$this->section][] = $reason;
  8601. }
  8602. }
  8603. public function nextSection()
  8604. {
  8605. $this->section++;
  8606. }
  8607. protected function jobToText($job)
  8608. {
  8609. $packageName = $job['packageName'];
  8610. $constraint = $job['constraint'];
  8611. switch ($job['cmd']) {
  8612. case 'install':
  8613. $packages = $this->pool->whatProvides($packageName, $constraint);
  8614. if (!$packages) {
  8615. return 'No package found to satisfy install request for '.$packageName.$this->constraintToText($constraint);
  8616. }
  8617. return 'Installation request for '.$packageName.$this->constraintToText($constraint).' -> satisfiable by '.$this->getPackageList($packages).'.';
  8618. case 'update':
  8619. return 'Update request for '.$packageName.$this->constraintToText($constraint).'.';
  8620. case 'remove':
  8621. return 'Removal request for '.$packageName.$this->constraintToText($constraint).'';
  8622. }
  8623. if (isset($constraint)) {
  8624. $packages = $this->pool->whatProvides($packageName, $constraint);
  8625. } else {
  8626. $packages = array();
  8627. }
  8628. return 'Job(cmd='.$job['cmd'].', target='.$packageName.', packages=['.$this->getPackageList($packages).'])';
  8629. }
  8630. protected function getPackageList($packages)
  8631. {
  8632. $prepared = array();
  8633. foreach ($packages as $package) {
  8634. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  8635. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  8636. }
  8637. foreach ($prepared as $name => $package) {
  8638. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  8639. }
  8640. return implode(', ', $prepared);
  8641. }
  8642. protected function constraintToText($constraint)
  8643. {
  8644. return $constraint ? ' '.$constraint->getPrettyString() : '';
  8645. }
  8646. }
  8647. <?php
  8648. namespace Composer\DependencyResolver;
  8649. use Composer\Semver\Constraint\ConstraintInterface;
  8650. class Request
  8651. {
  8652. protected $jobs;
  8653. public function __construct()
  8654. {
  8655. $this->jobs = array();
  8656. }
  8657. public function install($packageName, ConstraintInterface $constraint = null)
  8658. {
  8659. $this->addJob($packageName, 'install', $constraint);
  8660. }
  8661. public function update($packageName, ConstraintInterface $constraint = null)
  8662. {
  8663. $this->addJob($packageName, 'update', $constraint);
  8664. }
  8665. public function remove($packageName, ConstraintInterface $constraint = null)
  8666. {
  8667. $this->addJob($packageName, 'remove', $constraint);
  8668. }
  8669. public function fix($packageName, ConstraintInterface $constraint = null)
  8670. {
  8671. $this->addJob($packageName, 'install', $constraint, true);
  8672. }
  8673. protected function addJob($packageName, $cmd, ConstraintInterface $constraint = null, $fixed = false)
  8674. {
  8675. $packageName = strtolower($packageName);
  8676. $this->jobs[] = array(
  8677. 'cmd' => $cmd,
  8678. 'packageName' => $packageName,
  8679. 'constraint' => $constraint,
  8680. 'fixed' => $fixed,
  8681. );
  8682. }
  8683. public function updateAll()
  8684. {
  8685. $this->jobs[] = array('cmd' => 'update-all');
  8686. }
  8687. public function getJobs()
  8688. {
  8689. return $this->jobs;
  8690. }
  8691. }
  8692. <?php
  8693. namespace Composer\DependencyResolver;
  8694. use Composer\Package\CompletePackage;
  8695. use Composer\Package\Link;
  8696. use Composer\Package\PackageInterface;
  8697. abstract class Rule
  8698. {
  8699. const RULE_INTERNAL_ALLOW_UPDATE = 1;
  8700. const RULE_JOB_INSTALL = 2;
  8701. const RULE_JOB_REMOVE = 3;
  8702. const RULE_PACKAGE_CONFLICT = 6;
  8703. const RULE_PACKAGE_REQUIRES = 7;
  8704. const RULE_PACKAGE_OBSOLETES = 8;
  8705. const RULE_INSTALLED_PACKAGE_OBSOLETES = 9;
  8706. const RULE_PACKAGE_SAME_NAME = 10;
  8707. const RULE_PACKAGE_IMPLICIT_OBSOLETES = 11;
  8708. const RULE_LEARNED = 12;
  8709. const RULE_PACKAGE_ALIAS = 13;
  8710. const BITFIELD_TYPE = 0;
  8711. const BITFIELD_REASON = 8;
  8712. const BITFIELD_DISABLED = 16;
  8713. protected $bitfield;
  8714. protected $job;
  8715. protected $reasonData;
  8716. public function __construct($reason, $reasonData, $job = null)
  8717. {
  8718. $this->reasonData = $reasonData;
  8719. if ($job) {
  8720. $this->job = $job;
  8721. }
  8722. $this->bitfield = (0 << self::BITFIELD_DISABLED) |
  8723. ($reason << self::BITFIELD_REASON) |
  8724. (255 << self::BITFIELD_TYPE);
  8725. }
  8726. abstract public function getLiterals();
  8727. abstract public function getHash();
  8728. public function getJob()
  8729. {
  8730. return $this->job;
  8731. }
  8732. abstract public function equals(Rule $rule);
  8733. public function getReason()
  8734. {
  8735. return ($this->bitfield & (255 << self::BITFIELD_REASON)) >> self::BITFIELD_REASON;
  8736. }
  8737. public function getReasonData()
  8738. {
  8739. return $this->reasonData;
  8740. }
  8741. public function getRequiredPackage()
  8742. {
  8743. if ($this->getReason() === self::RULE_JOB_INSTALL) {
  8744. return $this->reasonData;
  8745. }
  8746. if ($this->getReason() === self::RULE_PACKAGE_REQUIRES) {
  8747. return $this->reasonData->getTarget();
  8748. }
  8749. }
  8750. public function setType($type)
  8751. {
  8752. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_TYPE)) | ((255 & $type) << self::BITFIELD_TYPE);
  8753. }
  8754. public function getType()
  8755. {
  8756. return ($this->bitfield & (255 << self::BITFIELD_TYPE)) >> self::BITFIELD_TYPE;
  8757. }
  8758. public function disable()
  8759. {
  8760. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_DISABLED)) | (1 << self::BITFIELD_DISABLED);
  8761. }
  8762. public function enable()
  8763. {
  8764. $this->bitfield &= ~(255 << self::BITFIELD_DISABLED);
  8765. }
  8766. public function isDisabled()
  8767. {
  8768. return (bool) (($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  8769. }
  8770. public function isEnabled()
  8771. {
  8772. return !(($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  8773. }
  8774. abstract public function isAssertion();
  8775. public function getPrettyString(Pool $pool, array $installedMap = array())
  8776. {
  8777. $literals = $this->getLiterals();
  8778. $ruleText = '';
  8779. foreach ($literals as $i => $literal) {
  8780. if ($i != 0) {
  8781. $ruleText .= '|';
  8782. }
  8783. $ruleText .= $pool->literalToPrettyString($literal, $installedMap);
  8784. }
  8785. switch ($this->getReason()) {
  8786. case self::RULE_INTERNAL_ALLOW_UPDATE:
  8787. return $ruleText;
  8788. case self::RULE_JOB_INSTALL:
  8789. return "Install command rule ($ruleText)";
  8790. case self::RULE_JOB_REMOVE:
  8791. return "Remove command rule ($ruleText)";
  8792. case self::RULE_PACKAGE_CONFLICT:
  8793. $package1 = $pool->literalToPackage($literals[0]);
  8794. $package2 = $pool->literalToPackage($literals[1]);
  8795. return $package1->getPrettyString().' conflicts with '.$this->formatPackagesUnique($pool, array($package2)).'.';
  8796. case self::RULE_PACKAGE_REQUIRES:
  8797. $sourceLiteral = array_shift($literals);
  8798. $sourcePackage = $pool->literalToPackage($sourceLiteral);
  8799. $requires = array();
  8800. foreach ($literals as $literal) {
  8801. $requires[] = $pool->literalToPackage($literal);
  8802. }
  8803. $text = $this->reasonData->getPrettyString($sourcePackage);
  8804. if ($requires) {
  8805. $text .= ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $requires) . '.';
  8806. } else {
  8807. $targetName = $this->reasonData->getTarget();
  8808. if ($targetName === 'php' || $targetName === 'php-64bit' || $targetName === 'hhvm') {
  8809. if (defined('HHVM_VERSION')) {
  8810. return $text . ' -> your HHVM version does not satisfy that requirement.';
  8811. }
  8812. $packages = $pool->whatProvides($targetName);
  8813. $package = count($packages) ? current($packages) : phpversion();
  8814. if ($targetName === 'hhvm') {
  8815. if ($package instanceof CompletePackage) {
  8816. return $text . ' -> your HHVM version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  8817. } else {
  8818. return $text . ' -> you are running this with PHP and not HHVM.';
  8819. }
  8820. }
  8821. if (!($package instanceof CompletePackage)) {
  8822. return $text . ' -> your PHP version ('.phpversion().') does not satisfy that requirement.';
  8823. }
  8824. $extra = $package->getExtra();
  8825. if (!empty($extra['config.platform'])) {
  8826. $text .= ' -> your PHP version ('.phpversion().') overridden by "config.platform.php" version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  8827. } else {
  8828. $text .= ' -> your PHP version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  8829. }
  8830. return $text;
  8831. }
  8832. if (0 === strpos($targetName, 'ext-')) {
  8833. $ext = substr($targetName, 4);
  8834. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  8835. return $text . ' -> the requested PHP extension '.$ext.' '.$error.'.';
  8836. }
  8837. if (0 === strpos($targetName, 'lib-')) {
  8838. $lib = substr($targetName, 4);
  8839. 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.';
  8840. }
  8841. if ($providers = $pool->whatProvides($targetName, $this->reasonData->getConstraint(), true, true)) {
  8842. return $text . ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $providers) .' but these conflict with your requirements or minimum-stability.';
  8843. }
  8844. return $text . ' -> no matching package found.';
  8845. }
  8846. return $text;
  8847. case self::RULE_PACKAGE_OBSOLETES:
  8848. return $ruleText;
  8849. case self::RULE_INSTALLED_PACKAGE_OBSOLETES:
  8850. return $ruleText;
  8851. case self::RULE_PACKAGE_SAME_NAME:
  8852. return 'Can only install one of: ' . $this->formatPackagesUnique($pool, $literals) . '.';
  8853. case self::RULE_PACKAGE_IMPLICIT_OBSOLETES:
  8854. return $ruleText;
  8855. case self::RULE_LEARNED:
  8856. return 'Conclusion: '.$ruleText;
  8857. case self::RULE_PACKAGE_ALIAS:
  8858. return $ruleText;
  8859. default:
  8860. return '('.$ruleText.')';
  8861. }
  8862. }
  8863. protected function formatPackagesUnique($pool, array $packages)
  8864. {
  8865. $prepared = array();
  8866. foreach ($packages as $package) {
  8867. if (!is_object($package)) {
  8868. $package = $pool->literalToPackage($package);
  8869. }
  8870. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  8871. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  8872. }
  8873. foreach ($prepared as $name => $package) {
  8874. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  8875. }
  8876. return implode(', ', $prepared);
  8877. }
  8878. }
  8879. <?php
  8880. namespace Composer\DependencyResolver;
  8881. use Composer\Package\PackageInterface;
  8882. use Composer\Package\Link;
  8883. class Rule2Literals extends Rule
  8884. {
  8885. protected $literal1;
  8886. protected $literal2;
  8887. public function __construct($literal1, $literal2, $reason, $reasonData, $job = null)
  8888. {
  8889. parent::__construct($reason, $reasonData, $job);
  8890. if ($literal1 < $literal2) {
  8891. $this->literal1 = $literal1;
  8892. $this->literal2 = $literal2;
  8893. } else {
  8894. $this->literal1 = $literal2;
  8895. $this->literal2 = $literal1;
  8896. }
  8897. }
  8898. public function getLiterals()
  8899. {
  8900. return array($this->literal1, $this->literal2);
  8901. }
  8902. public function getHash()
  8903. {
  8904. return $this->literal1.','.$this->literal2;
  8905. }
  8906. public function equals(Rule $rule)
  8907. {
  8908. if ($rule instanceof self) {
  8909. if ($this->literal1 !== $rule->literal1) {
  8910. return false;
  8911. }
  8912. if ($this->literal2 !== $rule->literal2) {
  8913. return false;
  8914. }
  8915. return true;
  8916. }
  8917. $literals = $rule->getLiterals();
  8918. if (2 != count($literals)) {
  8919. return false;
  8920. }
  8921. if ($this->literal1 !== $literals[0]) {
  8922. return false;
  8923. }
  8924. if ($this->literal2 !== $literals[1]) {
  8925. return false;
  8926. }
  8927. return true;
  8928. }
  8929. public function isAssertion()
  8930. {
  8931. return false;
  8932. }
  8933. public function __toString()
  8934. {
  8935. $result = $this->isDisabled() ? 'disabled(' : '(';
  8936. $result .= $this->literal1 . '|' . $this->literal2 . ')';
  8937. return $result;
  8938. }
  8939. }
  8940. <?php
  8941. namespace Composer\DependencyResolver;
  8942. class RuleSet implements \IteratorAggregate, \Countable
  8943. {
  8944. const TYPE_PACKAGE = 0;
  8945. const TYPE_JOB = 1;
  8946. const TYPE_LEARNED = 4;
  8947. public $ruleById;
  8948. protected static $types = array(
  8949. 255 => 'UNKNOWN',
  8950. self::TYPE_PACKAGE => 'PACKAGE',
  8951. self::TYPE_JOB => 'JOB',
  8952. self::TYPE_LEARNED => 'LEARNED',
  8953. );
  8954. protected $rules;
  8955. protected $nextRuleId;
  8956. protected $rulesByHash;
  8957. public function __construct()
  8958. {
  8959. $this->nextRuleId = 0;
  8960. foreach ($this->getTypes() as $type) {
  8961. $this->rules[$type] = array();
  8962. }
  8963. $this->rulesByHash = array();
  8964. }
  8965. public function add(Rule $rule, $type)
  8966. {
  8967. if (!isset(self::$types[$type])) {
  8968. throw new \OutOfBoundsException('Unknown rule type: ' . $type);
  8969. }
  8970. $hash = $rule->getHash();
  8971. if (isset($this->rulesByHash[$hash])) {
  8972. $potentialDuplicates = $this->rulesByHash[$hash];
  8973. if (is_array($potentialDuplicates)) {
  8974. foreach ($potentialDuplicates as $potentialDuplicate) {
  8975. if ($rule->equals($potentialDuplicate)) {
  8976. return;
  8977. }
  8978. }
  8979. } else {
  8980. if ($rule->equals($potentialDuplicates)) {
  8981. return;
  8982. }
  8983. }
  8984. }
  8985. if (!isset($this->rules[$type])) {
  8986. $this->rules[$type] = array();
  8987. }
  8988. $this->rules[$type][] = $rule;
  8989. $this->ruleById[$this->nextRuleId] = $rule;
  8990. $rule->setType($type);
  8991. $this->nextRuleId++;
  8992. if (!isset($this->rulesByHash[$hash])) {
  8993. $this->rulesByHash[$hash] = $rule;
  8994. } elseif (is_array($this->rulesByHash[$hash])) {
  8995. $this->rulesByHash[$hash][] = $rule;
  8996. } else {
  8997. $originalRule = $this->rulesByHash[$hash];
  8998. $this->rulesByHash[$hash] = array($originalRule, $rule);
  8999. }
  9000. }
  9001. public function count()
  9002. {
  9003. return $this->nextRuleId;
  9004. }
  9005. public function ruleById($id)
  9006. {
  9007. return $this->ruleById[$id];
  9008. }
  9009. public function getRules()
  9010. {
  9011. return $this->rules;
  9012. }
  9013. public function getIterator()
  9014. {
  9015. return new RuleSetIterator($this->getRules());
  9016. }
  9017. public function getIteratorFor($types)
  9018. {
  9019. if (!is_array($types)) {
  9020. $types = array($types);
  9021. }
  9022. $allRules = $this->getRules();
  9023. $rules = array();
  9024. foreach ($types as $type) {
  9025. $rules[$type] = $allRules[$type];
  9026. }
  9027. return new RuleSetIterator($rules);
  9028. }
  9029. public function getIteratorWithout($types)
  9030. {
  9031. if (!is_array($types)) {
  9032. $types = array($types);
  9033. }
  9034. $rules = $this->getRules();
  9035. foreach ($types as $type) {
  9036. unset($rules[$type]);
  9037. }
  9038. return new RuleSetIterator($rules);
  9039. }
  9040. public function getTypes()
  9041. {
  9042. $types = self::$types;
  9043. unset($types[255]);
  9044. return array_keys($types);
  9045. }
  9046. public function getPrettyString(Pool $pool = null)
  9047. {
  9048. $string = "\n";
  9049. foreach ($this->rules as $type => $rules) {
  9050. $string .= str_pad(self::$types[$type], 8, ' ') . ": ";
  9051. foreach ($rules as $rule) {
  9052. $string .= ($pool ? $rule->getPrettyString($pool) : $rule)."\n";
  9053. }
  9054. $string .= "\n\n";
  9055. }
  9056. return $string;
  9057. }
  9058. public function __toString()
  9059. {
  9060. return $this->getPrettyString(null);
  9061. }
  9062. }
  9063. <?php
  9064. namespace Composer\DependencyResolver;
  9065. use Composer\Package\PackageInterface;
  9066. use Composer\Package\AliasPackage;
  9067. use Composer\Repository\PlatformRepository;
  9068. class RuleSetGenerator
  9069. {
  9070. protected $policy;
  9071. protected $pool;
  9072. protected $rules;
  9073. protected $jobs;
  9074. protected $installedMap;
  9075. protected $whitelistedMap;
  9076. protected $addedMap;
  9077. protected $conflictAddedMap;
  9078. protected $addedPackages;
  9079. protected $addedPackagesByNames;
  9080. public function __construct(PolicyInterface $policy, Pool $pool)
  9081. {
  9082. $this->policy = $policy;
  9083. $this->pool = $pool;
  9084. }
  9085. protected function createRequireRule(PackageInterface $package, array $providers, $reason, $reasonData = null)
  9086. {
  9087. $literals = array(-$package->id);
  9088. foreach ($providers as $provider) {
  9089. if ($provider === $package) {
  9090. return null;
  9091. }
  9092. $literals[] = $provider->id;
  9093. }
  9094. return new GenericRule($literals, $reason, $reasonData);
  9095. }
  9096. protected function createInstallOneOfRule(array $packages, $reason, $job)
  9097. {
  9098. $literals = array();
  9099. foreach ($packages as $package) {
  9100. $literals[] = $package->id;
  9101. }
  9102. return new GenericRule($literals, $reason, $job['packageName'], $job);
  9103. }
  9104. protected function createRemoveRule(PackageInterface $package, $reason, $job)
  9105. {
  9106. return new GenericRule(array(-$package->id), $reason, $job['packageName'], $job);
  9107. }
  9108. protected function createRule2Literals(PackageInterface $issuer, PackageInterface $provider, $reason, $reasonData = null)
  9109. {
  9110. if ($issuer === $provider) {
  9111. return null;
  9112. }
  9113. return new Rule2Literals(-$issuer->id, -$provider->id, $reason, $reasonData);
  9114. }
  9115. private function addRule($type, Rule $newRule = null)
  9116. {
  9117. if (!$newRule) {
  9118. return;
  9119. }
  9120. $this->rules->add($newRule, $type);
  9121. }
  9122. protected function whitelistFromPackage(PackageInterface $package)
  9123. {
  9124. $workQueue = new \SplQueue;
  9125. $workQueue->enqueue($package);
  9126. while (!$workQueue->isEmpty()) {
  9127. $package = $workQueue->dequeue();
  9128. if (isset($this->whitelistedMap[$package->id])) {
  9129. continue;
  9130. }
  9131. $this->whitelistedMap[$package->id] = true;
  9132. foreach ($package->getRequires() as $link) {
  9133. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint(), true);
  9134. foreach ($possibleRequires as $require) {
  9135. $workQueue->enqueue($require);
  9136. }
  9137. }
  9138. $obsoleteProviders = $this->pool->whatProvides($package->getName(), null, true);
  9139. foreach ($obsoleteProviders as $provider) {
  9140. if ($provider === $package) {
  9141. continue;
  9142. }
  9143. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  9144. $workQueue->enqueue($provider);
  9145. }
  9146. }
  9147. }
  9148. }
  9149. protected function addRulesForPackage(PackageInterface $package, $ignorePlatformReqs)
  9150. {
  9151. $workQueue = new \SplQueue;
  9152. $workQueue->enqueue($package);
  9153. while (!$workQueue->isEmpty()) {
  9154. $package = $workQueue->dequeue();
  9155. if (isset($this->addedMap[$package->id])) {
  9156. continue;
  9157. }
  9158. $this->addedMap[$package->id] = true;
  9159. $this->addedPackages[] = $package;
  9160. foreach ($package->getNames() as $name) {
  9161. $this->addedPackagesByNames[$name][] = $package;
  9162. }
  9163. foreach ($package->getRequires() as $link) {
  9164. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  9165. continue;
  9166. }
  9167. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  9168. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRequireRule($package, $possibleRequires, Rule::RULE_PACKAGE_REQUIRES, $link));
  9169. foreach ($possibleRequires as $require) {
  9170. $workQueue->enqueue($require);
  9171. }
  9172. }
  9173. $packageName = $package->getName();
  9174. $obsoleteProviders = $this->pool->whatProvides($packageName, null);
  9175. foreach ($obsoleteProviders as $provider) {
  9176. if ($provider === $package) {
  9177. continue;
  9178. }
  9179. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  9180. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRequireRule($package, array($provider), Rule::RULE_PACKAGE_ALIAS, $package));
  9181. } elseif (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  9182. $reason = ($packageName == $provider->getName()) ? Rule::RULE_PACKAGE_SAME_NAME : Rule::RULE_PACKAGE_IMPLICIT_OBSOLETES;
  9183. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $provider, $reason, $package));
  9184. }
  9185. }
  9186. }
  9187. }
  9188. protected function addConflictRules($ignorePlatformReqs = false)
  9189. {
  9190. foreach ($this->addedPackages as $package) {
  9191. foreach ($package->getConflicts() as $link) {
  9192. if (!isset($this->addedPackagesByNames[$link->getTarget()])) {
  9193. continue;
  9194. }
  9195. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  9196. continue;
  9197. }
  9198. foreach ($this->addedPackagesByNames[$link->getTarget()] as $possibleConflict) {
  9199. $conflictMatch = $this->pool->match($possibleConflict, $link->getTarget(), $link->getConstraint(), true);
  9200. if ($conflictMatch === Pool::MATCH || $conflictMatch === Pool::MATCH_REPLACE) {
  9201. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $possibleConflict, Rule::RULE_PACKAGE_CONFLICT, $link));
  9202. }
  9203. }
  9204. }
  9205. $isInstalled = isset($this->installedMap[$package->id]);
  9206. foreach ($package->getReplaces() as $link) {
  9207. if (!isset($this->addedPackagesByNames[$link->getTarget()])) {
  9208. continue;
  9209. }
  9210. foreach ($this->addedPackagesByNames[$link->getTarget()] as $provider) {
  9211. if ($provider === $package) {
  9212. continue;
  9213. }
  9214. if (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  9215. $reason = $isInstalled ? Rule::RULE_INSTALLED_PACKAGE_OBSOLETES : Rule::RULE_PACKAGE_OBSOLETES;
  9216. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $provider, $reason, $link));
  9217. }
  9218. }
  9219. }
  9220. }
  9221. }
  9222. protected function obsoleteImpossibleForAlias($package, $provider)
  9223. {
  9224. $packageIsAlias = $package instanceof AliasPackage;
  9225. $providerIsAlias = $provider instanceof AliasPackage;
  9226. $impossible = (
  9227. ($packageIsAlias && $package->getAliasOf() === $provider) ||
  9228. ($providerIsAlias && $provider->getAliasOf() === $package) ||
  9229. ($packageIsAlias && $providerIsAlias && $provider->getAliasOf() === $package->getAliasOf())
  9230. );
  9231. return $impossible;
  9232. }
  9233. protected function whitelistFromJobs()
  9234. {
  9235. foreach ($this->jobs as $job) {
  9236. switch ($job['cmd']) {
  9237. case 'install':
  9238. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint'], true);
  9239. foreach ($packages as $package) {
  9240. $this->whitelistFromPackage($package);
  9241. }
  9242. break;
  9243. }
  9244. }
  9245. }
  9246. protected function addRulesForJobs($ignorePlatformReqs)
  9247. {
  9248. foreach ($this->jobs as $job) {
  9249. switch ($job['cmd']) {
  9250. case 'install':
  9251. if (!$job['fixed'] && $ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  9252. break;
  9253. }
  9254. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  9255. if ($packages) {
  9256. foreach ($packages as $package) {
  9257. if (!isset($this->installedMap[$package->id])) {
  9258. $this->addRulesForPackage($package, $ignorePlatformReqs);
  9259. }
  9260. }
  9261. $rule = $this->createInstallOneOfRule($packages, Rule::RULE_JOB_INSTALL, $job);
  9262. $this->addRule(RuleSet::TYPE_JOB, $rule);
  9263. }
  9264. break;
  9265. case 'remove':
  9266. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  9267. foreach ($packages as $package) {
  9268. $rule = $this->createRemoveRule($package, Rule::RULE_JOB_REMOVE, $job);
  9269. $this->addRule(RuleSet::TYPE_JOB, $rule);
  9270. }
  9271. break;
  9272. }
  9273. }
  9274. }
  9275. public function getRulesFor($jobs, $installedMap, $ignorePlatformReqs = false)
  9276. {
  9277. $this->jobs = $jobs;
  9278. $this->rules = new RuleSet;
  9279. $this->installedMap = $installedMap;
  9280. $this->whitelistedMap = array();
  9281. foreach ($this->installedMap as $package) {
  9282. $this->whitelistFromPackage($package);
  9283. }
  9284. $this->whitelistFromJobs();
  9285. $this->pool->setWhitelist($this->whitelistedMap);
  9286. $this->addedMap = array();
  9287. $this->conflictAddedMap = array();
  9288. $this->addedPackages = array();
  9289. $this->addedPackagesByNames = array();
  9290. foreach ($this->installedMap as $package) {
  9291. $this->addRulesForPackage($package, $ignorePlatformReqs);
  9292. }
  9293. $this->addRulesForJobs($ignorePlatformReqs);
  9294. $this->addConflictRules($ignorePlatformReqs);
  9295. $this->addedPackages = $this->addedPackagesByNames = null;
  9296. return $this->rules;
  9297. }
  9298. }
  9299. <?php
  9300. namespace Composer\DependencyResolver;
  9301. class RuleSetIterator implements \Iterator
  9302. {
  9303. protected $rules;
  9304. protected $types;
  9305. protected $currentOffset;
  9306. protected $currentType;
  9307. protected $currentTypeOffset;
  9308. public function __construct(array $rules)
  9309. {
  9310. $this->rules = $rules;
  9311. $this->types = array_keys($rules);
  9312. sort($this->types);
  9313. $this->rewind();
  9314. }
  9315. public function current()
  9316. {
  9317. return $this->rules[$this->currentType][$this->currentOffset];
  9318. }
  9319. public function key()
  9320. {
  9321. return $this->currentType;
  9322. }
  9323. public function next()
  9324. {
  9325. $this->currentOffset++;
  9326. if (!isset($this->rules[$this->currentType])) {
  9327. return;
  9328. }
  9329. if ($this->currentOffset >= count($this->rules[$this->currentType])) {
  9330. $this->currentOffset = 0;
  9331. do {
  9332. $this->currentTypeOffset++;
  9333. if (!isset($this->types[$this->currentTypeOffset])) {
  9334. $this->currentType = -1;
  9335. break;
  9336. }
  9337. $this->currentType = $this->types[$this->currentTypeOffset];
  9338. } while (isset($this->types[$this->currentTypeOffset]) && !count($this->rules[$this->currentType]));
  9339. }
  9340. }
  9341. public function rewind()
  9342. {
  9343. $this->currentOffset = 0;
  9344. $this->currentTypeOffset = -1;
  9345. $this->currentType = -1;
  9346. do {
  9347. $this->currentTypeOffset++;
  9348. if (!isset($this->types[$this->currentTypeOffset])) {
  9349. $this->currentType = -1;
  9350. break;
  9351. }
  9352. $this->currentType = $this->types[$this->currentTypeOffset];
  9353. } while (isset($this->types[$this->currentTypeOffset]) && !count($this->rules[$this->currentType]));
  9354. }
  9355. public function valid()
  9356. {
  9357. return isset($this->rules[$this->currentType])
  9358. && isset($this->rules[$this->currentType][$this->currentOffset]);
  9359. }
  9360. }
  9361. <?php
  9362. namespace Composer\DependencyResolver;
  9363. class RuleWatchChain extends \SplDoublyLinkedList
  9364. {
  9365. protected $offset = 0;
  9366. public function seek($offset)
  9367. {
  9368. $this->rewind();
  9369. for ($i = 0; $i < $offset; $i++, $this->next());
  9370. }
  9371. public function remove()
  9372. {
  9373. $offset = $this->key();
  9374. $this->offsetUnset($offset);
  9375. $this->seek($offset);
  9376. }
  9377. }
  9378. <?php
  9379. namespace Composer\DependencyResolver;
  9380. class RuleWatchGraph
  9381. {
  9382. protected $watchChains = array();
  9383. public function insert(RuleWatchNode $node)
  9384. {
  9385. if ($node->getRule()->isAssertion()) {
  9386. return;
  9387. }
  9388. foreach (array($node->watch1, $node->watch2) as $literal) {
  9389. if (!isset($this->watchChains[$literal])) {
  9390. $this->watchChains[$literal] = new RuleWatchChain;
  9391. }
  9392. $this->watchChains[$literal]->unshift($node);
  9393. }
  9394. }
  9395. public function propagateLiteral($decidedLiteral, $level, $decisions)
  9396. {
  9397. $literal = -$decidedLiteral;
  9398. if (!isset($this->watchChains[$literal])) {
  9399. return null;
  9400. }
  9401. $chain = $this->watchChains[$literal];
  9402. $chain->rewind();
  9403. while ($chain->valid()) {
  9404. $node = $chain->current();
  9405. $otherWatch = $node->getOtherWatch($literal);
  9406. if (!$node->getRule()->isDisabled() && !$decisions->satisfy($otherWatch)) {
  9407. $ruleLiterals = $node->getRule()->getLiterals();
  9408. $alternativeLiterals = array_filter($ruleLiterals, function ($ruleLiteral) use ($literal, $otherWatch, $decisions) {
  9409. return $literal !== $ruleLiteral &&
  9410. $otherWatch !== $ruleLiteral &&
  9411. !$decisions->conflict($ruleLiteral);
  9412. });
  9413. if ($alternativeLiterals) {
  9414. reset($alternativeLiterals);
  9415. $this->moveWatch($literal, current($alternativeLiterals), $node);
  9416. continue;
  9417. }
  9418. if ($decisions->conflict($otherWatch)) {
  9419. return $node->getRule();
  9420. }
  9421. $decisions->decide($otherWatch, $level, $node->getRule());
  9422. }
  9423. $chain->next();
  9424. }
  9425. return null;
  9426. }
  9427. protected function moveWatch($fromLiteral, $toLiteral, $node)
  9428. {
  9429. if (!isset($this->watchChains[$toLiteral])) {
  9430. $this->watchChains[$toLiteral] = new RuleWatchChain;
  9431. }
  9432. $node->moveWatch($fromLiteral, $toLiteral);
  9433. $this->watchChains[$fromLiteral]->remove();
  9434. $this->watchChains[$toLiteral]->unshift($node);
  9435. }
  9436. }
  9437. <?php
  9438. namespace Composer\DependencyResolver;
  9439. class RuleWatchNode
  9440. {
  9441. public $watch1;
  9442. public $watch2;
  9443. protected $rule;
  9444. public function __construct($rule)
  9445. {
  9446. $this->rule = $rule;
  9447. $literals = $rule->getLiterals();
  9448. $literalCount = count($literals);
  9449. $this->watch1 = $literalCount > 0 ? $literals[0] : 0;
  9450. $this->watch2 = $literalCount > 1 ? $literals[1] : 0;
  9451. }
  9452. public function watch2OnHighest(Decisions $decisions)
  9453. {
  9454. $literals = $this->rule->getLiterals();
  9455. if (count($literals) < 3) {
  9456. return;
  9457. }
  9458. $watchLevel = 0;
  9459. foreach ($literals as $literal) {
  9460. $level = $decisions->decisionLevel($literal);
  9461. if ($level > $watchLevel) {
  9462. $this->watch2 = $literal;
  9463. $watchLevel = $level;
  9464. }
  9465. }
  9466. }
  9467. public function getRule()
  9468. {
  9469. return $this->rule;
  9470. }
  9471. public function getOtherWatch($literal)
  9472. {
  9473. if ($this->watch1 == $literal) {
  9474. return $this->watch2;
  9475. }
  9476. return $this->watch1;
  9477. }
  9478. public function moveWatch($from, $to)
  9479. {
  9480. if ($this->watch1 == $from) {
  9481. $this->watch1 = $to;
  9482. } else {
  9483. $this->watch2 = $to;
  9484. }
  9485. }
  9486. }
  9487. <?php
  9488. namespace Composer\DependencyResolver;
  9489. use Composer\IO\IOInterface;
  9490. use Composer\Repository\RepositoryInterface;
  9491. use Composer\Repository\PlatformRepository;
  9492. class Solver
  9493. {
  9494. const BRANCH_LITERALS = 0;
  9495. const BRANCH_LEVEL = 1;
  9496. protected $policy;
  9497. protected $pool;
  9498. protected $installed;
  9499. protected $rules;
  9500. protected $ruleSetGenerator;
  9501. protected $jobs;
  9502. protected $updateMap = array();
  9503. protected $watchGraph;
  9504. protected $decisions;
  9505. protected $installedMap;
  9506. protected $propagateIndex;
  9507. protected $branches = array();
  9508. protected $problems = array();
  9509. protected $learnedPool = array();
  9510. protected $learnedWhy = array();
  9511. public $testFlagLearnedPositiveLiteral = false;
  9512. protected $io;
  9513. public function __construct(PolicyInterface $policy, Pool $pool, RepositoryInterface $installed, IOInterface $io)
  9514. {
  9515. $this->io = $io;
  9516. $this->policy = $policy;
  9517. $this->pool = $pool;
  9518. $this->installed = $installed;
  9519. $this->ruleSetGenerator = new RuleSetGenerator($policy, $pool);
  9520. }
  9521. public function getRuleSetSize()
  9522. {
  9523. return count($this->rules);
  9524. }
  9525. private function makeAssertionRuleDecisions()
  9526. {
  9527. $decisionStart = count($this->decisions) - 1;
  9528. $rulesCount = count($this->rules);
  9529. for ($ruleIndex = 0; $ruleIndex < $rulesCount; $ruleIndex++) {
  9530. $rule = $this->rules->ruleById[$ruleIndex];
  9531. if (!$rule->isAssertion() || $rule->isDisabled()) {
  9532. continue;
  9533. }
  9534. $literals = $rule->getLiterals();
  9535. $literal = $literals[0];
  9536. if (!$this->decisions->decided($literal)) {
  9537. $this->decisions->decide($literal, 1, $rule);
  9538. continue;
  9539. }
  9540. if ($this->decisions->satisfy($literal)) {
  9541. continue;
  9542. }
  9543. if (RuleSet::TYPE_LEARNED === $rule->getType()) {
  9544. $rule->disable();
  9545. continue;
  9546. }
  9547. $conflict = $this->decisions->decisionRule($literal);
  9548. if ($conflict && RuleSet::TYPE_PACKAGE === $conflict->getType()) {
  9549. $problem = new Problem($this->pool);
  9550. $problem->addRule($rule);
  9551. $problem->addRule($conflict);
  9552. $this->disableProblem($rule);
  9553. $this->problems[] = $problem;
  9554. continue;
  9555. }
  9556. $problem = new Problem($this->pool);
  9557. $problem->addRule($rule);
  9558. $problem->addRule($conflict);
  9559. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_JOB) as $assertRule) {
  9560. if ($assertRule->isDisabled() || !$assertRule->isAssertion()) {
  9561. continue;
  9562. }
  9563. $assertRuleLiterals = $assertRule->getLiterals();
  9564. $assertRuleLiteral = $assertRuleLiterals[0];
  9565. if (abs($literal) !== abs($assertRuleLiteral)) {
  9566. continue;
  9567. }
  9568. $problem->addRule($assertRule);
  9569. $this->disableProblem($assertRule);
  9570. }
  9571. $this->problems[] = $problem;
  9572. $this->decisions->resetToOffset($decisionStart);
  9573. $ruleIndex = -1;
  9574. }
  9575. }
  9576. protected function setupInstalledMap()
  9577. {
  9578. $this->installedMap = array();
  9579. foreach ($this->installed->getPackages() as $package) {
  9580. $this->installedMap[$package->id] = $package;
  9581. }
  9582. }
  9583. protected function checkForRootRequireProblems($ignorePlatformReqs)
  9584. {
  9585. foreach ($this->jobs as $job) {
  9586. switch ($job['cmd']) {
  9587. case 'update':
  9588. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  9589. foreach ($packages as $package) {
  9590. if (isset($this->installedMap[$package->id])) {
  9591. $this->updateMap[$package->id] = true;
  9592. }
  9593. }
  9594. break;
  9595. case 'update-all':
  9596. foreach ($this->installedMap as $package) {
  9597. $this->updateMap[$package->id] = true;
  9598. }
  9599. break;
  9600. case 'install':
  9601. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  9602. break;
  9603. }
  9604. if (!$this->pool->whatProvides($job['packageName'], $job['constraint'])) {
  9605. $problem = new Problem($this->pool);
  9606. $problem->addRule(new GenericRule(array(), null, null, $job));
  9607. $this->problems[] = $problem;
  9608. }
  9609. break;
  9610. }
  9611. }
  9612. }
  9613. public function solve(Request $request, $ignorePlatformReqs = false)
  9614. {
  9615. $this->jobs = $request->getJobs();
  9616. $this->setupInstalledMap();
  9617. $this->rules = $this->ruleSetGenerator->getRulesFor($this->jobs, $this->installedMap, $ignorePlatformReqs);
  9618. $this->checkForRootRequireProblems($ignorePlatformReqs);
  9619. $this->decisions = new Decisions($this->pool);
  9620. $this->watchGraph = new RuleWatchGraph;
  9621. foreach ($this->rules as $rule) {
  9622. $this->watchGraph->insert(new RuleWatchNode($rule));
  9623. }
  9624. $this->makeAssertionRuleDecisions();
  9625. $this->io->writeError('Resolving dependencies through SAT', true, IOInterface::DEBUG);
  9626. $before = microtime(true);
  9627. $this->runSat(true);
  9628. $this->io->writeError('', true, IOInterface::DEBUG);
  9629. $this->io->writeError(sprintf('Dependency resolution completed in %.3f seconds', microtime(true) - $before), true, IOInterface::VERBOSE);
  9630. foreach ($this->installedMap as $packageId => $void) {
  9631. if ($this->decisions->undecided($packageId)) {
  9632. $this->decisions->decide(-$packageId, 1, null);
  9633. }
  9634. }
  9635. if ($this->problems) {
  9636. throw new SolverProblemsException($this->problems, $this->installedMap);
  9637. }
  9638. $transaction = new Transaction($this->policy, $this->pool, $this->installedMap, $this->decisions);
  9639. return $transaction->getOperations();
  9640. }
  9641. protected function propagate($level)
  9642. {
  9643. while ($this->decisions->validOffset($this->propagateIndex)) {
  9644. $decision = $this->decisions->atOffset($this->propagateIndex);
  9645. $conflict = $this->watchGraph->propagateLiteral(
  9646. $decision[Decisions::DECISION_LITERAL],
  9647. $level,
  9648. $this->decisions
  9649. );
  9650. $this->propagateIndex++;
  9651. if ($conflict) {
  9652. return $conflict;
  9653. }
  9654. }
  9655. return null;
  9656. }
  9657. private function revert($level)
  9658. {
  9659. while (!$this->decisions->isEmpty()) {
  9660. $literal = $this->decisions->lastLiteral();
  9661. if ($this->decisions->undecided($literal)) {
  9662. break;
  9663. }
  9664. $decisionLevel = $this->decisions->decisionLevel($literal);
  9665. if ($decisionLevel <= $level) {
  9666. break;
  9667. }
  9668. $this->decisions->revertLast();
  9669. $this->propagateIndex = count($this->decisions);
  9670. }
  9671. while (!empty($this->branches) && $this->branches[count($this->branches) - 1][self::BRANCH_LEVEL] >= $level) {
  9672. array_pop($this->branches);
  9673. }
  9674. }
  9675. private function setPropagateLearn($level, $literal, $disableRules, Rule $rule)
  9676. {
  9677. $level++;
  9678. $this->decisions->decide($literal, $level, $rule);
  9679. while (true) {
  9680. $rule = $this->propagate($level);
  9681. if (!$rule) {
  9682. break;
  9683. }
  9684. if ($level == 1) {
  9685. return $this->analyzeUnsolvable($rule, $disableRules);
  9686. }
  9687. list($learnLiteral, $newLevel, $newRule, $why) = $this->analyze($level, $rule);
  9688. if ($newLevel <= 0 || $newLevel >= $level) {
  9689. throw new SolverBugException(
  9690. "Trying to revert to invalid level ".(int) $newLevel." from level ".(int) $level."."
  9691. );
  9692. } elseif (!$newRule) {
  9693. throw new SolverBugException(
  9694. "No rule was learned from analyzing $rule at level $level."
  9695. );
  9696. }
  9697. $level = $newLevel;
  9698. $this->revert($level);
  9699. $this->rules->add($newRule, RuleSet::TYPE_LEARNED);
  9700. $this->learnedWhy[spl_object_hash($newRule)] = $why;
  9701. $ruleNode = new RuleWatchNode($newRule);
  9702. $ruleNode->watch2OnHighest($this->decisions);
  9703. $this->watchGraph->insert($ruleNode);
  9704. $this->decisions->decide($learnLiteral, $level, $newRule);
  9705. }
  9706. return $level;
  9707. }
  9708. private function selectAndInstall($level, array $decisionQueue, $disableRules, Rule $rule)
  9709. {
  9710. $literals = $this->policy->selectPreferredPackages($this->pool, $this->installedMap, $decisionQueue, $rule->getRequiredPackage());
  9711. $selectedLiteral = array_shift($literals);
  9712. if (count($literals)) {
  9713. $this->branches[] = array($literals, $level);
  9714. }
  9715. return $this->setPropagateLearn($level, $selectedLiteral, $disableRules, $rule);
  9716. }
  9717. protected function analyze($level, Rule $rule)
  9718. {
  9719. $analyzedRule = $rule;
  9720. $ruleLevel = 1;
  9721. $num = 0;
  9722. $l1num = 0;
  9723. $seen = array();
  9724. $learnedLiterals = array(null);
  9725. $decisionId = count($this->decisions);
  9726. $this->learnedPool[] = array();
  9727. while (true) {
  9728. $this->learnedPool[count($this->learnedPool) - 1][] = $rule;
  9729. foreach ($rule->getLiterals() as $literal) {
  9730. if ($this->decisions->satisfy($literal)) {
  9731. continue;
  9732. }
  9733. if (isset($seen[abs($literal)])) {
  9734. continue;
  9735. }
  9736. $seen[abs($literal)] = true;
  9737. $l = $this->decisions->decisionLevel($literal);
  9738. if (1 === $l) {
  9739. $l1num++;
  9740. } elseif ($level === $l) {
  9741. $num++;
  9742. } else {
  9743. $learnedLiterals[] = $literal;
  9744. if ($l > $ruleLevel) {
  9745. $ruleLevel = $l;
  9746. }
  9747. }
  9748. }
  9749. $l1retry = true;
  9750. while ($l1retry) {
  9751. $l1retry = false;
  9752. if (!$num && !--$l1num) {
  9753. break 2;
  9754. }
  9755. while (true) {
  9756. if ($decisionId <= 0) {
  9757. throw new SolverBugException(
  9758. "Reached invalid decision id $decisionId while looking through $rule for a literal present in the analyzed rule $analyzedRule."
  9759. );
  9760. }
  9761. $decisionId--;
  9762. $decision = $this->decisions->atOffset($decisionId);
  9763. $literal = $decision[Decisions::DECISION_LITERAL];
  9764. if (isset($seen[abs($literal)])) {
  9765. break;
  9766. }
  9767. }
  9768. unset($seen[abs($literal)]);
  9769. if ($num && 0 === --$num) {
  9770. if ($literal < 0) {
  9771. $this->testFlagLearnedPositiveLiteral = true;
  9772. }
  9773. $learnedLiterals[0] = -$literal;
  9774. if (!$l1num) {
  9775. break 2;
  9776. }
  9777. foreach ($learnedLiterals as $i => $learnedLiteral) {
  9778. if ($i !== 0) {
  9779. unset($seen[abs($learnedLiteral)]);
  9780. }
  9781. }
  9782. $l1num++;
  9783. $l1retry = true;
  9784. }
  9785. }
  9786. $decision = $this->decisions->atOffset($decisionId);
  9787. $rule = $decision[Decisions::DECISION_REASON];
  9788. }
  9789. $why = count($this->learnedPool) - 1;
  9790. if (!$learnedLiterals[0]) {
  9791. throw new SolverBugException(
  9792. "Did not find a learnable literal in analyzed rule $analyzedRule."
  9793. );
  9794. }
  9795. $newRule = new GenericRule($learnedLiterals, Rule::RULE_LEARNED, $why);
  9796. return array($learnedLiterals[0], $ruleLevel, $newRule, $why);
  9797. }
  9798. private function analyzeUnsolvableRule(Problem $problem, Rule $conflictRule)
  9799. {
  9800. if ($conflictRule->getType() == RuleSet::TYPE_LEARNED) {
  9801. $why = spl_object_hash($conflictRule);
  9802. $learnedWhy = $this->learnedWhy[$why];
  9803. $problemRules = $this->learnedPool[$learnedWhy];
  9804. foreach ($problemRules as $problemRule) {
  9805. $this->analyzeUnsolvableRule($problem, $problemRule);
  9806. }
  9807. return;
  9808. }
  9809. if ($conflictRule->getType() == RuleSet::TYPE_PACKAGE) {
  9810. return;
  9811. }
  9812. $problem->nextSection();
  9813. $problem->addRule($conflictRule);
  9814. }
  9815. private function analyzeUnsolvable(Rule $conflictRule, $disableRules)
  9816. {
  9817. $problem = new Problem($this->pool);
  9818. $problem->addRule($conflictRule);
  9819. $this->analyzeUnsolvableRule($problem, $conflictRule);
  9820. $this->problems[] = $problem;
  9821. $seen = array();
  9822. $literals = $conflictRule->getLiterals();
  9823. foreach ($literals as $literal) {
  9824. if ($this->decisions->satisfy($literal)) {
  9825. continue;
  9826. }
  9827. $seen[abs($literal)] = true;
  9828. }
  9829. foreach ($this->decisions as $decision) {
  9830. $literal = $decision[Decisions::DECISION_LITERAL];
  9831. if (!isset($seen[abs($literal)])) {
  9832. continue;
  9833. }
  9834. $why = $decision[Decisions::DECISION_REASON];
  9835. $problem->addRule($why);
  9836. $this->analyzeUnsolvableRule($problem, $why);
  9837. $literals = $why->getLiterals();
  9838. foreach ($literals as $literal) {
  9839. if ($this->decisions->satisfy($literal)) {
  9840. continue;
  9841. }
  9842. $seen[abs($literal)] = true;
  9843. }
  9844. }
  9845. if ($disableRules) {
  9846. foreach ($this->problems[count($this->problems) - 1] as $reason) {
  9847. $this->disableProblem($reason['rule']);
  9848. }
  9849. $this->resetSolver();
  9850. return 1;
  9851. }
  9852. return 0;
  9853. }
  9854. private function disableProblem(Rule $why)
  9855. {
  9856. $job = $why->getJob();
  9857. if (!$job) {
  9858. $why->disable();
  9859. return;
  9860. }
  9861. foreach ($this->rules as $rule) {
  9862. if ($job === $rule->getJob()) {
  9863. $rule->disable();
  9864. }
  9865. }
  9866. }
  9867. private function resetSolver()
  9868. {
  9869. $this->decisions->reset();
  9870. $this->propagateIndex = 0;
  9871. $this->branches = array();
  9872. $this->enableDisableLearnedRules();
  9873. $this->makeAssertionRuleDecisions();
  9874. }
  9875. private function enableDisableLearnedRules()
  9876. {
  9877. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_LEARNED) as $rule) {
  9878. $why = $this->learnedWhy[spl_object_hash($rule)];
  9879. $problemRules = $this->learnedPool[$why];
  9880. $foundDisabled = false;
  9881. foreach ($problemRules as $problemRule) {
  9882. if ($problemRule->isDisabled()) {
  9883. $foundDisabled = true;
  9884. break;
  9885. }
  9886. }
  9887. if ($foundDisabled && $rule->isEnabled()) {
  9888. $rule->disable();
  9889. } elseif (!$foundDisabled && $rule->isDisabled()) {
  9890. $rule->enable();
  9891. }
  9892. }
  9893. }
  9894. private function runSat($disableRules = true)
  9895. {
  9896. $this->propagateIndex = 0;
  9897. $decisionQueue = array();
  9898. $decisionSupplementQueue = array();
  9899. $disableRules = array();
  9900. $level = 1;
  9901. $systemLevel = $level + 1;
  9902. $installedPos = 0;
  9903. while (true) {
  9904. if (1 === $level) {
  9905. $conflictRule = $this->propagate($level);
  9906. if (null !== $conflictRule) {
  9907. if ($this->analyzeUnsolvable($conflictRule, $disableRules)) {
  9908. continue;
  9909. }
  9910. return;
  9911. }
  9912. }
  9913. if ($level < $systemLevel) {
  9914. $iterator = $this->rules->getIteratorFor(RuleSet::TYPE_JOB);
  9915. foreach ($iterator as $rule) {
  9916. if ($rule->isEnabled()) {
  9917. $decisionQueue = array();
  9918. $noneSatisfied = true;
  9919. foreach ($rule->getLiterals() as $literal) {
  9920. if ($this->decisions->satisfy($literal)) {
  9921. $noneSatisfied = false;
  9922. break;
  9923. }
  9924. if ($literal > 0 && $this->decisions->undecided($literal)) {
  9925. $decisionQueue[] = $literal;
  9926. }
  9927. }
  9928. if ($noneSatisfied && count($decisionQueue)) {
  9929. if (count($this->installed) != count($this->updateMap)) {
  9930. $prunedQueue = array();
  9931. foreach ($decisionQueue as $literal) {
  9932. if (isset($this->installedMap[abs($literal)])) {
  9933. $prunedQueue[] = $literal;
  9934. if (isset($this->updateMap[abs($literal)])) {
  9935. $prunedQueue = $decisionQueue;
  9936. break;
  9937. }
  9938. }
  9939. }
  9940. $decisionQueue = $prunedQueue;
  9941. }
  9942. }
  9943. if ($noneSatisfied && count($decisionQueue)) {
  9944. $oLevel = $level;
  9945. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  9946. if (0 === $level) {
  9947. return;
  9948. }
  9949. if ($level <= $oLevel) {
  9950. break;
  9951. }
  9952. }
  9953. }
  9954. }
  9955. $systemLevel = $level + 1;
  9956. $iterator->next();
  9957. if ($iterator->valid()) {
  9958. continue;
  9959. }
  9960. }
  9961. if ($level < $systemLevel) {
  9962. $systemLevel = $level;
  9963. }
  9964. $rulesCount = count($this->rules);
  9965. $pass = 1;
  9966. $this->io->writeError('Looking at all rules.', true, IOInterface::DEBUG);
  9967. for ($i = 0, $n = 0; $n < $rulesCount; $i++, $n++) {
  9968. if ($i == $rulesCount) {
  9969. if (1 === $pass) {
  9970. $this->io->writeError("Something's changed, looking at all rules again (pass #$pass)", false, IOInterface::DEBUG);
  9971. } else {
  9972. $this->io->overwriteError("Something's changed, looking at all rules again (pass #$pass)", false, null, IOInterface::DEBUG);
  9973. }
  9974. $i = 0;
  9975. $pass++;
  9976. }
  9977. $rule = $this->rules->ruleById[$i];
  9978. $literals = $rule->getLiterals();
  9979. if ($rule->isDisabled()) {
  9980. continue;
  9981. }
  9982. $decisionQueue = array();
  9983. foreach ($literals as $literal) {
  9984. if ($literal <= 0) {
  9985. if (!$this->decisions->decidedInstall($literal)) {
  9986. continue 2;
  9987. }
  9988. } else {
  9989. if ($this->decisions->decidedInstall($literal)) {
  9990. continue 2;
  9991. }
  9992. if ($this->decisions->undecided($literal)) {
  9993. $decisionQueue[] = $literal;
  9994. }
  9995. }
  9996. }
  9997. if (count($decisionQueue) < 2) {
  9998. continue;
  9999. }
  10000. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  10001. if (0 === $level) {
  10002. return;
  10003. }
  10004. $rulesCount = count($this->rules);
  10005. $n = -1;
  10006. }
  10007. if ($level < $systemLevel) {
  10008. continue;
  10009. }
  10010. if (count($this->branches)) {
  10011. $lastLiteral = null;
  10012. $lastLevel = null;
  10013. $lastBranchIndex = 0;
  10014. $lastBranchOffset = 0;
  10015. for ($i = count($this->branches) - 1; $i >= 0; $i--) {
  10016. list($literals, $l) = $this->branches[$i];
  10017. foreach ($literals as $offset => $literal) {
  10018. if ($literal && $literal > 0 && $this->decisions->decisionLevel($literal) > $l + 1) {
  10019. $lastLiteral = $literal;
  10020. $lastBranchIndex = $i;
  10021. $lastBranchOffset = $offset;
  10022. $lastLevel = $l;
  10023. }
  10024. }
  10025. }
  10026. if ($lastLiteral) {
  10027. unset($this->branches[$lastBranchIndex][self::BRANCH_LITERALS][$lastBranchOffset]);
  10028. $level = $lastLevel;
  10029. $this->revert($level);
  10030. $why = $this->decisions->lastReason();
  10031. $level = $this->setPropagateLearn($level, $lastLiteral, $disableRules, $why);
  10032. if ($level == 0) {
  10033. return;
  10034. }
  10035. continue;
  10036. }
  10037. }
  10038. break;
  10039. }
  10040. }
  10041. }
  10042. <?php
  10043. namespace Composer\DependencyResolver;
  10044. class SolverBugException extends \RuntimeException
  10045. {
  10046. public function __construct($message)
  10047. {
  10048. parent::__construct(
  10049. $message."\nThis exception was most likely caused by a bug in Composer.\n".
  10050. "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"
  10051. );
  10052. }
  10053. }
  10054. <?php
  10055. namespace Composer\DependencyResolver;
  10056. use Composer\Util\IniHelper;
  10057. class SolverProblemsException extends \RuntimeException
  10058. {
  10059. protected $problems;
  10060. protected $installedMap;
  10061. public function __construct(array $problems, array $installedMap)
  10062. {
  10063. $this->problems = $problems;
  10064. $this->installedMap = $installedMap;
  10065. parent::__construct($this->createMessage(), 2);
  10066. }
  10067. protected function createMessage()
  10068. {
  10069. $text = "\n";
  10070. $hasExtensionProblems = false;
  10071. foreach ($this->problems as $i => $problem) {
  10072. $text .= " Problem ".($i + 1).$problem->getPrettyString($this->installedMap)."\n";
  10073. if (!$hasExtensionProblems && $this->hasExtensionProblems($problem->getReasons())) {
  10074. $hasExtensionProblems = true;
  10075. }
  10076. }
  10077. if (strpos($text, 'could not be found') || strpos($text, 'no matching package found')) {
  10078. $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.";
  10079. }
  10080. if ($hasExtensionProblems) {
  10081. $text .= $this->createExtensionHint();
  10082. }
  10083. return $text;
  10084. }
  10085. public function getProblems()
  10086. {
  10087. return $this->problems;
  10088. }
  10089. private function createExtensionHint()
  10090. {
  10091. $paths = IniHelper::getAll();
  10092. if (count($paths) === 1 && empty($paths[0])) {
  10093. return '';
  10094. }
  10095. $text = "\n To enable extensions, verify that they are enabled in your .ini files:\n - ";
  10096. $text .= implode("\n - ", $paths);
  10097. $text .= "\n You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.";
  10098. return $text;
  10099. }
  10100. private function hasExtensionProblems(array $reasonSets)
  10101. {
  10102. foreach ($reasonSets as $reasonSet) {
  10103. foreach ($reasonSet as $reason) {
  10104. if (isset($reason["rule"]) && 0 === strpos($reason["rule"]->getRequiredPackage(), 'ext-')) {
  10105. return true;
  10106. }
  10107. }
  10108. }
  10109. return false;
  10110. }
  10111. }
  10112. <?php
  10113. namespace Composer\DependencyResolver;
  10114. use Composer\Package\AliasPackage;
  10115. class Transaction
  10116. {
  10117. protected $policy;
  10118. protected $pool;
  10119. protected $installedMap;
  10120. protected $decisions;
  10121. protected $transaction;
  10122. public function __construct($policy, $pool, $installedMap, $decisions)
  10123. {
  10124. $this->policy = $policy;
  10125. $this->pool = $pool;
  10126. $this->installedMap = $installedMap;
  10127. $this->decisions = $decisions;
  10128. $this->transaction = array();
  10129. }
  10130. public function getOperations()
  10131. {
  10132. $installMeansUpdateMap = $this->findUpdates();
  10133. $updateMap = array();
  10134. $installMap = array();
  10135. $uninstallMap = array();
  10136. foreach ($this->decisions as $i => $decision) {
  10137. $literal = $decision[Decisions::DECISION_LITERAL];
  10138. $reason = $decision[Decisions::DECISION_REASON];
  10139. $package = $this->pool->literalToPackage($literal);
  10140. if (($literal > 0) == isset($this->installedMap[$package->id])) {
  10141. continue;
  10142. }
  10143. if ($literal > 0) {
  10144. if (isset($installMeansUpdateMap[abs($literal)]) && !$package instanceof AliasPackage) {
  10145. $source = $installMeansUpdateMap[abs($literal)];
  10146. $updateMap[$package->id] = array(
  10147. 'package' => $package,
  10148. 'source' => $source,
  10149. 'reason' => $reason,
  10150. );
  10151. unset($installMeansUpdateMap[abs($literal)]);
  10152. $ignoreRemove[$source->id] = true;
  10153. } else {
  10154. $installMap[$package->id] = array(
  10155. 'package' => $package,
  10156. 'reason' => $reason,
  10157. );
  10158. }
  10159. }
  10160. }
  10161. foreach ($this->decisions as $i => $decision) {
  10162. $literal = $decision[Decisions::DECISION_LITERAL];
  10163. $reason = $decision[Decisions::DECISION_REASON];
  10164. $package = $this->pool->literalToPackage($literal);
  10165. if ($literal <= 0 &&
  10166. isset($this->installedMap[$package->id]) &&
  10167. !isset($ignoreRemove[$package->id])) {
  10168. $uninstallMap[$package->id] = array(
  10169. 'package' => $package,
  10170. 'reason' => $reason,
  10171. );
  10172. }
  10173. }
  10174. $this->transactionFromMaps($installMap, $updateMap, $uninstallMap);
  10175. return $this->transaction;
  10176. }
  10177. protected function transactionFromMaps($installMap, $updateMap, $uninstallMap)
  10178. {
  10179. $queue = array_map(
  10180. function ($operation) {
  10181. return $operation['package'];
  10182. },
  10183. $this->findRootPackages($installMap, $updateMap)
  10184. );
  10185. $visited = array();
  10186. while (!empty($queue)) {
  10187. $package = array_pop($queue);
  10188. $packageId = $package->id;
  10189. if (!isset($visited[$packageId])) {
  10190. $queue[] = $package;
  10191. if ($package instanceof AliasPackage) {
  10192. $queue[] = $package->getAliasOf();
  10193. } else {
  10194. foreach ($package->getRequires() as $link) {
  10195. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  10196. foreach ($possibleRequires as $require) {
  10197. $queue[] = $require;
  10198. }
  10199. }
  10200. }
  10201. $visited[$package->id] = true;
  10202. } else {
  10203. if (isset($installMap[$packageId])) {
  10204. $this->install(
  10205. $installMap[$packageId]['package'],
  10206. $installMap[$packageId]['reason']
  10207. );
  10208. unset($installMap[$packageId]);
  10209. }
  10210. if (isset($updateMap[$packageId])) {
  10211. $this->update(
  10212. $updateMap[$packageId]['source'],
  10213. $updateMap[$packageId]['package'],
  10214. $updateMap[$packageId]['reason']
  10215. );
  10216. unset($updateMap[$packageId]);
  10217. }
  10218. }
  10219. }
  10220. foreach ($uninstallMap as $uninstall) {
  10221. $this->uninstall($uninstall['package'], $uninstall['reason']);
  10222. }
  10223. }
  10224. protected function findRootPackages($installMap, $updateMap)
  10225. {
  10226. $packages = $installMap + $updateMap;
  10227. $roots = $packages;
  10228. foreach ($packages as $packageId => $operation) {
  10229. $package = $operation['package'];
  10230. if (!isset($roots[$packageId])) {
  10231. continue;
  10232. }
  10233. foreach ($package->getRequires() as $link) {
  10234. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  10235. foreach ($possibleRequires as $require) {
  10236. if ($require !== $package) {
  10237. unset($roots[$require->id]);
  10238. }
  10239. }
  10240. }
  10241. }
  10242. return $roots;
  10243. }
  10244. protected function findUpdates()
  10245. {
  10246. $installMeansUpdateMap = array();
  10247. foreach ($this->decisions as $i => $decision) {
  10248. $literal = $decision[Decisions::DECISION_LITERAL];
  10249. $package = $this->pool->literalToPackage($literal);
  10250. if ($package instanceof AliasPackage) {
  10251. continue;
  10252. }
  10253. if ($literal <= 0 && isset($this->installedMap[$package->id])) {
  10254. $updates = $this->policy->findUpdatePackages($this->pool, $this->installedMap, $package);
  10255. $literals = array($package->id);
  10256. foreach ($updates as $update) {
  10257. $literals[] = $update->id;
  10258. }
  10259. foreach ($literals as $updateLiteral) {
  10260. if ($updateLiteral !== $literal) {
  10261. $installMeansUpdateMap[abs($updateLiteral)] = $package;
  10262. }
  10263. }
  10264. }
  10265. }
  10266. return $installMeansUpdateMap;
  10267. }
  10268. protected function install($package, $reason)
  10269. {
  10270. if ($package instanceof AliasPackage) {
  10271. return $this->markAliasInstalled($package, $reason);
  10272. }
  10273. $this->transaction[] = new Operation\InstallOperation($package, $reason);
  10274. }
  10275. protected function update($from, $to, $reason)
  10276. {
  10277. $this->transaction[] = new Operation\UpdateOperation($from, $to, $reason);
  10278. }
  10279. protected function uninstall($package, $reason)
  10280. {
  10281. if ($package instanceof AliasPackage) {
  10282. return $this->markAliasUninstalled($package, $reason);
  10283. }
  10284. $this->transaction[] = new Operation\UninstallOperation($package, $reason);
  10285. }
  10286. protected function markAliasInstalled($package, $reason)
  10287. {
  10288. $this->transaction[] = new Operation\MarkAliasInstalledOperation($package, $reason);
  10289. }
  10290. protected function markAliasUninstalled($package, $reason)
  10291. {
  10292. $this->transaction[] = new Operation\MarkAliasUninstalledOperation($package, $reason);
  10293. }
  10294. }
  10295. <?php
  10296. namespace Composer\Downloader;
  10297. use Composer\Package\PackageInterface;
  10298. use Symfony\Component\Finder\Finder;
  10299. use Composer\IO\IOInterface;
  10300. abstract class ArchiveDownloader extends FileDownloader
  10301. {
  10302. public function download(PackageInterface $package, $path, $output = true)
  10303. {
  10304. $temporaryDir = $this->config->get('vendor-dir').'/composer/'.substr(md5(uniqid('', true)), 0, 8);
  10305. $retries = 3;
  10306. while ($retries--) {
  10307. $fileName = parent::download($package, $path, $output);
  10308. if ($output) {
  10309. $this->io->writeError(' Extracting archive', false, IOInterface::VERBOSE);
  10310. }
  10311. try {
  10312. $this->filesystem->ensureDirectoryExists($temporaryDir);
  10313. try {
  10314. $this->extract($fileName, $temporaryDir);
  10315. } catch (\Exception $e) {
  10316. parent::clearLastCacheWrite($package);
  10317. throw $e;
  10318. }
  10319. $this->filesystem->unlink($fileName);
  10320. $contentDir = $this->getFolderContent($temporaryDir);
  10321. if (1 === count($contentDir) && is_dir(reset($contentDir))) {
  10322. $contentDir = $this->getFolderContent((string) reset($contentDir));
  10323. }
  10324. foreach ($contentDir as $file) {
  10325. $file = (string) $file;
  10326. $this->filesystem->rename($file, $path . '/' . basename($file));
  10327. }
  10328. $this->filesystem->removeDirectory($temporaryDir);
  10329. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir').'/composer/')) {
  10330. $this->filesystem->removeDirectory($this->config->get('vendor-dir').'/composer/');
  10331. }
  10332. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir'))) {
  10333. $this->filesystem->removeDirectory($this->config->get('vendor-dir'));
  10334. }
  10335. } catch (\Exception $e) {
  10336. $this->filesystem->removeDirectory($path);
  10337. $this->filesystem->removeDirectory($temporaryDir);
  10338. if ($retries && $e instanceof \UnexpectedValueException && class_exists('ZipArchive') && $e->getCode() === \ZipArchive::ER_NOZIP) {
  10339. $this->io->writeError('');
  10340. if ($this->io->isDebug()) {
  10341. $this->io->writeError(' Invalid zip file ('.$e->getMessage().'), retrying...');
  10342. } else {
  10343. $this->io->writeError(' Invalid zip file, retrying...');
  10344. }
  10345. usleep(500000);
  10346. continue;
  10347. }
  10348. throw $e;
  10349. }
  10350. break;
  10351. }
  10352. }
  10353. protected function getFileName(PackageInterface $package, $path)
  10354. {
  10355. return rtrim($path.'/'.md5($path.spl_object_hash($package)).'.'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_EXTENSION), '.');
  10356. }
  10357. abstract protected function extract($file, $path);
  10358. private function getFolderContent($dir)
  10359. {
  10360. $finder = Finder::create()
  10361. ->ignoreVCS(false)
  10362. ->ignoreDotFiles(false)
  10363. ->notName('.DS_Store')
  10364. ->depth(0)
  10365. ->in($dir);
  10366. return iterator_to_array($finder);
  10367. }
  10368. }
  10369. <?php
  10370. namespace Composer\Downloader;
  10371. use Composer\Package\PackageInterface;
  10372. interface ChangeReportInterface
  10373. {
  10374. public function getLocalChanges(PackageInterface $package, $path);
  10375. }
  10376. <?php
  10377. namespace Composer\Downloader;
  10378. use Composer\Package\PackageInterface;
  10379. use Composer\IO\IOInterface;
  10380. use Composer\Util\Filesystem;
  10381. class DownloadManager
  10382. {
  10383. private $io;
  10384. private $preferDist = false;
  10385. private $preferSource = false;
  10386. private $packagePreferences = array();
  10387. private $filesystem;
  10388. private $downloaders = array();
  10389. public function __construct(IOInterface $io, $preferSource = false, Filesystem $filesystem = null)
  10390. {
  10391. $this->io = $io;
  10392. $this->preferSource = $preferSource;
  10393. $this->filesystem = $filesystem ?: new Filesystem();
  10394. }
  10395. public function setPreferSource($preferSource)
  10396. {
  10397. $this->preferSource = $preferSource;
  10398. return $this;
  10399. }
  10400. public function setPreferDist($preferDist)
  10401. {
  10402. $this->preferDist = $preferDist;
  10403. return $this;
  10404. }
  10405. public function setPreferences(array $preferences)
  10406. {
  10407. $this->packagePreferences = $preferences;
  10408. return $this;
  10409. }
  10410. public function setOutputProgress($outputProgress)
  10411. {
  10412. foreach ($this->downloaders as $downloader) {
  10413. $downloader->setOutputProgress($outputProgress);
  10414. }
  10415. return $this;
  10416. }
  10417. public function setDownloader($type, DownloaderInterface $downloader)
  10418. {
  10419. $type = strtolower($type);
  10420. $this->downloaders[$type] = $downloader;
  10421. return $this;
  10422. }
  10423. public function getDownloader($type)
  10424. {
  10425. $type = strtolower($type);
  10426. if (!isset($this->downloaders[$type])) {
  10427. throw new \InvalidArgumentException(sprintf('Unknown downloader type: %s. Available types: %s.', $type, implode(', ', array_keys($this->downloaders))));
  10428. }
  10429. return $this->downloaders[$type];
  10430. }
  10431. public function getDownloaderForInstalledPackage(PackageInterface $package)
  10432. {
  10433. $installationSource = $package->getInstallationSource();
  10434. if ('metapackage' === $package->getType()) {
  10435. return;
  10436. }
  10437. if ('dist' === $installationSource) {
  10438. $downloader = $this->getDownloader($package->getDistType());
  10439. } elseif ('source' === $installationSource) {
  10440. $downloader = $this->getDownloader($package->getSourceType());
  10441. } else {
  10442. throw new \InvalidArgumentException(
  10443. 'Package '.$package.' seems not been installed properly'
  10444. );
  10445. }
  10446. if ($installationSource !== $downloader->getInstallationSource()) {
  10447. throw new \LogicException(sprintf(
  10448. 'Downloader "%s" is a %s type downloader and can not be used to download %s for package %s',
  10449. get_class($downloader),
  10450. $downloader->getInstallationSource(),
  10451. $installationSource,
  10452. $package
  10453. ));
  10454. }
  10455. return $downloader;
  10456. }
  10457. public function download(PackageInterface $package, $targetDir, $preferSource = null)
  10458. {
  10459. $preferSource = null !== $preferSource ? $preferSource : $this->preferSource;
  10460. $sourceType = $package->getSourceType();
  10461. $distType = $package->getDistType();
  10462. $sources = array();
  10463. if ($sourceType) {
  10464. $sources[] = 'source';
  10465. }
  10466. if ($distType) {
  10467. $sources[] = 'dist';
  10468. }
  10469. if (empty($sources)) {
  10470. throw new \InvalidArgumentException('Package '.$package.' must have a source or dist specified');
  10471. }
  10472. if (!$preferSource && ($this->preferDist || 'dist' === $this->resolvePackageInstallPreference($package))) {
  10473. $sources = array_reverse($sources);
  10474. }
  10475. $this->filesystem->ensureDirectoryExists($targetDir);
  10476. foreach ($sources as $i => $source) {
  10477. if (isset($e)) {
  10478. $this->io->writeError(' <warning>Now trying to download from ' . $source . '</warning>');
  10479. }
  10480. $package->setInstallationSource($source);
  10481. try {
  10482. $downloader = $this->getDownloaderForInstalledPackage($package);
  10483. if ($downloader) {
  10484. $downloader->download($package, $targetDir);
  10485. }
  10486. break;
  10487. } catch (\RuntimeException $e) {
  10488. if ($i === count($sources) - 1) {
  10489. throw $e;
  10490. }
  10491. $this->io->writeError(
  10492. ' <warning>Failed to download '.
  10493. $package->getPrettyName().
  10494. ' from ' . $source . ': '.
  10495. $e->getMessage().'</warning>'
  10496. );
  10497. }
  10498. }
  10499. }
  10500. public function update(PackageInterface $initial, PackageInterface $target, $targetDir)
  10501. {
  10502. $downloader = $this->getDownloaderForInstalledPackage($initial);
  10503. if (!$downloader) {
  10504. return;
  10505. }
  10506. $installationSource = $initial->getInstallationSource();
  10507. if ('dist' === $installationSource) {
  10508. $initialType = $initial->getDistType();
  10509. $targetType = $target->getDistType();
  10510. } else {
  10511. $initialType = $initial->getSourceType();
  10512. $targetType = $target->getSourceType();
  10513. }
  10514. if ($target->isDev() && 'dist' === $installationSource) {
  10515. $downloader->remove($initial, $targetDir);
  10516. $this->download($target, $targetDir);
  10517. return;
  10518. }
  10519. if ($initialType === $targetType) {
  10520. $target->setInstallationSource($installationSource);
  10521. try {
  10522. $downloader->update($initial, $target, $targetDir);
  10523. return;
  10524. } catch (\RuntimeException $e) {
  10525. if (!$this->io->isInteractive()) {
  10526. throw $e;
  10527. }
  10528. $this->io->writeError('<error> Update failed ('.$e->getMessage().')</error>');
  10529. if (!$this->io->askConfirmation(' Would you like to try reinstalling the package instead [<comment>yes</comment>]? ', true)) {
  10530. throw $e;
  10531. }
  10532. }
  10533. }
  10534. $downloader->remove($initial, $targetDir);
  10535. $this->download($target, $targetDir, 'source' === $installationSource);
  10536. }
  10537. public function remove(PackageInterface $package, $targetDir)
  10538. {
  10539. $downloader = $this->getDownloaderForInstalledPackage($package);
  10540. if ($downloader) {
  10541. $downloader->remove($package, $targetDir);
  10542. }
  10543. }
  10544. protected function resolvePackageInstallPreference(PackageInterface $package)
  10545. {
  10546. foreach ($this->packagePreferences as $pattern => $preference) {
  10547. $pattern = '{^'.str_replace('\\*', '.*', preg_quote($pattern)).'$}i';
  10548. if (preg_match($pattern, $package->getName())) {
  10549. if ('dist' === $preference || (!$package->isDev() && 'auto' === $preference)) {
  10550. return 'dist';
  10551. }
  10552. return 'source';
  10553. }
  10554. }
  10555. return $package->isDev() ? 'source' : 'dist';
  10556. }
  10557. }
  10558. <?php
  10559. namespace Composer\Downloader;
  10560. use Composer\Package\PackageInterface;
  10561. interface DownloaderInterface
  10562. {
  10563. public function getInstallationSource();
  10564. public function download(PackageInterface $package, $path);
  10565. public function update(PackageInterface $initial, PackageInterface $target, $path);
  10566. public function remove(PackageInterface $package, $path);
  10567. public function setOutputProgress($outputProgress);
  10568. }
  10569. <?php
  10570. namespace Composer\Downloader;
  10571. use Composer\Package\PackageInterface;
  10572. interface DvcsDownloaderInterface
  10573. {
  10574. public function getUnpushedChanges(PackageInterface $package, $path);
  10575. }
  10576. <?php
  10577. namespace Composer\Downloader;
  10578. use Composer\Config;
  10579. use Composer\Cache;
  10580. use Composer\Factory;
  10581. use Composer\IO\IOInterface;
  10582. use Composer\IO\NullIO;
  10583. use Composer\Package\Comparer\Comparer;
  10584. use Composer\Package\PackageInterface;
  10585. use Composer\Package\Version\VersionParser;
  10586. use Composer\Plugin\PluginEvents;
  10587. use Composer\Plugin\PreFileDownloadEvent;
  10588. use Composer\EventDispatcher\EventDispatcher;
  10589. use Composer\Util\Filesystem;
  10590. use Composer\Util\RemoteFilesystem;
  10591. use Composer\Util\Url as UrlUtil;
  10592. class FileDownloader implements DownloaderInterface, ChangeReportInterface
  10593. {
  10594. protected $io;
  10595. protected $config;
  10596. protected $rfs;
  10597. protected $filesystem;
  10598. protected $cache;
  10599. protected $outputProgress = true;
  10600. private $lastCacheWrites = array();
  10601. private $eventDispatcher;
  10602. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, RemoteFilesystem $rfs = null, Filesystem $filesystem = null)
  10603. {
  10604. $this->io = $io;
  10605. $this->config = $config;
  10606. $this->eventDispatcher = $eventDispatcher;
  10607. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  10608. $this->filesystem = $filesystem ?: new Filesystem();
  10609. $this->cache = $cache;
  10610. if ($this->cache && $this->cache->gcIsNecessary()) {
  10611. $this->cache->gc($config->get('cache-files-ttl'), $config->get('cache-files-maxsize'));
  10612. }
  10613. }
  10614. public function getInstallationSource()
  10615. {
  10616. return 'dist';
  10617. }
  10618. public function download(PackageInterface $package, $path, $output = true)
  10619. {
  10620. if (!$package->getDistUrl()) {
  10621. throw new \InvalidArgumentException('The given package is missing url information');
  10622. }
  10623. if ($output) {
  10624. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>): ", false);
  10625. }
  10626. $urls = $package->getDistUrls();
  10627. while ($url = array_shift($urls)) {
  10628. try {
  10629. $fileName = $this->doDownload($package, $path, $url);
  10630. break;
  10631. } catch (\Exception $e) {
  10632. if ($this->io->isDebug()) {
  10633. $this->io->writeError('');
  10634. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getCode().': '.$e->getMessage());
  10635. } elseif (count($urls)) {
  10636. $this->io->writeError('');
  10637. $this->io->writeError(' Failed, trying the next URL ('.$e->getCode().': '.$e->getMessage().')', false);
  10638. }
  10639. if (!count($urls)) {
  10640. throw $e;
  10641. }
  10642. }
  10643. }
  10644. if ($output) {
  10645. $this->io->writeError('');
  10646. }
  10647. return $fileName;
  10648. }
  10649. protected function doDownload(PackageInterface $package, $path, $url)
  10650. {
  10651. $this->filesystem->emptyDirectory($path);
  10652. $fileName = $this->getFileName($package, $path);
  10653. $processedUrl = $this->processUrl($package, $url);
  10654. $origin = RemoteFilesystem::getOrigin($processedUrl);
  10655. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $processedUrl);
  10656. if ($this->eventDispatcher) {
  10657. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  10658. }
  10659. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  10660. try {
  10661. $checksum = $package->getDistSha1Checksum();
  10662. $cacheKey = $this->getCacheKey($package, $processedUrl);
  10663. if ($this->cache && (!$checksum || $checksum === $this->cache->sha1($cacheKey)) && $this->cache->copyTo($cacheKey, $fileName)) {
  10664. $this->io->writeError('Loading from cache', false);
  10665. } else {
  10666. if (!$this->outputProgress) {
  10667. $this->io->writeError('Downloading', false);
  10668. }
  10669. $retries = 3;
  10670. while ($retries--) {
  10671. try {
  10672. $rfs->copy($origin, $processedUrl, $fileName, $this->outputProgress, $package->getTransportOptions());
  10673. break;
  10674. } catch (TransportException $e) {
  10675. if ((0 !== $e->getCode() && !in_array($e->getCode(), array(500, 502, 503, 504))) || !$retries) {
  10676. throw $e;
  10677. }
  10678. $this->io->writeError('');
  10679. $this->io->writeError(' Download failed, retrying...', true, IOInterface::VERBOSE);
  10680. usleep(500000);
  10681. }
  10682. }
  10683. if (!$this->outputProgress) {
  10684. $this->io->writeError(' (<comment>100%</comment>)', false);
  10685. }
  10686. if ($this->cache) {
  10687. $this->lastCacheWrites[$package->getName()] = $cacheKey;
  10688. $this->cache->copyFrom($cacheKey, $fileName);
  10689. }
  10690. }
  10691. if (!file_exists($fileName)) {
  10692. throw new \UnexpectedValueException($url.' could not be saved to '.$fileName.', make sure the'
  10693. .' directory is writable and you have internet connectivity');
  10694. }
  10695. if ($checksum && hash_file('sha1', $fileName) !== $checksum) {
  10696. throw new \UnexpectedValueException('The checksum verification of the file failed (downloaded from '.$url.')');
  10697. }
  10698. } catch (\Exception $e) {
  10699. $this->filesystem->removeDirectory($path);
  10700. $this->clearLastCacheWrite($package);
  10701. throw $e;
  10702. }
  10703. return $fileName;
  10704. }
  10705. public function setOutputProgress($outputProgress)
  10706. {
  10707. $this->outputProgress = $outputProgress;
  10708. return $this;
  10709. }
  10710. protected function clearLastCacheWrite(PackageInterface $package)
  10711. {
  10712. if ($this->cache && isset($this->lastCacheWrites[$package->getName()])) {
  10713. $this->cache->remove($this->lastCacheWrites[$package->getName()]);
  10714. unset($this->lastCacheWrites[$package->getName()]);
  10715. }
  10716. }
  10717. public function update(PackageInterface $initial, PackageInterface $target, $path)
  10718. {
  10719. $name = $target->getName();
  10720. $from = $initial->getFullPrettyVersion();
  10721. $to = $target->getFullPrettyVersion();
  10722. $actionName = VersionParser::isUpgrade($initial->getVersion(), $target->getVersion()) ? 'Updating' : 'Downgrading';
  10723. $this->io->writeError(" - " . $actionName . " <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>): ", false);
  10724. $this->remove($initial, $path, false);
  10725. $this->download($target, $path, false);
  10726. $this->io->writeError('');
  10727. }
  10728. public function remove(PackageInterface $package, $path, $output = true)
  10729. {
  10730. if ($output) {
  10731. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  10732. }
  10733. if (!$this->filesystem->removeDirectory($path)) {
  10734. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  10735. }
  10736. }
  10737. protected function getFileName(PackageInterface $package, $path)
  10738. {
  10739. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  10740. }
  10741. protected function processUrl(PackageInterface $package, $url)
  10742. {
  10743. if (!extension_loaded('openssl') && 0 === strpos($url, 'https:')) {
  10744. throw new \RuntimeException('You must enable the openssl extension to download files via https');
  10745. }
  10746. if ($package->getDistReference()) {
  10747. $url = UrlUtil::updateDistReference($this->config, $url, $package->getDistReference());
  10748. }
  10749. return $url;
  10750. }
  10751. private function getCacheKey(PackageInterface $package, $processedUrl)
  10752. {
  10753. $cacheKey = sha1($processedUrl);
  10754. return $package->getName().'/'.$cacheKey.'.'.$package->getDistType();
  10755. }
  10756. public function getLocalChanges(PackageInterface $package, $targetDir)
  10757. {
  10758. $prevIO = $this->io;
  10759. $prevProgress = $this->outputProgress;
  10760. $this->io = new NullIO;
  10761. $this->io->loadConfiguration($this->config);
  10762. $this->outputProgress = false;
  10763. $e = null;
  10764. try {
  10765. $this->download($package, $targetDir.'_compare', false);
  10766. $comparer = new Comparer();
  10767. $comparer->setSource($targetDir.'_compare');
  10768. $comparer->setUpdate($targetDir);
  10769. $comparer->doCompare();
  10770. $output = $comparer->getChanged(true, true);
  10771. $this->filesystem->removeDirectory($targetDir.'_compare');
  10772. } catch (\Exception $e) {
  10773. }
  10774. $this->io = $prevIO;
  10775. $this->outputProgress = $prevProgress;
  10776. if ($e) {
  10777. throw $e;
  10778. }
  10779. return trim($output);
  10780. }
  10781. }
  10782. <?php
  10783. namespace Composer\Downloader;
  10784. class FilesystemException extends \Exception
  10785. {
  10786. public function __construct($message = '', $code = 0, \Exception $previous = null)
  10787. {
  10788. parent::__construct("Filesystem exception: \n".$message, $code, $previous);
  10789. }
  10790. }
  10791. <?php
  10792. namespace Composer\Downloader;
  10793. use Composer\Package\PackageInterface;
  10794. use Composer\Util\ProcessExecutor;
  10795. class FossilDownloader extends VcsDownloader
  10796. {
  10797. public function doDownload(PackageInterface $package, $path, $url)
  10798. {
  10799. $this->config->prohibitUrlByConfig($url, $this->io);
  10800. $url = ProcessExecutor::escape($url);
  10801. $ref = ProcessExecutor::escape($package->getSourceReference());
  10802. $repoFile = $path . '.fossil';
  10803. $this->io->writeError("Cloning ".$package->getSourceReference());
  10804. $command = sprintf('fossil clone %s %s', $url, ProcessExecutor::escape($repoFile));
  10805. if (0 !== $this->process->execute($command, $ignoredOutput)) {
  10806. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10807. }
  10808. $command = sprintf('fossil open %s --nested', ProcessExecutor::escape($repoFile));
  10809. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10810. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10811. }
  10812. $command = sprintf('fossil update %s', $ref);
  10813. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10814. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10815. }
  10816. }
  10817. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  10818. {
  10819. $this->config->prohibitUrlByConfig($url, $this->io);
  10820. $url = ProcessExecutor::escape($url);
  10821. $ref = ProcessExecutor::escape($target->getSourceReference());
  10822. $this->io->writeError(" Updating to ".$target->getSourceReference());
  10823. if (!$this->hasMetadataRepository($path)) {
  10824. throw new \RuntimeException('The .fslckout file is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  10825. }
  10826. $command = sprintf('fossil pull && fossil up %s', $ref);
  10827. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10828. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10829. }
  10830. }
  10831. public function getLocalChanges(PackageInterface $package, $path)
  10832. {
  10833. if (!$this->hasMetadataRepository($path)) {
  10834. return null;
  10835. }
  10836. $this->process->execute('fossil changes', $output, realpath($path));
  10837. return trim($output) ?: null;
  10838. }
  10839. protected function getCommitLogs($fromReference, $toReference, $path)
  10840. {
  10841. $command = sprintf('fossil timeline -t ci -W 0 -n 0 before %s', ProcessExecutor::escape($toReference));
  10842. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  10843. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10844. }
  10845. $log = '';
  10846. $match = '/\d\d:\d\d:\d\d\s+\[' . $toReference . '\]/';
  10847. foreach ($this->process->splitLines($output) as $line) {
  10848. if (preg_match($match, $line)) {
  10849. break;
  10850. }
  10851. $log .= $line;
  10852. }
  10853. return $log;
  10854. }
  10855. protected function hasMetadataRepository($path)
  10856. {
  10857. return is_file($path . '/.fslckout') || is_file($path . '/_FOSSIL_');
  10858. }
  10859. }
  10860. <?php
  10861. namespace Composer\Downloader;
  10862. use Composer\Config;
  10863. use Composer\IO\IOInterface;
  10864. use Composer\Package\PackageInterface;
  10865. use Composer\Util\Filesystem;
  10866. use Composer\Util\Git as GitUtil;
  10867. use Composer\Util\Platform;
  10868. use Composer\Util\ProcessExecutor;
  10869. use Composer\Cache;
  10870. class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
  10871. {
  10872. private $hasStashedChanges = false;
  10873. private $hasDiscardedChanges = false;
  10874. private $gitUtil;
  10875. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  10876. {
  10877. parent::__construct($io, $config, $process, $fs);
  10878. $this->gitUtil = new GitUtil($this->io, $this->config, $this->process, $this->filesystem);
  10879. }
  10880. public function doDownload(PackageInterface $package, $path, $url)
  10881. {
  10882. GitUtil::cleanEnv();
  10883. $path = $this->normalizePath($path);
  10884. $cachePath = $this->config->get('cache-vcs-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $url).'/';
  10885. $ref = $package->getSourceReference();
  10886. $flag = Platform::isWindows() ? '/D ' : '';
  10887. $gitVersion = $this->gitUtil->getVersion();
  10888. $msg = "Cloning ".$this->getShortHash($ref);
  10889. $command = 'git clone --no-checkout %url% %path% && cd '.$flag.'%path% && git remote add composer %url% && git fetch composer && git remote set-url origin %sanitizedUrl% && git remote set-url composer %sanitizedUrl%';
  10890. if ($gitVersion && version_compare($gitVersion, '2.3.0-rc0', '>=') && Cache::isUsable($cachePath)) {
  10891. $this->io->writeError('', true, IOInterface::DEBUG);
  10892. $this->io->writeError(sprintf(' Cloning to cache at %s', ProcessExecutor::escape($cachePath)), true, IOInterface::DEBUG);
  10893. try {
  10894. if (!$this->gitUtil->fetchRefOrSyncMirror($url, $cachePath, $ref)) {
  10895. $this->io->writeError('<error>Failed to update '.$url.' in cache, package installation for '.$package->getPrettyName().' might fail.</error>');
  10896. }
  10897. if (is_dir($cachePath)) {
  10898. $command =
  10899. 'git clone --no-checkout %cachePath% %path% --dissociate --reference %cachePath% '
  10900. . '&& cd '.$flag.'%path% '
  10901. . '&& git remote set-url origin %sanitizedUrl% && git remote add composer %sanitizedUrl%';
  10902. $msg = "Cloning ".$this->getShortHash($ref).' from cache';
  10903. }
  10904. } catch (\RuntimeException $e) {
  10905. if (0 === strpos(get_class($e), 'PHPUnit')) {
  10906. throw $e;
  10907. }
  10908. }
  10909. }
  10910. $this->io->writeError($msg);
  10911. $commandCallable = function ($url) use ($path, $command, $cachePath) {
  10912. return str_replace(
  10913. array('%url%', '%path%', '%cachePath%', '%sanitizedUrl%'),
  10914. array(
  10915. ProcessExecutor::escape($url),
  10916. ProcessExecutor::escape($path),
  10917. ProcessExecutor::escape($cachePath),
  10918. ProcessExecutor::escape(preg_replace('{://([^@]+?):(.+?)@}', '://', $url)),
  10919. ),
  10920. $command
  10921. );
  10922. };
  10923. $this->gitUtil->runCommand($commandCallable, $url, $path, true);
  10924. if ($url !== $package->getSourceUrl()) {
  10925. $this->updateOriginUrl($path, $package->getSourceUrl());
  10926. } else {
  10927. $this->setPushUrl($path, $url);
  10928. }
  10929. if ($newRef = $this->updateToCommit($path, $ref, $package->getPrettyVersion(), $package->getReleaseDate())) {
  10930. if ($package->getDistReference() === $package->getSourceReference()) {
  10931. $package->setDistReference($newRef);
  10932. }
  10933. $package->setSourceReference($newRef);
  10934. }
  10935. }
  10936. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  10937. {
  10938. GitUtil::cleanEnv();
  10939. if (!$this->hasMetadataRepository($path)) {
  10940. throw new \RuntimeException('The .git directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  10941. }
  10942. $updateOriginUrl = false;
  10943. if (
  10944. 0 === $this->process->execute('git remote -v', $output, $path)
  10945. && preg_match('{^origin\s+(?P<url>\S+)}m', $output, $originMatch)
  10946. && preg_match('{^composer\s+(?P<url>\S+)}m', $output, $composerMatch)
  10947. ) {
  10948. if ($originMatch['url'] === $composerMatch['url'] && $composerMatch['url'] !== $target->getSourceUrl()) {
  10949. $updateOriginUrl = true;
  10950. }
  10951. }
  10952. $ref = $target->getSourceReference();
  10953. $this->io->writeError(" Checking out ".$this->getShortHash($ref));
  10954. $command = '(git remote set-url composer %s && git rev-parse --quiet --verify %s || (git fetch composer && git fetch --tags composer)) && git remote set-url composer %s';
  10955. $commandCallable = function ($url) use ($command, $ref) {
  10956. return sprintf(
  10957. $command,
  10958. ProcessExecutor::escape($url),
  10959. ProcessExecutor::escape($ref.'^{commit}'),
  10960. ProcessExecutor::escape(preg_replace('{://([^@]+?):(.+?)@}', '://', $url))
  10961. );
  10962. };
  10963. $this->gitUtil->runCommand($commandCallable, $url, $path);
  10964. if ($newRef = $this->updateToCommit($path, $ref, $target->getPrettyVersion(), $target->getReleaseDate())) {
  10965. if ($target->getDistReference() === $target->getSourceReference()) {
  10966. $target->setDistReference($newRef);
  10967. }
  10968. $target->setSourceReference($newRef);
  10969. }
  10970. if ($updateOriginUrl) {
  10971. $this->updateOriginUrl($path, $target->getSourceUrl());
  10972. }
  10973. }
  10974. public function getLocalChanges(PackageInterface $package, $path)
  10975. {
  10976. GitUtil::cleanEnv();
  10977. if (!$this->hasMetadataRepository($path)) {
  10978. return;
  10979. }
  10980. $command = 'git status --porcelain --untracked-files=no';
  10981. if (0 !== $this->process->execute($command, $output, $path)) {
  10982. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10983. }
  10984. return trim($output) ?: null;
  10985. }
  10986. public function getUnpushedChanges(PackageInterface $package, $path)
  10987. {
  10988. GitUtil::cleanEnv();
  10989. $path = $this->normalizePath($path);
  10990. if (!$this->hasMetadataRepository($path)) {
  10991. return;
  10992. }
  10993. $command = 'git show-ref --head -d';
  10994. if (0 !== $this->process->execute($command, $output, $path)) {
  10995. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10996. }
  10997. $refs = trim($output);
  10998. if (!preg_match('{^([a-f0-9]+) HEAD$}mi', $refs, $match)) {
  10999. return;
  11000. }
  11001. $headRef = $match[1];
  11002. if (!preg_match_all('{^'.$headRef.' refs/heads/(.+)$}mi', $refs, $matches)) {
  11003. return;
  11004. }
  11005. $branch = $matches[1][0];
  11006. $unpushedChanges = null;
  11007. for ($i = 0; $i <= 1; $i++) {
  11008. foreach ($matches[1] as $candidate) {
  11009. if (preg_match('{^[a-f0-9]+ refs/remotes/((?:composer|origin)/'.preg_quote($candidate).')$}mi', $refs, $match)) {
  11010. $branch = $candidate;
  11011. $remoteBranch = $match[1];
  11012. break;
  11013. }
  11014. }
  11015. if (!isset($remoteBranch)) {
  11016. $unpushedChanges = 'Branch ' . $branch . ' could not be found on the origin remote and appears to be unpushed';
  11017. } else {
  11018. $command = sprintf('git diff --name-status %s...%s --', $remoteBranch, $branch);
  11019. if (0 !== $this->process->execute($command, $output, $path)) {
  11020. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11021. }
  11022. $unpushedChanges = trim($output) ?: null;
  11023. }
  11024. if ($unpushedChanges && $i === 0) {
  11025. $this->process->execute('git fetch composer && git fetch origin', $output, $path);
  11026. }
  11027. if (!$unpushedChanges) {
  11028. break;
  11029. }
  11030. }
  11031. return $unpushedChanges;
  11032. }
  11033. protected function cleanChanges(PackageInterface $package, $path, $update)
  11034. {
  11035. GitUtil::cleanEnv();
  11036. $path = $this->normalizePath($path);
  11037. $unpushed = $this->getUnpushedChanges($package, $path);
  11038. if ($unpushed && ($this->io->isInteractive() || $this->config->get('discard-changes') !== true)) {
  11039. throw new \RuntimeException('Source directory ' . $path . ' has unpushed changes on the current branch: '."\n".$unpushed);
  11040. }
  11041. if (!$changes = $this->getLocalChanges($package, $path)) {
  11042. return;
  11043. }
  11044. if (!$this->io->isInteractive()) {
  11045. $discardChanges = $this->config->get('discard-changes');
  11046. if (true === $discardChanges) {
  11047. return $this->discardChanges($path);
  11048. }
  11049. if ('stash' === $discardChanges) {
  11050. if (!$update) {
  11051. return parent::cleanChanges($package, $path, $update);
  11052. }
  11053. return $this->stashChanges($path);
  11054. }
  11055. return parent::cleanChanges($package, $path, $update);
  11056. }
  11057. $changes = array_map(function ($elem) {
  11058. return ' '.$elem;
  11059. }, preg_split('{\s*\r?\n\s*}', $changes));
  11060. $this->io->writeError(' <error>The package has modified files:</error>');
  11061. $this->io->writeError(array_slice($changes, 0, 10));
  11062. if (count($changes) > 10) {
  11063. $this->io->writeError(' <info>' . (count($changes) - 10) . ' more files modified, choose "v" to view the full list</info>');
  11064. }
  11065. while (true) {
  11066. switch ($this->io->ask(' <info>Discard changes [y,n,v,d,'.($update ? 's,' : '').'?]?</info> ', '?')) {
  11067. case 'y':
  11068. $this->discardChanges($path);
  11069. break 2;
  11070. case 's':
  11071. if (!$update) {
  11072. goto help;
  11073. }
  11074. $this->stashChanges($path);
  11075. break 2;
  11076. case 'n':
  11077. throw new \RuntimeException('Update aborted');
  11078. case 'v':
  11079. $this->io->writeError($changes);
  11080. break;
  11081. case 'd':
  11082. $this->viewDiff($path);
  11083. break;
  11084. case '?':
  11085. default:
  11086. help:
  11087. $this->io->writeError(array(
  11088. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  11089. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  11090. ' v - view modified files',
  11091. ' d - view local modifications (diff)',
  11092. ));
  11093. if ($update) {
  11094. $this->io->writeError(' s - stash changes and try to reapply them after the update');
  11095. }
  11096. $this->io->writeError(' ? - print help');
  11097. break;
  11098. }
  11099. }
  11100. }
  11101. protected function reapplyChanges($path)
  11102. {
  11103. $path = $this->normalizePath($path);
  11104. if ($this->hasStashedChanges) {
  11105. $this->hasStashedChanges = false;
  11106. $this->io->writeError(' <info>Re-applying stashed changes</info>');
  11107. if (0 !== $this->process->execute('git stash pop', $output, $path)) {
  11108. throw new \RuntimeException("Failed to apply stashed changes:\n\n".$this->process->getErrorOutput());
  11109. }
  11110. }
  11111. $this->hasDiscardedChanges = false;
  11112. }
  11113. protected function updateToCommit($path, $reference, $branch, $date)
  11114. {
  11115. $force = $this->hasDiscardedChanges || $this->hasStashedChanges ? '-f ' : '';
  11116. $template = 'git checkout '.$force.'%s -- && git reset --hard %1$s --';
  11117. $branch = preg_replace('{(?:^dev-|(?:\.x)?-dev$)}i', '', $branch);
  11118. $branches = null;
  11119. if (0 === $this->process->execute('git branch -r', $output, $path)) {
  11120. $branches = $output;
  11121. }
  11122. $gitRef = $reference;
  11123. if (!preg_match('{^[a-f0-9]{40}$}', $reference)
  11124. && $branches
  11125. && preg_match('{^\s+composer/'.preg_quote($reference).'$}m', $branches)
  11126. ) {
  11127. $command = sprintf('git checkout '.$force.'-B %s %s -- && git reset --hard %2$s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$reference));
  11128. if (0 === $this->process->execute($command, $output, $path)) {
  11129. return;
  11130. }
  11131. }
  11132. if (preg_match('{^[a-f0-9]{40}$}', $reference)) {
  11133. if (!preg_match('{^\s+composer/'.preg_quote($branch).'$}m', $branches) && preg_match('{^\s+composer/v'.preg_quote($branch).'$}m', $branches)) {
  11134. $branch = 'v' . $branch;
  11135. }
  11136. $command = sprintf('git checkout %s --', ProcessExecutor::escape($branch));
  11137. $fallbackCommand = sprintf('git checkout '.$force.'-B %s %s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$branch));
  11138. if (0 === $this->process->execute($command, $output, $path)
  11139. || 0 === $this->process->execute($fallbackCommand, $output, $path)
  11140. ) {
  11141. $command = sprintf('git reset --hard %s --', ProcessExecutor::escape($reference));
  11142. if (0 === $this->process->execute($command, $output, $path)) {
  11143. return;
  11144. }
  11145. }
  11146. }
  11147. $command = sprintf($template, ProcessExecutor::escape($gitRef));
  11148. if (0 === $this->process->execute($command, $output, $path)) {
  11149. return;
  11150. }
  11151. if (false !== strpos($this->process->getErrorOutput(), $reference)) {
  11152. $this->io->writeError(' <warning>'.$reference.' is gone (history was rewritten?)</warning>');
  11153. }
  11154. throw new \RuntimeException(GitUtil::sanitizeUrl('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()));
  11155. }
  11156. protected function updateOriginUrl($path, $url)
  11157. {
  11158. $this->process->execute(sprintf('git remote set-url origin %s', ProcessExecutor::escape($url)), $output, $path);
  11159. $this->setPushUrl($path, $url);
  11160. }
  11161. protected function setPushUrl($path, $url)
  11162. {
  11163. if (preg_match('{^(?:https?|git)://'.GitUtil::getGitHubDomainsRegex($this->config).'/([^/]+)/([^/]+?)(?:\.git)?$}', $url, $match)) {
  11164. $protocols = $this->config->get('github-protocols');
  11165. $pushUrl = 'git@'.$match[1].':'.$match[2].'/'.$match[3].'.git';
  11166. if (!in_array('ssh', $protocols, true)) {
  11167. $pushUrl = 'https://' . $match[1] . '/'.$match[2].'/'.$match[3].'.git';
  11168. }
  11169. $cmd = sprintf('git remote set-url --push origin %s', ProcessExecutor::escape($pushUrl));
  11170. $this->process->execute($cmd, $ignoredOutput, $path);
  11171. }
  11172. }
  11173. protected function getCommitLogs($fromReference, $toReference, $path)
  11174. {
  11175. $path = $this->normalizePath($path);
  11176. $command = sprintf('git log %s..%s --pretty=format:"%%h - %%an: %%s"', ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference));
  11177. if (0 !== $this->process->execute($command, $output, $path)) {
  11178. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11179. }
  11180. return $output;
  11181. }
  11182. protected function discardChanges($path)
  11183. {
  11184. $path = $this->normalizePath($path);
  11185. if (0 !== $this->process->execute('git reset --hard', $output, $path)) {
  11186. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  11187. }
  11188. $this->hasDiscardedChanges = true;
  11189. }
  11190. protected function stashChanges($path)
  11191. {
  11192. $path = $this->normalizePath($path);
  11193. if (0 !== $this->process->execute('git stash --include-untracked', $output, $path)) {
  11194. throw new \RuntimeException("Could not stash changes\n\n:".$this->process->getErrorOutput());
  11195. }
  11196. $this->hasStashedChanges = true;
  11197. }
  11198. protected function viewDiff($path)
  11199. {
  11200. $path = $this->normalizePath($path);
  11201. if (0 !== $this->process->execute('git diff HEAD', $output, $path)) {
  11202. throw new \RuntimeException("Could not view diff\n\n:".$this->process->getErrorOutput());
  11203. }
  11204. $this->io->writeError($output);
  11205. }
  11206. protected function normalizePath($path)
  11207. {
  11208. if (Platform::isWindows() && strlen($path) > 0) {
  11209. $basePath = $path;
  11210. $removed = array();
  11211. while (!is_dir($basePath) && $basePath !== '\\') {
  11212. array_unshift($removed, basename($basePath));
  11213. $basePath = dirname($basePath);
  11214. }
  11215. if ($basePath === '\\') {
  11216. return $path;
  11217. }
  11218. $path = rtrim(realpath($basePath) . '/' . implode('/', $removed), '/');
  11219. }
  11220. return $path;
  11221. }
  11222. protected function hasMetadataRepository($path)
  11223. {
  11224. $path = $this->normalizePath($path);
  11225. return is_dir($path.'/.git');
  11226. }
  11227. protected function getShortHash($reference)
  11228. {
  11229. if (!$this->io->isVerbose() && preg_match('{^[0-9a-f]{40}$}', $reference)) {
  11230. return substr($reference, 0, 10);
  11231. }
  11232. return $reference;
  11233. }
  11234. }
  11235. <?php
  11236. namespace Composer\Downloader;
  11237. use Composer\Config;
  11238. use Composer\Cache;
  11239. use Composer\EventDispatcher\EventDispatcher;
  11240. use Composer\Package\PackageInterface;
  11241. use Composer\Util\Platform;
  11242. use Composer\Util\ProcessExecutor;
  11243. use Composer\Util\RemoteFilesystem;
  11244. use Composer\IO\IOInterface;
  11245. class GzipDownloader extends ArchiveDownloader
  11246. {
  11247. protected $process;
  11248. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  11249. {
  11250. $this->process = $process ?: new ProcessExecutor($io);
  11251. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  11252. }
  11253. protected function extract($file, $path)
  11254. {
  11255. $targetFilepath = $path . DIRECTORY_SEPARATOR . basename(substr($file, 0, -3));
  11256. if (!Platform::isWindows()) {
  11257. $command = 'gzip -cd ' . ProcessExecutor::escape($file) . ' > ' . ProcessExecutor::escape($targetFilepath);
  11258. if (0 === $this->process->execute($command, $ignoredOutput)) {
  11259. return;
  11260. }
  11261. if (extension_loaded('zlib')) {
  11262. $this->extractUsingExt($file, $targetFilepath);
  11263. return;
  11264. }
  11265. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  11266. throw new \RuntimeException($processError);
  11267. }
  11268. $this->extractUsingExt($file, $targetFilepath);
  11269. }
  11270. protected function getFileName(PackageInterface $package, $path)
  11271. {
  11272. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  11273. }
  11274. private function extractUsingExt($file, $targetFilepath)
  11275. {
  11276. $archiveFile = gzopen($file, 'rb');
  11277. $targetFile = fopen($targetFilepath, 'wb');
  11278. while ($string = gzread($archiveFile, 4096)) {
  11279. fwrite($targetFile, $string, Platform::strlen($string));
  11280. }
  11281. gzclose($archiveFile);
  11282. fclose($targetFile);
  11283. }
  11284. }
  11285. <?php
  11286. namespace Composer\Downloader;
  11287. use Composer\Package\PackageInterface;
  11288. use Composer\Util\ProcessExecutor;
  11289. use Composer\Util\Hg as HgUtils;
  11290. class HgDownloader extends VcsDownloader
  11291. {
  11292. public function doDownload(PackageInterface $package, $path, $url)
  11293. {
  11294. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  11295. $cloneCommand = function ($url) use ($path) {
  11296. return sprintf('hg clone %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($path));
  11297. };
  11298. $hgUtils->runCommand($cloneCommand, $url, $path);
  11299. $ref = ProcessExecutor::escape($package->getSourceReference());
  11300. $command = sprintf('hg up %s', $ref);
  11301. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  11302. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11303. }
  11304. }
  11305. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11306. {
  11307. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  11308. $ref = $target->getSourceReference();
  11309. $this->io->writeError(" Updating to ".$target->getSourceReference());
  11310. if (!$this->hasMetadataRepository($path)) {
  11311. throw new \RuntimeException('The .hg directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  11312. }
  11313. $command = function ($url) use ($ref) {
  11314. return sprintf('hg pull %s && hg up %s', ProcessExecutor::escape($url), ProcessExecutor::escape($ref));
  11315. };
  11316. $hgUtils->runCommand($command, $url, $path);
  11317. }
  11318. public function getLocalChanges(PackageInterface $package, $path)
  11319. {
  11320. if (!is_dir($path.'/.hg')) {
  11321. return null;
  11322. }
  11323. $this->process->execute('hg st', $output, realpath($path));
  11324. return trim($output) ?: null;
  11325. }
  11326. protected function getCommitLogs($fromReference, $toReference, $path)
  11327. {
  11328. $command = sprintf('hg log -r %s:%s --style compact', ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference));
  11329. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  11330. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11331. }
  11332. return $output;
  11333. }
  11334. protected function hasMetadataRepository($path)
  11335. {
  11336. return is_dir($path . '/.hg');
  11337. }
  11338. }
  11339. <?php
  11340. namespace Composer\Downloader;
  11341. use Composer\Package\Archiver\ArchivableFilesFinder;
  11342. use Composer\Package\Dumper\ArrayDumper;
  11343. use Composer\Package\PackageInterface;
  11344. use Composer\Package\Version\VersionGuesser;
  11345. use Composer\Package\Version\VersionParser;
  11346. use Composer\Util\Platform;
  11347. use Composer\Util\ProcessExecutor;
  11348. use Composer\Util\Filesystem as ComposerFilesystem;
  11349. use Symfony\Component\Filesystem\Exception\IOException;
  11350. use Symfony\Component\Filesystem\Filesystem;
  11351. class PathDownloader extends FileDownloader implements VcsCapableDownloaderInterface
  11352. {
  11353. const STRATEGY_SYMLINK = 10;
  11354. const STRATEGY_MIRROR = 20;
  11355. public function download(PackageInterface $package, $path, $output = true)
  11356. {
  11357. $url = $package->getDistUrl();
  11358. $realUrl = realpath($url);
  11359. if (false === $realUrl || !file_exists($realUrl) || !is_dir($realUrl)) {
  11360. throw new \RuntimeException(sprintf(
  11361. 'Source path "%s" is not found for package %s',
  11362. $url,
  11363. $package->getName()
  11364. ));
  11365. }
  11366. if (realpath($path) === $realUrl) {
  11367. if ($output) {
  11368. $this->io->writeError(sprintf(
  11369. ' - Installing <info>%s</info> (<comment>%s</comment>): Source already present',
  11370. $package->getName(),
  11371. $package->getFullPrettyVersion()
  11372. ));
  11373. }
  11374. return;
  11375. }
  11376. if (strpos(realpath($path) . DIRECTORY_SEPARATOR, $realUrl . DIRECTORY_SEPARATOR) === 0) {
  11377. throw new \RuntimeException(sprintf(
  11378. 'Package %s cannot install to "%s" inside its source at "%s"',
  11379. $package->getName(),
  11380. realpath($path),
  11381. $realUrl
  11382. ));
  11383. }
  11384. $transportOptions = $package->getTransportOptions() + array('symlink' => null);
  11385. $currentStrategy = self::STRATEGY_SYMLINK;
  11386. $allowedStrategies = array(self::STRATEGY_SYMLINK, self::STRATEGY_MIRROR);
  11387. $mirrorPathRepos = getenv('COMPOSER_MIRROR_PATH_REPOS');
  11388. if ($mirrorPathRepos) {
  11389. $currentStrategy = self::STRATEGY_MIRROR;
  11390. }
  11391. if (true === $transportOptions['symlink']) {
  11392. $currentStrategy = self::STRATEGY_SYMLINK;
  11393. $allowedStrategies = array(self::STRATEGY_SYMLINK);
  11394. } elseif (false === $transportOptions['symlink']) {
  11395. $currentStrategy = self::STRATEGY_MIRROR;
  11396. $allowedStrategies = array(self::STRATEGY_MIRROR);
  11397. }
  11398. if (Platform::isWindows() && self::STRATEGY_SYMLINK === $currentStrategy && !$this->safeJunctions()) {
  11399. $currentStrategy = self::STRATEGY_MIRROR;
  11400. $allowedStrategies = array(self::STRATEGY_MIRROR);
  11401. }
  11402. $fileSystem = new Filesystem();
  11403. $this->filesystem->removeDirectory($path);
  11404. if ($output) {
  11405. $this->io->writeError(sprintf(
  11406. ' - Installing <info>%s</info> (<comment>%s</comment>): ',
  11407. $package->getName(),
  11408. $package->getFullPrettyVersion()
  11409. ), false);
  11410. }
  11411. $isFallback = false;
  11412. if (self::STRATEGY_SYMLINK == $currentStrategy) {
  11413. try {
  11414. if (Platform::isWindows()) {
  11415. $this->io->writeError(sprintf('Junctioning from %s', $url), false);
  11416. $this->filesystem->junction($realUrl, $path);
  11417. } else {
  11418. $absolutePath = $path;
  11419. if (!$this->filesystem->isAbsolutePath($absolutePath)) {
  11420. $absolutePath = getcwd() . DIRECTORY_SEPARATOR . $path;
  11421. }
  11422. $shortestPath = $this->filesystem->findShortestPath($absolutePath, $realUrl);
  11423. $path = rtrim($path, "/");
  11424. $this->io->writeError(sprintf('Symlinking from %s', $url), false);
  11425. $fileSystem->symlink($shortestPath, $path);
  11426. }
  11427. } catch (IOException $e) {
  11428. if (in_array(self::STRATEGY_MIRROR, $allowedStrategies)) {
  11429. $this->io->writeError('');
  11430. $this->io->writeError(' <error>Symlink failed, fallback to use mirroring!</error>');
  11431. $currentStrategy = self::STRATEGY_MIRROR;
  11432. $isFallback = true;
  11433. } else {
  11434. throw new \RuntimeException(sprintf('Symlink from "%s" to "%s" failed!', $realUrl, $path));
  11435. }
  11436. }
  11437. }
  11438. if (self::STRATEGY_MIRROR == $currentStrategy) {
  11439. $fs = new ComposerFilesystem();
  11440. $realUrl = $fs->normalizePath($realUrl);
  11441. $this->io->writeError(sprintf('%sMirroring from %s', $isFallback ? ' ' : '', $url), false);
  11442. $iterator = new ArchivableFilesFinder($realUrl, array());
  11443. $fileSystem->mirror($realUrl, $path, $iterator);
  11444. }
  11445. $this->io->writeError('');
  11446. }
  11447. public function remove(PackageInterface $package, $path, $output = true)
  11448. {
  11449. $realUrl = realpath($package->getDistUrl());
  11450. if (realpath($path) === $realUrl) {
  11451. if ($output) {
  11452. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>), source is still present in $path");
  11453. }
  11454. return;
  11455. }
  11456. if (Platform::isWindows() && $this->filesystem->isJunction($path)) {
  11457. if ($output) {
  11458. $this->io->writeError(" - Removing junction for <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  11459. }
  11460. if (!$this->filesystem->removeJunction($path)) {
  11461. $this->io->writeError(" <warning>Could not remove junction at " . $path . " - is another process locking it?</warning>");
  11462. throw new \RuntimeException('Could not reliably remove junction for package ' . $package->getName());
  11463. }
  11464. } else {
  11465. parent::remove($package, $path, $output);
  11466. }
  11467. }
  11468. public function getVcsReference(PackageInterface $package, $path)
  11469. {
  11470. $parser = new VersionParser;
  11471. $guesser = new VersionGuesser($this->config, new ProcessExecutor($this->io), $parser);
  11472. $dumper = new ArrayDumper;
  11473. $packageConfig = $dumper->dump($package);
  11474. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  11475. return $packageVersion['commit'];
  11476. }
  11477. }
  11478. private function safeJunctions()
  11479. {
  11480. return function_exists('proc_open') &&
  11481. (PHP_WINDOWS_VERSION_MAJOR > 6 ||
  11482. (PHP_WINDOWS_VERSION_MAJOR === 6 && PHP_WINDOWS_VERSION_MINOR >= 1));
  11483. }
  11484. }
  11485. <?php
  11486. namespace Composer\Downloader;
  11487. use Composer\Util\Filesystem;
  11488. class PearPackageExtractor
  11489. {
  11490. private static $rolesWithoutPackageNamePrefix = array('php', 'script', 'www');
  11491. private $filesystem;
  11492. private $file;
  11493. public function __construct($file)
  11494. {
  11495. if (!is_file($file)) {
  11496. throw new \UnexpectedValueException('PEAR package file is not found at '.$file);
  11497. }
  11498. $this->filesystem = new Filesystem();
  11499. $this->file = $file;
  11500. }
  11501. public function extractTo($target, array $roles = array('php' => '/', 'script' => '/bin'), $vars = array())
  11502. {
  11503. $extractionPath = $target.'/tarball';
  11504. try {
  11505. $archive = new \PharData($this->file);
  11506. $archive->extractTo($extractionPath, null, true);
  11507. if (!is_file($this->combine($extractionPath, '/package.xml'))) {
  11508. throw new \RuntimeException('Invalid PEAR package. It must contain package.xml file.');
  11509. }
  11510. $fileCopyActions = $this->buildCopyActions($extractionPath, $roles, $vars);
  11511. $this->copyFiles($fileCopyActions, $extractionPath, $target, $roles, $vars);
  11512. $this->filesystem->removeDirectory($extractionPath);
  11513. } catch (\Exception $exception) {
  11514. throw new \UnexpectedValueException(sprintf('Failed to extract PEAR package %s to %s. Reason: %s', $this->file, $target, $exception->getMessage()), 0, $exception);
  11515. }
  11516. }
  11517. private function copyFiles($files, $source, $target, $roles, $vars)
  11518. {
  11519. foreach ($files as $file) {
  11520. $from = $this->combine($source, $file['from']);
  11521. $to = $this->combine($target, $roles[$file['role']]);
  11522. $to = $this->combine($to, $file['to']);
  11523. $tasks = $file['tasks'];
  11524. $this->copyFile($from, $to, $tasks, $vars);
  11525. }
  11526. }
  11527. private function copyFile($from, $to, $tasks, $vars)
  11528. {
  11529. if (!is_file($from)) {
  11530. throw new \RuntimeException('Invalid PEAR package. package.xml defines file that is not located inside tarball.');
  11531. }
  11532. $this->filesystem->ensureDirectoryExists(dirname($to));
  11533. if (0 == count($tasks)) {
  11534. $copied = copy($from, $to);
  11535. } else {
  11536. $content = file_get_contents($from);
  11537. $replacements = array();
  11538. foreach ($tasks as $task) {
  11539. $pattern = $task['from'];
  11540. $varName = $task['to'];
  11541. if (isset($vars[$varName])) {
  11542. if ($varName === 'php_bin' && false === strpos($to, '.bat')) {
  11543. $replacements[$pattern] = preg_replace('{\.bat$}', '', $vars[$varName]);
  11544. } else {
  11545. $replacements[$pattern] = $vars[$varName];
  11546. }
  11547. }
  11548. }
  11549. $content = strtr($content, $replacements);
  11550. $copied = file_put_contents($to, $content);
  11551. }
  11552. if (false === $copied) {
  11553. throw new \RuntimeException(sprintf('Failed to copy %s to %s', $from, $to));
  11554. }
  11555. }
  11556. private function buildCopyActions($source, array $roles, $vars)
  11557. {
  11558. $package = simplexml_load_string(file_get_contents($this->combine($source, 'package.xml')));
  11559. if (false === $package) {
  11560. throw new \RuntimeException('Package definition file is not valid.');
  11561. }
  11562. $packageSchemaVersion = $package['version'];
  11563. if ('1.0' == $packageSchemaVersion) {
  11564. $children = $package->release->filelist->children();
  11565. $packageName = (string) $package->name;
  11566. $packageVersion = (string) $package->release->version;
  11567. $sourceDir = $packageName . '-' . $packageVersion;
  11568. $result = $this->buildSourceList10($children, $roles, $sourceDir, '', null, $packageName);
  11569. } elseif ('2.0' == $packageSchemaVersion || '2.1' == $packageSchemaVersion) {
  11570. $children = $package->contents->children();
  11571. $packageName = (string) $package->name;
  11572. $packageVersion = (string) $package->version->release;
  11573. $sourceDir = $packageName . '-' . $packageVersion;
  11574. $result = $this->buildSourceList20($children, $roles, $sourceDir, '', null, $packageName);
  11575. $namespaces = $package->getNamespaces();
  11576. $package->registerXPathNamespace('ns', $namespaces['']);
  11577. $releaseNodes = $package->xpath('ns:phprelease');
  11578. $this->applyRelease($result, $releaseNodes, $vars);
  11579. } else {
  11580. throw new \RuntimeException('Unsupported schema version of package definition file.');
  11581. }
  11582. return $result;
  11583. }
  11584. private function applyRelease(&$actions, $releaseNodes, $vars)
  11585. {
  11586. foreach ($releaseNodes as $releaseNode) {
  11587. $requiredOs = $releaseNode->installconditions && $releaseNode->installconditions->os && $releaseNode->installconditions->os->name ? (string) $releaseNode->installconditions->os->name : '';
  11588. if ($requiredOs && $vars['os'] != $requiredOs) {
  11589. continue;
  11590. }
  11591. if ($releaseNode->filelist) {
  11592. foreach ($releaseNode->filelist->children() as $action) {
  11593. if ('install' == $action->getName()) {
  11594. $name = (string) $action['name'];
  11595. $as = (string) $action['as'];
  11596. if (isset($actions[$name])) {
  11597. $actions[$name]['to'] = $as;
  11598. }
  11599. } elseif ('ignore' == $action->getName()) {
  11600. $name = (string) $action['name'];
  11601. unset($actions[$name]);
  11602. } else {
  11603. }
  11604. }
  11605. }
  11606. break;
  11607. }
  11608. }
  11609. private function buildSourceList10($children, $targetRoles, $source, $target, $role, $packageName)
  11610. {
  11611. $result = array();
  11612. foreach ($children as $child) {
  11613. if ($child->getName() == 'dir') {
  11614. $dirSource = $this->combine($source, (string) $child['name']);
  11615. $dirTarget = $child['baseinstalldir'] ?: $target;
  11616. $dirRole = $child['role'] ?: $role;
  11617. $dirFiles = $this->buildSourceList10($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  11618. $result = array_merge($result, $dirFiles);
  11619. } elseif ($child->getName() == 'file') {
  11620. $fileRole = (string) $child['role'] ?: $role;
  11621. if (isset($targetRoles[$fileRole])) {
  11622. $fileName = (string) ($child['name'] ?: $child[0]);
  11623. $fileSource = $this->combine($source, $fileName);
  11624. $fileTarget = $this->combine((string) $child['baseinstalldir'] ?: $target, $fileName);
  11625. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  11626. $fileTarget = $packageName . '/' . $fileTarget;
  11627. }
  11628. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => array());
  11629. }
  11630. }
  11631. }
  11632. return $result;
  11633. }
  11634. private function buildSourceList20($children, $targetRoles, $source, $target, $role, $packageName)
  11635. {
  11636. $result = array();
  11637. foreach ($children as $child) {
  11638. if ('dir' == $child->getName()) {
  11639. $dirSource = $this->combine($source, $child['name']);
  11640. $dirTarget = $child['baseinstalldir'] ?: $target;
  11641. $dirRole = $child['role'] ?: $role;
  11642. $dirFiles = $this->buildSourceList20($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  11643. $result = array_merge($result, $dirFiles);
  11644. } elseif ('file' == $child->getName()) {
  11645. $fileRole = (string) $child['role'] ?: $role;
  11646. if (isset($targetRoles[$fileRole])) {
  11647. $fileSource = $this->combine($source, (string) $child['name']);
  11648. $fileTarget = $this->combine((string) ($child['baseinstalldir'] ?: $target), (string) $child['name']);
  11649. $fileTasks = array();
  11650. foreach ($child->children('http://pear.php.net/dtd/tasks-1.0') as $taskNode) {
  11651. if ('replace' == $taskNode->getName()) {
  11652. $fileTasks[] = array('from' => (string) $taskNode->attributes()->from, 'to' => (string) $taskNode->attributes()->to);
  11653. }
  11654. }
  11655. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  11656. $fileTarget = $packageName . '/' . $fileTarget;
  11657. }
  11658. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => $fileTasks);
  11659. }
  11660. }
  11661. }
  11662. return $result;
  11663. }
  11664. private function combine($left, $right)
  11665. {
  11666. return rtrim($left, '/') . '/' . ltrim($right, '/');
  11667. }
  11668. }
  11669. <?php
  11670. namespace Composer\Downloader;
  11671. use Composer\Package\PackageInterface;
  11672. use Composer\Repository\VcsRepository;
  11673. use Composer\Util\Perforce;
  11674. class PerforceDownloader extends VcsDownloader
  11675. {
  11676. protected $perforce;
  11677. public function doDownload(PackageInterface $package, $path, $url)
  11678. {
  11679. $ref = $package->getSourceReference();
  11680. $label = $this->getLabelFromSourceReference($ref);
  11681. $this->io->writeError('Cloning ' . $ref);
  11682. $this->initPerforce($package, $path, $url);
  11683. $this->perforce->setStream($ref);
  11684. $this->perforce->p4Login();
  11685. $this->perforce->writeP4ClientSpec();
  11686. $this->perforce->connectClient();
  11687. $this->perforce->syncCodeBase($label);
  11688. $this->perforce->cleanupClientSpec();
  11689. }
  11690. private function getLabelFromSourceReference($ref)
  11691. {
  11692. $pos = strpos($ref, '@');
  11693. if (false !== $pos) {
  11694. return substr($ref, $pos + 1);
  11695. }
  11696. return null;
  11697. }
  11698. public function initPerforce(PackageInterface $package, $path, $url)
  11699. {
  11700. if (!empty($this->perforce)) {
  11701. $this->perforce->initializePath($path);
  11702. return;
  11703. }
  11704. $repository = $package->getRepository();
  11705. $repoConfig = null;
  11706. if ($repository instanceof VcsRepository) {
  11707. $repoConfig = $this->getRepoConfig($repository);
  11708. }
  11709. $this->perforce = Perforce::create($repoConfig, $url, $path, $this->process, $this->io);
  11710. }
  11711. private function getRepoConfig(VcsRepository $repository)
  11712. {
  11713. return $repository->getRepoConfig();
  11714. }
  11715. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11716. {
  11717. $this->doDownload($target, $path, $url);
  11718. }
  11719. public function getLocalChanges(PackageInterface $package, $path)
  11720. {
  11721. $this->io->writeError('Perforce driver does not check for local changes before overriding', true);
  11722. }
  11723. protected function getCommitLogs($fromReference, $toReference, $path)
  11724. {
  11725. return $this->perforce->getCommitLogs($fromReference, $toReference);
  11726. }
  11727. public function setPerforce($perforce)
  11728. {
  11729. $this->perforce = $perforce;
  11730. }
  11731. protected function hasMetadataRepository($path)
  11732. {
  11733. return true;
  11734. }
  11735. }
  11736. <?php
  11737. namespace Composer\Downloader;
  11738. class PharDownloader extends ArchiveDownloader
  11739. {
  11740. protected function extract($file, $path)
  11741. {
  11742. $archive = new \Phar($file);
  11743. $archive->extractTo($path, null, true);
  11744. }
  11745. }
  11746. <?php
  11747. namespace Composer\Downloader;
  11748. use Composer\Config;
  11749. use Composer\Cache;
  11750. use Composer\EventDispatcher\EventDispatcher;
  11751. use Composer\Util\IniHelper;
  11752. use Composer\Util\Platform;
  11753. use Composer\Util\ProcessExecutor;
  11754. use Composer\Util\RemoteFilesystem;
  11755. use Composer\IO\IOInterface;
  11756. use RarArchive;
  11757. class RarDownloader extends ArchiveDownloader
  11758. {
  11759. protected $process;
  11760. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  11761. {
  11762. $this->process = $process ?: new ProcessExecutor($io);
  11763. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  11764. }
  11765. protected function extract($file, $path)
  11766. {
  11767. $processError = null;
  11768. if (!Platform::isWindows()) {
  11769. $command = 'unrar x ' . ProcessExecutor::escape($file) . ' ' . ProcessExecutor::escape($path) . ' >/dev/null && chmod -R u+w ' . ProcessExecutor::escape($path);
  11770. if (0 === $this->process->execute($command, $ignoredOutput)) {
  11771. return;
  11772. }
  11773. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  11774. }
  11775. if (!class_exists('RarArchive')) {
  11776. $iniMessage = IniHelper::getMessage();
  11777. $error = "Could not decompress the archive, enable the PHP rar extension or install unrar.\n"
  11778. . $iniMessage . "\n" . $processError;
  11779. if (!Platform::isWindows()) {
  11780. $error = "Could not decompress the archive, enable the PHP rar extension.\n" . $iniMessage;
  11781. }
  11782. throw new \RuntimeException($error);
  11783. }
  11784. $rarArchive = RarArchive::open($file);
  11785. if (false === $rarArchive) {
  11786. throw new \UnexpectedValueException('Could not open RAR archive: ' . $file);
  11787. }
  11788. $entries = $rarArchive->getEntries();
  11789. if (false === $entries) {
  11790. throw new \RuntimeException('Could not retrieve RAR archive entries');
  11791. }
  11792. foreach ($entries as $entry) {
  11793. if (false === $entry->extract($path)) {
  11794. throw new \RuntimeException('Could not extract entry');
  11795. }
  11796. }
  11797. $rarArchive->close();
  11798. }
  11799. }
  11800. <?php
  11801. namespace Composer\Downloader;
  11802. use Composer\Package\PackageInterface;
  11803. use Composer\Util\Svn as SvnUtil;
  11804. use Composer\Repository\VcsRepository;
  11805. use Composer\Util\ProcessExecutor;
  11806. class SvnDownloader extends VcsDownloader
  11807. {
  11808. protected $cacheCredentials = true;
  11809. public function doDownload(PackageInterface $package, $path, $url)
  11810. {
  11811. SvnUtil::cleanEnv();
  11812. $ref = $package->getSourceReference();
  11813. $repo = $package->getRepository();
  11814. if ($repo instanceof VcsRepository) {
  11815. $repoConfig = $repo->getRepoConfig();
  11816. if (array_key_exists('svn-cache-credentials', $repoConfig)) {
  11817. $this->cacheCredentials = (bool) $repoConfig['svn-cache-credentials'];
  11818. }
  11819. }
  11820. $this->io->writeError(" Checking out ".$package->getSourceReference());
  11821. $this->execute($url, "svn co", sprintf("%s/%s", $url, $ref), null, $path);
  11822. }
  11823. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11824. {
  11825. SvnUtil::cleanEnv();
  11826. $ref = $target->getSourceReference();
  11827. if (!$this->hasMetadataRepository($path)) {
  11828. throw new \RuntimeException('The .svn directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  11829. }
  11830. $util = new SvnUtil($url, $this->io, $this->config);
  11831. $flags = "";
  11832. if (version_compare($util->binaryVersion(), '1.7.0', '>=')) {
  11833. $flags .= ' --ignore-ancestry';
  11834. }
  11835. $this->io->writeError(" Checking out " . $ref);
  11836. $this->execute($url, "svn switch" . $flags, sprintf("%s/%s", $url, $ref), $path);
  11837. }
  11838. public function getLocalChanges(PackageInterface $package, $path)
  11839. {
  11840. if (!$this->hasMetadataRepository($path)) {
  11841. return null;
  11842. }
  11843. $this->process->execute('svn status --ignore-externals', $output, $path);
  11844. return preg_match('{^ *[^X ] +}m', $output) ? $output : null;
  11845. }
  11846. protected function execute($baseUrl, $command, $url, $cwd = null, $path = null)
  11847. {
  11848. $util = new SvnUtil($baseUrl, $this->io, $this->config);
  11849. $util->setCacheCredentials($this->cacheCredentials);
  11850. try {
  11851. return $util->execute($command, $url, $cwd, $path, $this->io->isVerbose());
  11852. } catch (\RuntimeException $e) {
  11853. throw new \RuntimeException(
  11854. 'Package could not be downloaded, '.$e->getMessage()
  11855. );
  11856. }
  11857. }
  11858. protected function cleanChanges(PackageInterface $package, $path, $update)
  11859. {
  11860. if (!$changes = $this->getLocalChanges($package, $path)) {
  11861. return;
  11862. }
  11863. if (!$this->io->isInteractive()) {
  11864. if (true === $this->config->get('discard-changes')) {
  11865. return $this->discardChanges($path);
  11866. }
  11867. return parent::cleanChanges($package, $path, $update);
  11868. }
  11869. $changes = array_map(function ($elem) {
  11870. return ' '.$elem;
  11871. }, preg_split('{\s*\r?\n\s*}', $changes));
  11872. $countChanges = count($changes);
  11873. $this->io->writeError(sprintf(' <error>The package has modified file%s:</error>', $countChanges === 1 ? '' : 's'));
  11874. $this->io->writeError(array_slice($changes, 0, 10));
  11875. if ($countChanges > 10) {
  11876. $remaingChanges = $countChanges - 10;
  11877. $this->io->writeError(
  11878. sprintf(
  11879. ' <info>'.$remaingChanges.' more file%s modified, choose "v" to view the full list</info>',
  11880. $remaingChanges === 1 ? '' : 's'
  11881. )
  11882. );
  11883. }
  11884. while (true) {
  11885. switch ($this->io->ask(' <info>Discard changes [y,n,v,?]?</info> ', '?')) {
  11886. case 'y':
  11887. $this->discardChanges($path);
  11888. break 2;
  11889. case 'n':
  11890. throw new \RuntimeException('Update aborted');
  11891. case 'v':
  11892. $this->io->writeError($changes);
  11893. break;
  11894. case '?':
  11895. default:
  11896. $this->io->writeError(array(
  11897. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  11898. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  11899. ' v - view modified files',
  11900. ' ? - print help',
  11901. ));
  11902. break;
  11903. }
  11904. }
  11905. }
  11906. protected function getCommitLogs($fromReference, $toReference, $path)
  11907. {
  11908. if (preg_match('{.*@(\d+)$}', $fromReference) && preg_match('{.*@(\d+)$}', $toReference)) {
  11909. $command = sprintf('svn info --non-interactive --xml %s', ProcessExecutor::escape($path));
  11910. if (0 !== $this->process->execute($command, $output, $path)) {
  11911. throw new \RuntimeException(
  11912. 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()
  11913. );
  11914. }
  11915. $urlPattern = '#<url>(.*)</url>#';
  11916. if (preg_match($urlPattern, $output, $matches)) {
  11917. $baseUrl = $matches[1];
  11918. } else {
  11919. throw new \RuntimeException(
  11920. 'Unable to determine svn url for path '. $path
  11921. );
  11922. }
  11923. $fromRevision = preg_replace('{.*@(\d+)$}', '$1', $fromReference);
  11924. $toRevision = preg_replace('{.*@(\d+)$}', '$1', $toReference);
  11925. $command = sprintf('svn log -r%s:%s --incremental', ProcessExecutor::escape($fromRevision), ProcessExecutor::escape($toRevision));
  11926. $util = new SvnUtil($baseUrl, $this->io, $this->config);
  11927. $util->setCacheCredentials($this->cacheCredentials);
  11928. try {
  11929. return $util->executeLocal($command, $path, null, $this->io->isVerbose());
  11930. } catch (\RuntimeException $e) {
  11931. throw new \RuntimeException(
  11932. 'Failed to execute ' . $command . "\n\n".$e->getMessage()
  11933. );
  11934. }
  11935. }
  11936. return "Could not retrieve changes between $fromReference and $toReference due to missing revision information";
  11937. }
  11938. protected function discardChanges($path)
  11939. {
  11940. if (0 !== $this->process->execute('svn revert -R .', $output, $path)) {
  11941. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  11942. }
  11943. }
  11944. protected function hasMetadataRepository($path)
  11945. {
  11946. return is_dir($path.'/.svn');
  11947. }
  11948. }
  11949. <?php
  11950. namespace Composer\Downloader;
  11951. class TarDownloader extends ArchiveDownloader
  11952. {
  11953. protected function extract($file, $path)
  11954. {
  11955. $archive = new \PharData($file);
  11956. $archive->extractTo($path, null, true);
  11957. }
  11958. }
  11959. <?php
  11960. namespace Composer\Downloader;
  11961. class TransportException extends \RuntimeException
  11962. {
  11963. protected $headers;
  11964. protected $response;
  11965. protected $statusCode;
  11966. public function setHeaders($headers)
  11967. {
  11968. $this->headers = $headers;
  11969. }
  11970. public function getHeaders()
  11971. {
  11972. return $this->headers;
  11973. }
  11974. public function setResponse($response)
  11975. {
  11976. $this->response = $response;
  11977. }
  11978. public function getResponse()
  11979. {
  11980. return $this->response;
  11981. }
  11982. public function setStatusCode($statusCode)
  11983. {
  11984. $this->statusCode = $statusCode;
  11985. }
  11986. public function getStatusCode()
  11987. {
  11988. return $this->statusCode;
  11989. }
  11990. }
  11991. <?php
  11992. namespace Composer\Downloader;
  11993. use Composer\Package\PackageInterface;
  11994. interface VcsCapableDownloaderInterface
  11995. {
  11996. public function getVcsReference(PackageInterface $package, $path);
  11997. }
  11998. <?php
  11999. namespace Composer\Downloader;
  12000. use Composer\Config;
  12001. use Composer\Package\Dumper\ArrayDumper;
  12002. use Composer\Package\PackageInterface;
  12003. use Composer\Package\Version\VersionGuesser;
  12004. use Composer\Package\Version\VersionParser;
  12005. use Composer\Util\ProcessExecutor;
  12006. use Composer\IO\IOInterface;
  12007. use Composer\Util\Filesystem;
  12008. abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterface, VcsCapableDownloaderInterface
  12009. {
  12010. protected $io;
  12011. protected $config;
  12012. protected $process;
  12013. protected $filesystem;
  12014. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  12015. {
  12016. $this->io = $io;
  12017. $this->config = $config;
  12018. $this->process = $process ?: new ProcessExecutor($io);
  12019. $this->filesystem = $fs ?: new Filesystem($this->process);
  12020. }
  12021. public function getInstallationSource()
  12022. {
  12023. return 'source';
  12024. }
  12025. public function download(PackageInterface $package, $path)
  12026. {
  12027. if (!$package->getSourceReference()) {
  12028. throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
  12029. }
  12030. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>): ", false);
  12031. $this->filesystem->emptyDirectory($path);
  12032. $urls = $package->getSourceUrls();
  12033. while ($url = array_shift($urls)) {
  12034. try {
  12035. if (Filesystem::isLocalPath($url)) {
  12036. $needle = 'file://';
  12037. $isFileProtocol = false;
  12038. if (0 === strpos($url, $needle)) {
  12039. $url = substr($url, strlen($needle));
  12040. $isFileProtocol = true;
  12041. }
  12042. if (false !== strpos($url, '%')) {
  12043. $url = rawurldecode($url);
  12044. }
  12045. $url = realpath($url);
  12046. if ($isFileProtocol) {
  12047. $url = $needle . $url;
  12048. }
  12049. }
  12050. $this->doDownload($package, $path, $url);
  12051. break;
  12052. } catch (\Exception $e) {
  12053. if ($e instanceof \PHPUnit_Framework_Exception) {
  12054. throw $e;
  12055. }
  12056. if ($this->io->isDebug()) {
  12057. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getMessage());
  12058. } elseif (count($urls)) {
  12059. $this->io->writeError(' Failed, trying the next URL');
  12060. }
  12061. if (!count($urls)) {
  12062. throw $e;
  12063. }
  12064. }
  12065. }
  12066. }
  12067. public function update(PackageInterface $initial, PackageInterface $target, $path)
  12068. {
  12069. if (!$target->getSourceReference()) {
  12070. throw new \InvalidArgumentException('Package '.$target->getPrettyName().' is missing reference information');
  12071. }
  12072. $name = $target->getName();
  12073. if ($initial->getPrettyVersion() == $target->getPrettyVersion()) {
  12074. if ($target->getSourceType() === 'svn') {
  12075. $from = $initial->getSourceReference();
  12076. $to = $target->getSourceReference();
  12077. } else {
  12078. $from = substr($initial->getSourceReference(), 0, 7);
  12079. $to = substr($target->getSourceReference(), 0, 7);
  12080. }
  12081. $name .= ' '.$initial->getPrettyVersion();
  12082. } else {
  12083. $from = $initial->getFullPrettyVersion();
  12084. $to = $target->getFullPrettyVersion();
  12085. }
  12086. $actionName = VersionParser::isUpgrade($initial->getVersion(), $target->getVersion()) ? 'Updating' : 'Downgrading';
  12087. $this->io->writeError(" - " . $actionName . " <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>): ", false);
  12088. $this->cleanChanges($initial, $path, true);
  12089. $urls = $target->getSourceUrls();
  12090. $exception = null;
  12091. while ($url = array_shift($urls)) {
  12092. try {
  12093. if (Filesystem::isLocalPath($url)) {
  12094. $url = realpath($url);
  12095. }
  12096. $this->doUpdate($initial, $target, $path, $url);
  12097. $exception = null;
  12098. break;
  12099. } catch (\Exception $exception) {
  12100. if ($exception instanceof \PHPUnit_Framework_Exception) {
  12101. throw $exception;
  12102. }
  12103. if ($this->io->isDebug()) {
  12104. $this->io->writeError('Failed: ['.get_class($exception).'] '.$exception->getMessage());
  12105. } elseif (count($urls)) {
  12106. $this->io->writeError(' Failed, trying the next URL');
  12107. }
  12108. }
  12109. }
  12110. $this->reapplyChanges($path);
  12111. if (!$exception && $this->io->isVerbose() && $this->hasMetadataRepository($path)) {
  12112. $message = 'Pulling in changes:';
  12113. $logs = $this->getCommitLogs($initial->getSourceReference(), $target->getSourceReference(), $path);
  12114. if (!trim($logs)) {
  12115. $message = 'Rolling back changes:';
  12116. $logs = $this->getCommitLogs($target->getSourceReference(), $initial->getSourceReference(), $path);
  12117. }
  12118. if (trim($logs)) {
  12119. $logs = implode("\n", array_map(function ($line) {
  12120. return ' ' . $line;
  12121. }, explode("\n", $logs)));
  12122. $logs = str_replace('<', '\<', $logs);
  12123. $this->io->writeError(' '.$message);
  12124. $this->io->writeError($logs);
  12125. }
  12126. }
  12127. if (!$urls && $exception) {
  12128. throw $exception;
  12129. }
  12130. }
  12131. public function remove(PackageInterface $package, $path)
  12132. {
  12133. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getPrettyVersion() . "</comment>)");
  12134. $this->cleanChanges($package, $path, false);
  12135. if (!$this->filesystem->removeDirectory($path)) {
  12136. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  12137. }
  12138. }
  12139. public function setOutputProgress($outputProgress)
  12140. {
  12141. return $this;
  12142. }
  12143. public function getVcsReference(PackageInterface $package, $path)
  12144. {
  12145. $parser = new VersionParser;
  12146. $guesser = new VersionGuesser($this->config, $this->process, $parser);
  12147. $dumper = new ArrayDumper;
  12148. $packageConfig = $dumper->dump($package);
  12149. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  12150. return $packageVersion['commit'];
  12151. }
  12152. }
  12153. protected function cleanChanges(PackageInterface $package, $path, $update)
  12154. {
  12155. if (null !== $this->getLocalChanges($package, $path)) {
  12156. throw new \RuntimeException('Source directory ' . $path . ' has uncommitted changes.');
  12157. }
  12158. }
  12159. protected function reapplyChanges($path)
  12160. {
  12161. }
  12162. abstract protected function doDownload(PackageInterface $package, $path, $url);
  12163. abstract protected function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url);
  12164. abstract protected function getCommitLogs($fromReference, $toReference, $path);
  12165. abstract protected function hasMetadataRepository($path);
  12166. }
  12167. <?php
  12168. namespace Composer\Downloader;
  12169. use Composer\Config;
  12170. use Composer\Cache;
  12171. use Composer\EventDispatcher\EventDispatcher;
  12172. use Composer\Package\PackageInterface;
  12173. use Composer\Util\ProcessExecutor;
  12174. use Composer\Util\RemoteFilesystem;
  12175. use Composer\IO\IOInterface;
  12176. class XzDownloader extends ArchiveDownloader
  12177. {
  12178. protected $process;
  12179. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  12180. {
  12181. $this->process = $process ?: new ProcessExecutor($io);
  12182. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  12183. }
  12184. protected function extract($file, $path)
  12185. {
  12186. $command = 'tar -xJf ' . ProcessExecutor::escape($file) . ' -C ' . ProcessExecutor::escape($path);
  12187. if (0 === $this->process->execute($command, $ignoredOutput)) {
  12188. return;
  12189. }
  12190. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  12191. throw new \RuntimeException($processError);
  12192. }
  12193. protected function getFileName(PackageInterface $package, $path)
  12194. {
  12195. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  12196. }
  12197. }
  12198. <?php
  12199. namespace Composer\Downloader;
  12200. use Composer\Config;
  12201. use Composer\Cache;
  12202. use Composer\EventDispatcher\EventDispatcher;
  12203. use Composer\Package\PackageInterface;
  12204. use Composer\Util\IniHelper;
  12205. use Composer\Util\Platform;
  12206. use Composer\Util\ProcessExecutor;
  12207. use Composer\Util\RemoteFilesystem;
  12208. use Composer\IO\IOInterface;
  12209. use Symfony\Component\Process\ExecutableFinder;
  12210. use ZipArchive;
  12211. class ZipDownloader extends ArchiveDownloader
  12212. {
  12213. protected static $hasSystemUnzip;
  12214. private static $hasZipArchive;
  12215. private static $isWindows;
  12216. protected $process;
  12217. private $zipArchiveObject;
  12218. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  12219. {
  12220. $this->process = $process ?: new ProcessExecutor($io);
  12221. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  12222. }
  12223. public function download(PackageInterface $package, $path, $output = true)
  12224. {
  12225. if (null === self::$hasSystemUnzip) {
  12226. $finder = new ExecutableFinder;
  12227. self::$hasSystemUnzip = (bool) $finder->find('unzip');
  12228. }
  12229. if (null === self::$hasZipArchive) {
  12230. self::$hasZipArchive = class_exists('ZipArchive');
  12231. }
  12232. if (!self::$hasZipArchive && !self::$hasSystemUnzip) {
  12233. $iniMessage = IniHelper::getMessage();
  12234. $error = "The zip extension and unzip command are both missing, skipping.\n" . $iniMessage;
  12235. throw new \RuntimeException($error);
  12236. }
  12237. if (null === self::$isWindows) {
  12238. self::$isWindows = Platform::isWindows();
  12239. if (!self::$isWindows && !self::$hasSystemUnzip) {
  12240. $this->io->writeError("<warning>As there is no 'unzip' command installed zip files are being unpacked using the PHP zip extension.</warning>");
  12241. $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>");
  12242. $this->io->writeError("<warning>Installing 'unzip' may remediate them.</warning>");
  12243. }
  12244. }
  12245. return parent::download($package, $path, $output);
  12246. }
  12247. protected function extractWithSystemUnzip($file, $path, $isLastChance)
  12248. {
  12249. if (!self::$hasZipArchive) {
  12250. $isLastChance = true;
  12251. }
  12252. if (!self::$hasSystemUnzip && !$isLastChance) {
  12253. return $this->extractWithZipArchive($file, $path, true);
  12254. }
  12255. $processError = null;
  12256. $overwrite = $isLastChance ? '-o' : '';
  12257. $command = 'unzip -qq '.$overwrite.' '.ProcessExecutor::escape($file).' -d '.ProcessExecutor::escape($path);
  12258. try {
  12259. if (0 === $this->process->execute($command, $ignoredOutput)) {
  12260. return true;
  12261. }
  12262. $processError = new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  12263. } catch (\Exception $e) {
  12264. $processError = $e;
  12265. }
  12266. if ($isLastChance) {
  12267. throw $processError;
  12268. }
  12269. $this->io->writeError(' '.$processError->getMessage());
  12270. $this->io->writeError(' The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems)');
  12271. $this->io->writeError(' Unzip with unzip command failed, falling back to ZipArchive class');
  12272. return $this->extractWithZipArchive($file, $path, true);
  12273. }
  12274. protected function extractWithZipArchive($file, $path, $isLastChance)
  12275. {
  12276. if (!self::$hasSystemUnzip) {
  12277. $isLastChance = true;
  12278. }
  12279. if (!self::$hasZipArchive && !$isLastChance) {
  12280. return $this->extractWithSystemUnzip($file, $path, true);
  12281. }
  12282. $processError = null;
  12283. $zipArchive = $this->zipArchiveObject ?: new ZipArchive();
  12284. try {
  12285. if (true === ($retval = $zipArchive->open($file))) {
  12286. $extractResult = $zipArchive->extractTo($path);
  12287. if (true === $extractResult) {
  12288. $zipArchive->close();
  12289. return true;
  12290. }
  12291. $processError = new \RuntimeException(rtrim("There was an error extracting the ZIP file, it is either corrupted or using an invalid format.\n"));
  12292. } else {
  12293. $processError = new \UnexpectedValueException(rtrim($this->getErrorMessage($retval, $file)."\n"), $retval);
  12294. }
  12295. } catch (\ErrorException $e) {
  12296. $processError = new \RuntimeException('The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems): '.$e->getMessage(), 0, $e);
  12297. } catch (\Exception $e) {
  12298. $processError = $e;
  12299. }
  12300. if ($isLastChance) {
  12301. throw $processError;
  12302. }
  12303. $this->io->writeError(' '.$processError->getMessage());
  12304. $this->io->writeError(' Unzip with ZipArchive class failed, falling back to unzip command');
  12305. return $this->extractWithSystemUnzip($file, $path, true);
  12306. }
  12307. public function extract($file, $path)
  12308. {
  12309. if (self::$isWindows) {
  12310. $this->extractWithZipArchive($file, $path, false);
  12311. } else {
  12312. $this->extractWithSystemUnzip($file, $path, false);
  12313. }
  12314. }
  12315. protected function getErrorMessage($retval, $file)
  12316. {
  12317. switch ($retval) {
  12318. case ZipArchive::ER_EXISTS:
  12319. return sprintf("File '%s' already exists.", $file);
  12320. case ZipArchive::ER_INCONS:
  12321. return sprintf("Zip archive '%s' is inconsistent.", $file);
  12322. case ZipArchive::ER_INVAL:
  12323. return sprintf("Invalid argument (%s)", $file);
  12324. case ZipArchive::ER_MEMORY:
  12325. return sprintf("Malloc failure (%s)", $file);
  12326. case ZipArchive::ER_NOENT:
  12327. return sprintf("No such zip file: '%s'", $file);
  12328. case ZipArchive::ER_NOZIP:
  12329. return sprintf("'%s' is not a zip archive.", $file);
  12330. case ZipArchive::ER_OPEN:
  12331. return sprintf("Can't open zip file: %s", $file);
  12332. case ZipArchive::ER_READ:
  12333. return sprintf("Zip read error (%s)", $file);
  12334. case ZipArchive::ER_SEEK:
  12335. return sprintf("Zip seek error (%s)", $file);
  12336. default:
  12337. return sprintf("'%s' is not a valid zip archive, got error code: %s", $file, $retval);
  12338. }
  12339. }
  12340. }
  12341. <?php
  12342. namespace Composer\EventDispatcher;
  12343. class Event
  12344. {
  12345. protected $name;
  12346. protected $args;
  12347. protected $flags;
  12348. private $propagationStopped = false;
  12349. public function __construct($name, array $args = array(), array $flags = array())
  12350. {
  12351. $this->name = $name;
  12352. $this->args = $args;
  12353. $this->flags = $flags;
  12354. }
  12355. public function getName()
  12356. {
  12357. return $this->name;
  12358. }
  12359. public function getArguments()
  12360. {
  12361. return $this->args;
  12362. }
  12363. public function getFlags()
  12364. {
  12365. return $this->flags;
  12366. }
  12367. public function isPropagationStopped()
  12368. {
  12369. return $this->propagationStopped;
  12370. }
  12371. public function stopPropagation()
  12372. {
  12373. $this->propagationStopped = true;
  12374. }
  12375. }
  12376. <?php
  12377. namespace Composer\EventDispatcher;
  12378. use Composer\DependencyResolver\PolicyInterface;
  12379. use Composer\DependencyResolver\Pool;
  12380. use Composer\DependencyResolver\Request;
  12381. use Composer\Installer\InstallerEvent;
  12382. use Composer\IO\IOInterface;
  12383. use Composer\Composer;
  12384. use Composer\DependencyResolver\Operation\OperationInterface;
  12385. use Composer\Repository\CompositeRepository;
  12386. use Composer\Script;
  12387. use Composer\Installer\PackageEvent;
  12388. use Composer\Installer\BinaryInstaller;
  12389. use Composer\Util\ProcessExecutor;
  12390. use Composer\Script\Event as ScriptEvent;
  12391. use Symfony\Component\Process\PhpExecutableFinder;
  12392. class EventDispatcher
  12393. {
  12394. protected $composer;
  12395. protected $io;
  12396. protected $loader;
  12397. protected $process;
  12398. protected $listeners;
  12399. private $eventStack;
  12400. public function __construct(Composer $composer, IOInterface $io, ProcessExecutor $process = null)
  12401. {
  12402. $this->composer = $composer;
  12403. $this->io = $io;
  12404. $this->process = $process ?: new ProcessExecutor($io);
  12405. $this->eventStack = array();
  12406. }
  12407. public function dispatch($eventName, Event $event = null)
  12408. {
  12409. if (null === $event) {
  12410. $event = new Event($eventName);
  12411. }
  12412. return $this->doDispatch($event);
  12413. }
  12414. public function dispatchScript($eventName, $devMode = false, $additionalArgs = array(), $flags = array())
  12415. {
  12416. return $this->doDispatch(new Script\Event($eventName, $this->composer, $this->io, $devMode, $additionalArgs, $flags));
  12417. }
  12418. public function dispatchPackageEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  12419. {
  12420. return $this->doDispatch(new PackageEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations, $operation));
  12421. }
  12422. public function dispatchInstallerEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  12423. {
  12424. return $this->doDispatch(new InstallerEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations));
  12425. }
  12426. protected function doDispatch(Event $event)
  12427. {
  12428. $pathStr = 'PATH';
  12429. if (!isset($_SERVER[$pathStr]) && isset($_SERVER['Path'])) {
  12430. $pathStr = 'Path';
  12431. }
  12432. $binDir = $this->composer->getConfig()->get('bin-dir');
  12433. if (is_dir($binDir)) {
  12434. $binDir = realpath($binDir);
  12435. if (isset($_SERVER[$pathStr]) && !preg_match('{(^|'.PATH_SEPARATOR.')'.preg_quote($binDir).'($|'.PATH_SEPARATOR.')}', $_SERVER[$pathStr])) {
  12436. $_SERVER[$pathStr] = $binDir.PATH_SEPARATOR.getenv($pathStr);
  12437. putenv($pathStr.'='.$_SERVER[$pathStr]);
  12438. }
  12439. }
  12440. $listeners = $this->getListeners($event);
  12441. $this->pushEvent($event);
  12442. $return = 0;
  12443. foreach ($listeners as $callable) {
  12444. if (!is_string($callable)) {
  12445. if (!is_callable($callable)) {
  12446. $className = is_object($callable[0]) ? get_class($callable[0]) : $callable[0];
  12447. throw new \RuntimeException('Subscriber '.$className.'::'.$callable[1].' for event '.$event->getName().' is not callable, make sure the function is defined and public');
  12448. }
  12449. $event = $this->checkListenerExpectedEvent($callable, $event);
  12450. $return = false === call_user_func($callable, $event) ? 1 : 0;
  12451. } elseif ($this->isComposerScript($callable)) {
  12452. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $callable), true, IOInterface::VERBOSE);
  12453. $script = explode(' ', substr($callable, 1));
  12454. $scriptName = $script[0];
  12455. unset($script[0]);
  12456. $args = array_merge($script, $event->getArguments());
  12457. $flags = $event->getFlags();
  12458. if (substr($callable, 0, 10) === '@composer ') {
  12459. $exec = $this->getPhpExecCommand() . ' ' . ProcessExecutor::escape(getenv('COMPOSER_BINARY')) . substr($callable, 9);
  12460. if (0 !== ($exitCode = $this->process->execute($exec))) {
  12461. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  12462. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  12463. }
  12464. } else {
  12465. if (!$this->getListeners(new Event($scriptName))) {
  12466. $this->io->writeError(sprintf('<warning>You made a reference to a non-existent script %s</warning>', $callable), true, IOInterface::QUIET);
  12467. }
  12468. try {
  12469. $scriptEvent = new Script\Event($scriptName, $event->getComposer(), $event->getIO(), $event->isDevMode(), $args, $flags);
  12470. $scriptEvent->setOriginatingEvent($event);
  12471. $return = $this->dispatch($scriptName, $scriptEvent);
  12472. } catch (ScriptExecutionException $e) {
  12473. $this->io->writeError(sprintf('<error>Script %s was called via %s</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  12474. throw $e;
  12475. }
  12476. }
  12477. } elseif ($this->isPhpScript($callable)) {
  12478. $className = substr($callable, 0, strpos($callable, '::'));
  12479. $methodName = substr($callable, strpos($callable, '::') + 2);
  12480. if (!class_exists($className)) {
  12481. $this->io->writeError('<warning>Class '.$className.' is not autoloadable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  12482. continue;
  12483. }
  12484. if (!is_callable($callable)) {
  12485. $this->io->writeError('<warning>Method '.$callable.' is not callable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  12486. continue;
  12487. }
  12488. try {
  12489. $return = false === $this->executeEventPhpScript($className, $methodName, $event) ? 1 : 0;
  12490. } catch (\Exception $e) {
  12491. $message = "Script %s handling the %s event terminated with an exception";
  12492. $this->io->writeError('<error>'.sprintf($message, $callable, $event->getName()).'</error>', true, IOInterface::QUIET);
  12493. throw $e;
  12494. }
  12495. } else {
  12496. $args = implode(' ', array_map(array('Composer\Util\ProcessExecutor', 'escape'), $event->getArguments()));
  12497. $exec = $callable . ($args === '' ? '' : ' '.$args);
  12498. if ($this->io->isVerbose()) {
  12499. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $exec));
  12500. } else {
  12501. $this->io->writeError(sprintf('> %s', $exec));
  12502. }
  12503. $possibleLocalBinaries = $this->composer->getPackage()->getBinaries();
  12504. if ($possibleLocalBinaries) {
  12505. foreach ($possibleLocalBinaries as $localExec) {
  12506. if (preg_match('{\b'.preg_quote($callable).'$}', $localExec)) {
  12507. $caller = BinaryInstaller::determineBinaryCaller($localExec);
  12508. $exec = preg_replace('{^'.preg_quote($callable).'}', $caller . ' ' . $localExec, $exec);
  12509. break;
  12510. }
  12511. }
  12512. }
  12513. if (substr($exec, 0, 5) === '@php ') {
  12514. $exec = $this->getPhpExecCommand() . ' ' . substr($exec, 5);
  12515. } else {
  12516. $finder = new PhpExecutableFinder();
  12517. $phpPath = $finder->find(false);
  12518. if ($phpPath) {
  12519. putenv('PHP_BINARY=' . $phpPath);
  12520. }
  12521. }
  12522. if (0 !== ($exitCode = $this->process->execute($exec))) {
  12523. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  12524. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  12525. }
  12526. }
  12527. if ($event->isPropagationStopped()) {
  12528. break;
  12529. }
  12530. }
  12531. $this->popEvent();
  12532. return $return;
  12533. }
  12534. protected function getPhpExecCommand()
  12535. {
  12536. $finder = new PhpExecutableFinder();
  12537. $phpPath = $finder->find(false);
  12538. if (!$phpPath) {
  12539. throw new \RuntimeException('Failed to locate PHP binary to execute '.$phpPath);
  12540. }
  12541. $phpArgs = $finder->findArguments();
  12542. $phpArgs = $phpArgs ? ' ' . implode(' ', $phpArgs) : '';
  12543. $allowUrlFOpenFlag = ' -d allow_url_fopen=' . ProcessExecutor::escape(ini_get('allow_url_fopen'));
  12544. $disableFunctionsFlag = ' -d disable_functions=' . ProcessExecutor::escape(ini_get('disable_functions'));
  12545. $memoryLimitFlag = ' -d memory_limit=' . ProcessExecutor::escape(ini_get('memory_limit'));
  12546. return ProcessExecutor::escape($phpPath) . $phpArgs . $allowUrlFOpenFlag . $disableFunctionsFlag . $memoryLimitFlag;
  12547. }
  12548. protected function executeEventPhpScript($className, $methodName, Event $event)
  12549. {
  12550. $event = $this->checkListenerExpectedEvent(array($className, $methodName), $event);
  12551. if ($this->io->isVerbose()) {
  12552. $this->io->writeError(sprintf('> %s: %s::%s', $event->getName(), $className, $methodName));
  12553. } else {
  12554. $this->io->writeError(sprintf('> %s::%s', $className, $methodName));
  12555. }
  12556. return $className::$methodName($event);
  12557. }
  12558. protected function checkListenerExpectedEvent($target, Event $event)
  12559. {
  12560. if (in_array($event->getName(), array(
  12561. 'init',
  12562. 'command',
  12563. 'pre-file-download',
  12564. ), true)) {
  12565. return $event;
  12566. }
  12567. try {
  12568. $reflected = new \ReflectionParameter($target, 0);
  12569. } catch (\Exception $e) {
  12570. return $event;
  12571. }
  12572. $typehint = $reflected->getClass();
  12573. if (!$typehint instanceof \ReflectionClass) {
  12574. return $event;
  12575. }
  12576. $expected = $typehint->getName();
  12577. if (!$event instanceof $expected && $expected === 'Composer\Script\CommandEvent') {
  12578. 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);
  12579. $event = new \Composer\Script\CommandEvent(
  12580. $event->getName(),
  12581. $event->getComposer(),
  12582. $event->getIO(),
  12583. $event->isDevMode(),
  12584. $event->getArguments()
  12585. );
  12586. }
  12587. if (!$event instanceof $expected && $expected === 'Composer\Script\PackageEvent') {
  12588. 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);
  12589. $event = new \Composer\Script\PackageEvent(
  12590. $event->getName(),
  12591. $event->getComposer(),
  12592. $event->getIO(),
  12593. $event->isDevMode(),
  12594. $event->getPolicy(),
  12595. $event->getPool(),
  12596. $event->getInstalledRepo(),
  12597. $event->getRequest(),
  12598. $event->getOperations(),
  12599. $event->getOperation()
  12600. );
  12601. }
  12602. if (!$event instanceof $expected && $expected === 'Composer\Script\Event') {
  12603. 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);
  12604. $event = new \Composer\Script\Event(
  12605. $event->getName(),
  12606. $event->getComposer(),
  12607. $event->getIO(),
  12608. $event->isDevMode(),
  12609. $event->getArguments(),
  12610. $event->getFlags()
  12611. );
  12612. }
  12613. return $event;
  12614. }
  12615. private function serializeCallback($cb)
  12616. {
  12617. if (is_array($cb) && count($cb) === 2) {
  12618. if (is_object($cb[0])) {
  12619. $cb[0] = get_class($cb[0]);
  12620. }
  12621. if (is_string($cb[0]) && is_string($cb[1])) {
  12622. $cb = implode('::', $cb);
  12623. }
  12624. }
  12625. if (is_string($cb)) {
  12626. return $cb;
  12627. }
  12628. return var_export($cb, true);
  12629. }
  12630. public function addListener($eventName, $listener, $priority = 0)
  12631. {
  12632. $this->listeners[$eventName][$priority][] = $listener;
  12633. }
  12634. public function addSubscriber(EventSubscriberInterface $subscriber)
  12635. {
  12636. foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
  12637. if (is_string($params)) {
  12638. $this->addListener($eventName, array($subscriber, $params));
  12639. } elseif (is_string($params[0])) {
  12640. $this->addListener($eventName, array($subscriber, $params[0]), isset($params[1]) ? $params[1] : 0);
  12641. } else {
  12642. foreach ($params as $listener) {
  12643. $this->addListener($eventName, array($subscriber, $listener[0]), isset($listener[1]) ? $listener[1] : 0);
  12644. }
  12645. }
  12646. }
  12647. }
  12648. protected function getListeners(Event $event)
  12649. {
  12650. $scriptListeners = $this->getScriptListeners($event);
  12651. if (!isset($this->listeners[$event->getName()][0])) {
  12652. $this->listeners[$event->getName()][0] = array();
  12653. }
  12654. krsort($this->listeners[$event->getName()]);
  12655. $listeners = $this->listeners;
  12656. $listeners[$event->getName()][0] = array_merge($listeners[$event->getName()][0], $scriptListeners);
  12657. return call_user_func_array('array_merge', $listeners[$event->getName()]);
  12658. }
  12659. public function hasEventListeners(Event $event)
  12660. {
  12661. $listeners = $this->getListeners($event);
  12662. return count($listeners) > 0;
  12663. }
  12664. protected function getScriptListeners(Event $event)
  12665. {
  12666. $package = $this->composer->getPackage();
  12667. $scripts = $package->getScripts();
  12668. if (empty($scripts[$event->getName()])) {
  12669. return array();
  12670. }
  12671. if ($this->loader) {
  12672. $this->loader->unregister();
  12673. }
  12674. $generator = $this->composer->getAutoloadGenerator();
  12675. if ($event instanceof ScriptEvent) {
  12676. $generator->setDevMode($event->isDevMode());
  12677. }
  12678. $packages = $this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages();
  12679. $packageMap = $generator->buildPackageMap($this->composer->getInstallationManager(), $package, $packages);
  12680. $map = $generator->parseAutoloads($packageMap, $package);
  12681. $this->loader = $generator->createLoader($map);
  12682. $this->loader->register();
  12683. return $scripts[$event->getName()];
  12684. }
  12685. protected function isPhpScript($callable)
  12686. {
  12687. return false === strpos($callable, ' ') && false !== strpos($callable, '::');
  12688. }
  12689. protected function isComposerScript($callable)
  12690. {
  12691. return '@' === substr($callable, 0, 1) && '@php ' !== substr($callable, 0, 5);
  12692. }
  12693. protected function pushEvent(Event $event)
  12694. {
  12695. $eventName = $event->getName();
  12696. if (in_array($eventName, $this->eventStack)) {
  12697. throw new \RuntimeException(sprintf("Circular call to script handler '%s' detected", $eventName));
  12698. }
  12699. return array_push($this->eventStack, $eventName);
  12700. }
  12701. protected function popEvent()
  12702. {
  12703. return array_pop($this->eventStack);
  12704. }
  12705. }
  12706. <?php
  12707. namespace Composer\EventDispatcher;
  12708. interface EventSubscriberInterface
  12709. {
  12710. public static function getSubscribedEvents();
  12711. }
  12712. <?php
  12713. namespace Composer\EventDispatcher;
  12714. class ScriptExecutionException extends \RuntimeException
  12715. {
  12716. }
  12717. <?php
  12718. namespace Composer\Exception;
  12719. class NoSslException extends \RuntimeException
  12720. {
  12721. }
  12722. <?php
  12723. namespace Composer;
  12724. use Composer\Config\JsonConfigSource;
  12725. use Composer\Json\JsonFile;
  12726. use Composer\IO\IOInterface;
  12727. use Composer\Package\Archiver;
  12728. use Composer\Package\Version\VersionGuesser;
  12729. use Composer\Repository\RepositoryManager;
  12730. use Composer\Repository\RepositoryFactory;
  12731. use Composer\Repository\WritableRepositoryInterface;
  12732. use Composer\Util\Filesystem;
  12733. use Composer\Util\Platform;
  12734. use Composer\Util\ProcessExecutor;
  12735. use Composer\Util\RemoteFilesystem;
  12736. use Composer\Util\Silencer;
  12737. use Composer\Plugin\PluginEvents;
  12738. use Composer\EventDispatcher\Event;
  12739. use Seld\JsonLint\DuplicateKeyException;
  12740. use Symfony\Component\Console\Formatter\OutputFormatter;
  12741. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  12742. use Symfony\Component\Console\Output\ConsoleOutput;
  12743. use Composer\EventDispatcher\EventDispatcher;
  12744. use Composer\Autoload\AutoloadGenerator;
  12745. use Composer\Package\Version\VersionParser;
  12746. use Composer\Downloader\TransportException;
  12747. use Seld\JsonLint\JsonParser;
  12748. class Factory
  12749. {
  12750. protected static function getHomeDir()
  12751. {
  12752. $home = getenv('COMPOSER_HOME');
  12753. if ($home) {
  12754. return $home;
  12755. }
  12756. if (Platform::isWindows()) {
  12757. if (!getenv('APPDATA')) {
  12758. throw new \RuntimeException('The APPDATA or COMPOSER_HOME environment variable must be set for composer to run correctly');
  12759. }
  12760. return rtrim(strtr(getenv('APPDATA'), '\\', '/'), '/') . '/Composer';
  12761. }
  12762. $userDir = self::getUserDir();
  12763. if (is_dir($userDir . '/.composer')) {
  12764. return $userDir . '/.composer';
  12765. }
  12766. if (self::useXdg()) {
  12767. $xdgConfig = getenv('XDG_CONFIG_HOME') ?: $userDir . '/.config';
  12768. return $xdgConfig . '/composer';
  12769. }
  12770. return $userDir . '/.composer';
  12771. }
  12772. protected static function getCacheDir($home)
  12773. {
  12774. $cacheDir = getenv('COMPOSER_CACHE_DIR');
  12775. if ($cacheDir) {
  12776. return $cacheDir;
  12777. }
  12778. $homeEnv = getenv('COMPOSER_HOME');
  12779. if ($homeEnv) {
  12780. return $homeEnv . '/cache';
  12781. }
  12782. if (Platform::isWindows()) {
  12783. if ($cacheDir = getenv('LOCALAPPDATA')) {
  12784. $cacheDir .= '/Composer';
  12785. } else {
  12786. $cacheDir = $home . '/cache';
  12787. }
  12788. return rtrim(strtr($cacheDir, '\\', '/'), '/');
  12789. }
  12790. $userDir = self::getUserDir();
  12791. if ($home === $userDir . '/.composer' && is_dir($home . '/cache')) {
  12792. return $home . '/cache';
  12793. }
  12794. if (self::useXdg()) {
  12795. $xdgCache = getenv('XDG_CACHE_HOME') ?: $userDir . '/.cache';
  12796. return $xdgCache . '/composer';
  12797. }
  12798. return $home . '/cache';
  12799. }
  12800. protected static function getDataDir($home)
  12801. {
  12802. $homeEnv = getenv('COMPOSER_HOME');
  12803. if ($homeEnv) {
  12804. return $homeEnv;
  12805. }
  12806. if (Platform::isWindows()) {
  12807. return strtr($home, '\\', '/');
  12808. }
  12809. $userDir = self::getUserDir();
  12810. if ($home !== $userDir . '/.composer' && self::useXdg()) {
  12811. $xdgData = getenv('XDG_DATA_HOME') ?: $userDir . '/.local/share';
  12812. return $xdgData . '/composer';
  12813. }
  12814. return $home;
  12815. }
  12816. public static function createConfig(IOInterface $io = null, $cwd = null)
  12817. {
  12818. $cwd = $cwd ?: getcwd();
  12819. $config = new Config(true, $cwd);
  12820. $home = self::getHomeDir();
  12821. $config->merge(array('config' => array(
  12822. 'home' => $home,
  12823. 'cache-dir' => self::getCacheDir($home),
  12824. 'data-dir' => self::getDataDir($home),
  12825. )));
  12826. $file = new JsonFile($config->get('home').'/config.json');
  12827. if ($file->exists()) {
  12828. if ($io && $io->isDebug()) {
  12829. $io->writeError('Loading config file ' . $file->getPath());
  12830. }
  12831. $config->merge($file->read());
  12832. }
  12833. $config->setConfigSource(new JsonConfigSource($file));
  12834. $htaccessProtect = (bool) $config->get('htaccess-protect');
  12835. if ($htaccessProtect) {
  12836. $dirs = array($config->get('home'), $config->get('cache-dir'), $config->get('data-dir'));
  12837. foreach ($dirs as $dir) {
  12838. if (!file_exists($dir . '/.htaccess')) {
  12839. if (!is_dir($dir)) {
  12840. Silencer::call('mkdir', $dir, 0777, true);
  12841. }
  12842. Silencer::call('file_put_contents', $dir . '/.htaccess', 'Deny from all');
  12843. }
  12844. }
  12845. }
  12846. $file = new JsonFile($config->get('home').'/auth.json');
  12847. if ($file->exists()) {
  12848. if ($io && $io->isDebug()) {
  12849. $io->writeError('Loading config file ' . $file->getPath());
  12850. }
  12851. $config->merge(array('config' => $file->read()));
  12852. }
  12853. $config->setAuthConfigSource(new JsonConfigSource($file, true));
  12854. if ($composerAuthEnv = getenv('COMPOSER_AUTH')) {
  12855. $authData = json_decode($composerAuthEnv, true);
  12856. if (null === $authData) {
  12857. throw new \UnexpectedValueException('COMPOSER_AUTH environment variable is malformed, should be a valid JSON object');
  12858. }
  12859. if ($io && $io->isDebug()) {
  12860. $io->writeError('Loading auth config from COMPOSER_AUTH');
  12861. }
  12862. $config->merge(array('config' => $authData));
  12863. }
  12864. return $config;
  12865. }
  12866. public static function getComposerFile()
  12867. {
  12868. return trim(getenv('COMPOSER')) ?: './composer.json';
  12869. }
  12870. public static function createAdditionalStyles()
  12871. {
  12872. return array(
  12873. 'highlight' => new OutputFormatterStyle('red'),
  12874. 'warning' => new OutputFormatterStyle('black', 'yellow'),
  12875. );
  12876. }
  12877. public static function createOutput()
  12878. {
  12879. $styles = self::createAdditionalStyles();
  12880. $formatter = new OutputFormatter(false, $styles);
  12881. return new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, null, $formatter);
  12882. }
  12883. public static function createDefaultRepositories(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  12884. {
  12885. return RepositoryFactory::defaultRepos($io, $config, $rm);
  12886. }
  12887. public function createComposer(IOInterface $io, $localConfig = null, $disablePlugins = false, $cwd = null, $fullLoad = true)
  12888. {
  12889. $cwd = $cwd ?: getcwd();
  12890. if (null === $localConfig) {
  12891. $localConfig = static::getComposerFile();
  12892. }
  12893. if (is_string($localConfig)) {
  12894. $composerFile = $localConfig;
  12895. $file = new JsonFile($localConfig, null, $io);
  12896. if (!$file->exists()) {
  12897. if ($localConfig === './composer.json' || $localConfig === 'composer.json') {
  12898. $message = 'Composer could not find a composer.json file in '.$cwd;
  12899. } else {
  12900. $message = 'Composer could not find the config file: '.$localConfig;
  12901. }
  12902. $instructions = 'To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section';
  12903. throw new \InvalidArgumentException($message.PHP_EOL.$instructions);
  12904. }
  12905. $file->validateSchema(JsonFile::LAX_SCHEMA);
  12906. $jsonParser = new JsonParser;
  12907. try {
  12908. $jsonParser->parse(file_get_contents($localConfig), JsonParser::DETECT_KEY_CONFLICTS);
  12909. } catch (DuplicateKeyException $e) {
  12910. $details = $e->getDetails();
  12911. $io->writeError('<warning>Key '.$details['key'].' is a duplicate in '.$localConfig.' at line '.$details['line'].'</warning>');
  12912. }
  12913. $localConfig = $file->read();
  12914. }
  12915. $config = static::createConfig($io, $cwd);
  12916. $config->merge($localConfig);
  12917. if (isset($composerFile)) {
  12918. $io->writeError('Loading config file ' . $composerFile, true, IOInterface::DEBUG);
  12919. $config->setConfigSource(new JsonConfigSource(new JsonFile(realpath($composerFile), null, $io)));
  12920. $localAuthFile = new JsonFile(dirname(realpath($composerFile)) . '/auth.json', null, $io);
  12921. if ($localAuthFile->exists()) {
  12922. $io->writeError('Loading config file ' . $localAuthFile->getPath(), true, IOInterface::DEBUG);
  12923. $config->merge(array('config' => $localAuthFile->read()));
  12924. $config->setAuthConfigSource(new JsonConfigSource($localAuthFile, true));
  12925. }
  12926. }
  12927. $vendorDir = $config->get('vendor-dir');
  12928. $composer = new Composer();
  12929. $composer->setConfig($config);
  12930. if ($fullLoad) {
  12931. $io->loadConfiguration($config);
  12932. }
  12933. $rfs = self::createRemoteFilesystem($io, $config);
  12934. $dispatcher = new EventDispatcher($composer, $io);
  12935. $composer->setEventDispatcher($dispatcher);
  12936. $rm = RepositoryFactory::manager($io, $config, $dispatcher, $rfs);
  12937. $composer->setRepositoryManager($rm);
  12938. $this->addLocalRepository($io, $rm, $vendorDir);
  12939. if (!$fullLoad && !isset($localConfig['version'])) {
  12940. $localConfig['version'] = '1.0.0';
  12941. }
  12942. $parser = new VersionParser;
  12943. $guesser = new VersionGuesser($config, new ProcessExecutor($io), $parser);
  12944. $loader = new Package\Loader\RootPackageLoader($rm, $config, $parser, $guesser, $io);
  12945. $package = $loader->load($localConfig, 'Composer\Package\RootPackage', $cwd);
  12946. $composer->setPackage($package);
  12947. $im = $this->createInstallationManager();
  12948. $composer->setInstallationManager($im);
  12949. if ($fullLoad) {
  12950. $dm = $this->createDownloadManager($io, $config, $dispatcher, $rfs);
  12951. $composer->setDownloadManager($dm);
  12952. $generator = new AutoloadGenerator($dispatcher, $io);
  12953. $composer->setAutoloadGenerator($generator);
  12954. $am = $this->createArchiveManager($config, $dm);
  12955. $composer->setArchiveManager($am);
  12956. }
  12957. $this->createDefaultInstallers($im, $composer, $io);
  12958. if ($fullLoad) {
  12959. $globalComposer = null;
  12960. if (realpath($config->get('home')) !== $cwd) {
  12961. $globalComposer = $this->createGlobalComposer($io, $config, $disablePlugins);
  12962. }
  12963. $pm = $this->createPluginManager($io, $composer, $globalComposer, $disablePlugins);
  12964. $composer->setPluginManager($pm);
  12965. $pm->loadInstalledPlugins();
  12966. }
  12967. if ($fullLoad && isset($composerFile)) {
  12968. $lockFile = "json" === pathinfo($composerFile, PATHINFO_EXTENSION)
  12969. ? substr($composerFile, 0, -4).'lock'
  12970. : $composerFile . '.lock';
  12971. $locker = new Package\Locker($io, new JsonFile($lockFile, null, $io), $rm, $im, file_get_contents($composerFile));
  12972. $composer->setLocker($locker);
  12973. }
  12974. if ($fullLoad) {
  12975. $initEvent = new Event(PluginEvents::INIT);
  12976. $composer->getEventDispatcher()->dispatch($initEvent->getName(), $initEvent);
  12977. if ($rm->getLocalRepository()) {
  12978. $this->purgePackages($rm->getLocalRepository(), $im);
  12979. }
  12980. }
  12981. return $composer;
  12982. }
  12983. public static function createGlobal(IOInterface $io, $disablePlugins = false)
  12984. {
  12985. $factory = new static();
  12986. return $factory->createGlobalComposer($io, static::createConfig($io), $disablePlugins, true);
  12987. }
  12988. protected function addLocalRepository(IOInterface $io, RepositoryManager $rm, $vendorDir)
  12989. {
  12990. $rm->setLocalRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/composer/installed.json', null, $io)));
  12991. }
  12992. protected function createGlobalComposer(IOInterface $io, Config $config, $disablePlugins, $fullLoad = false)
  12993. {
  12994. $composer = null;
  12995. try {
  12996. $composer = $this->createComposer($io, $config->get('home') . '/composer.json', $disablePlugins, $config->get('home'), $fullLoad);
  12997. } catch (\Exception $e) {
  12998. $io->writeError('Failed to initialize global composer: '.$e->getMessage(), true, IOInterface::DEBUG);
  12999. }
  13000. return $composer;
  13001. }
  13002. public function createDownloadManager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  13003. {
  13004. $cache = null;
  13005. if ($config->get('cache-files-ttl') > 0) {
  13006. $cache = new Cache($io, $config->get('cache-files-dir'), 'a-z0-9_./');
  13007. }
  13008. $dm = new Downloader\DownloadManager($io);
  13009. switch ($preferred = $config->get('preferred-install')) {
  13010. case 'dist':
  13011. $dm->setPreferDist(true);
  13012. break;
  13013. case 'source':
  13014. $dm->setPreferSource(true);
  13015. break;
  13016. case 'auto':
  13017. default:
  13018. break;
  13019. }
  13020. if (is_array($preferred)) {
  13021. $dm->setPreferences($preferred);
  13022. }
  13023. $executor = new ProcessExecutor($io);
  13024. $fs = new Filesystem($executor);
  13025. $dm->setDownloader('git', new Downloader\GitDownloader($io, $config, $executor, $fs));
  13026. $dm->setDownloader('svn', new Downloader\SvnDownloader($io, $config, $executor, $fs));
  13027. $dm->setDownloader('fossil', new Downloader\FossilDownloader($io, $config, $executor, $fs));
  13028. $dm->setDownloader('hg', new Downloader\HgDownloader($io, $config, $executor, $fs));
  13029. $dm->setDownloader('perforce', new Downloader\PerforceDownloader($io, $config));
  13030. $dm->setDownloader('zip', new Downloader\ZipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  13031. $dm->setDownloader('rar', new Downloader\RarDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  13032. $dm->setDownloader('tar', new Downloader\TarDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  13033. $dm->setDownloader('gzip', new Downloader\GzipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  13034. $dm->setDownloader('xz', new Downloader\XzDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  13035. $dm->setDownloader('phar', new Downloader\PharDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  13036. $dm->setDownloader('file', new Downloader\FileDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  13037. $dm->setDownloader('path', new Downloader\PathDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  13038. return $dm;
  13039. }
  13040. public function createArchiveManager(Config $config, Downloader\DownloadManager $dm = null)
  13041. {
  13042. if (null === $dm) {
  13043. $io = new IO\NullIO();
  13044. $io->loadConfiguration($config);
  13045. $dm = $this->createDownloadManager($io, $config);
  13046. }
  13047. $am = new Archiver\ArchiveManager($dm);
  13048. $am->addArchiver(new Archiver\ZipArchiver);
  13049. $am->addArchiver(new Archiver\PharArchiver);
  13050. return $am;
  13051. }
  13052. protected function createPluginManager(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  13053. {
  13054. return new Plugin\PluginManager($io, $composer, $globalComposer, $disablePlugins);
  13055. }
  13056. protected function createInstallationManager()
  13057. {
  13058. return new Installer\InstallationManager();
  13059. }
  13060. protected function createDefaultInstallers(Installer\InstallationManager $im, Composer $composer, IOInterface $io)
  13061. {
  13062. $im->addInstaller(new Installer\LibraryInstaller($io, $composer, null));
  13063. $im->addInstaller(new Installer\PearInstaller($io, $composer, 'pear-library'));
  13064. $im->addInstaller(new Installer\PluginInstaller($io, $composer));
  13065. $im->addInstaller(new Installer\MetapackageInstaller($io));
  13066. }
  13067. protected function purgePackages(WritableRepositoryInterface $repo, Installer\InstallationManager $im)
  13068. {
  13069. foreach ($repo->getPackages() as $package) {
  13070. if (!$im->isPackageInstalled($repo, $package)) {
  13071. $repo->removePackage($package);
  13072. }
  13073. }
  13074. }
  13075. public static function create(IOInterface $io, $config = null, $disablePlugins = false)
  13076. {
  13077. $factory = new static();
  13078. return $factory->createComposer($io, $config, $disablePlugins);
  13079. }
  13080. public static function createRemoteFilesystem(IOInterface $io, Config $config = null, $options = array())
  13081. {
  13082. static $warned = false;
  13083. $disableTls = false;
  13084. if ($config && $config->get('disable-tls') === true) {
  13085. if (!$warned) {
  13086. $io->writeError('<warning>You are running Composer with SSL/TLS protection disabled.</warning>');
  13087. }
  13088. $warned = true;
  13089. $disableTls = true;
  13090. } elseif (!extension_loaded('openssl')) {
  13091. throw new Exception\NoSslException('The openssl extension is required for SSL/TLS protection but is not available. '
  13092. . '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.');
  13093. }
  13094. $remoteFilesystemOptions = array();
  13095. if ($disableTls === false) {
  13096. if ($config && $config->get('cafile')) {
  13097. $remoteFilesystemOptions['ssl']['cafile'] = $config->get('cafile');
  13098. }
  13099. if ($config && $config->get('capath')) {
  13100. $remoteFilesystemOptions['ssl']['capath'] = $config->get('capath');
  13101. }
  13102. $remoteFilesystemOptions = array_replace_recursive($remoteFilesystemOptions, $options);
  13103. }
  13104. try {
  13105. $remoteFilesystem = new RemoteFilesystem($io, $config, $remoteFilesystemOptions, $disableTls);
  13106. } catch (TransportException $e) {
  13107. if (false !== strpos($e->getMessage(), 'cafile')) {
  13108. $io->write('<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>');
  13109. $io->write('<error>A valid CA certificate file is required for SSL/TLS protection.</error>');
  13110. if (PHP_VERSION_ID < 50600) {
  13111. $io->write('<error>It is recommended you upgrade to PHP 5.6+ which can detect your system CA file automatically.</error>');
  13112. }
  13113. $io->write('<error>You can disable this error, at your own risk, by setting the \'disable-tls\' option to true.</error>');
  13114. }
  13115. throw $e;
  13116. }
  13117. return $remoteFilesystem;
  13118. }
  13119. private static function useXdg()
  13120. {
  13121. foreach (array_keys($_SERVER) as $key) {
  13122. if (substr($key, 0, 4) === 'XDG_') {
  13123. return true;
  13124. }
  13125. }
  13126. return false;
  13127. }
  13128. private static function getUserDir()
  13129. {
  13130. $home = getenv('HOME');
  13131. if (!$home) {
  13132. throw new \RuntimeException('The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly');
  13133. }
  13134. return rtrim(strtr($home, '\\', '/'), '/');
  13135. }
  13136. }
  13137. <?php
  13138. namespace Composer\IO;
  13139. use Composer\Config;
  13140. use Composer\Util\ProcessExecutor;
  13141. use Psr\Log\LoggerInterface;
  13142. use Psr\Log\LogLevel;
  13143. abstract class BaseIO implements IOInterface, LoggerInterface
  13144. {
  13145. protected $authentications = array();
  13146. public function getAuthentications()
  13147. {
  13148. return $this->authentications;
  13149. }
  13150. public function resetAuthentications()
  13151. {
  13152. $this->authentications = array();
  13153. }
  13154. public function hasAuthentication($repositoryName)
  13155. {
  13156. return isset($this->authentications[$repositoryName]);
  13157. }
  13158. public function getAuthentication($repositoryName)
  13159. {
  13160. if (isset($this->authentications[$repositoryName])) {
  13161. return $this->authentications[$repositoryName];
  13162. }
  13163. return array('username' => null, 'password' => null);
  13164. }
  13165. public function setAuthentication($repositoryName, $username, $password = null)
  13166. {
  13167. $this->authentications[$repositoryName] = array('username' => $username, 'password' => $password);
  13168. }
  13169. protected function checkAndSetAuthentication($repositoryName, $username, $password = null)
  13170. {
  13171. if ($this->hasAuthentication($repositoryName)) {
  13172. $auth = $this->getAuthentication($repositoryName);
  13173. if ($auth['username'] === $username && $auth['password'] === $password) {
  13174. return;
  13175. }
  13176. $this->writeError(
  13177. sprintf(
  13178. "<warning>Warning: You should avoid overwriting already defined auth settings for %s.</warning>",
  13179. $repositoryName
  13180. )
  13181. );
  13182. }
  13183. $this->setAuthentication($repositoryName, $username, $password);
  13184. }
  13185. public function loadConfiguration(Config $config)
  13186. {
  13187. $bitbucketOauth = $config->get('bitbucket-oauth') ?: array();
  13188. $githubOauth = $config->get('github-oauth') ?: array();
  13189. $gitlabOauth = $config->get('gitlab-oauth') ?: array();
  13190. $gitlabToken = $config->get('gitlab-token') ?: array();
  13191. $httpBasic = $config->get('http-basic') ?: array();
  13192. foreach ($bitbucketOauth as $domain => $cred) {
  13193. $this->checkAndSetAuthentication($domain, $cred['consumer-key'], $cred['consumer-secret']);
  13194. }
  13195. foreach ($githubOauth as $domain => $token) {
  13196. if (!preg_match('{^[.a-z0-9]+$}', $token)) {
  13197. throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"');
  13198. }
  13199. $this->checkAndSetAuthentication($domain, $token, 'x-oauth-basic');
  13200. }
  13201. foreach ($gitlabOauth as $domain => $token) {
  13202. $this->checkAndSetAuthentication($domain, $token, 'oauth2');
  13203. }
  13204. foreach ($gitlabToken as $domain => $token) {
  13205. $this->checkAndSetAuthentication($domain, $token, 'private-token');
  13206. }
  13207. foreach ($httpBasic as $domain => $cred) {
  13208. $this->checkAndSetAuthentication($domain, $cred['username'], $cred['password']);
  13209. }
  13210. ProcessExecutor::setTimeout((int) $config->get('process-timeout'));
  13211. }
  13212. public function emergency($message, array $context = array())
  13213. {
  13214. return $this->log(LogLevel::EMERGENCY, $message, $context);
  13215. }
  13216. public function alert($message, array $context = array())
  13217. {
  13218. return $this->log(LogLevel::ALERT, $message, $context);
  13219. }
  13220. public function critical($message, array $context = array())
  13221. {
  13222. return $this->log(LogLevel::CRITICAL, $message, $context);
  13223. }
  13224. public function error($message, array $context = array())
  13225. {
  13226. return $this->log(LogLevel::ERROR, $message, $context);
  13227. }
  13228. public function warning($message, array $context = array())
  13229. {
  13230. return $this->log(LogLevel::WARNING, $message, $context);
  13231. }
  13232. public function notice($message, array $context = array())
  13233. {
  13234. return $this->log(LogLevel::NOTICE, $message, $context);
  13235. }
  13236. public function info($message, array $context = array())
  13237. {
  13238. return $this->log(LogLevel::INFO, $message, $context);
  13239. }
  13240. public function debug($message, array $context = array())
  13241. {
  13242. return $this->log(LogLevel::DEBUG, $message, $context);
  13243. }
  13244. public function log($level, $message, array $context = array())
  13245. {
  13246. if (in_array($level, array(LogLevel::EMERGENCY, LogLevel::ALERT, LogLevel::CRITICAL, LogLevel::ERROR))) {
  13247. $this->writeError('<error>'.$message.'</error>', true, self::NORMAL);
  13248. } elseif ($level === LogLevel::WARNING) {
  13249. $this->writeError('<warning>'.$message.'</warning>', true, self::NORMAL);
  13250. } elseif ($level === LogLevel::NOTICE) {
  13251. $this->writeError('<info>'.$message.'</info>', true, self::VERBOSE);
  13252. } elseif ($level === LogLevel::INFO) {
  13253. $this->writeError('<info>'.$message.'</info>', true, self::VERY_VERBOSE);
  13254. } else {
  13255. $this->writeError($message, true, self::DEBUG);
  13256. }
  13257. }
  13258. }
  13259. <?php
  13260. namespace Composer\IO;
  13261. use Symfony\Component\Console\Helper\QuestionHelper;
  13262. use Symfony\Component\Console\Output\StreamOutput;
  13263. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  13264. use Symfony\Component\Console\Input\StreamableInputInterface;
  13265. use Symfony\Component\Console\Input\StringInput;
  13266. use Symfony\Component\Console\Helper\HelperSet;
  13267. class BufferIO extends ConsoleIO
  13268. {
  13269. public function __construct($input = '', $verbosity = StreamOutput::VERBOSITY_NORMAL, OutputFormatterInterface $formatter = null)
  13270. {
  13271. $input = new StringInput($input);
  13272. $input->setInteractive(false);
  13273. $output = new StreamOutput(fopen('php://memory', 'rw'), $verbosity, $formatter ? $formatter->isDecorated() : false, $formatter);
  13274. parent::__construct($input, $output, new HelperSet(array(
  13275. new QuestionHelper(),
  13276. )));
  13277. }
  13278. public function getOutput()
  13279. {
  13280. fseek($this->output->getStream(), 0);
  13281. $output = stream_get_contents($this->output->getStream());
  13282. $output = preg_replace_callback("{(?<=^|\n|\x08)(.+?)(\x08+)}", function ($matches) {
  13283. $pre = strip_tags($matches[1]);
  13284. if (strlen($pre) === strlen($matches[2])) {
  13285. return '';
  13286. }
  13287. return rtrim($matches[1])."\n";
  13288. }, $output);
  13289. return $output;
  13290. }
  13291. public function setUserInputs(array $inputs)
  13292. {
  13293. if (!$this->input instanceof StreamableInputInterface) {
  13294. throw new \RuntimeException('Setting the user inputs requires at least the version 3.2 of the symfony/console component.');
  13295. }
  13296. $this->input->setStream($this->createStream($inputs));
  13297. $this->input->setInteractive(true);
  13298. }
  13299. private function createStream(array $inputs)
  13300. {
  13301. $stream = fopen('php://memory', 'r+', false);
  13302. foreach ($inputs as $input) {
  13303. fwrite($stream, $input.PHP_EOL);
  13304. }
  13305. rewind($stream);
  13306. return $stream;
  13307. }
  13308. }
  13309. <?php
  13310. namespace Composer\IO;
  13311. use Composer\Question\StrictConfirmationQuestion;
  13312. use Symfony\Component\Console\Helper\HelperSet;
  13313. use Symfony\Component\Console\Input\InputInterface;
  13314. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  13315. use Symfony\Component\Console\Output\OutputInterface;
  13316. use Symfony\Component\Console\Question\ChoiceQuestion;
  13317. use Symfony\Component\Console\Question\Question;
  13318. class ConsoleIO extends BaseIO
  13319. {
  13320. protected $input;
  13321. protected $output;
  13322. protected $helperSet;
  13323. protected $lastMessage;
  13324. protected $lastMessageErr;
  13325. private $startTime;
  13326. private $verbosityMap;
  13327. public function __construct(InputInterface $input, OutputInterface $output, HelperSet $helperSet)
  13328. {
  13329. $this->input = $input;
  13330. $this->output = $output;
  13331. $this->helperSet = $helperSet;
  13332. $this->verbosityMap = array(
  13333. self::QUIET => OutputInterface::VERBOSITY_QUIET,
  13334. self::NORMAL => OutputInterface::VERBOSITY_NORMAL,
  13335. self::VERBOSE => OutputInterface::VERBOSITY_VERBOSE,
  13336. self::VERY_VERBOSE => OutputInterface::VERBOSITY_VERY_VERBOSE,
  13337. self::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  13338. );
  13339. }
  13340. public function enableDebugging($startTime)
  13341. {
  13342. $this->startTime = $startTime;
  13343. }
  13344. public function isInteractive()
  13345. {
  13346. return $this->input->isInteractive();
  13347. }
  13348. public function isDecorated()
  13349. {
  13350. return $this->output->isDecorated();
  13351. }
  13352. public function isVerbose()
  13353. {
  13354. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE;
  13355. }
  13356. public function isVeryVerbose()
  13357. {
  13358. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE;
  13359. }
  13360. public function isDebug()
  13361. {
  13362. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG;
  13363. }
  13364. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  13365. {
  13366. $this->doWrite($messages, $newline, false, $verbosity);
  13367. }
  13368. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  13369. {
  13370. $this->doWrite($messages, $newline, true, $verbosity);
  13371. }
  13372. private function doWrite($messages, $newline, $stderr, $verbosity)
  13373. {
  13374. $sfVerbosity = $this->verbosityMap[$verbosity];
  13375. if ($sfVerbosity > $this->output->getVerbosity()) {
  13376. return;
  13377. }
  13378. if (OutputInterface::VERBOSITY_QUIET === 0) {
  13379. $sfVerbosity = OutputInterface::OUTPUT_NORMAL;
  13380. }
  13381. if (null !== $this->startTime) {
  13382. $memoryUsage = memory_get_usage() / 1024 / 1024;
  13383. $timeSpent = microtime(true) - $this->startTime;
  13384. $messages = array_map(function ($message) use ($memoryUsage, $timeSpent) {
  13385. return sprintf('[%.1fMiB/%.2fs] %s', $memoryUsage, $timeSpent, $message);
  13386. }, (array) $messages);
  13387. }
  13388. if (true === $stderr && $this->output instanceof ConsoleOutputInterface) {
  13389. $this->output->getErrorOutput()->write($messages, $newline, $sfVerbosity);
  13390. $this->lastMessageErr = implode($newline ? "\n" : '', (array) $messages);
  13391. return;
  13392. }
  13393. $this->output->write($messages, $newline, $sfVerbosity);
  13394. $this->lastMessage = implode($newline ? "\n" : '', (array) $messages);
  13395. }
  13396. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  13397. {
  13398. $this->doOverwrite($messages, $newline, $size, false, $verbosity);
  13399. }
  13400. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  13401. {
  13402. $this->doOverwrite($messages, $newline, $size, true, $verbosity);
  13403. }
  13404. private function doOverwrite($messages, $newline, $size, $stderr, $verbosity)
  13405. {
  13406. $messages = implode($newline ? "\n" : '', (array) $messages);
  13407. if (!isset($size)) {
  13408. $size = strlen(strip_tags($stderr ? $this->lastMessageErr : $this->lastMessage));
  13409. }
  13410. $this->doWrite(str_repeat("\x08", $size), false, $stderr, $verbosity);
  13411. $this->doWrite($messages, false, $stderr, $verbosity);
  13412. $fill = $size - strlen(strip_tags($messages));
  13413. if ($fill > 0) {
  13414. $this->doWrite(str_repeat(' ', $fill), false, $stderr, $verbosity);
  13415. $this->doWrite(str_repeat("\x08", $fill), false, $stderr, $verbosity);
  13416. }
  13417. if ($newline) {
  13418. $this->doWrite('', true, $stderr, $verbosity);
  13419. }
  13420. if ($stderr) {
  13421. $this->lastMessageErr = $messages;
  13422. } else {
  13423. $this->lastMessage = $messages;
  13424. }
  13425. }
  13426. public function ask($question, $default = null)
  13427. {
  13428. $helper = $this->helperSet->get('question');
  13429. $question = new Question($question, $default);
  13430. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  13431. }
  13432. public function askConfirmation($question, $default = true)
  13433. {
  13434. $helper = $this->helperSet->get('question');
  13435. $question = new StrictConfirmationQuestion($question, $default);
  13436. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  13437. }
  13438. public function askAndValidate($question, $validator, $attempts = null, $default = null)
  13439. {
  13440. $helper = $this->helperSet->get('question');
  13441. $question = new Question($question, $default);
  13442. $question->setValidator($validator);
  13443. $question->setMaxAttempts($attempts);
  13444. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  13445. }
  13446. public function askAndHideAnswer($question)
  13447. {
  13448. $helper = $this->helperSet->get('question');
  13449. $question = new Question($question);
  13450. $question->setHidden(true);
  13451. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  13452. }
  13453. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  13454. {
  13455. $helper = $this->helperSet->get('question');
  13456. $question = new ChoiceQuestion($question, $choices, $default);
  13457. $question->setMaxAttempts($attempts ?: null);
  13458. $question->setErrorMessage($errorMessage);
  13459. $question->setMultiselect($multiselect);
  13460. $result = $helper->ask($this->input, $this->getErrorOutput(), $question);
  13461. if (!is_array($result)) {
  13462. return (string) array_search($result, $choices, true);
  13463. }
  13464. $results = array();
  13465. foreach ($choices as $index => $choice) {
  13466. if (in_array($choice, $result, true)) {
  13467. $results[] = (string) $index;
  13468. }
  13469. }
  13470. return $results;
  13471. }
  13472. private function getErrorOutput()
  13473. {
  13474. if ($this->output instanceof ConsoleOutputInterface) {
  13475. return $this->output->getErrorOutput();
  13476. }
  13477. return $this->output;
  13478. }
  13479. }
  13480. <?php
  13481. namespace Composer\IO;
  13482. use Composer\Config;
  13483. interface IOInterface
  13484. {
  13485. const QUIET = 1;
  13486. const NORMAL = 2;
  13487. const VERBOSE = 4;
  13488. const VERY_VERBOSE = 8;
  13489. const DEBUG = 16;
  13490. public function isInteractive();
  13491. public function isVerbose();
  13492. public function isVeryVerbose();
  13493. public function isDebug();
  13494. public function isDecorated();
  13495. public function write($messages, $newline = true, $verbosity = self::NORMAL);
  13496. public function writeError($messages, $newline = true, $verbosity = self::NORMAL);
  13497. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  13498. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  13499. public function ask($question, $default = null);
  13500. public function askConfirmation($question, $default = true);
  13501. public function askAndValidate($question, $validator, $attempts = null, $default = null);
  13502. public function askAndHideAnswer($question);
  13503. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false);
  13504. public function getAuthentications();
  13505. public function hasAuthentication($repositoryName);
  13506. public function getAuthentication($repositoryName);
  13507. public function setAuthentication($repositoryName, $username, $password = null);
  13508. public function loadConfiguration(Config $config);
  13509. }
  13510. <?php
  13511. namespace Composer\IO;
  13512. class NullIO extends BaseIO
  13513. {
  13514. public function isInteractive()
  13515. {
  13516. return false;
  13517. }
  13518. public function isVerbose()
  13519. {
  13520. return false;
  13521. }
  13522. public function isVeryVerbose()
  13523. {
  13524. return false;
  13525. }
  13526. public function isDebug()
  13527. {
  13528. return false;
  13529. }
  13530. public function isDecorated()
  13531. {
  13532. return false;
  13533. }
  13534. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  13535. {
  13536. }
  13537. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  13538. {
  13539. }
  13540. public function overwrite($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  13541. {
  13542. }
  13543. public function overwriteError($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  13544. {
  13545. }
  13546. public function ask($question, $default = null)
  13547. {
  13548. return $default;
  13549. }
  13550. public function askConfirmation($question, $default = true)
  13551. {
  13552. return $default;
  13553. }
  13554. public function askAndValidate($question, $validator, $attempts = false, $default = null)
  13555. {
  13556. return $default;
  13557. }
  13558. public function askAndHideAnswer($question)
  13559. {
  13560. return null;
  13561. }
  13562. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  13563. {
  13564. return $default;
  13565. }
  13566. }
  13567. <?php
  13568. namespace Composer;
  13569. use Composer\Autoload\AutoloadGenerator;
  13570. use Composer\DependencyResolver\DefaultPolicy;
  13571. use Composer\DependencyResolver\Operation\UpdateOperation;
  13572. use Composer\DependencyResolver\Operation\InstallOperation;
  13573. use Composer\DependencyResolver\Operation\UninstallOperation;
  13574. use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
  13575. use Composer\DependencyResolver\Operation\OperationInterface;
  13576. use Composer\DependencyResolver\PolicyInterface;
  13577. use Composer\DependencyResolver\Pool;
  13578. use Composer\DependencyResolver\Request;
  13579. use Composer\DependencyResolver\Rule;
  13580. use Composer\DependencyResolver\Solver;
  13581. use Composer\DependencyResolver\SolverProblemsException;
  13582. use Composer\Downloader\DownloadManager;
  13583. use Composer\EventDispatcher\EventDispatcher;
  13584. use Composer\Installer\InstallationManager;
  13585. use Composer\Installer\InstallerEvents;
  13586. use Composer\Installer\NoopInstaller;
  13587. use Composer\Installer\SuggestedPackagesReporter;
  13588. use Composer\IO\IOInterface;
  13589. use Composer\Package\AliasPackage;
  13590. use Composer\Package\BasePackage;
  13591. use Composer\Package\CompletePackage;
  13592. use Composer\Package\Link;
  13593. use Composer\Package\Loader\ArrayLoader;
  13594. use Composer\Package\Dumper\ArrayDumper;
  13595. use Composer\Semver\Constraint\Constraint;
  13596. use Composer\Package\Locker;
  13597. use Composer\Package\PackageInterface;
  13598. use Composer\Package\RootPackageInterface;
  13599. use Composer\Repository\CompositeRepository;
  13600. use Composer\Repository\InstalledArrayRepository;
  13601. use Composer\Repository\PlatformRepository;
  13602. use Composer\Repository\RepositoryInterface;
  13603. use Composer\Repository\RepositoryManager;
  13604. use Composer\Repository\WritableRepositoryInterface;
  13605. use Composer\Script\ScriptEvents;
  13606. class Installer
  13607. {
  13608. protected $io;
  13609. protected $config;
  13610. protected $package;
  13611. protected $downloadManager;
  13612. protected $repositoryManager;
  13613. protected $locker;
  13614. protected $installationManager;
  13615. protected $eventDispatcher;
  13616. protected $autoloadGenerator;
  13617. protected $preferSource = false;
  13618. protected $preferDist = false;
  13619. protected $optimizeAutoloader = false;
  13620. protected $classMapAuthoritative = false;
  13621. protected $apcuAutoloader = false;
  13622. protected $devMode = false;
  13623. protected $dryRun = false;
  13624. protected $verbose = false;
  13625. protected $update = false;
  13626. protected $dumpAutoloader = true;
  13627. protected $runScripts = true;
  13628. protected $ignorePlatformReqs = false;
  13629. protected $preferStable = false;
  13630. protected $preferLowest = false;
  13631. protected $skipSuggest = false;
  13632. protected $writeLock;
  13633. protected $executeOperations = true;
  13634. protected $updateWhitelist = null;
  13635. protected $whitelistDependencies = false;
  13636. protected $whitelistAllDependencies = false;
  13637. protected $suggestedPackagesReporter;
  13638. protected $additionalInstalledRepository;
  13639. public function __construct(IOInterface $io, Config $config, RootPackageInterface $package, DownloadManager $downloadManager, RepositoryManager $repositoryManager, Locker $locker, InstallationManager $installationManager, EventDispatcher $eventDispatcher, AutoloadGenerator $autoloadGenerator)
  13640. {
  13641. $this->io = $io;
  13642. $this->config = $config;
  13643. $this->package = $package;
  13644. $this->downloadManager = $downloadManager;
  13645. $this->repositoryManager = $repositoryManager;
  13646. $this->locker = $locker;
  13647. $this->installationManager = $installationManager;
  13648. $this->eventDispatcher = $eventDispatcher;
  13649. $this->autoloadGenerator = $autoloadGenerator;
  13650. $this->writeLock = $config->get('lock');
  13651. }
  13652. public function run()
  13653. {
  13654. gc_collect_cycles();
  13655. gc_disable();
  13656. if (!$this->update && !$this->locker->isLocked()) {
  13657. $this->update = true;
  13658. }
  13659. if ($this->dryRun) {
  13660. $this->verbose = true;
  13661. $this->runScripts = false;
  13662. $this->executeOperations = false;
  13663. $this->writeLock = false;
  13664. $this->dumpAutoloader = false;
  13665. $this->installationManager->addInstaller(new NoopInstaller);
  13666. $this->mockLocalRepositories($this->repositoryManager);
  13667. }
  13668. if ($this->runScripts) {
  13669. $devMode = (int) $this->devMode;
  13670. putenv("COMPOSER_DEV_MODE=$devMode");
  13671. $eventName = $this->update ? ScriptEvents::PRE_UPDATE_CMD : ScriptEvents::PRE_INSTALL_CMD;
  13672. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  13673. }
  13674. $this->downloadManager->setPreferSource($this->preferSource);
  13675. $this->downloadManager->setPreferDist($this->preferDist);
  13676. $localRepo = $this->repositoryManager->getLocalRepository();
  13677. if ($this->update) {
  13678. $platformOverrides = $this->config->get('platform') ?: array();
  13679. } else {
  13680. $platformOverrides = $this->locker->getPlatformOverrides();
  13681. }
  13682. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  13683. $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
  13684. $aliases = $this->getRootAliases();
  13685. $this->aliasPlatformPackages($platformRepo, $aliases);
  13686. if (!$this->suggestedPackagesReporter) {
  13687. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($this->io);
  13688. }
  13689. try {
  13690. list($res, $devPackages) = $this->doInstall($localRepo, $installedRepo, $platformRepo, $aliases);
  13691. if ($res !== 0) {
  13692. return $res;
  13693. }
  13694. } catch (\Exception $e) {
  13695. if ($this->executeOperations) {
  13696. $this->installationManager->notifyInstalls($this->io);
  13697. }
  13698. throw $e;
  13699. }
  13700. if ($this->executeOperations) {
  13701. $this->installationManager->notifyInstalls($this->io);
  13702. }
  13703. if ($this->devMode && !$this->skipSuggest) {
  13704. $this->suggestedPackagesReporter->output($installedRepo);
  13705. }
  13706. foreach ($localRepo->getPackages() as $package) {
  13707. if (!$package instanceof CompletePackage || !$package->isAbandoned()) {
  13708. continue;
  13709. }
  13710. $replacement = is_string($package->getReplacementPackage())
  13711. ? 'Use ' . $package->getReplacementPackage() . ' instead'
  13712. : 'No replacement was suggested';
  13713. $this->io->writeError(
  13714. sprintf(
  13715. "<warning>Package %s is abandoned, you should avoid using it. %s.</warning>",
  13716. $package->getPrettyName(),
  13717. $replacement
  13718. )
  13719. );
  13720. }
  13721. if ($this->update && $this->writeLock) {
  13722. $localRepo->reload();
  13723. $platformReqs = $this->extractPlatformRequirements($this->package->getRequires());
  13724. $platformDevReqs = $this->extractPlatformRequirements($this->package->getDevRequires());
  13725. $updatedLock = $this->locker->setLockData(
  13726. array_diff($localRepo->getCanonicalPackages(), $devPackages),
  13727. $devPackages,
  13728. $platformReqs,
  13729. $platformDevReqs,
  13730. $aliases,
  13731. $this->package->getMinimumStability(),
  13732. $this->package->getStabilityFlags(),
  13733. $this->preferStable || $this->package->getPreferStable(),
  13734. $this->preferLowest,
  13735. $this->config->get('platform') ?: array()
  13736. );
  13737. if ($updatedLock) {
  13738. $this->io->writeError('<info>Writing lock file</info>');
  13739. }
  13740. }
  13741. if ($this->dumpAutoloader) {
  13742. if ($this->optimizeAutoloader) {
  13743. $this->io->writeError('<info>Generating optimized autoload files</info>');
  13744. } else {
  13745. $this->io->writeError('<info>Generating autoload files</info>');
  13746. }
  13747. $this->autoloadGenerator->setDevMode($this->devMode);
  13748. $this->autoloadGenerator->setClassMapAuthoritative($this->classMapAuthoritative);
  13749. $this->autoloadGenerator->setApcu($this->apcuAutoloader);
  13750. $this->autoloadGenerator->setRunScripts($this->runScripts);
  13751. $this->autoloadGenerator->dump($this->config, $localRepo, $this->package, $this->installationManager, 'composer', $this->optimizeAutoloader);
  13752. }
  13753. if ($this->executeOperations) {
  13754. foreach ($localRepo->getPackages() as $package) {
  13755. $this->installationManager->ensureBinariesPresence($package);
  13756. }
  13757. $vendorDir = $this->config->get('vendor-dir');
  13758. if (is_dir($vendorDir)) {
  13759. @touch($vendorDir);
  13760. }
  13761. }
  13762. if ($this->runScripts) {
  13763. $eventName = $this->update ? ScriptEvents::POST_UPDATE_CMD : ScriptEvents::POST_INSTALL_CMD;
  13764. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  13765. }
  13766. if (!defined('HHVM_VERSION')) {
  13767. gc_enable();
  13768. }
  13769. return 0;
  13770. }
  13771. protected function doInstall($localRepo, $installedRepo, $platformRepo, $aliases)
  13772. {
  13773. $lockedRepository = null;
  13774. $repositories = null;
  13775. if (!$this->update || (!empty($this->updateWhitelist) && $this->locker->isLocked())) {
  13776. try {
  13777. $lockedRepository = $this->locker->getLockedRepository($this->devMode);
  13778. } catch (\RuntimeException $e) {
  13779. if ($this->package->getDevRequires()) {
  13780. throw $e;
  13781. }
  13782. $lockedRepository = $this->locker->getLockedRepository();
  13783. }
  13784. }
  13785. $this->whitelistUpdateDependencies(
  13786. $lockedRepository ?: $localRepo,
  13787. $this->package->getRequires(),
  13788. $this->package->getDevRequires()
  13789. );
  13790. $this->io->writeError('<info>Loading composer repositories with package information</info>');
  13791. $policy = $this->createPolicy();
  13792. $pool = $this->createPool($this->update ? null : $lockedRepository);
  13793. $pool->addRepository($installedRepo, $aliases);
  13794. if ($this->update) {
  13795. $repositories = $this->repositoryManager->getRepositories();
  13796. foreach ($repositories as $repository) {
  13797. $pool->addRepository($repository, $aliases);
  13798. }
  13799. }
  13800. if ($lockedRepository) {
  13801. $pool->addRepository($lockedRepository, $aliases);
  13802. }
  13803. $request = $this->createRequest($this->package, $platformRepo);
  13804. if ($this->update) {
  13805. $removedUnstablePackages = array();
  13806. foreach ($localRepo->getPackages() as $package) {
  13807. if (
  13808. !$pool->isPackageAcceptable($package->getNames(), $package->getStability())
  13809. && $this->installationManager->isPackageInstalled($localRepo, $package)
  13810. ) {
  13811. $removedUnstablePackages[$package->getName()] = true;
  13812. $request->remove($package->getName(), new Constraint('=', $package->getVersion()));
  13813. }
  13814. }
  13815. $this->io->writeError('<info>Updating dependencies'.($this->devMode ? ' (including require-dev)' : '').'</info>');
  13816. $request->updateAll();
  13817. $links = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  13818. foreach ($links as $link) {
  13819. $request->install($link->getTarget(), $link->getConstraint());
  13820. }
  13821. if ($this->updateWhitelist) {
  13822. $currentPackages = $this->getCurrentPackages($installedRepo);
  13823. $candidates = array();
  13824. foreach ($links as $link) {
  13825. $candidates[$link->getTarget()] = true;
  13826. $rootRequires[$link->getTarget()] = $link;
  13827. }
  13828. foreach ($currentPackages as $package) {
  13829. $candidates[$package->getName()] = true;
  13830. }
  13831. foreach ($candidates as $candidate => $dummy) {
  13832. foreach ($currentPackages as $curPackage) {
  13833. if ($curPackage->getName() === $candidate) {
  13834. if (!$this->isUpdateable($curPackage) && !isset($removedUnstablePackages[$curPackage->getName()])) {
  13835. $constraint = new Constraint('=', $curPackage->getVersion());
  13836. $description = $this->locker->isLocked() ? '(locked at' : '(installed at';
  13837. $requiredAt = isset($rootRequires[$candidate]) ? ', required as ' . $rootRequires[$candidate]->getPrettyConstraint() : '';
  13838. $constraint->setPrettyString($description . ' ' . $curPackage->getPrettyVersion() . $requiredAt . ')');
  13839. $request->install($curPackage->getName(), $constraint);
  13840. }
  13841. break;
  13842. }
  13843. }
  13844. }
  13845. }
  13846. } else {
  13847. $this->io->writeError('<info>Installing dependencies'.($this->devMode ? ' (including require-dev)' : '').' from lock file</info>');
  13848. if (!$this->locker->isFresh()) {
  13849. $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);
  13850. }
  13851. foreach ($lockedRepository->getPackages() as $package) {
  13852. $version = $package->getVersion();
  13853. if (isset($aliases[$package->getName()][$version])) {
  13854. $version = $aliases[$package->getName()][$version]['alias_normalized'];
  13855. }
  13856. $constraint = new Constraint('=', $version);
  13857. $constraint->setPrettyString($package->getPrettyVersion());
  13858. $request->install($package->getName(), $constraint);
  13859. }
  13860. foreach ($this->locker->getPlatformRequirements($this->devMode) as $link) {
  13861. $request->install($link->getTarget(), $link->getConstraint());
  13862. }
  13863. }
  13864. $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, 'force-links');
  13865. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request);
  13866. $solver = new Solver($policy, $pool, $installedRepo, $this->io);
  13867. try {
  13868. $operations = $solver->solve($request, $this->ignorePlatformReqs);
  13869. $ruleSetSize = $solver->getRuleSetSize();
  13870. $solver = null;
  13871. } catch (SolverProblemsException $e) {
  13872. $this->io->writeError('<error>Your requirements could not be resolved to an installable set of packages.</error>', true, IOInterface::QUIET);
  13873. $this->io->writeError($e->getMessage());
  13874. if ($this->update && !$this->devMode) {
  13875. $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);
  13876. }
  13877. return array(max(1, $e->getCode()), array());
  13878. }
  13879. $operations = $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, 'force-updates', $operations);
  13880. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request, $operations);
  13881. $this->io->writeError("Analyzed ".count($pool)." packages to resolve dependencies", true, IOInterface::VERBOSE);
  13882. $this->io->writeError("Analyzed ".$ruleSetSize." rules to resolve dependencies", true, IOInterface::VERBOSE);
  13883. if (!$operations) {
  13884. $this->io->writeError('Nothing to install or update');
  13885. }
  13886. $operations = $this->movePluginsToFront($operations);
  13887. $operations = $this->moveUninstallsToFront($operations);
  13888. if ($this->update) {
  13889. $devPackages = $this->extractDevPackages($operations, $localRepo, $platformRepo, $aliases);
  13890. if (!$this->devMode) {
  13891. $operations = $this->filterDevPackageOperations($devPackages, $operations, $localRepo);
  13892. }
  13893. } else {
  13894. $devPackages = null;
  13895. }
  13896. if ($operations) {
  13897. $installs = $updates = $uninstalls = array();
  13898. foreach ($operations as $operation) {
  13899. if ($operation instanceof InstallOperation) {
  13900. $installs[] = $operation->getPackage()->getPrettyName().':'.$operation->getPackage()->getFullPrettyVersion();
  13901. } elseif ($operation instanceof UpdateOperation) {
  13902. $updates[] = $operation->getTargetPackage()->getPrettyName().':'.$operation->getTargetPackage()->getFullPrettyVersion();
  13903. } elseif ($operation instanceof UninstallOperation) {
  13904. $uninstalls[] = $operation->getPackage()->getPrettyName();
  13905. }
  13906. }
  13907. $this->io->writeError(sprintf(
  13908. "<info>Package operations: %d install%s, %d update%s, %d removal%s</info>",
  13909. count($installs),
  13910. 1 === count($installs) ? '' : 's',
  13911. count($updates),
  13912. 1 === count($updates) ? '' : 's',
  13913. count($uninstalls),
  13914. 1 === count($uninstalls) ? '' : 's'
  13915. ));
  13916. if ($installs) {
  13917. $this->io->writeError("Installs: ".implode(', ', $installs), true, IOInterface::VERBOSE);
  13918. }
  13919. if ($updates) {
  13920. $this->io->writeError("Updates: ".implode(', ', $updates), true, IOInterface::VERBOSE);
  13921. }
  13922. if ($uninstalls) {
  13923. $this->io->writeError("Removals: ".implode(', ', $uninstalls), true, IOInterface::VERBOSE);
  13924. }
  13925. }
  13926. foreach ($operations as $operation) {
  13927. $jobType = $operation->getJobType();
  13928. if ('install' === $jobType) {
  13929. $this->suggestedPackagesReporter->addSuggestionsFromPackage($operation->getPackage());
  13930. }
  13931. if ($this->update) {
  13932. $package = null;
  13933. if ('update' === $jobType) {
  13934. $package = $operation->getTargetPackage();
  13935. } elseif ('install' === $jobType) {
  13936. $package = $operation->getPackage();
  13937. }
  13938. if ($package && $package->isDev()) {
  13939. $references = $this->package->getReferences();
  13940. if (isset($references[$package->getName()])) {
  13941. $this->updateInstallReferences($package, $references[$package->getName()]);
  13942. }
  13943. }
  13944. if ('update' === $jobType) {
  13945. $targetPackage = $operation->getTargetPackage();
  13946. if ($targetPackage->isDev()) {
  13947. $initialPackage = $operation->getInitialPackage();
  13948. if ($targetPackage->getVersion() === $initialPackage->getVersion()
  13949. && (!$targetPackage->getSourceReference() || $targetPackage->getSourceReference() === $initialPackage->getSourceReference())
  13950. && (!$targetPackage->getDistReference() || $targetPackage->getDistReference() === $initialPackage->getDistReference())
  13951. ) {
  13952. $this->io->writeError(' - Skipping update of ' . $targetPackage->getPrettyName() . ' to the same reference-locked version', true, IOInterface::DEBUG);
  13953. $this->io->writeError('', true, IOInterface::DEBUG);
  13954. continue;
  13955. }
  13956. }
  13957. }
  13958. }
  13959. $event = 'Composer\Installer\PackageEvents::PRE_PACKAGE_'.strtoupper($jobType);
  13960. if (defined($event) && $this->runScripts) {
  13961. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  13962. }
  13963. if (!$this->executeOperations && false === strpos($operation->getJobType(), 'Alias')) {
  13964. $this->io->writeError(' - ' . $operation);
  13965. } elseif ($this->io->isDebug() && false !== strpos($operation->getJobType(), 'Alias')) {
  13966. $this->io->writeError(' - ' . $operation);
  13967. }
  13968. $this->installationManager->execute($localRepo, $operation);
  13969. if ($this->verbose && $this->io->isVeryVerbose() && in_array($jobType, array('install', 'update'))) {
  13970. $reason = $operation->getReason();
  13971. if ($reason instanceof Rule) {
  13972. switch ($reason->getReason()) {
  13973. case Rule::RULE_JOB_INSTALL:
  13974. $this->io->writeError(' REASON: Required by the root package: '.$reason->getPrettyString($pool));
  13975. $this->io->writeError('');
  13976. break;
  13977. case Rule::RULE_PACKAGE_REQUIRES:
  13978. $this->io->writeError(' REASON: '.$reason->getPrettyString($pool));
  13979. $this->io->writeError('');
  13980. break;
  13981. }
  13982. }
  13983. }
  13984. if ($this->executeOperations || $this->writeLock) {
  13985. $localRepo->write();
  13986. }
  13987. $event = 'Composer\Installer\PackageEvents::POST_PACKAGE_'.strtoupper($jobType);
  13988. if (defined($event) && $this->runScripts) {
  13989. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  13990. }
  13991. }
  13992. if ($this->executeOperations) {
  13993. $this->processPackageUrls($pool, $policy, $localRepo, $repositories);
  13994. $localRepo->write();
  13995. }
  13996. return array(0, $devPackages);
  13997. }
  13998. private function extractDevPackages(array $operations, RepositoryInterface $localRepo, PlatformRepository $platformRepo, array $aliases)
  13999. {
  14000. if (!$this->package->getDevRequires()) {
  14001. return array();
  14002. }
  14003. $tempLocalRepo = clone $localRepo;
  14004. foreach ($operations as $operation) {
  14005. switch ($operation->getJobType()) {
  14006. case 'install':
  14007. case 'markAliasInstalled':
  14008. if (!$tempLocalRepo->hasPackage($operation->getPackage())) {
  14009. $tempLocalRepo->addPackage(clone $operation->getPackage());
  14010. }
  14011. break;
  14012. case 'uninstall':
  14013. case 'markAliasUninstalled':
  14014. $tempLocalRepo->removePackage($operation->getPackage());
  14015. break;
  14016. case 'update':
  14017. $tempLocalRepo->removePackage($operation->getInitialPackage());
  14018. if (!$tempLocalRepo->hasPackage($operation->getTargetPackage())) {
  14019. $tempLocalRepo->addPackage(clone $operation->getTargetPackage());
  14020. }
  14021. break;
  14022. default:
  14023. throw new \LogicException('Unknown type: '.$operation->getJobType());
  14024. }
  14025. }
  14026. $localRepo = new InstalledArrayRepository(array());
  14027. $loader = new ArrayLoader(null, true);
  14028. $dumper = new ArrayDumper();
  14029. foreach ($tempLocalRepo->getCanonicalPackages() as $pkg) {
  14030. $localRepo->addPackage($loader->load($dumper->dump($pkg)));
  14031. }
  14032. unset($tempLocalRepo, $loader, $dumper);
  14033. $policy = $this->createPolicy();
  14034. $pool = $this->createPool();
  14035. $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
  14036. $pool->addRepository($installedRepo, $aliases);
  14037. $request = $this->createRequest($this->package, $platformRepo);
  14038. $request->updateAll();
  14039. foreach ($this->package->getRequires() as $link) {
  14040. $request->install($link->getTarget(), $link->getConstraint());
  14041. }
  14042. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request);
  14043. $solver = new Solver($policy, $pool, $installedRepo, $this->io);
  14044. $ops = $solver->solve($request, $this->ignorePlatformReqs);
  14045. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request, $ops);
  14046. $devPackages = array();
  14047. foreach ($ops as $op) {
  14048. if ($op->getJobType() === 'uninstall') {
  14049. $devPackages[] = $op->getPackage();
  14050. }
  14051. }
  14052. return $devPackages;
  14053. }
  14054. private function filterDevPackageOperations(array $devPackages, array $operations, RepositoryInterface $localRepo)
  14055. {
  14056. $finalOps = array();
  14057. $packagesToSkip = array();
  14058. foreach ($devPackages as $pkg) {
  14059. $packagesToSkip[$pkg->getName()] = true;
  14060. if ($installedDevPkg = $localRepo->findPackage($pkg->getName(), '*')) {
  14061. if ($installedDevPkg instanceof AliasPackage) {
  14062. $finalOps[] = new MarkAliasUninstalledOperation($installedDevPkg, 'non-dev install removing it');
  14063. $installedDevPkg = $installedDevPkg->getAliasOf();
  14064. }
  14065. $finalOps[] = new UninstallOperation($installedDevPkg, 'non-dev install removing it');
  14066. }
  14067. }
  14068. foreach ($operations as $op) {
  14069. $package = $op->getJobType() === 'update' ? $op->getTargetPackage() : $op->getPackage();
  14070. if (isset($packagesToSkip[$package->getName()])) {
  14071. continue;
  14072. }
  14073. $finalOps[] = $op;
  14074. }
  14075. return $finalOps;
  14076. }
  14077. private function movePluginsToFront(array $operations)
  14078. {
  14079. $pluginsNoDeps = array();
  14080. $pluginsWithDeps = array();
  14081. $pluginRequires = array();
  14082. foreach (array_reverse($operations, true) as $idx => $op) {
  14083. if ($op instanceof InstallOperation) {
  14084. $package = $op->getPackage();
  14085. } elseif ($op instanceof UpdateOperation) {
  14086. $package = $op->getTargetPackage();
  14087. } else {
  14088. continue;
  14089. }
  14090. $isPlugin = $package->getType() === 'composer-plugin' || $package->getType() === 'composer-installer';
  14091. if ($isPlugin || count(array_intersect($package->getNames(), $pluginRequires))) {
  14092. $requires = array_filter(array_keys($package->getRequires()), function ($req) {
  14093. return $req !== 'composer-plugin-api' && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req);
  14094. });
  14095. if ($isPlugin && !count($requires)) {
  14096. array_unshift($pluginsNoDeps, $op);
  14097. } else {
  14098. $pluginRequires = array_merge($pluginRequires, $requires);
  14099. array_unshift($pluginsWithDeps, $op);
  14100. }
  14101. unset($operations[$idx]);
  14102. }
  14103. }
  14104. return array_merge($pluginsNoDeps, $pluginsWithDeps, $operations);
  14105. }
  14106. private function moveUninstallsToFront(array $operations)
  14107. {
  14108. $uninstOps = array();
  14109. foreach ($operations as $idx => $op) {
  14110. if ($op instanceof UninstallOperation) {
  14111. $uninstOps[] = $op;
  14112. unset($operations[$idx]);
  14113. }
  14114. }
  14115. return array_merge($uninstOps, $operations);
  14116. }
  14117. private function createInstalledRepo(RepositoryInterface $localRepo, PlatformRepository $platformRepo)
  14118. {
  14119. $installedRootPackage = clone $this->package;
  14120. $installedRootPackage->setRequires(array());
  14121. $installedRootPackage->setDevRequires(array());
  14122. $repos = array(
  14123. $localRepo,
  14124. new InstalledArrayRepository(array($installedRootPackage)),
  14125. $platformRepo,
  14126. );
  14127. $installedRepo = new CompositeRepository($repos);
  14128. if ($this->additionalInstalledRepository) {
  14129. $installedRepo->addRepository($this->additionalInstalledRepository);
  14130. }
  14131. return $installedRepo;
  14132. }
  14133. private function createPool(RepositoryInterface $lockedRepository = null)
  14134. {
  14135. if ($this->update) {
  14136. $minimumStability = $this->package->getMinimumStability();
  14137. $stabilityFlags = $this->package->getStabilityFlags();
  14138. $requires = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  14139. } else {
  14140. $minimumStability = $this->locker->getMinimumStability();
  14141. $stabilityFlags = $this->locker->getStabilityFlags();
  14142. $requires = array();
  14143. foreach ($lockedRepository->getPackages() as $package) {
  14144. $constraint = new Constraint('=', $package->getVersion());
  14145. $constraint->setPrettyString($package->getPrettyVersion());
  14146. $requires[$package->getName()] = $constraint;
  14147. }
  14148. }
  14149. $rootConstraints = array();
  14150. foreach ($requires as $req => $constraint) {
  14151. if ($this->ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req)) {
  14152. continue;
  14153. }
  14154. if ($constraint instanceof Link) {
  14155. $rootConstraints[$req] = $constraint->getConstraint();
  14156. } else {
  14157. $rootConstraints[$req] = $constraint;
  14158. }
  14159. }
  14160. return new Pool($minimumStability, $stabilityFlags, $rootConstraints);
  14161. }
  14162. private function createPolicy()
  14163. {
  14164. $preferStable = null;
  14165. $preferLowest = null;
  14166. if (!$this->update) {
  14167. $preferStable = $this->locker->getPreferStable();
  14168. $preferLowest = $this->locker->getPreferLowest();
  14169. }
  14170. if (null === $preferStable) {
  14171. $preferStable = $this->preferStable || $this->package->getPreferStable();
  14172. }
  14173. if (null === $preferLowest) {
  14174. $preferLowest = $this->preferLowest;
  14175. }
  14176. return new DefaultPolicy($preferStable, $preferLowest);
  14177. }
  14178. private function createRequest(RootPackageInterface $rootPackage, PlatformRepository $platformRepo)
  14179. {
  14180. $request = new Request();
  14181. $constraint = new Constraint('=', $rootPackage->getVersion());
  14182. $constraint->setPrettyString($rootPackage->getPrettyVersion());
  14183. $request->install($rootPackage->getName(), $constraint);
  14184. $fixedPackages = $platformRepo->getPackages();
  14185. if ($this->additionalInstalledRepository) {
  14186. $additionalFixedPackages = $this->additionalInstalledRepository->getPackages();
  14187. $fixedPackages = array_merge($fixedPackages, $additionalFixedPackages);
  14188. }
  14189. $provided = $rootPackage->getProvides();
  14190. foreach ($fixedPackages as $package) {
  14191. $constraint = new Constraint('=', $package->getVersion());
  14192. $constraint->setPrettyString($package->getPrettyVersion());
  14193. if ($package->getRepository() !== $platformRepo
  14194. || !isset($provided[$package->getName()])
  14195. || !$provided[$package->getName()]->getConstraint()->matches($constraint)
  14196. ) {
  14197. $request->fix($package->getName(), $constraint);
  14198. }
  14199. }
  14200. return $request;
  14201. }
  14202. private function processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, $task, array $operations = null)
  14203. {
  14204. if ($task === 'force-updates' && null === $operations) {
  14205. throw new \InvalidArgumentException('Missing operations argument');
  14206. }
  14207. if ($task === 'force-links') {
  14208. $operations = array();
  14209. }
  14210. if ($this->update && $this->updateWhitelist) {
  14211. $currentPackages = $this->getCurrentPackages($installedRepo);
  14212. }
  14213. foreach ($localRepo->getCanonicalPackages() as $package) {
  14214. if (!$package->isDev()) {
  14215. continue;
  14216. }
  14217. foreach ($operations as $operation) {
  14218. if (('update' === $operation->getJobType() && $operation->getInitialPackage()->equals($package))
  14219. || ('uninstall' === $operation->getJobType() && $operation->getPackage()->equals($package))
  14220. ) {
  14221. continue 2;
  14222. }
  14223. }
  14224. if ($this->update) {
  14225. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  14226. foreach ($currentPackages as $curPackage) {
  14227. if ($curPackage->isDev() && $curPackage->getName() === $package->getName() && $curPackage->getVersion() === $package->getVersion()) {
  14228. if ($task === 'force-links') {
  14229. $package->setRequires($curPackage->getRequires());
  14230. $package->setConflicts($curPackage->getConflicts());
  14231. $package->setProvides($curPackage->getProvides());
  14232. $package->setReplaces($curPackage->getReplaces());
  14233. } elseif ($task === 'force-updates') {
  14234. if (($curPackage->getSourceReference() && $curPackage->getSourceReference() !== $package->getSourceReference())
  14235. || ($curPackage->getDistReference() && $curPackage->getDistReference() !== $package->getDistReference())
  14236. ) {
  14237. $operations[] = new UpdateOperation($package, $curPackage);
  14238. }
  14239. }
  14240. break;
  14241. }
  14242. }
  14243. continue;
  14244. }
  14245. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  14246. foreach ($matches as $index => $match) {
  14247. if (!in_array($match->getRepository(), $repositories, true)) {
  14248. unset($matches[$index]);
  14249. continue;
  14250. }
  14251. if ($match->getName() !== $package->getName()) {
  14252. unset($matches[$index]);
  14253. continue;
  14254. }
  14255. $matches[$index] = $match->getId();
  14256. }
  14257. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  14258. $newPackage = $pool->literalToPackage($matches[0]);
  14259. if ($task === 'force-links' && $newPackage) {
  14260. $package->setRequires($newPackage->getRequires());
  14261. $package->setConflicts($newPackage->getConflicts());
  14262. $package->setProvides($newPackage->getProvides());
  14263. $package->setReplaces($newPackage->getReplaces());
  14264. }
  14265. if (
  14266. $task === 'force-updates'
  14267. && $newPackage
  14268. && (
  14269. ($newPackage->getSourceReference() && $newPackage->getSourceReference() !== $package->getSourceReference())
  14270. || ($newPackage->getDistReference() && $newPackage->getDistReference() !== $package->getDistReference())
  14271. )
  14272. ) {
  14273. $operations[] = new UpdateOperation($package, $newPackage);
  14274. continue;
  14275. }
  14276. }
  14277. if ($task === 'force-updates') {
  14278. $references = $this->package->getReferences();
  14279. if (isset($references[$package->getName()]) && $references[$package->getName()] !== $package->getSourceReference()) {
  14280. $operations[] = new UpdateOperation($package, clone $package);
  14281. }
  14282. }
  14283. } else {
  14284. foreach ($lockedRepository->findPackages($package->getName()) as $lockedPackage) {
  14285. if ($lockedPackage->isDev() && $lockedPackage->getVersion() === $package->getVersion()) {
  14286. if ($task === 'force-links') {
  14287. $package->setRequires($lockedPackage->getRequires());
  14288. $package->setConflicts($lockedPackage->getConflicts());
  14289. $package->setProvides($lockedPackage->getProvides());
  14290. $package->setReplaces($lockedPackage->getReplaces());
  14291. } elseif ($task === 'force-updates') {
  14292. if (($lockedPackage->getSourceReference() && $lockedPackage->getSourceReference() !== $package->getSourceReference())
  14293. || ($lockedPackage->getDistReference() && $lockedPackage->getDistReference() !== $package->getDistReference())
  14294. ) {
  14295. $operations[] = new UpdateOperation($package, $lockedPackage);
  14296. }
  14297. }
  14298. break;
  14299. }
  14300. }
  14301. }
  14302. }
  14303. return $operations;
  14304. }
  14305. private function getCurrentPackages($installedRepo)
  14306. {
  14307. if ($this->locker->isLocked()) {
  14308. try {
  14309. return $this->locker->getLockedRepository(true)->getPackages();
  14310. } catch (\RuntimeException $e) {
  14311. return $this->locker->getLockedRepository()->getPackages();
  14312. }
  14313. }
  14314. return $installedRepo->getPackages();
  14315. }
  14316. private function getRootAliases()
  14317. {
  14318. if ($this->update) {
  14319. $aliases = $this->package->getAliases();
  14320. } else {
  14321. $aliases = $this->locker->getAliases();
  14322. }
  14323. $normalizedAliases = array();
  14324. foreach ($aliases as $alias) {
  14325. $normalizedAliases[$alias['package']][$alias['version']] = array(
  14326. 'alias' => $alias['alias'],
  14327. 'alias_normalized' => $alias['alias_normalized'],
  14328. );
  14329. }
  14330. return $normalizedAliases;
  14331. }
  14332. private function processPackageUrls($pool, $policy, $localRepo, $repositories)
  14333. {
  14334. if (!$this->update) {
  14335. return;
  14336. }
  14337. $rootRefs = $this->package->getReferences();
  14338. foreach ($localRepo->getCanonicalPackages() as $package) {
  14339. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  14340. foreach ($matches as $index => $match) {
  14341. if (!in_array($match->getRepository(), $repositories, true)) {
  14342. unset($matches[$index]);
  14343. continue;
  14344. }
  14345. if ($match->getName() !== $package->getName()) {
  14346. unset($matches[$index]);
  14347. continue;
  14348. }
  14349. $matches[$index] = $match->getId();
  14350. }
  14351. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  14352. $newPackage = $pool->literalToPackage($matches[0]);
  14353. $sourceUrl = $package->getSourceUrl();
  14354. $newSourceUrl = $newPackage->getSourceUrl();
  14355. $newReference = $newPackage->getSourceReference();
  14356. if ($package->isDev() && isset($rootRefs[$package->getName()]) && $package->getSourceReference() === $rootRefs[$package->getName()]) {
  14357. $newReference = $rootRefs[$package->getName()];
  14358. }
  14359. $this->updatePackageUrl($package, $newSourceUrl, $newPackage->getSourceType(), $newReference, $newPackage->getDistUrl(), $newPackage->getDistType(), $newPackage->getDistSha1Checksum());
  14360. if ($package instanceof CompletePackage && $newPackage instanceof CompletePackage) {
  14361. $package->setAbandoned($newPackage->getReplacementPackage() ?: $newPackage->isAbandoned());
  14362. }
  14363. $package->setDistMirrors($newPackage->getDistMirrors());
  14364. $package->setSourceMirrors($newPackage->getSourceMirrors());
  14365. $package->setTransportOptions($newPackage->getTransportOptions());
  14366. }
  14367. }
  14368. }
  14369. private function updatePackageUrl(PackageInterface $package, $sourceUrl, $sourceType, $sourceReference, $distUrl, $distType, $distShaSum)
  14370. {
  14371. $oldSourceRef = $package->getSourceReference();
  14372. if ($package->getSourceUrl() !== $sourceUrl) {
  14373. $package->setSourceType($sourceType);
  14374. $package->setSourceUrl($sourceUrl);
  14375. $package->setSourceReference($sourceReference);
  14376. }
  14377. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com|(?:www\.)?gitlab\.com)/}i', $distUrl)) {
  14378. $package->setDistUrl($distUrl);
  14379. $package->setDistType($distType);
  14380. $package->setDistSha1Checksum($distShaSum);
  14381. $this->updateInstallReferences($package, $sourceReference);
  14382. }
  14383. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  14384. $this->updateInstallReferences($package, $oldSourceRef);
  14385. }
  14386. }
  14387. private function updateInstallReferences(PackageInterface $package, $reference)
  14388. {
  14389. if (!$reference) {
  14390. return;
  14391. }
  14392. $package->setSourceReference($reference);
  14393. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com|(?:www\.)?gitlab\.com)/}i', $package->getDistUrl())) {
  14394. $package->setDistReference($reference);
  14395. $package->setDistUrl(preg_replace('{(?<=/|sha=)[a-f0-9]{40}(?=/|$)}i', $reference, $package->getDistUrl()));
  14396. } elseif ($package->getDistReference()) {
  14397. $package->setDistReference($reference);
  14398. }
  14399. }
  14400. private function aliasPlatformPackages(PlatformRepository $platformRepo, $aliases)
  14401. {
  14402. foreach ($aliases as $package => $versions) {
  14403. foreach ($versions as $version => $alias) {
  14404. $packages = $platformRepo->findPackages($package, $version);
  14405. foreach ($packages as $package) {
  14406. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  14407. $aliasPackage->setRootPackageAlias(true);
  14408. $platformRepo->addPackage($aliasPackage);
  14409. }
  14410. }
  14411. }
  14412. }
  14413. private function isUpdateable(PackageInterface $package)
  14414. {
  14415. if (!$this->updateWhitelist) {
  14416. throw new \LogicException('isUpdateable should only be called when a whitelist is present');
  14417. }
  14418. foreach ($this->updateWhitelist as $whiteListedPattern => $void) {
  14419. $patternRegexp = BasePackage::packageNameToRegexp($whiteListedPattern);
  14420. if (preg_match($patternRegexp, $package->getName())) {
  14421. return true;
  14422. }
  14423. }
  14424. return false;
  14425. }
  14426. private function extractPlatformRequirements($links)
  14427. {
  14428. $platformReqs = array();
  14429. foreach ($links as $link) {
  14430. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  14431. $platformReqs[$link->getTarget()] = $link->getPrettyConstraint();
  14432. }
  14433. }
  14434. return $platformReqs;
  14435. }
  14436. private function whitelistUpdateDependencies($localOrLockRepo, array $rootRequires, array $rootDevRequires)
  14437. {
  14438. if (!$this->updateWhitelist) {
  14439. return;
  14440. }
  14441. $rootRequires = array_merge($rootRequires, $rootDevRequires);
  14442. $skipPackages = array();
  14443. if (!$this->whitelistAllDependencies) {
  14444. foreach ($rootRequires as $require) {
  14445. $skipPackages[$require->getTarget()] = true;
  14446. }
  14447. }
  14448. $pool = new Pool('dev');
  14449. $pool->addRepository($localOrLockRepo);
  14450. $seen = array();
  14451. $rootRequiredPackageNames = array_keys($rootRequires);
  14452. foreach ($this->updateWhitelist as $packageName => $void) {
  14453. $packageQueue = new \SplQueue;
  14454. $nameMatchesRequiredPackage = false;
  14455. $depPackages = $pool->whatProvides($packageName);
  14456. $matchesByPattern = array();
  14457. if (empty($depPackages)) {
  14458. $whitelistPatternSearchRegexp = BasePackage::packageNameToRegexp($packageName, '^%s$');
  14459. foreach ($localOrLockRepo->search($whitelistPatternSearchRegexp) as $installedPackage) {
  14460. $matchesByPattern[] = $pool->whatProvides($installedPackage['name']);
  14461. }
  14462. $whitelistPatternRegexp = BasePackage::packageNameToRegexp($packageName);
  14463. foreach ($rootRequiredPackageNames as $rootRequiredPackageName) {
  14464. if (preg_match($whitelistPatternRegexp, $rootRequiredPackageName)) {
  14465. $nameMatchesRequiredPackage = true;
  14466. break;
  14467. }
  14468. }
  14469. }
  14470. if (!empty($matchesByPattern)) {
  14471. $depPackages = array_merge($depPackages, call_user_func_array('array_merge', $matchesByPattern));
  14472. }
  14473. if (count($depPackages) == 0 && !$nameMatchesRequiredPackage && !in_array($packageName, array('nothing', 'lock', 'mirrors'))) {
  14474. $this->io->writeError('<warning>Package "' . $packageName . '" listed for update is not installed. Ignoring.</warning>');
  14475. }
  14476. foreach ($depPackages as $depPackage) {
  14477. $packageQueue->enqueue($depPackage);
  14478. }
  14479. while (!$packageQueue->isEmpty()) {
  14480. $package = $packageQueue->dequeue();
  14481. if (isset($seen[$package->getId()])) {
  14482. continue;
  14483. }
  14484. $seen[$package->getId()] = true;
  14485. $this->updateWhitelist[$package->getName()] = true;
  14486. if (!$this->whitelistDependencies && !$this->whitelistAllDependencies) {
  14487. continue;
  14488. }
  14489. $requires = $package->getRequires();
  14490. foreach ($requires as $require) {
  14491. $requirePackages = $pool->whatProvides($require->getTarget());
  14492. foreach ($requirePackages as $requirePackage) {
  14493. if (isset($this->updateWhitelist[$requirePackage->getName()])) {
  14494. continue;
  14495. }
  14496. if (isset($skipPackages[$requirePackage->getName()]) && !preg_match(BasePackage::packageNameToRegexp($packageName), $requirePackage->getName())) {
  14497. $this->io->writeError('<warning>Dependency "' . $requirePackage->getName() . '" is also a root requirement, but is not explicitly whitelisted. Ignoring.</warning>');
  14498. continue;
  14499. }
  14500. $packageQueue->enqueue($requirePackage);
  14501. }
  14502. }
  14503. }
  14504. }
  14505. }
  14506. private function mockLocalRepositories(RepositoryManager $rm)
  14507. {
  14508. $packages = array();
  14509. foreach ($rm->getLocalRepository()->getPackages() as $package) {
  14510. $packages[(string) $package] = clone $package;
  14511. }
  14512. foreach ($packages as $key => $package) {
  14513. if ($package instanceof AliasPackage) {
  14514. $alias = (string) $package->getAliasOf();
  14515. $packages[$key] = new AliasPackage($packages[$alias], $package->getVersion(), $package->getPrettyVersion());
  14516. }
  14517. }
  14518. $rm->setLocalRepository(
  14519. new InstalledArrayRepository($packages)
  14520. );
  14521. }
  14522. public static function create(IOInterface $io, Composer $composer)
  14523. {
  14524. return new static(
  14525. $io,
  14526. $composer->getConfig(),
  14527. $composer->getPackage(),
  14528. $composer->getDownloadManager(),
  14529. $composer->getRepositoryManager(),
  14530. $composer->getLocker(),
  14531. $composer->getInstallationManager(),
  14532. $composer->getEventDispatcher(),
  14533. $composer->getAutoloadGenerator()
  14534. );
  14535. }
  14536. public function setAdditionalInstalledRepository(RepositoryInterface $additionalInstalledRepository)
  14537. {
  14538. $this->additionalInstalledRepository = $additionalInstalledRepository;
  14539. return $this;
  14540. }
  14541. public function setDryRun($dryRun = true)
  14542. {
  14543. $this->dryRun = (bool) $dryRun;
  14544. return $this;
  14545. }
  14546. public function isDryRun()
  14547. {
  14548. return $this->dryRun;
  14549. }
  14550. public function setPreferSource($preferSource = true)
  14551. {
  14552. $this->preferSource = (bool) $preferSource;
  14553. return $this;
  14554. }
  14555. public function setPreferDist($preferDist = true)
  14556. {
  14557. $this->preferDist = (bool) $preferDist;
  14558. return $this;
  14559. }
  14560. public function setOptimizeAutoloader($optimizeAutoloader = false)
  14561. {
  14562. $this->optimizeAutoloader = (bool) $optimizeAutoloader;
  14563. if (!$this->optimizeAutoloader) {
  14564. $this->setClassMapAuthoritative(false);
  14565. }
  14566. return $this;
  14567. }
  14568. public function setClassMapAuthoritative($classMapAuthoritative = false)
  14569. {
  14570. $this->classMapAuthoritative = (bool) $classMapAuthoritative;
  14571. if ($this->classMapAuthoritative) {
  14572. $this->setOptimizeAutoloader(true);
  14573. }
  14574. return $this;
  14575. }
  14576. public function setApcuAutoloader($apcuAutoloader = false)
  14577. {
  14578. $this->apcuAutoloader = (bool) $apcuAutoloader;
  14579. return $this;
  14580. }
  14581. public function setUpdate($update = true)
  14582. {
  14583. $this->update = (bool) $update;
  14584. return $this;
  14585. }
  14586. public function setDevMode($devMode = true)
  14587. {
  14588. $this->devMode = (bool) $devMode;
  14589. return $this;
  14590. }
  14591. public function setDumpAutoloader($dumpAutoloader = true)
  14592. {
  14593. $this->dumpAutoloader = (bool) $dumpAutoloader;
  14594. return $this;
  14595. }
  14596. public function setRunScripts($runScripts = true)
  14597. {
  14598. $this->runScripts = (bool) $runScripts;
  14599. return $this;
  14600. }
  14601. public function setConfig(Config $config)
  14602. {
  14603. $this->config = $config;
  14604. return $this;
  14605. }
  14606. public function setVerbose($verbose = true)
  14607. {
  14608. $this->verbose = (bool) $verbose;
  14609. return $this;
  14610. }
  14611. public function isVerbose()
  14612. {
  14613. return $this->verbose;
  14614. }
  14615. public function setIgnorePlatformRequirements($ignorePlatformReqs = false)
  14616. {
  14617. $this->ignorePlatformReqs = (bool) $ignorePlatformReqs;
  14618. return $this;
  14619. }
  14620. public function setUpdateWhitelist(array $packages)
  14621. {
  14622. $this->updateWhitelist = array_flip(array_map('strtolower', $packages));
  14623. return $this;
  14624. }
  14625. public function setWhitelistDependencies($updateDependencies = true)
  14626. {
  14627. return $this->setWhitelistTransitiveDependencies($updateDependencies);
  14628. }
  14629. public function setWhitelistTransitiveDependencies($updateTransitiveDependencies = true)
  14630. {
  14631. $this->whitelistDependencies = (bool) $updateTransitiveDependencies;
  14632. return $this;
  14633. }
  14634. public function setWhitelistAllDependencies($updateAllDependencies = true)
  14635. {
  14636. $this->whitelistAllDependencies = (bool) $updateAllDependencies;
  14637. return $this;
  14638. }
  14639. public function setPreferStable($preferStable = true)
  14640. {
  14641. $this->preferStable = (bool) $preferStable;
  14642. return $this;
  14643. }
  14644. public function setPreferLowest($preferLowest = true)
  14645. {
  14646. $this->preferLowest = (bool) $preferLowest;
  14647. return $this;
  14648. }
  14649. public function setWriteLock($writeLock = true)
  14650. {
  14651. $this->writeLock = (bool) $writeLock;
  14652. return $this;
  14653. }
  14654. public function setExecuteOperations($executeOperations = true)
  14655. {
  14656. $this->executeOperations = (bool) $executeOperations;
  14657. return $this;
  14658. }
  14659. public function setSkipSuggest($skipSuggest = true)
  14660. {
  14661. $this->skipSuggest = (bool) $skipSuggest;
  14662. return $this;
  14663. }
  14664. public function disablePlugins()
  14665. {
  14666. $this->installationManager->disablePlugins();
  14667. return $this;
  14668. }
  14669. public function setSuggestedPackagesReporter(SuggestedPackagesReporter $suggestedPackagesReporter)
  14670. {
  14671. $this->suggestedPackagesReporter = $suggestedPackagesReporter;
  14672. return $this;
  14673. }
  14674. }
  14675. <?php
  14676. namespace Composer\Installer;
  14677. use Composer\IO\IOInterface;
  14678. use Composer\Package\PackageInterface;
  14679. use Composer\Util\Filesystem;
  14680. use Composer\Util\Platform;
  14681. use Composer\Util\ProcessExecutor;
  14682. use Composer\Util\Silencer;
  14683. class BinaryInstaller
  14684. {
  14685. protected $binDir;
  14686. protected $binCompat;
  14687. protected $io;
  14688. protected $filesystem;
  14689. public function __construct(IOInterface $io, $binDir, $binCompat, Filesystem $filesystem = null)
  14690. {
  14691. $this->binDir = $binDir;
  14692. $this->binCompat = $binCompat;
  14693. $this->io = $io;
  14694. $this->filesystem = $filesystem ?: new Filesystem();
  14695. }
  14696. public function installBinaries(PackageInterface $package, $installPath, $warnOnOverwrite = true)
  14697. {
  14698. $binaries = $this->getBinaries($package);
  14699. if (!$binaries) {
  14700. return;
  14701. }
  14702. foreach ($binaries as $bin) {
  14703. $binPath = $installPath.'/'.$bin;
  14704. if (!file_exists($binPath)) {
  14705. $this->io->writeError(' <warning>Skipped installation of bin '.$bin.' for package '.$package->getName().': file not found in package</warning>');
  14706. continue;
  14707. }
  14708. $binPath = realpath($binPath);
  14709. $this->initializeBinDir();
  14710. $link = $this->binDir.'/'.basename($bin);
  14711. if (file_exists($link)) {
  14712. if (is_link($link)) {
  14713. Silencer::call('chmod', $link, 0777 & ~umask());
  14714. }
  14715. if ($warnOnOverwrite) {
  14716. $this->io->writeError(' Skipped installation of bin '.$bin.' for package '.$package->getName().': name conflicts with an existing file');
  14717. }
  14718. continue;
  14719. }
  14720. if ($this->binCompat === "auto") {
  14721. if (Platform::isWindows()) {
  14722. $this->installFullBinaries($binPath, $link, $bin, $package);
  14723. } else {
  14724. $this->installSymlinkBinaries($binPath, $link);
  14725. }
  14726. } elseif ($this->binCompat === "full") {
  14727. $this->installFullBinaries($binPath, $link, $bin, $package);
  14728. }
  14729. Silencer::call('chmod', $link, 0777 & ~umask());
  14730. }
  14731. }
  14732. public function removeBinaries(PackageInterface $package)
  14733. {
  14734. $this->initializeBinDir();
  14735. $binaries = $this->getBinaries($package);
  14736. if (!$binaries) {
  14737. return;
  14738. }
  14739. foreach ($binaries as $bin) {
  14740. $link = $this->binDir.'/'.basename($bin);
  14741. if (is_link($link) || file_exists($link)) {
  14742. $this->filesystem->unlink($link);
  14743. }
  14744. if (file_exists($link.'.bat')) {
  14745. $this->filesystem->unlink($link.'.bat');
  14746. }
  14747. }
  14748. if (is_dir($this->binDir) && $this->filesystem->isDirEmpty($this->binDir)) {
  14749. Silencer::call('rmdir', $this->binDir);
  14750. }
  14751. }
  14752. public static function determineBinaryCaller($bin)
  14753. {
  14754. if ('.bat' === substr($bin, -4) || '.exe' === substr($bin, -4)) {
  14755. return 'call';
  14756. }
  14757. $handle = fopen($bin, 'r');
  14758. $line = fgets($handle);
  14759. fclose($handle);
  14760. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  14761. return trim($match[1]);
  14762. }
  14763. return 'php';
  14764. }
  14765. protected function getBinaries(PackageInterface $package)
  14766. {
  14767. return $package->getBinaries();
  14768. }
  14769. protected function installFullBinaries($binPath, $link, $bin, PackageInterface $package)
  14770. {
  14771. if ('.bat' !== substr($binPath, -4)) {
  14772. $this->installUnixyProxyBinaries($binPath, $link);
  14773. @chmod($link, 0777 & ~umask());
  14774. $link .= '.bat';
  14775. if (file_exists($link)) {
  14776. $this->io->writeError(' Skipped installation of bin '.$bin.'.bat proxy for package '.$package->getName().': a .bat proxy was already installed');
  14777. }
  14778. }
  14779. if (!file_exists($link)) {
  14780. file_put_contents($link, $this->generateWindowsProxyCode($binPath, $link));
  14781. }
  14782. }
  14783. protected function installSymlinkBinaries($binPath, $link)
  14784. {
  14785. if (!$this->filesystem->relativeSymlink($binPath, $link)) {
  14786. $this->installUnixyProxyBinaries($binPath, $link);
  14787. }
  14788. }
  14789. protected function installUnixyProxyBinaries($binPath, $link)
  14790. {
  14791. file_put_contents($link, $this->generateUnixyProxyCode($binPath, $link));
  14792. }
  14793. protected function initializeBinDir()
  14794. {
  14795. $this->filesystem->ensureDirectoryExists($this->binDir);
  14796. $this->binDir = realpath($this->binDir);
  14797. }
  14798. protected function generateWindowsProxyCode($bin, $link)
  14799. {
  14800. $binPath = $this->filesystem->findShortestPath($link, $bin);
  14801. $caller = self::determineBinaryCaller($bin);
  14802. return "@ECHO OFF\r\n".
  14803. "setlocal DISABLEDELAYEDEXPANSION\r\n".
  14804. "SET BIN_TARGET=%~dp0/".trim(ProcessExecutor::escape($binPath), '"\'')."\r\n".
  14805. "{$caller} \"%BIN_TARGET%\" %*\r\n";
  14806. }
  14807. protected function generateUnixyProxyCode($bin, $link)
  14808. {
  14809. $binPath = $this->filesystem->findShortestPath($link, $bin);
  14810. $binDir = ProcessExecutor::escape(dirname($binPath));
  14811. $binFile = basename($binPath);
  14812. $proxyCode = <<<PROXY
  14813. #!/usr/bin/env sh
  14814. dir=\$(cd "\${0%[/\\\\]*}" > /dev/null; cd $binDir && pwd)
  14815. if [ -d /proc/cygdrive ]; then
  14816. case \$(which php) in
  14817. \$(readlink -n /proc/cygdrive)/*)
  14818. # We are in Cygwin using Windows php, so the path must be translated
  14819. dir=\$(cygpath -m "\$dir");
  14820. ;;
  14821. esac
  14822. fi
  14823. "\${dir}/$binFile" "\$@"
  14824. PROXY;
  14825. return $proxyCode;
  14826. }
  14827. }
  14828. <?php
  14829. namespace Composer\Installer;
  14830. use Composer\Package\PackageInterface;
  14831. interface BinaryPresenceInterface
  14832. {
  14833. public function ensureBinariesPresence(PackageInterface $package);
  14834. }
  14835. <?php
  14836. namespace Composer\Installer;
  14837. use Composer\IO\IOInterface;
  14838. use Composer\Package\PackageInterface;
  14839. use Composer\Package\AliasPackage;
  14840. use Composer\Repository\RepositoryInterface;
  14841. use Composer\Repository\InstalledRepositoryInterface;
  14842. use Composer\DependencyResolver\Operation\OperationInterface;
  14843. use Composer\DependencyResolver\Operation\InstallOperation;
  14844. use Composer\DependencyResolver\Operation\UpdateOperation;
  14845. use Composer\DependencyResolver\Operation\UninstallOperation;
  14846. use Composer\DependencyResolver\Operation\MarkAliasInstalledOperation;
  14847. use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
  14848. use Composer\Util\StreamContextFactory;
  14849. class InstallationManager
  14850. {
  14851. private $installers = array();
  14852. private $cache = array();
  14853. private $notifiablePackages = array();
  14854. public function reset()
  14855. {
  14856. $this->notifiablePackages = array();
  14857. }
  14858. public function addInstaller(InstallerInterface $installer)
  14859. {
  14860. array_unshift($this->installers, $installer);
  14861. $this->cache = array();
  14862. }
  14863. public function removeInstaller(InstallerInterface $installer)
  14864. {
  14865. if (false !== ($key = array_search($installer, $this->installers, true))) {
  14866. array_splice($this->installers, $key, 1);
  14867. $this->cache = array();
  14868. }
  14869. }
  14870. public function disablePlugins()
  14871. {
  14872. foreach ($this->installers as $i => $installer) {
  14873. if (!$installer instanceof PluginInstaller) {
  14874. continue;
  14875. }
  14876. unset($this->installers[$i]);
  14877. }
  14878. }
  14879. public function getInstaller($type)
  14880. {
  14881. $type = strtolower($type);
  14882. if (isset($this->cache[$type])) {
  14883. return $this->cache[$type];
  14884. }
  14885. foreach ($this->installers as $installer) {
  14886. if ($installer->supports($type)) {
  14887. return $this->cache[$type] = $installer;
  14888. }
  14889. }
  14890. throw new \InvalidArgumentException('Unknown installer type: '.$type);
  14891. }
  14892. public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14893. {
  14894. if ($package instanceof AliasPackage) {
  14895. return $repo->hasPackage($package) && $this->isPackageInstalled($repo, $package->getAliasOf());
  14896. }
  14897. return $this->getInstaller($package->getType())->isInstalled($repo, $package);
  14898. }
  14899. public function ensureBinariesPresence(PackageInterface $package)
  14900. {
  14901. try {
  14902. $installer = $this->getInstaller($package->getType());
  14903. } catch (\InvalidArgumentException $e) {
  14904. return;
  14905. }
  14906. if ($installer instanceof BinaryPresenceInterface) {
  14907. $installer->ensureBinariesPresence($package);
  14908. }
  14909. }
  14910. public function execute(RepositoryInterface $repo, OperationInterface $operation)
  14911. {
  14912. $method = $operation->getJobType();
  14913. $this->$method($repo, $operation);
  14914. }
  14915. public function install(RepositoryInterface $repo, InstallOperation $operation)
  14916. {
  14917. $package = $operation->getPackage();
  14918. $installer = $this->getInstaller($package->getType());
  14919. $installer->install($repo, $package);
  14920. $this->markForNotification($package);
  14921. }
  14922. public function update(RepositoryInterface $repo, UpdateOperation $operation)
  14923. {
  14924. $initial = $operation->getInitialPackage();
  14925. $target = $operation->getTargetPackage();
  14926. $initialType = $initial->getType();
  14927. $targetType = $target->getType();
  14928. if ($initialType === $targetType) {
  14929. $installer = $this->getInstaller($initialType);
  14930. $installer->update($repo, $initial, $target);
  14931. $this->markForNotification($target);
  14932. } else {
  14933. $this->getInstaller($initialType)->uninstall($repo, $initial);
  14934. $this->getInstaller($targetType)->install($repo, $target);
  14935. }
  14936. }
  14937. public function uninstall(RepositoryInterface $repo, UninstallOperation $operation)
  14938. {
  14939. $package = $operation->getPackage();
  14940. $installer = $this->getInstaller($package->getType());
  14941. $installer->uninstall($repo, $package);
  14942. }
  14943. public function markAliasInstalled(RepositoryInterface $repo, MarkAliasInstalledOperation $operation)
  14944. {
  14945. $package = $operation->getPackage();
  14946. if (!$repo->hasPackage($package)) {
  14947. $repo->addPackage(clone $package);
  14948. }
  14949. }
  14950. public function markAliasUninstalled(RepositoryInterface $repo, MarkAliasUninstalledOperation $operation)
  14951. {
  14952. $package = $operation->getPackage();
  14953. $repo->removePackage($package);
  14954. }
  14955. public function getInstallPath(PackageInterface $package)
  14956. {
  14957. $installer = $this->getInstaller($package->getType());
  14958. return $installer->getInstallPath($package);
  14959. }
  14960. public function notifyInstalls(IOInterface $io)
  14961. {
  14962. foreach ($this->notifiablePackages as $repoUrl => $packages) {
  14963. $repositoryName = parse_url($repoUrl, PHP_URL_HOST);
  14964. if ($io->hasAuthentication($repositoryName)) {
  14965. $auth = $io->getAuthentication($repositoryName);
  14966. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  14967. $authHeader = 'Authorization: Basic '.$authStr;
  14968. }
  14969. if (strpos($repoUrl, '%package%')) {
  14970. foreach ($packages as $package) {
  14971. $url = str_replace('%package%', $package->getPrettyName(), $repoUrl);
  14972. $params = array(
  14973. 'version' => $package->getPrettyVersion(),
  14974. 'version_normalized' => $package->getVersion(),
  14975. );
  14976. $opts = array('http' =>
  14977. array(
  14978. 'method' => 'POST',
  14979. 'header' => array('Content-type: application/x-www-form-urlencoded'),
  14980. 'content' => http_build_query($params, '', '&'),
  14981. 'timeout' => 3,
  14982. ),
  14983. );
  14984. if (isset($authHeader)) {
  14985. $opts['http']['header'][] = $authHeader;
  14986. }
  14987. $context = StreamContextFactory::getContext($url, $opts);
  14988. @file_get_contents($url, false, $context);
  14989. }
  14990. continue;
  14991. }
  14992. $postData = array('downloads' => array());
  14993. foreach ($packages as $package) {
  14994. $postData['downloads'][] = array(
  14995. 'name' => $package->getPrettyName(),
  14996. 'version' => $package->getVersion(),
  14997. );
  14998. }
  14999. $opts = array('http' =>
  15000. array(
  15001. 'method' => 'POST',
  15002. 'header' => array('Content-Type: application/json'),
  15003. 'content' => json_encode($postData),
  15004. 'timeout' => 6,
  15005. ),
  15006. );
  15007. if (isset($authHeader)) {
  15008. $opts['http']['header'][] = $authHeader;
  15009. }
  15010. $context = StreamContextFactory::getContext($repoUrl, $opts);
  15011. @file_get_contents($repoUrl, false, $context);
  15012. }
  15013. $this->reset();
  15014. }
  15015. private function markForNotification(PackageInterface $package)
  15016. {
  15017. if ($package->getNotificationUrl()) {
  15018. $this->notifiablePackages[$package->getNotificationUrl()][$package->getName()] = $package;
  15019. }
  15020. }
  15021. }
  15022. <?php
  15023. namespace Composer\Installer;
  15024. use Composer\Composer;
  15025. use Composer\DependencyResolver\PolicyInterface;
  15026. use Composer\DependencyResolver\Operation\OperationInterface;
  15027. use Composer\DependencyResolver\Pool;
  15028. use Composer\DependencyResolver\Request;
  15029. use Composer\EventDispatcher\Event;
  15030. use Composer\IO\IOInterface;
  15031. use Composer\Repository\CompositeRepository;
  15032. class InstallerEvent extends Event
  15033. {
  15034. private $composer;
  15035. private $io;
  15036. private $devMode;
  15037. private $policy;
  15038. private $pool;
  15039. private $installedRepo;
  15040. private $request;
  15041. private $operations;
  15042. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  15043. {
  15044. parent::__construct($eventName);
  15045. $this->composer = $composer;
  15046. $this->io = $io;
  15047. $this->devMode = $devMode;
  15048. $this->policy = $policy;
  15049. $this->pool = $pool;
  15050. $this->installedRepo = $installedRepo;
  15051. $this->request = $request;
  15052. $this->operations = $operations;
  15053. }
  15054. public function getComposer()
  15055. {
  15056. return $this->composer;
  15057. }
  15058. public function getIO()
  15059. {
  15060. return $this->io;
  15061. }
  15062. public function isDevMode()
  15063. {
  15064. return $this->devMode;
  15065. }
  15066. public function getPolicy()
  15067. {
  15068. return $this->policy;
  15069. }
  15070. public function getPool()
  15071. {
  15072. return $this->pool;
  15073. }
  15074. public function getInstalledRepo()
  15075. {
  15076. return $this->installedRepo;
  15077. }
  15078. public function getRequest()
  15079. {
  15080. return $this->request;
  15081. }
  15082. public function getOperations()
  15083. {
  15084. return $this->operations;
  15085. }
  15086. }
  15087. <?php
  15088. namespace Composer\Installer;
  15089. class InstallerEvents
  15090. {
  15091. const PRE_DEPENDENCIES_SOLVING = 'pre-dependencies-solving';
  15092. const POST_DEPENDENCIES_SOLVING = 'post-dependencies-solving';
  15093. }
  15094. <?php
  15095. namespace Composer\Installer;
  15096. use Composer\Package\PackageInterface;
  15097. use Composer\Repository\InstalledRepositoryInterface;
  15098. use InvalidArgumentException;
  15099. interface InstallerInterface
  15100. {
  15101. public function supports($packageType);
  15102. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package);
  15103. public function install(InstalledRepositoryInterface $repo, PackageInterface $package);
  15104. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target);
  15105. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package);
  15106. public function getInstallPath(PackageInterface $package);
  15107. }
  15108. <?php
  15109. namespace Composer\Installer;
  15110. use Composer\Composer;
  15111. use Composer\IO\IOInterface;
  15112. use Composer\Repository\InstalledRepositoryInterface;
  15113. use Composer\Package\PackageInterface;
  15114. use Composer\Util\Filesystem;
  15115. use Composer\Util\Silencer;
  15116. use Composer\Util\Platform;
  15117. class LibraryInstaller implements InstallerInterface, BinaryPresenceInterface
  15118. {
  15119. protected $composer;
  15120. protected $vendorDir;
  15121. protected $binDir;
  15122. protected $downloadManager;
  15123. protected $io;
  15124. protected $type;
  15125. protected $filesystem;
  15126. protected $binCompat;
  15127. protected $binaryInstaller;
  15128. public function __construct(IOInterface $io, Composer $composer, $type = 'library', Filesystem $filesystem = null, BinaryInstaller $binaryInstaller = null)
  15129. {
  15130. $this->composer = $composer;
  15131. $this->downloadManager = $composer->getDownloadManager();
  15132. $this->io = $io;
  15133. $this->type = $type;
  15134. $this->filesystem = $filesystem ?: new Filesystem();
  15135. $this->vendorDir = rtrim($composer->getConfig()->get('vendor-dir'), '/');
  15136. $this->binaryInstaller = $binaryInstaller ?: new BinaryInstaller($this->io, rtrim($composer->getConfig()->get('bin-dir'), '/'), $composer->getConfig()->get('bin-compat'), $this->filesystem);
  15137. }
  15138. public function supports($packageType)
  15139. {
  15140. return $packageType === $this->type || null === $this->type;
  15141. }
  15142. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15143. {
  15144. if (!$repo->hasPackage($package)) {
  15145. return false;
  15146. }
  15147. $installPath = $this->getInstallPath($package);
  15148. if (is_readable($installPath)) {
  15149. return true;
  15150. }
  15151. return (Platform::isWindows() && $this->filesystem->isJunction($installPath)) || is_link($installPath);
  15152. }
  15153. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15154. {
  15155. $this->initializeVendorDir();
  15156. $downloadPath = $this->getInstallPath($package);
  15157. if (!is_readable($downloadPath) && $repo->hasPackage($package)) {
  15158. $this->binaryInstaller->removeBinaries($package);
  15159. }
  15160. $this->installCode($package);
  15161. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package));
  15162. if (!$repo->hasPackage($package)) {
  15163. $repo->addPackage(clone $package);
  15164. }
  15165. }
  15166. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15167. {
  15168. if (!$repo->hasPackage($initial)) {
  15169. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  15170. }
  15171. $this->initializeVendorDir();
  15172. $this->binaryInstaller->removeBinaries($initial);
  15173. $this->updateCode($initial, $target);
  15174. $this->binaryInstaller->installBinaries($target, $this->getInstallPath($target));
  15175. $repo->removePackage($initial);
  15176. if (!$repo->hasPackage($target)) {
  15177. $repo->addPackage(clone $target);
  15178. }
  15179. }
  15180. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  15181. {
  15182. if (!$repo->hasPackage($package)) {
  15183. throw new \InvalidArgumentException('Package is not installed: '.$package);
  15184. }
  15185. $this->removeCode($package);
  15186. $this->binaryInstaller->removeBinaries($package);
  15187. $repo->removePackage($package);
  15188. $downloadPath = $this->getPackageBasePath($package);
  15189. if (strpos($package->getName(), '/')) {
  15190. $packageVendorDir = dirname($downloadPath);
  15191. if (is_dir($packageVendorDir) && $this->filesystem->isDirEmpty($packageVendorDir)) {
  15192. Silencer::call('rmdir', $packageVendorDir);
  15193. }
  15194. }
  15195. }
  15196. public function getInstallPath(PackageInterface $package)
  15197. {
  15198. $this->initializeVendorDir();
  15199. $basePath = ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName();
  15200. $targetDir = $package->getTargetDir();
  15201. return $basePath . ($targetDir ? '/'.$targetDir : '');
  15202. }
  15203. public function ensureBinariesPresence(PackageInterface $package)
  15204. {
  15205. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package), false);
  15206. }
  15207. protected function getPackageBasePath(PackageInterface $package)
  15208. {
  15209. $installPath = $this->getInstallPath($package);
  15210. $targetDir = $package->getTargetDir();
  15211. if ($targetDir) {
  15212. return preg_replace('{/*'.str_replace('/', '/+', preg_quote($targetDir)).'/?$}', '', $installPath);
  15213. }
  15214. return $installPath;
  15215. }
  15216. protected function installCode(PackageInterface $package)
  15217. {
  15218. $downloadPath = $this->getInstallPath($package);
  15219. $this->downloadManager->download($package, $downloadPath);
  15220. }
  15221. protected function updateCode(PackageInterface $initial, PackageInterface $target)
  15222. {
  15223. $initialDownloadPath = $this->getInstallPath($initial);
  15224. $targetDownloadPath = $this->getInstallPath($target);
  15225. if ($targetDownloadPath !== $initialDownloadPath) {
  15226. if (substr($initialDownloadPath, 0, strlen($targetDownloadPath)) === $targetDownloadPath
  15227. || substr($targetDownloadPath, 0, strlen($initialDownloadPath)) === $initialDownloadPath
  15228. ) {
  15229. $this->removeCode($initial);
  15230. $this->installCode($target);
  15231. return;
  15232. }
  15233. $this->filesystem->rename($initialDownloadPath, $targetDownloadPath);
  15234. }
  15235. $this->downloadManager->update($initial, $target, $targetDownloadPath);
  15236. }
  15237. protected function removeCode(PackageInterface $package)
  15238. {
  15239. $downloadPath = $this->getPackageBasePath($package);
  15240. $this->downloadManager->remove($package, $downloadPath);
  15241. }
  15242. protected function initializeVendorDir()
  15243. {
  15244. $this->filesystem->ensureDirectoryExists($this->vendorDir);
  15245. $this->vendorDir = realpath($this->vendorDir);
  15246. }
  15247. }
  15248. <?php
  15249. namespace Composer\Installer;
  15250. use Composer\Repository\InstalledRepositoryInterface;
  15251. use Composer\Package\PackageInterface;
  15252. use Composer\Package\Version\VersionParser;
  15253. use Composer\IO\IOInterface;
  15254. class MetapackageInstaller implements InstallerInterface
  15255. {
  15256. private $io;
  15257. public function __construct(IOInterface $io)
  15258. {
  15259. $this->io = $io;
  15260. }
  15261. public function supports($packageType)
  15262. {
  15263. return $packageType === 'metapackage';
  15264. }
  15265. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15266. {
  15267. return $repo->hasPackage($package);
  15268. }
  15269. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15270. {
  15271. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  15272. $repo->addPackage(clone $package);
  15273. }
  15274. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15275. {
  15276. if (!$repo->hasPackage($initial)) {
  15277. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  15278. }
  15279. $name = $target->getName();
  15280. $from = $initial->getFullPrettyVersion();
  15281. $to = $target->getFullPrettyVersion();
  15282. $actionName = VersionParser::isUpgrade($initial->getVersion(), $target->getVersion()) ? 'Updating' : 'Downgrading';
  15283. $this->io->writeError(" - " . $actionName . " <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>)");
  15284. $repo->removePackage($initial);
  15285. $repo->addPackage(clone $target);
  15286. }
  15287. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  15288. {
  15289. if (!$repo->hasPackage($package)) {
  15290. throw new \InvalidArgumentException('Package is not installed: '.$package);
  15291. }
  15292. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  15293. $repo->removePackage($package);
  15294. }
  15295. public function getInstallPath(PackageInterface $package)
  15296. {
  15297. return '';
  15298. }
  15299. }
  15300. <?php
  15301. namespace Composer\Installer;
  15302. use Composer\Repository\InstalledRepositoryInterface;
  15303. use Composer\Package\PackageInterface;
  15304. class NoopInstaller implements InstallerInterface
  15305. {
  15306. public function supports($packageType)
  15307. {
  15308. return true;
  15309. }
  15310. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15311. {
  15312. return $repo->hasPackage($package);
  15313. }
  15314. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15315. {
  15316. if (!$repo->hasPackage($package)) {
  15317. $repo->addPackage(clone $package);
  15318. }
  15319. }
  15320. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15321. {
  15322. if (!$repo->hasPackage($initial)) {
  15323. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  15324. }
  15325. $repo->removePackage($initial);
  15326. if (!$repo->hasPackage($target)) {
  15327. $repo->addPackage(clone $target);
  15328. }
  15329. }
  15330. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  15331. {
  15332. if (!$repo->hasPackage($package)) {
  15333. throw new \InvalidArgumentException('Package is not installed: '.$package);
  15334. }
  15335. $repo->removePackage($package);
  15336. }
  15337. public function getInstallPath(PackageInterface $package)
  15338. {
  15339. $targetDir = $package->getTargetDir();
  15340. return $package->getPrettyName() . ($targetDir ? '/'.$targetDir : '');
  15341. }
  15342. }
  15343. <?php
  15344. namespace Composer\Installer;
  15345. use Composer\Composer;
  15346. use Composer\IO\IOInterface;
  15347. use Composer\DependencyResolver\Operation\OperationInterface;
  15348. use Composer\DependencyResolver\PolicyInterface;
  15349. use Composer\DependencyResolver\Pool;
  15350. use Composer\DependencyResolver\Request;
  15351. use Composer\Repository\CompositeRepository;
  15352. class PackageEvent extends InstallerEvent
  15353. {
  15354. private $operation;
  15355. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  15356. {
  15357. parent::__construct($eventName, $composer, $io, $devMode, $policy, $pool, $installedRepo, $request, $operations);
  15358. $this->operation = $operation;
  15359. }
  15360. public function getOperation()
  15361. {
  15362. return $this->operation;
  15363. }
  15364. }
  15365. <?php
  15366. namespace Composer\Installer;
  15367. class PackageEvents
  15368. {
  15369. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  15370. const POST_PACKAGE_INSTALL = 'post-package-install';
  15371. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  15372. const POST_PACKAGE_UPDATE = 'post-package-update';
  15373. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  15374. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  15375. }
  15376. <?php
  15377. namespace Composer\Installer;
  15378. use Composer\IO\IOInterface;
  15379. use Composer\Package\PackageInterface;
  15380. use Composer\Util\Filesystem;
  15381. use Composer\Util\ProcessExecutor;
  15382. class PearBinaryInstaller extends BinaryInstaller
  15383. {
  15384. private $installer;
  15385. private $vendorDir;
  15386. public function __construct(IOInterface $io, $binDir, $vendorDir, $binCompat, Filesystem $filesystem, PearInstaller $installer)
  15387. {
  15388. parent::__construct($io, $binDir, $binCompat, $filesystem);
  15389. $this->installer = $installer;
  15390. $this->vendorDir = $vendorDir;
  15391. }
  15392. protected function getBinaries(PackageInterface $package)
  15393. {
  15394. $binariesPath = $this->installer->getInstallPath($package) . '/bin/';
  15395. $binaries = array();
  15396. if (file_exists($binariesPath)) {
  15397. foreach (new \FilesystemIterator($binariesPath, \FilesystemIterator::KEY_AS_FILENAME | \FilesystemIterator::CURRENT_AS_FILEINFO) as $fileName => $value) {
  15398. if (!$value->isDir()) {
  15399. $binaries[] = 'bin/'.$fileName;
  15400. }
  15401. }
  15402. }
  15403. return $binaries;
  15404. }
  15405. protected function initializeBinDir()
  15406. {
  15407. parent::initializeBinDir();
  15408. file_put_contents($this->binDir.'/composer-php', $this->generateUnixyPhpProxyCode());
  15409. @chmod($this->binDir.'/composer-php', 0777 & ~umask());
  15410. file_put_contents($this->binDir.'/composer-php.bat', $this->generateWindowsPhpProxyCode());
  15411. @chmod($this->binDir.'/composer-php.bat', 0777 & ~umask());
  15412. }
  15413. protected function generateWindowsProxyCode($bin, $link)
  15414. {
  15415. $binPath = $this->filesystem->findShortestPath($link, $bin);
  15416. if ('.bat' === substr($bin, -4)) {
  15417. $caller = 'call';
  15418. } else {
  15419. $handle = fopen($bin, 'r');
  15420. $line = fgets($handle);
  15421. fclose($handle);
  15422. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  15423. $caller = trim($match[1]);
  15424. } else {
  15425. $caller = 'php';
  15426. }
  15427. if ($caller === 'php') {
  15428. return "@echo off\r\n".
  15429. "pushd .\r\n".
  15430. "cd %~dp0\r\n".
  15431. "set PHP_PROXY=%CD%\\composer-php.bat\r\n".
  15432. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  15433. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  15434. "popd\r\n".
  15435. "%PHP_PROXY% \"%BIN_TARGET%\" %*\r\n";
  15436. }
  15437. }
  15438. return "@echo off\r\n".
  15439. "pushd .\r\n".
  15440. "cd %~dp0\r\n".
  15441. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  15442. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  15443. "popd\r\n".
  15444. $caller." \"%BIN_TARGET%\" %*\r\n";
  15445. }
  15446. private function generateWindowsPhpProxyCode()
  15447. {
  15448. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  15449. return
  15450. "@echo off\r\n" .
  15451. "setlocal enabledelayedexpansion\r\n" .
  15452. "set BIN_DIR=%~dp0\r\n" .
  15453. "set VENDOR_DIR=%BIN_DIR%\\".$binToVendor."\r\n" .
  15454. "set DIRS=.\r\n" .
  15455. "FOR /D %%V IN (%VENDOR_DIR%\\*) DO (\r\n" .
  15456. " FOR /D %%P IN (%%V\\*) DO (\r\n" .
  15457. " set DIRS=!DIRS!;%%~fP\r\n" .
  15458. " )\r\n" .
  15459. ")\r\n" .
  15460. "php.exe -d include_path=!DIRS! %*\r\n";
  15461. }
  15462. private function generateUnixyPhpProxyCode()
  15463. {
  15464. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  15465. return
  15466. "#!/usr/bin/env sh\n".
  15467. "SRC_DIR=`pwd`\n".
  15468. "BIN_DIR=`dirname $0`\n".
  15469. "VENDOR_DIR=\$BIN_DIR/".escapeshellarg($binToVendor)."\n".
  15470. "DIRS=\"\"\n".
  15471. "for vendor in \$VENDOR_DIR/*; do\n".
  15472. " if [ -d \"\$vendor\" ]; then\n".
  15473. " for package in \$vendor/*; do\n".
  15474. " if [ -d \"\$package\" ]; then\n".
  15475. " DIRS=\"\${DIRS}:\${package}\"\n".
  15476. " fi\n".
  15477. " done\n".
  15478. " fi\n".
  15479. "done\n".
  15480. "php -d include_path=\".\$DIRS\" $@\n";
  15481. }
  15482. }
  15483. <?php
  15484. namespace Composer\Installer;
  15485. use Composer\IO\IOInterface;
  15486. use Composer\Composer;
  15487. use Composer\Downloader\PearPackageExtractor;
  15488. use Composer\Repository\InstalledRepositoryInterface;
  15489. use Composer\Package\PackageInterface;
  15490. use Composer\Util\Platform;
  15491. use Composer\Util\Filesystem;
  15492. class PearInstaller extends LibraryInstaller
  15493. {
  15494. public function __construct(IOInterface $io, Composer $composer, $type = 'pear-library')
  15495. {
  15496. $filesystem = new Filesystem();
  15497. $binaryInstaller = new PearBinaryInstaller($io, rtrim($composer->getConfig()->get('bin-dir'), '/'), rtrim($composer->getConfig()->get('vendor-dir'), '/'), $composer->getConfig()->get('bin-compat'), $filesystem, $this);
  15498. parent::__construct($io, $composer, $type, $filesystem, $binaryInstaller);
  15499. }
  15500. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15501. {
  15502. $this->uninstall($repo, $initial);
  15503. $this->install($repo, $target);
  15504. }
  15505. protected function installCode(PackageInterface $package)
  15506. {
  15507. parent::installCode($package);
  15508. $isWindows = Platform::isWindows();
  15509. $php_bin = $this->binDir . ($isWindows ? '/composer-php.bat' : '/composer-php');
  15510. if (!$isWindows) {
  15511. $php_bin = '/usr/bin/env ' . $php_bin;
  15512. }
  15513. $installPath = $this->getInstallPath($package);
  15514. $vars = array(
  15515. 'os' => $isWindows ? 'windows' : 'linux',
  15516. 'php_bin' => $php_bin,
  15517. 'pear_php' => $installPath,
  15518. 'php_dir' => $installPath,
  15519. 'bin_dir' => $installPath . '/bin',
  15520. 'data_dir' => $installPath . '/data',
  15521. 'version' => $package->getPrettyVersion(),
  15522. );
  15523. $packageArchive = $this->getInstallPath($package).'/'.pathinfo($package->getDistUrl(), PATHINFO_BASENAME);
  15524. $pearExtractor = new PearPackageExtractor($packageArchive);
  15525. $pearExtractor->extractTo($this->getInstallPath($package), array('php' => '/', 'script' => '/bin', 'data' => '/data'), $vars);
  15526. $this->io->writeError(' Cleaning up', true, IOInterface::VERBOSE);
  15527. $this->filesystem->unlink($packageArchive);
  15528. }
  15529. }
  15530. <?php
  15531. namespace Composer\Installer;
  15532. use Composer\Composer;
  15533. use Composer\IO\IOInterface;
  15534. use Composer\Repository\InstalledRepositoryInterface;
  15535. use Composer\Package\PackageInterface;
  15536. class PluginInstaller extends LibraryInstaller
  15537. {
  15538. private $installationManager;
  15539. public function __construct(IOInterface $io, Composer $composer)
  15540. {
  15541. parent::__construct($io, $composer, 'composer-plugin');
  15542. $this->installationManager = $composer->getInstallationManager();
  15543. }
  15544. public function supports($packageType)
  15545. {
  15546. return $packageType === 'composer-plugin' || $packageType === 'composer-installer';
  15547. }
  15548. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15549. {
  15550. $extra = $package->getExtra();
  15551. if (empty($extra['class'])) {
  15552. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  15553. }
  15554. parent::install($repo, $package);
  15555. try {
  15556. $this->composer->getPluginManager()->registerPackage($package, true);
  15557. } catch (\Exception $e) {
  15558. $this->io->writeError('Plugin installation failed, rolling back');
  15559. parent::uninstall($repo, $package);
  15560. throw $e;
  15561. }
  15562. }
  15563. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15564. {
  15565. $extra = $target->getExtra();
  15566. if (empty($extra['class'])) {
  15567. throw new \UnexpectedValueException('Error while installing '.$target->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  15568. }
  15569. parent::update($repo, $initial, $target);
  15570. $this->composer->getPluginManager()->registerPackage($target, true);
  15571. }
  15572. }
  15573. <?php
  15574. namespace Composer\Installer;
  15575. use Composer\Package\PackageInterface;
  15576. use Composer\Downloader\DownloadManager;
  15577. use Composer\Repository\InstalledRepositoryInterface;
  15578. use Composer\Util\Filesystem;
  15579. class ProjectInstaller implements InstallerInterface
  15580. {
  15581. private $installPath;
  15582. private $downloadManager;
  15583. private $filesystem;
  15584. public function __construct($installPath, DownloadManager $dm)
  15585. {
  15586. $this->installPath = rtrim(strtr($installPath, '\\', '/'), '/').'/';
  15587. $this->downloadManager = $dm;
  15588. $this->filesystem = new Filesystem;
  15589. }
  15590. public function supports($packageType)
  15591. {
  15592. return true;
  15593. }
  15594. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15595. {
  15596. return false;
  15597. }
  15598. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15599. {
  15600. $installPath = $this->installPath;
  15601. if (file_exists($installPath) && !$this->filesystem->isDirEmpty($installPath)) {
  15602. throw new \InvalidArgumentException("Project directory $installPath is not empty.");
  15603. }
  15604. if (!is_dir($installPath)) {
  15605. mkdir($installPath, 0777, true);
  15606. }
  15607. $this->downloadManager->download($package, $installPath);
  15608. }
  15609. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15610. {
  15611. throw new \InvalidArgumentException("not supported");
  15612. }
  15613. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  15614. {
  15615. throw new \InvalidArgumentException("not supported");
  15616. }
  15617. public function getInstallPath(PackageInterface $package)
  15618. {
  15619. return $this->installPath;
  15620. }
  15621. }
  15622. <?php
  15623. namespace Composer\Installer;
  15624. use Composer\IO\IOInterface;
  15625. use Composer\Package\PackageInterface;
  15626. use Composer\Repository\RepositoryInterface;
  15627. use Symfony\Component\Console\Formatter\OutputFormatter;
  15628. class SuggestedPackagesReporter
  15629. {
  15630. protected $suggestedPackages = array();
  15631. private $io;
  15632. public function __construct(IOInterface $io)
  15633. {
  15634. $this->io = $io;
  15635. }
  15636. public function getPackages()
  15637. {
  15638. return $this->suggestedPackages;
  15639. }
  15640. public function addPackage($source, $target, $reason)
  15641. {
  15642. $this->suggestedPackages[] = array(
  15643. 'source' => $source,
  15644. 'target' => $target,
  15645. 'reason' => $reason,
  15646. );
  15647. return $this;
  15648. }
  15649. public function addSuggestionsFromPackage(PackageInterface $package)
  15650. {
  15651. $source = $package->getPrettyName();
  15652. foreach ($package->getSuggests() as $target => $reason) {
  15653. $this->addPackage(
  15654. $source,
  15655. $target,
  15656. $reason
  15657. );
  15658. }
  15659. return $this;
  15660. }
  15661. public function output(RepositoryInterface $installedRepo = null)
  15662. {
  15663. $suggestedPackages = $this->getPackages();
  15664. $installedPackages = array();
  15665. if (null !== $installedRepo && ! empty($suggestedPackages)) {
  15666. foreach ($installedRepo->getPackages() as $package) {
  15667. $installedPackages = array_merge(
  15668. $installedPackages,
  15669. $package->getNames()
  15670. );
  15671. }
  15672. }
  15673. foreach ($suggestedPackages as $suggestion) {
  15674. if (in_array($suggestion['target'], $installedPackages)) {
  15675. continue;
  15676. }
  15677. $this->io->writeError(sprintf(
  15678. '%s suggests installing %s%s',
  15679. $suggestion['source'],
  15680. $this->escapeOutput($suggestion['target']),
  15681. $this->escapeOutput('' !== $suggestion['reason'] ? ' ('.$suggestion['reason'].')' : '')
  15682. ));
  15683. }
  15684. return $this;
  15685. }
  15686. private function escapeOutput($string)
  15687. {
  15688. return OutputFormatter::escape(
  15689. $this->removeControlCharacters($string)
  15690. );
  15691. }
  15692. private function removeControlCharacters($string)
  15693. {
  15694. return preg_replace(
  15695. '/[[:cntrl:]]/',
  15696. '',
  15697. str_replace("\n", ' ', $string)
  15698. );
  15699. }
  15700. }
  15701. <?php
  15702. namespace Composer\Json;
  15703. use JsonSchema\Validator;
  15704. use Seld\JsonLint\JsonParser;
  15705. use Seld\JsonLint\ParsingException;
  15706. use Composer\Util\RemoteFilesystem;
  15707. use Composer\IO\IOInterface;
  15708. use Composer\Downloader\TransportException;
  15709. class JsonFile
  15710. {
  15711. const LAX_SCHEMA = 1;
  15712. const STRICT_SCHEMA = 2;
  15713. const JSON_UNESCAPED_SLASHES = 64;
  15714. const JSON_PRETTY_PRINT = 128;
  15715. const JSON_UNESCAPED_UNICODE = 256;
  15716. const COMPOSER_SCHEMA_PATH = '/../../../res/composer-schema.json';
  15717. private $path;
  15718. private $rfs;
  15719. private $io;
  15720. public function __construct($path, RemoteFilesystem $rfs = null, IOInterface $io = null)
  15721. {
  15722. $this->path = $path;
  15723. if (null === $rfs && preg_match('{^https?://}i', $path)) {
  15724. throw new \InvalidArgumentException('http urls require a RemoteFilesystem instance to be passed');
  15725. }
  15726. $this->rfs = $rfs;
  15727. $this->io = $io;
  15728. }
  15729. public function getPath()
  15730. {
  15731. return $this->path;
  15732. }
  15733. public function exists()
  15734. {
  15735. return is_file($this->path);
  15736. }
  15737. public function read()
  15738. {
  15739. try {
  15740. if ($this->rfs) {
  15741. $json = $this->rfs->getContents($this->path, $this->path, false);
  15742. } else {
  15743. if ($this->io && $this->io->isDebug()) {
  15744. $this->io->writeError('Reading ' . $this->path);
  15745. }
  15746. $json = file_get_contents($this->path);
  15747. }
  15748. } catch (TransportException $e) {
  15749. throw new \RuntimeException($e->getMessage(), 0, $e);
  15750. } catch (\Exception $e) {
  15751. throw new \RuntimeException('Could not read '.$this->path."\n\n".$e->getMessage());
  15752. }
  15753. return static::parseJson($json, $this->path);
  15754. }
  15755. public function write(array $hash, $options = 448)
  15756. {
  15757. $dir = dirname($this->path);
  15758. if (!is_dir($dir)) {
  15759. if (file_exists($dir)) {
  15760. throw new \UnexpectedValueException(
  15761. $dir.' exists and is not a directory.'
  15762. );
  15763. }
  15764. if (!@mkdir($dir, 0777, true)) {
  15765. throw new \UnexpectedValueException(
  15766. $dir.' does not exist and could not be created.'
  15767. );
  15768. }
  15769. }
  15770. $retries = 3;
  15771. while ($retries--) {
  15772. try {
  15773. file_put_contents($this->path, static::encode($hash, $options). ($options & self::JSON_PRETTY_PRINT ? "\n" : ''));
  15774. break;
  15775. } catch (\Exception $e) {
  15776. if ($retries) {
  15777. usleep(500000);
  15778. continue;
  15779. }
  15780. throw $e;
  15781. }
  15782. }
  15783. }
  15784. public function validateSchema($schema = self::STRICT_SCHEMA, $schemaFile = null)
  15785. {
  15786. $content = file_get_contents($this->path);
  15787. $data = json_decode($content);
  15788. if (null === $data && 'null' !== $content) {
  15789. self::validateSyntax($content, $this->path);
  15790. }
  15791. if (null === $schemaFile) {
  15792. $schemaFile = __DIR__ . self::COMPOSER_SCHEMA_PATH;
  15793. }
  15794. if (false === strpos($schemaFile, '://')) {
  15795. $schemaFile = 'file://' . $schemaFile;
  15796. }
  15797. $schemaData = (object) array('$ref' => $schemaFile);
  15798. if ($schema === self::LAX_SCHEMA) {
  15799. $schemaData->additionalProperties = true;
  15800. $schemaData->required = array();
  15801. }
  15802. $validator = new Validator();
  15803. $validator->check($data, $schemaData);
  15804. if (!$validator->isValid()) {
  15805. $errors = array();
  15806. foreach ((array) $validator->getErrors() as $error) {
  15807. $errors[] = ($error['property'] ? $error['property'].' : ' : '').$error['message'];
  15808. }
  15809. throw new JsonValidationException('"'.$this->path.'" does not match the expected JSON schema', $errors);
  15810. }
  15811. return true;
  15812. }
  15813. public static function encode($data, $options = 448)
  15814. {
  15815. if (PHP_VERSION_ID >= 50400) {
  15816. $json = json_encode($data, $options);
  15817. if (false === $json) {
  15818. self::throwEncodeError(json_last_error());
  15819. }
  15820. if (PHP_VERSION_ID < 50428 || (PHP_VERSION_ID >= 50500 && PHP_VERSION_ID < 50512) || (defined('JSON_C_VERSION') && version_compare(phpversion('json'), '1.3.6', '<'))) {
  15821. $json = preg_replace('/\[\s+\]/', '[]', $json);
  15822. $json = preg_replace('/\{\s+\}/', '{}', $json);
  15823. }
  15824. return $json;
  15825. }
  15826. $json = json_encode($data);
  15827. if (false === $json) {
  15828. self::throwEncodeError(json_last_error());
  15829. }
  15830. $prettyPrint = (bool) ($options & self::JSON_PRETTY_PRINT);
  15831. $unescapeUnicode = (bool) ($options & self::JSON_UNESCAPED_UNICODE);
  15832. $unescapeSlashes = (bool) ($options & self::JSON_UNESCAPED_SLASHES);
  15833. if (!$prettyPrint && !$unescapeUnicode && !$unescapeSlashes) {
  15834. return $json;
  15835. }
  15836. return JsonFormatter::format($json, $unescapeUnicode, $unescapeSlashes);
  15837. }
  15838. private static function throwEncodeError($code)
  15839. {
  15840. switch ($code) {
  15841. case JSON_ERROR_DEPTH:
  15842. $msg = 'Maximum stack depth exceeded';
  15843. break;
  15844. case JSON_ERROR_STATE_MISMATCH:
  15845. $msg = 'Underflow or the modes mismatch';
  15846. break;
  15847. case JSON_ERROR_CTRL_CHAR:
  15848. $msg = 'Unexpected control character found';
  15849. break;
  15850. case JSON_ERROR_UTF8:
  15851. $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  15852. break;
  15853. default:
  15854. $msg = 'Unknown error';
  15855. }
  15856. throw new \RuntimeException('JSON encoding failed: '.$msg);
  15857. }
  15858. public static function parseJson($json, $file = null)
  15859. {
  15860. if (null === $json) {
  15861. return;
  15862. }
  15863. $data = json_decode($json, true);
  15864. if (null === $data && JSON_ERROR_NONE !== json_last_error()) {
  15865. self::validateSyntax($json, $file);
  15866. }
  15867. return $data;
  15868. }
  15869. protected static function validateSyntax($json, $file = null)
  15870. {
  15871. $parser = new JsonParser();
  15872. $result = $parser->lint($json);
  15873. if (null === $result) {
  15874. if (defined('JSON_ERROR_UTF8') && JSON_ERROR_UTF8 === json_last_error()) {
  15875. throw new \UnexpectedValueException('"'.$file.'" is not UTF-8, could not parse as JSON');
  15876. }
  15877. return true;
  15878. }
  15879. throw new ParsingException('"'.$file.'" does not contain valid JSON'."\n".$result->getMessage(), $result->getDetails());
  15880. }
  15881. }
  15882. <?php
  15883. namespace Composer\Json;
  15884. class JsonFormatter
  15885. {
  15886. public static function format($json, $unescapeUnicode, $unescapeSlashes)
  15887. {
  15888. $result = '';
  15889. $pos = 0;
  15890. $strLen = strlen($json);
  15891. $indentStr = ' ';
  15892. $newLine = "\n";
  15893. $outOfQuotes = true;
  15894. $buffer = '';
  15895. $noescape = true;
  15896. for ($i = 0; $i < $strLen; $i++) {
  15897. $char = substr($json, $i, 1);
  15898. if ('"' === $char && $noescape) {
  15899. $outOfQuotes = !$outOfQuotes;
  15900. }
  15901. if (!$outOfQuotes) {
  15902. $buffer .= $char;
  15903. $noescape = '\\' === $char ? !$noescape : true;
  15904. continue;
  15905. } elseif ('' !== $buffer) {
  15906. if ($unescapeSlashes) {
  15907. $buffer = str_replace('\\/', '/', $buffer);
  15908. }
  15909. if ($unescapeUnicode && function_exists('mb_convert_encoding')) {
  15910. $buffer = preg_replace_callback('/(\\\\+)u([0-9a-f]{4})/i', function ($match) {
  15911. $l = strlen($match[1]);
  15912. if ($l % 2) {
  15913. $code = hexdec($match[2]);
  15914. if (0xD800 <= $code && 0xDFFF >= $code) {
  15915. return $match[0];
  15916. }
  15917. return str_repeat('\\', $l - 1) . mb_convert_encoding(
  15918. pack('H*', $match[2]),
  15919. 'UTF-8',
  15920. 'UCS-2BE'
  15921. );
  15922. }
  15923. return $match[0];
  15924. }, $buffer);
  15925. }
  15926. $result .= $buffer.$char;
  15927. $buffer = '';
  15928. continue;
  15929. }
  15930. if (':' === $char) {
  15931. $char .= ' ';
  15932. } elseif ('}' === $char || ']' === $char) {
  15933. $pos--;
  15934. $prevChar = substr($json, $i - 1, 1);
  15935. if ('{' !== $prevChar && '[' !== $prevChar) {
  15936. $result .= $newLine;
  15937. for ($j = 0; $j < $pos; $j++) {
  15938. $result .= $indentStr;
  15939. }
  15940. } else {
  15941. $result = rtrim($result);
  15942. }
  15943. }
  15944. $result .= $char;
  15945. if (',' === $char || '{' === $char || '[' === $char) {
  15946. $result .= $newLine;
  15947. if ('{' === $char || '[' === $char) {
  15948. $pos++;
  15949. }
  15950. for ($j = 0; $j < $pos; $j++) {
  15951. $result .= $indentStr;
  15952. }
  15953. }
  15954. }
  15955. return $result;
  15956. }
  15957. }
  15958. <?php
  15959. namespace Composer\Json;
  15960. use Composer\Repository\PlatformRepository;
  15961. class JsonManipulator
  15962. {
  15963. private static $DEFINES = '(?(DEFINE)
  15964. (?<number> -? (?= [1-9]|0(?!\d) ) \d+ (\.\d+)? ([eE] [+-]? \d+)? )
  15965. (?<boolean> true | false | null )
  15966. (?<string> " ([^"\\\\]* | \\\\ ["\\\\bfnrt\/] | \\\\ u [0-9A-Fa-f]{4} )* " )
  15967. (?<array> \[ (?: (?&json) \s* (?: , (?&json) \s* )* )? \s* \] )
  15968. (?<pair> \s* (?&string) \s* : (?&json) \s* )
  15969. (?<object> \{ (?: (?&pair) (?: , (?&pair) )* )? \s* \} )
  15970. (?<json> \s* (?: (?&number) | (?&boolean) | (?&string) | (?&array) | (?&object) ) )
  15971. )';
  15972. private $contents;
  15973. private $newline;
  15974. private $indent;
  15975. public function __construct($contents)
  15976. {
  15977. $contents = trim($contents);
  15978. if ($contents === '') {
  15979. $contents = '{}';
  15980. }
  15981. if (!$this->pregMatch('#^\{(.*)\}$#s', $contents)) {
  15982. throw new \InvalidArgumentException('The json file must be an object ({})');
  15983. }
  15984. $this->newline = false !== strpos($contents, "\r\n") ? "\r\n" : "\n";
  15985. $this->contents = $contents === '{}' ? '{' . $this->newline . '}' : $contents;
  15986. $this->detectIndenting();
  15987. }
  15988. public function getContents()
  15989. {
  15990. return $this->contents . $this->newline;
  15991. }
  15992. public function addLink($type, $package, $constraint, $sortPackages = false)
  15993. {
  15994. $decoded = JsonFile::parseJson($this->contents);
  15995. if (!isset($decoded[$type])) {
  15996. return $this->addMainKey($type, array($package => $constraint));
  15997. }
  15998. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  15999. '(?P<property>'.preg_quote(JsonFile::encode($type)).'\s*:\s*)(?P<value>(?&json))(?P<end>.*)}sx';
  16000. if (!$this->pregMatch($regex, $this->contents, $matches)) {
  16001. return false;
  16002. }
  16003. $links = $matches['value'];
  16004. $packageRegex = str_replace('/', '\\\\?/', preg_quote($package));
  16005. $regex = '{'.self::$DEFINES.'"(?P<package>'.$packageRegex.')"(\s*:\s*)(?&string)}ix';
  16006. if ($this->pregMatch($regex, $links, $packageMatches)) {
  16007. $existingPackage = $packageMatches['package'];
  16008. $packageRegex = str_replace('/', '\\\\?/', preg_quote($existingPackage));
  16009. $links = preg_replace_callback('{'.self::$DEFINES.'"'.$packageRegex.'"(?P<separator>\s*:\s*)(?&string)}ix', function ($m) use ($existingPackage, $constraint) {
  16010. return JsonFile::encode(str_replace('\\/', '/', $existingPackage)) . $m['separator'] . '"' . $constraint . '"';
  16011. }, $links);
  16012. } else {
  16013. if ($this->pregMatch('#^\s*\{\s*\S+.*?(\s*\}\s*)$#s', $links, $match)) {
  16014. $links = preg_replace(
  16015. '{'.preg_quote($match[1]).'$}',
  16016. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $match[1], '\\$'),
  16017. $links
  16018. );
  16019. } else {
  16020. $links = '{' . $this->newline .
  16021. $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $this->newline .
  16022. $this->indent . '}';
  16023. }
  16024. }
  16025. if (true === $sortPackages) {
  16026. $requirements = json_decode($links, true);
  16027. $this->sortPackages($requirements);
  16028. $links = $this->format($requirements);
  16029. }
  16030. $this->contents = $matches['start'] . $matches['property'] . $links . $matches['end'];
  16031. return true;
  16032. }
  16033. private function sortPackages(array &$packages = array())
  16034. {
  16035. $prefix = function ($requirement) {
  16036. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $requirement)) {
  16037. return preg_replace(
  16038. array(
  16039. '/^php/',
  16040. '/^hhvm/',
  16041. '/^ext/',
  16042. '/^lib/',
  16043. '/^\D/',
  16044. ),
  16045. array(
  16046. '0-$0',
  16047. '1-$0',
  16048. '2-$0',
  16049. '3-$0',
  16050. '4-$0',
  16051. ),
  16052. $requirement
  16053. );
  16054. }
  16055. return '5-'.$requirement;
  16056. };
  16057. uksort($packages, function ($a, $b) use ($prefix) {
  16058. return strnatcmp($prefix($a), $prefix($b));
  16059. });
  16060. }
  16061. public function addRepository($name, $config)
  16062. {
  16063. return $this->addSubNode('repositories', $name, $config);
  16064. }
  16065. public function removeRepository($name)
  16066. {
  16067. return $this->removeSubNode('repositories', $name);
  16068. }
  16069. public function addConfigSetting($name, $value)
  16070. {
  16071. return $this->addSubNode('config', $name, $value);
  16072. }
  16073. public function removeConfigSetting($name)
  16074. {
  16075. return $this->removeSubNode('config', $name);
  16076. }
  16077. public function addProperty($name, $value)
  16078. {
  16079. if (substr($name, 0, 6) === 'extra.') {
  16080. return $this->addSubNode('extra', substr($name, 6), $value);
  16081. }
  16082. if (substr($name, 0, 8) === 'scripts.') {
  16083. return $this->addSubNode('scripts', substr($name, 8), $value);
  16084. }
  16085. return $this->addMainKey($name, $value);
  16086. }
  16087. public function removeProperty($name)
  16088. {
  16089. if (substr($name, 0, 6) === 'extra.') {
  16090. return $this->removeSubNode('extra', substr($name, 6));
  16091. }
  16092. if (substr($name, 0, 8) === 'scripts.') {
  16093. return $this->removeSubNode('scripts', substr($name, 8));
  16094. }
  16095. return $this->removeMainKey($name);
  16096. }
  16097. public function addSubNode($mainNode, $name, $value)
  16098. {
  16099. $decoded = JsonFile::parseJson($this->contents);
  16100. $subName = null;
  16101. if (in_array($mainNode, array('config', 'extra', 'scripts')) && false !== strpos($name, '.')) {
  16102. list($name, $subName) = explode('.', $name, 2);
  16103. }
  16104. if (!isset($decoded[$mainNode])) {
  16105. if ($subName !== null) {
  16106. $this->addMainKey($mainNode, array($name => array($subName => $value)));
  16107. } else {
  16108. $this->addMainKey($mainNode, array($name => $value));
  16109. }
  16110. return true;
  16111. }
  16112. $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  16113. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  16114. try {
  16115. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  16116. return false;
  16117. }
  16118. } catch (\RuntimeException $e) {
  16119. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  16120. return false;
  16121. }
  16122. throw $e;
  16123. }
  16124. $children = $match['content'];
  16125. if (!@json_decode($children)) {
  16126. return false;
  16127. }
  16128. $that = $this;
  16129. $childRegex = '{'.self::$DEFINES.'(?P<start>"'.preg_quote($name).'"\s*:\s*)(?P<content>(?&json))(?P<end>,?)}x';
  16130. if ($this->pregMatch($childRegex, $children, $matches)) {
  16131. $children = preg_replace_callback($childRegex, function ($matches) use ($subName, $value, $that) {
  16132. if ($subName !== null) {
  16133. $curVal = json_decode($matches['content'], true);
  16134. if (!is_array($curVal)) {
  16135. $curVal = array();
  16136. }
  16137. $curVal[$subName] = $value;
  16138. $value = $curVal;
  16139. }
  16140. return $matches['start'] . $that->format($value, 1) . $matches['end'];
  16141. }, $children);
  16142. } else {
  16143. $this->pregMatch('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $children, $match);
  16144. $whitespace = '';
  16145. if (!empty($match['trailingspace'])) {
  16146. $whitespace = $match['trailingspace'];
  16147. }
  16148. if (!empty($match['content'])) {
  16149. if ($subName !== null) {
  16150. $value = array($subName => $value);
  16151. }
  16152. $children = preg_replace(
  16153. '#'.$whitespace.'}$#',
  16154. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}', '\\$'),
  16155. $children
  16156. );
  16157. } else {
  16158. if ($subName !== null) {
  16159. $value = array($subName => $value);
  16160. }
  16161. $children = '{' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}';
  16162. }
  16163. }
  16164. $this->contents = preg_replace_callback($nodeRegex, function ($m) use ($children) {
  16165. return $m['start'] . $children . $m['end'];
  16166. }, $this->contents);
  16167. return true;
  16168. }
  16169. public function removeSubNode($mainNode, $name)
  16170. {
  16171. $decoded = JsonFile::parseJson($this->contents);
  16172. if (empty($decoded[$mainNode])) {
  16173. return true;
  16174. }
  16175. $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  16176. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  16177. try {
  16178. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  16179. return false;
  16180. }
  16181. } catch (\RuntimeException $e) {
  16182. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  16183. return false;
  16184. }
  16185. throw $e;
  16186. }
  16187. $children = $match['content'];
  16188. if (!@json_decode($children, true)) {
  16189. return false;
  16190. }
  16191. $subName = null;
  16192. if (in_array($mainNode, array('config', 'extra', 'scripts')) && false !== strpos($name, '.')) {
  16193. list($name, $subName) = explode('.', $name, 2);
  16194. }
  16195. if (!isset($decoded[$mainNode][$name]) || ($subName && !isset($decoded[$mainNode][$name][$subName]))) {
  16196. return true;
  16197. }
  16198. $keyRegex = str_replace('/', '\\\\?/', preg_quote($name));
  16199. if ($this->pregMatch('{"'.$keyRegex.'"\s*:}i', $children)) {
  16200. if (preg_match_all('{'.self::$DEFINES.'"'.$keyRegex.'"\s*:\s*(?:(?&json))}x', $children, $matches)) {
  16201. $bestMatch = '';
  16202. foreach ($matches[0] as $match) {
  16203. if (strlen($bestMatch) < strlen($match)) {
  16204. $bestMatch = $match;
  16205. }
  16206. }
  16207. $childrenClean = preg_replace('{,\s*'.preg_quote($bestMatch).'}i', '', $children, -1, $count);
  16208. if (1 !== $count) {
  16209. $childrenClean = preg_replace('{'.preg_quote($bestMatch).'\s*,?\s*}i', '', $childrenClean, -1, $count);
  16210. if (1 !== $count) {
  16211. return false;
  16212. }
  16213. }
  16214. }
  16215. } else {
  16216. $childrenClean = $children;
  16217. }
  16218. $this->pregMatch('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $childrenClean, $match);
  16219. if (empty($match['content'])) {
  16220. $newline = $this->newline;
  16221. $indent = $this->indent;
  16222. $this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($indent, $newline) {
  16223. return $matches['start'] . '{' . $newline . $indent . '}' . $matches['end'];
  16224. }, $this->contents);
  16225. if ($subName !== null) {
  16226. $curVal = json_decode($children, true);
  16227. unset($curVal[$name][$subName]);
  16228. $this->addSubNode($mainNode, $name, $curVal[$name]);
  16229. }
  16230. return true;
  16231. }
  16232. $that = $this;
  16233. $this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($that, $name, $subName, $childrenClean) {
  16234. if ($subName !== null) {
  16235. $curVal = json_decode($matches['content'], true);
  16236. unset($curVal[$name][$subName]);
  16237. $childrenClean = $that->format($curVal, 0);
  16238. }
  16239. return $matches['start'] . $childrenClean . $matches['end'];
  16240. }, $this->contents);
  16241. return true;
  16242. }
  16243. public function addMainKey($key, $content)
  16244. {
  16245. $decoded = JsonFile::parseJson($this->contents);
  16246. $content = $this->format($content);
  16247. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  16248. '(?P<key>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))(?P<end>.*)}sx';
  16249. if (isset($decoded[$key]) && $this->pregMatch($regex, $this->contents, $matches)) {
  16250. if (!@json_decode('{'.$matches['key'].'}')) {
  16251. return false;
  16252. }
  16253. $this->contents = $matches['start'] . JsonFile::encode($key).': '.$content . $matches['end'];
  16254. return true;
  16255. }
  16256. if ($this->pregMatch('#[^{\s](\s*)\}$#', $this->contents, $match)) {
  16257. $this->contents = preg_replace(
  16258. '#'.$match[1].'\}$#',
  16259. addcslashes(',' . $this->newline . $this->indent . JsonFile::encode($key). ': '. $content . $this->newline . '}', '\\$'),
  16260. $this->contents
  16261. );
  16262. return true;
  16263. }
  16264. $this->contents = preg_replace(
  16265. '#\}$#',
  16266. addcslashes($this->indent . JsonFile::encode($key). ': '.$content . $this->newline . '}', '\\$'),
  16267. $this->contents
  16268. );
  16269. return true;
  16270. }
  16271. public function removeMainKey($key)
  16272. {
  16273. $decoded = JsonFile::parseJson($this->contents);
  16274. if (!array_key_exists($key, $decoded)) {
  16275. return true;
  16276. }
  16277. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  16278. '(?P<removal>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))\s*,?\s*(?P<end>.*)}sx';
  16279. if ($this->pregMatch($regex, $this->contents, $matches)) {
  16280. if (!@json_decode('{'.$matches['removal'].'}')) {
  16281. return false;
  16282. }
  16283. if (preg_match('#,\s*$#', $matches['start']) && preg_match('#^\}$#', $matches['end'])) {
  16284. $matches['start'] = rtrim(preg_replace('#,(\s*)$#', '$1', $matches['start']), $this->indent);
  16285. }
  16286. $this->contents = $matches['start'] . $matches['end'];
  16287. if (preg_match('#^\{\s*\}\s*$#', $this->contents)) {
  16288. $this->contents = "{\n}";
  16289. }
  16290. return true;
  16291. }
  16292. return false;
  16293. }
  16294. public function format($data, $depth = 0)
  16295. {
  16296. if (is_array($data)) {
  16297. reset($data);
  16298. if (is_numeric(key($data))) {
  16299. foreach ($data as $key => $val) {
  16300. $data[$key] = $this->format($val, $depth + 1);
  16301. }
  16302. return '['.implode(', ', $data).']';
  16303. }
  16304. $out = '{' . $this->newline;
  16305. $elems = array();
  16306. foreach ($data as $key => $val) {
  16307. $elems[] = str_repeat($this->indent, $depth + 2) . JsonFile::encode($key). ': '.$this->format($val, $depth + 1);
  16308. }
  16309. return $out . implode(','.$this->newline, $elems) . $this->newline . str_repeat($this->indent, $depth + 1) . '}';
  16310. }
  16311. return JsonFile::encode($data);
  16312. }
  16313. protected function detectIndenting()
  16314. {
  16315. if ($this->pregMatch('{^([ \t]+)"}m', $this->contents, $match)) {
  16316. $this->indent = $match[1];
  16317. } else {
  16318. $this->indent = ' ';
  16319. }
  16320. }
  16321. protected function pregMatch($re, $str, &$matches = array())
  16322. {
  16323. $count = preg_match($re, $str, $matches);
  16324. if ($count === false) {
  16325. switch (preg_last_error()) {
  16326. case PREG_NO_ERROR:
  16327. throw new \RuntimeException('Failed to execute regex: PREG_NO_ERROR', PREG_NO_ERROR);
  16328. case PREG_INTERNAL_ERROR:
  16329. throw new \RuntimeException('Failed to execute regex: PREG_INTERNAL_ERROR', PREG_INTERNAL_ERROR);
  16330. case PREG_BACKTRACK_LIMIT_ERROR:
  16331. throw new \RuntimeException('Failed to execute regex: PREG_BACKTRACK_LIMIT_ERROR', PREG_BACKTRACK_LIMIT_ERROR);
  16332. case PREG_RECURSION_LIMIT_ERROR:
  16333. throw new \RuntimeException('Failed to execute regex: PREG_RECURSION_LIMIT_ERROR', PREG_RECURSION_LIMIT_ERROR);
  16334. case PREG_BAD_UTF8_ERROR:
  16335. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_ERROR', PREG_BAD_UTF8_ERROR);
  16336. case PREG_BAD_UTF8_OFFSET_ERROR:
  16337. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_OFFSET_ERROR', PREG_BAD_UTF8_OFFSET_ERROR);
  16338. case 6:
  16339. if (PHP_VERSION_ID > 70000) {
  16340. throw new \RuntimeException('Failed to execute regex: PREG_JIT_STACKLIMIT_ERROR', 6);
  16341. }
  16342. default:
  16343. throw new \RuntimeException('Failed to execute regex: Unknown error');
  16344. }
  16345. }
  16346. return $count;
  16347. }
  16348. }
  16349. <?php
  16350. namespace Composer\Json;
  16351. use Exception;
  16352. class JsonValidationException extends Exception
  16353. {
  16354. protected $errors;
  16355. public function __construct($message, $errors = array(), Exception $previous = null)
  16356. {
  16357. $this->errors = $errors;
  16358. parent::__construct($message, 0, $previous);
  16359. }
  16360. public function getErrors()
  16361. {
  16362. return $this->errors;
  16363. }
  16364. }
  16365. <?php
  16366. namespace Composer\Package;
  16367. use Composer\Semver\Constraint\Constraint;
  16368. use Composer\Package\Version\VersionParser;
  16369. class AliasPackage extends BasePackage implements CompletePackageInterface
  16370. {
  16371. protected $version;
  16372. protected $prettyVersion;
  16373. protected $dev;
  16374. protected $rootPackageAlias = false;
  16375. protected $stability;
  16376. protected $aliasOf;
  16377. protected $requires;
  16378. protected $devRequires;
  16379. protected $conflicts;
  16380. protected $provides;
  16381. protected $replaces;
  16382. public function __construct(PackageInterface $aliasOf, $version, $prettyVersion)
  16383. {
  16384. parent::__construct($aliasOf->getName());
  16385. $this->version = $version;
  16386. $this->prettyVersion = $prettyVersion;
  16387. $this->aliasOf = $aliasOf;
  16388. $this->stability = VersionParser::parseStability($version);
  16389. $this->dev = $this->stability === 'dev';
  16390. foreach (array('requires', 'devRequires', 'conflicts', 'provides', 'replaces') as $type) {
  16391. $links = $aliasOf->{'get' . ucfirst($type)}();
  16392. $this->$type = $this->replaceSelfVersionDependencies($links, $type);
  16393. }
  16394. }
  16395. public function getAliasOf()
  16396. {
  16397. return $this->aliasOf;
  16398. }
  16399. public function getVersion()
  16400. {
  16401. return $this->version;
  16402. }
  16403. public function getStability()
  16404. {
  16405. return $this->stability;
  16406. }
  16407. public function getPrettyVersion()
  16408. {
  16409. return $this->prettyVersion;
  16410. }
  16411. public function isDev()
  16412. {
  16413. return $this->dev;
  16414. }
  16415. public function getRequires()
  16416. {
  16417. return $this->requires;
  16418. }
  16419. public function getConflicts()
  16420. {
  16421. return $this->conflicts;
  16422. }
  16423. public function getProvides()
  16424. {
  16425. return $this->provides;
  16426. }
  16427. public function getReplaces()
  16428. {
  16429. return $this->replaces;
  16430. }
  16431. public function getDevRequires()
  16432. {
  16433. return $this->devRequires;
  16434. }
  16435. public function setRootPackageAlias($value)
  16436. {
  16437. return $this->rootPackageAlias = $value;
  16438. }
  16439. public function isRootPackageAlias()
  16440. {
  16441. return $this->rootPackageAlias;
  16442. }
  16443. protected function replaceSelfVersionDependencies(array $links, $linkType)
  16444. {
  16445. if (in_array($linkType, array('conflicts', 'provides', 'replaces'), true)) {
  16446. $newLinks = array();
  16447. foreach ($links as $link) {
  16448. if ('self.version' === $link->getPrettyConstraint()) {
  16449. $newLinks[] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  16450. }
  16451. }
  16452. $links = array_merge($links, $newLinks);
  16453. } else {
  16454. foreach ($links as $index => $link) {
  16455. if ('self.version' === $link->getPrettyConstraint()) {
  16456. $links[$index] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  16457. }
  16458. }
  16459. }
  16460. return $links;
  16461. }
  16462. public function getType()
  16463. {
  16464. return $this->aliasOf->getType();
  16465. }
  16466. public function getTargetDir()
  16467. {
  16468. return $this->aliasOf->getTargetDir();
  16469. }
  16470. public function getExtra()
  16471. {
  16472. return $this->aliasOf->getExtra();
  16473. }
  16474. public function setInstallationSource($type)
  16475. {
  16476. $this->aliasOf->setInstallationSource($type);
  16477. }
  16478. public function getInstallationSource()
  16479. {
  16480. return $this->aliasOf->getInstallationSource();
  16481. }
  16482. public function getSourceType()
  16483. {
  16484. return $this->aliasOf->getSourceType();
  16485. }
  16486. public function getSourceUrl()
  16487. {
  16488. return $this->aliasOf->getSourceUrl();
  16489. }
  16490. public function getSourceUrls()
  16491. {
  16492. return $this->aliasOf->getSourceUrls();
  16493. }
  16494. public function getSourceReference()
  16495. {
  16496. return $this->aliasOf->getSourceReference();
  16497. }
  16498. public function setSourceReference($reference)
  16499. {
  16500. return $this->aliasOf->setSourceReference($reference);
  16501. }
  16502. public function setSourceMirrors($mirrors)
  16503. {
  16504. return $this->aliasOf->setSourceMirrors($mirrors);
  16505. }
  16506. public function getSourceMirrors()
  16507. {
  16508. return $this->aliasOf->getSourceMirrors();
  16509. }
  16510. public function getDistType()
  16511. {
  16512. return $this->aliasOf->getDistType();
  16513. }
  16514. public function getDistUrl()
  16515. {
  16516. return $this->aliasOf->getDistUrl();
  16517. }
  16518. public function getDistUrls()
  16519. {
  16520. return $this->aliasOf->getDistUrls();
  16521. }
  16522. public function getDistReference()
  16523. {
  16524. return $this->aliasOf->getDistReference();
  16525. }
  16526. public function setDistReference($reference)
  16527. {
  16528. return $this->aliasOf->setDistReference($reference);
  16529. }
  16530. public function getDistSha1Checksum()
  16531. {
  16532. return $this->aliasOf->getDistSha1Checksum();
  16533. }
  16534. public function setTransportOptions(array $options)
  16535. {
  16536. return $this->aliasOf->setTransportOptions($options);
  16537. }
  16538. public function getTransportOptions()
  16539. {
  16540. return $this->aliasOf->getTransportOptions();
  16541. }
  16542. public function setDistMirrors($mirrors)
  16543. {
  16544. return $this->aliasOf->setDistMirrors($mirrors);
  16545. }
  16546. public function getDistMirrors()
  16547. {
  16548. return $this->aliasOf->getDistMirrors();
  16549. }
  16550. public function getScripts()
  16551. {
  16552. return $this->aliasOf->getScripts();
  16553. }
  16554. public function getLicense()
  16555. {
  16556. return $this->aliasOf->getLicense();
  16557. }
  16558. public function getAutoload()
  16559. {
  16560. return $this->aliasOf->getAutoload();
  16561. }
  16562. public function getDevAutoload()
  16563. {
  16564. return $this->aliasOf->getDevAutoload();
  16565. }
  16566. public function getIncludePaths()
  16567. {
  16568. return $this->aliasOf->getIncludePaths();
  16569. }
  16570. public function getRepositories()
  16571. {
  16572. return $this->aliasOf->getRepositories();
  16573. }
  16574. public function getReleaseDate()
  16575. {
  16576. return $this->aliasOf->getReleaseDate();
  16577. }
  16578. public function getBinaries()
  16579. {
  16580. return $this->aliasOf->getBinaries();
  16581. }
  16582. public function getKeywords()
  16583. {
  16584. return $this->aliasOf->getKeywords();
  16585. }
  16586. public function getDescription()
  16587. {
  16588. return $this->aliasOf->getDescription();
  16589. }
  16590. public function getHomepage()
  16591. {
  16592. return $this->aliasOf->getHomepage();
  16593. }
  16594. public function getSuggests()
  16595. {
  16596. return $this->aliasOf->getSuggests();
  16597. }
  16598. public function getAuthors()
  16599. {
  16600. return $this->aliasOf->getAuthors();
  16601. }
  16602. public function getSupport()
  16603. {
  16604. return $this->aliasOf->getSupport();
  16605. }
  16606. public function getNotificationUrl()
  16607. {
  16608. return $this->aliasOf->getNotificationUrl();
  16609. }
  16610. public function getArchiveExcludes()
  16611. {
  16612. return $this->aliasOf->getArchiveExcludes();
  16613. }
  16614. public function isAbandoned()
  16615. {
  16616. return $this->aliasOf->isAbandoned();
  16617. }
  16618. public function getReplacementPackage()
  16619. {
  16620. return $this->aliasOf->getReplacementPackage();
  16621. }
  16622. public function __toString()
  16623. {
  16624. return parent::__toString().' (alias of '.$this->aliasOf->getVersion().')';
  16625. }
  16626. public function setDistUrl($url)
  16627. {
  16628. return $this->aliasOf->setDistUrl($url);
  16629. }
  16630. public function setDistType($type)
  16631. {
  16632. return $this->aliasOf->setDistType($type);
  16633. }
  16634. }
  16635. <?php
  16636. namespace Composer\Package\Archiver;
  16637. use FilterIterator;
  16638. use PharData;
  16639. class ArchivableFilesFilter extends FilterIterator
  16640. {
  16641. private $dirs = array();
  16642. public function accept()
  16643. {
  16644. $file = $this->getInnerIterator()->current();
  16645. if ($file->isDir()) {
  16646. $this->dirs[] = (string) $file;
  16647. return false;
  16648. }
  16649. return true;
  16650. }
  16651. public function addEmptyDir(PharData $phar, $sources)
  16652. {
  16653. foreach ($this->dirs as $filepath) {
  16654. $localname = str_replace($sources . "/", '', $filepath);
  16655. $phar->addEmptyDir($localname);
  16656. }
  16657. }
  16658. }
  16659. <?php
  16660. namespace Composer\Package\Archiver;
  16661. use Composer\Util\Filesystem;
  16662. use FilesystemIterator;
  16663. use Symfony\Component\Finder\Finder;
  16664. use Symfony\Component\Finder\SplFileInfo;
  16665. class ArchivableFilesFinder extends \FilterIterator
  16666. {
  16667. protected $finder;
  16668. public function __construct($sources, array $excludes, $ignoreFilters = false)
  16669. {
  16670. $fs = new Filesystem();
  16671. $sources = $fs->normalizePath($sources);
  16672. if ($ignoreFilters) {
  16673. $filters = array();
  16674. } else {
  16675. $filters = array(
  16676. new HgExcludeFilter($sources),
  16677. new GitExcludeFilter($sources),
  16678. new ComposerExcludeFilter($sources, $excludes),
  16679. );
  16680. }
  16681. $this->finder = new Finder();
  16682. $filter = function (\SplFileInfo $file) use ($sources, $filters, $fs) {
  16683. if ($file->isLink() && strpos($file->getLinkTarget(), $sources) !== 0) {
  16684. return false;
  16685. }
  16686. $relativePath = preg_replace(
  16687. '#^'.preg_quote($sources, '#').'#',
  16688. '',
  16689. $fs->normalizePath($file->getRealPath())
  16690. );
  16691. $exclude = false;
  16692. foreach ($filters as $filter) {
  16693. $exclude = $filter->filter($relativePath, $exclude);
  16694. }
  16695. return !$exclude;
  16696. };
  16697. if (method_exists($filter, 'bindTo')) {
  16698. $filter = $filter->bindTo(null);
  16699. }
  16700. $this->finder
  16701. ->in($sources)
  16702. ->filter($filter)
  16703. ->ignoreVCS(true)
  16704. ->ignoreDotFiles(false);
  16705. parent::__construct($this->finder->getIterator());
  16706. }
  16707. public function accept()
  16708. {
  16709. $current = $this->getInnerIterator()->current();
  16710. if (!$current->isDir()) {
  16711. return true;
  16712. }
  16713. $iterator = new FilesystemIterator($current, FilesystemIterator::SKIP_DOTS);
  16714. return !$iterator->valid();
  16715. }
  16716. }
  16717. <?php
  16718. namespace Composer\Package\Archiver;
  16719. use Composer\Downloader\DownloadManager;
  16720. use Composer\Package\PackageInterface;
  16721. use Composer\Package\RootPackageInterface;
  16722. use Composer\Util\Filesystem;
  16723. use Composer\Json\JsonFile;
  16724. class ArchiveManager
  16725. {
  16726. protected $downloadManager;
  16727. protected $archivers = array();
  16728. protected $overwriteFiles = true;
  16729. public function __construct(DownloadManager $downloadManager)
  16730. {
  16731. $this->downloadManager = $downloadManager;
  16732. }
  16733. public function addArchiver(ArchiverInterface $archiver)
  16734. {
  16735. $this->archivers[] = $archiver;
  16736. }
  16737. public function setOverwriteFiles($overwriteFiles)
  16738. {
  16739. $this->overwriteFiles = $overwriteFiles;
  16740. return $this;
  16741. }
  16742. public function getPackageFilename(PackageInterface $package)
  16743. {
  16744. $nameParts = array(preg_replace('#[^a-z0-9-_]#i', '-', $package->getName()));
  16745. if (preg_match('{^[a-f0-9]{40}$}', $package->getDistReference())) {
  16746. array_push($nameParts, $package->getDistReference(), $package->getDistType());
  16747. } else {
  16748. array_push($nameParts, $package->getPrettyVersion(), $package->getDistReference());
  16749. }
  16750. if ($package->getSourceReference()) {
  16751. $nameParts[] = substr(sha1($package->getSourceReference()), 0, 6);
  16752. }
  16753. $name = implode('-', array_filter($nameParts, function ($p) {
  16754. return !empty($p);
  16755. }));
  16756. return str_replace('/', '-', $name);
  16757. }
  16758. public function archive(PackageInterface $package, $format, $targetDir, $fileName = null, $ignoreFilters = false)
  16759. {
  16760. if (empty($format)) {
  16761. throw new \InvalidArgumentException('Format must be specified');
  16762. }
  16763. $usableArchiver = null;
  16764. foreach ($this->archivers as $archiver) {
  16765. if ($archiver->supports($format, $package->getSourceType())) {
  16766. $usableArchiver = $archiver;
  16767. break;
  16768. }
  16769. }
  16770. if (null === $usableArchiver) {
  16771. throw new \RuntimeException(sprintf('No archiver found to support %s format', $format));
  16772. }
  16773. $filesystem = new Filesystem();
  16774. if (null === $fileName) {
  16775. $packageName = $this->getPackageFilename($package);
  16776. } else {
  16777. $packageName = $fileName;
  16778. }
  16779. $filesystem->ensureDirectoryExists($targetDir);
  16780. $target = realpath($targetDir).'/'.$packageName.'.'.$format;
  16781. $filesystem->ensureDirectoryExists(dirname($target));
  16782. if (!$this->overwriteFiles && file_exists($target)) {
  16783. return $target;
  16784. }
  16785. if ($package instanceof RootPackageInterface) {
  16786. $sourcePath = realpath('.');
  16787. } else {
  16788. $sourcePath = sys_get_temp_dir().'/composer_archive'.uniqid();
  16789. $filesystem->ensureDirectoryExists($sourcePath);
  16790. try {
  16791. $this->downloadManager->download($package, $sourcePath);
  16792. } catch (\Exception $e) {
  16793. $filesystem->removeDirectory($sourcePath);
  16794. throw $e;
  16795. }
  16796. if (file_exists($composerJsonPath = $sourcePath.'/composer.json')) {
  16797. $jsonFile = new JsonFile($composerJsonPath);
  16798. $jsonData = $jsonFile->read();
  16799. if (!empty($jsonData['archive']['exclude'])) {
  16800. $package->setArchiveExcludes($jsonData['archive']['exclude']);
  16801. }
  16802. }
  16803. }
  16804. $tempTarget = sys_get_temp_dir().'/composer_archive'.uniqid().'.'.$format;
  16805. $filesystem->ensureDirectoryExists(dirname($tempTarget));
  16806. $archivePath = $usableArchiver->archive($sourcePath, $tempTarget, $format, $package->getArchiveExcludes(), $ignoreFilters);
  16807. $filesystem->rename($archivePath, $target);
  16808. if (!$package instanceof RootPackageInterface) {
  16809. $filesystem->removeDirectory($sourcePath);
  16810. }
  16811. $filesystem->remove($tempTarget);
  16812. return $target;
  16813. }
  16814. }
  16815. <?php
  16816. namespace Composer\Package\Archiver;
  16817. interface ArchiverInterface
  16818. {
  16819. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false);
  16820. public function supports($format, $sourceType);
  16821. }
  16822. <?php
  16823. namespace Composer\Package\Archiver;
  16824. use Symfony\Component\Finder;
  16825. abstract class BaseExcludeFilter
  16826. {
  16827. protected $sourcePath;
  16828. protected $excludePatterns;
  16829. public function __construct($sourcePath)
  16830. {
  16831. $this->sourcePath = $sourcePath;
  16832. $this->excludePatterns = array();
  16833. }
  16834. public function filter($relativePath, $exclude)
  16835. {
  16836. foreach ($this->excludePatterns as $patternData) {
  16837. list($pattern, $negate, $stripLeadingSlash) = $patternData;
  16838. if ($stripLeadingSlash) {
  16839. $path = substr($relativePath, 1);
  16840. } else {
  16841. $path = $relativePath;
  16842. }
  16843. if (preg_match($pattern, $path)) {
  16844. $exclude = !$negate;
  16845. }
  16846. }
  16847. return $exclude;
  16848. }
  16849. protected function parseLines(array $lines, $lineParser)
  16850. {
  16851. return array_filter(
  16852. array_map(
  16853. function ($line) use ($lineParser) {
  16854. $line = trim($line);
  16855. if (!$line || 0 === strpos($line, '#')) {
  16856. return null;
  16857. }
  16858. return call_user_func($lineParser, $line);
  16859. },
  16860. $lines
  16861. ),
  16862. function ($pattern) {
  16863. return $pattern !== null;
  16864. }
  16865. );
  16866. }
  16867. protected function generatePatterns($rules)
  16868. {
  16869. $patterns = array();
  16870. foreach ($rules as $rule) {
  16871. $patterns[] = $this->generatePattern($rule);
  16872. }
  16873. return $patterns;
  16874. }
  16875. protected function generatePattern($rule)
  16876. {
  16877. $negate = false;
  16878. $pattern = '{';
  16879. if (strlen($rule) && $rule[0] === '!') {
  16880. $negate = true;
  16881. $rule = substr($rule, 1);
  16882. }
  16883. if (strlen($rule) && $rule[0] === '/') {
  16884. $pattern .= '^/';
  16885. $rule = substr($rule, 1);
  16886. } elseif (strlen($rule) - 1 === strpos($rule, '/')) {
  16887. $pattern .= '/';
  16888. $rule = substr($rule, 0, -1);
  16889. } elseif (false === strpos($rule, '/')) {
  16890. $pattern .= '/';
  16891. }
  16892. $pattern .= substr(Finder\Glob::toRegex($rule), 2, -2) . '(?=$|/)';
  16893. return array($pattern . '}', $negate, false);
  16894. }
  16895. }
  16896. <?php
  16897. namespace Composer\Package\Archiver;
  16898. class ComposerExcludeFilter extends BaseExcludeFilter
  16899. {
  16900. public function __construct($sourcePath, array $excludeRules)
  16901. {
  16902. parent::__construct($sourcePath);
  16903. $this->excludePatterns = $this->generatePatterns($excludeRules);
  16904. }
  16905. }
  16906. <?php
  16907. namespace Composer\Package\Archiver;
  16908. class GitExcludeFilter extends BaseExcludeFilter
  16909. {
  16910. public function __construct($sourcePath)
  16911. {
  16912. parent::__construct($sourcePath);
  16913. if (file_exists($sourcePath.'/.gitignore')) {
  16914. $this->excludePatterns = $this->parseLines(
  16915. file($sourcePath.'/.gitignore'),
  16916. array($this, 'parseGitIgnoreLine')
  16917. );
  16918. }
  16919. if (file_exists($sourcePath.'/.gitattributes')) {
  16920. $this->excludePatterns = array_merge(
  16921. $this->excludePatterns,
  16922. $this->parseLines(
  16923. file($sourcePath.'/.gitattributes'),
  16924. array($this, 'parseGitAttributesLine')
  16925. )
  16926. );
  16927. }
  16928. }
  16929. public function parseGitIgnoreLine($line)
  16930. {
  16931. return $this->generatePattern($line);
  16932. }
  16933. public function parseGitAttributesLine($line)
  16934. {
  16935. $parts = preg_split('#\s+#', $line);
  16936. if (count($parts) == 2 && $parts[1] === 'export-ignore') {
  16937. return $this->generatePattern($parts[0]);
  16938. }
  16939. return null;
  16940. }
  16941. }
  16942. <?php
  16943. namespace Composer\Package\Archiver;
  16944. use Symfony\Component\Finder;
  16945. class HgExcludeFilter extends BaseExcludeFilter
  16946. {
  16947. const HG_IGNORE_REGEX = 1;
  16948. const HG_IGNORE_GLOB = 2;
  16949. protected $patternMode;
  16950. public function __construct($sourcePath)
  16951. {
  16952. parent::__construct($sourcePath);
  16953. $this->patternMode = self::HG_IGNORE_REGEX;
  16954. if (file_exists($sourcePath.'/.hgignore')) {
  16955. $this->excludePatterns = $this->parseLines(
  16956. file($sourcePath.'/.hgignore'),
  16957. array($this, 'parseHgIgnoreLine')
  16958. );
  16959. }
  16960. }
  16961. public function parseHgIgnoreLine($line)
  16962. {
  16963. if (preg_match('#^syntax\s*:\s*(glob|regexp)$#', $line, $matches)) {
  16964. if ($matches[1] === 'glob') {
  16965. $this->patternMode = self::HG_IGNORE_GLOB;
  16966. } else {
  16967. $this->patternMode = self::HG_IGNORE_REGEX;
  16968. }
  16969. return null;
  16970. }
  16971. if ($this->patternMode == self::HG_IGNORE_GLOB) {
  16972. return $this->patternFromGlob($line);
  16973. }
  16974. return $this->patternFromRegex($line);
  16975. }
  16976. protected function patternFromGlob($line)
  16977. {
  16978. $pattern = '#'.substr(Finder\Glob::toRegex($line), 2, -1).'#';
  16979. $pattern = str_replace('[^/]*', '.*', $pattern);
  16980. return array($pattern, false, true);
  16981. }
  16982. public function patternFromRegex($line)
  16983. {
  16984. $pattern = '#'.preg_replace('/((?:\\\\\\\\)*)(\\\\?)#/', '\1\2\2\\#', $line).'#';
  16985. return array($pattern, false, true);
  16986. }
  16987. }
  16988. <?php
  16989. namespace Composer\Package\Archiver;
  16990. class PharArchiver implements ArchiverInterface
  16991. {
  16992. protected static $formats = array(
  16993. 'zip' => \Phar::ZIP,
  16994. 'tar' => \Phar::TAR,
  16995. 'tar.gz' => \Phar::TAR,
  16996. 'tar.bz2' => \Phar::TAR,
  16997. );
  16998. protected static $compressFormats = array(
  16999. 'tar.gz' => \Phar::GZ,
  17000. 'tar.bz2' => \Phar::BZ2,
  17001. );
  17002. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false)
  17003. {
  17004. $sources = realpath($sources);
  17005. if (file_exists($target)) {
  17006. unlink($target);
  17007. }
  17008. try {
  17009. $filename = substr($target, 0, strrpos($target, $format) - 1);
  17010. if (isset(static::$compressFormats[$format])) {
  17011. $target = $filename . '.tar';
  17012. }
  17013. $phar = new \PharData($target, null, null, static::$formats[$format]);
  17014. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  17015. $filesOnly = new ArchivableFilesFilter($files);
  17016. $phar->buildFromIterator($filesOnly, $sources);
  17017. $filesOnly->addEmptyDir($phar, $sources);
  17018. if (isset(static::$compressFormats[$format])) {
  17019. if (!$phar->canCompress(static::$compressFormats[$format])) {
  17020. throw new \RuntimeException(sprintf('Can not compress to %s format', $format));
  17021. }
  17022. unlink($target);
  17023. $phar->compress(static::$compressFormats[$format]);
  17024. $target = $filename . '.' . $format;
  17025. }
  17026. return $target;
  17027. } catch (\UnexpectedValueException $e) {
  17028. $message = sprintf(
  17029. "Could not create archive '%s' from '%s': %s",
  17030. $target,
  17031. $sources,
  17032. $e->getMessage()
  17033. );
  17034. throw new \RuntimeException($message, $e->getCode(), $e);
  17035. }
  17036. }
  17037. public function supports($format, $sourceType)
  17038. {
  17039. return isset(static::$formats[$format]);
  17040. }
  17041. }
  17042. <?php
  17043. namespace Composer\Package\Archiver;
  17044. use ZipArchive;
  17045. use Composer\Util\Filesystem;
  17046. class ZipArchiver implements ArchiverInterface
  17047. {
  17048. protected static $formats = array(
  17049. 'zip' => 1,
  17050. );
  17051. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false)
  17052. {
  17053. $fs = new Filesystem();
  17054. $sources = $fs->normalizePath($sources);
  17055. $zip = new ZipArchive();
  17056. $res = $zip->open($target, ZipArchive::CREATE);
  17057. if ($res === true) {
  17058. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  17059. foreach ($files as $file) {
  17060. $filepath = strtr($file->getPath()."/".$file->getFilename(), '\\', '/');
  17061. $localname = str_replace($sources.'/', '', $filepath);
  17062. if ($file->isDir()) {
  17063. $zip->addEmptyDir($localname);
  17064. } else {
  17065. $zip->addFile($filepath, $localname);
  17066. }
  17067. }
  17068. if ($zip->close()) {
  17069. return $target;
  17070. }
  17071. }
  17072. $message = sprintf(
  17073. "Could not create archive '%s' from '%s': %s",
  17074. $target,
  17075. $sources,
  17076. $zip->getStatusString()
  17077. );
  17078. throw new \RuntimeException($message);
  17079. }
  17080. public function supports($format, $sourceType)
  17081. {
  17082. return isset(static::$formats[$format]) && $this->compressionAvailable();
  17083. }
  17084. private function compressionAvailable()
  17085. {
  17086. return class_exists('ZipArchive');
  17087. }
  17088. }
  17089. <?php
  17090. namespace Composer\Package;
  17091. use Composer\Repository\RepositoryInterface;
  17092. use Composer\Repository\PlatformRepository;
  17093. abstract class BasePackage implements PackageInterface
  17094. {
  17095. public static $supportedLinkTypes = array(
  17096. 'require' => array('description' => 'requires', 'method' => 'requires'),
  17097. 'conflict' => array('description' => 'conflicts', 'method' => 'conflicts'),
  17098. 'provide' => array('description' => 'provides', 'method' => 'provides'),
  17099. 'replace' => array('description' => 'replaces', 'method' => 'replaces'),
  17100. 'require-dev' => array('description' => 'requires (for development)', 'method' => 'devRequires'),
  17101. );
  17102. const STABILITY_STABLE = 0;
  17103. const STABILITY_RC = 5;
  17104. const STABILITY_BETA = 10;
  17105. const STABILITY_ALPHA = 15;
  17106. const STABILITY_DEV = 20;
  17107. public static $stabilities = array(
  17108. 'stable' => self::STABILITY_STABLE,
  17109. 'RC' => self::STABILITY_RC,
  17110. 'beta' => self::STABILITY_BETA,
  17111. 'alpha' => self::STABILITY_ALPHA,
  17112. 'dev' => self::STABILITY_DEV,
  17113. );
  17114. public $id;
  17115. protected $name;
  17116. protected $prettyName;
  17117. protected $repository;
  17118. protected $transportOptions = array();
  17119. public function __construct($name)
  17120. {
  17121. $this->prettyName = $name;
  17122. $this->name = strtolower($name);
  17123. $this->id = -1;
  17124. }
  17125. public function getName()
  17126. {
  17127. return $this->name;
  17128. }
  17129. public function getPrettyName()
  17130. {
  17131. return $this->prettyName;
  17132. }
  17133. public function getNames()
  17134. {
  17135. $names = array(
  17136. $this->getName() => true,
  17137. );
  17138. foreach ($this->getProvides() as $link) {
  17139. $names[$link->getTarget()] = true;
  17140. }
  17141. foreach ($this->getReplaces() as $link) {
  17142. $names[$link->getTarget()] = true;
  17143. }
  17144. return array_keys($names);
  17145. }
  17146. public function setId($id)
  17147. {
  17148. $this->id = $id;
  17149. }
  17150. public function getId()
  17151. {
  17152. return $this->id;
  17153. }
  17154. public function setRepository(RepositoryInterface $repository)
  17155. {
  17156. if ($this->repository && $repository !== $this->repository) {
  17157. throw new \LogicException('A package can only be added to one repository');
  17158. }
  17159. $this->repository = $repository;
  17160. }
  17161. public function getRepository()
  17162. {
  17163. return $this->repository;
  17164. }
  17165. public function getTransportOptions()
  17166. {
  17167. return $this->transportOptions;
  17168. }
  17169. public function setTransportOptions(array $options)
  17170. {
  17171. $this->transportOptions = $options;
  17172. }
  17173. public function isPlatform()
  17174. {
  17175. return $this->getRepository() instanceof PlatformRepository;
  17176. }
  17177. public function getUniqueName()
  17178. {
  17179. return $this->getName().'-'.$this->getVersion();
  17180. }
  17181. public function equals(PackageInterface $package)
  17182. {
  17183. $self = $this;
  17184. if ($this instanceof AliasPackage) {
  17185. $self = $this->getAliasOf();
  17186. }
  17187. if ($package instanceof AliasPackage) {
  17188. $package = $package->getAliasOf();
  17189. }
  17190. return $package === $self;
  17191. }
  17192. public function __toString()
  17193. {
  17194. return $this->getUniqueName();
  17195. }
  17196. public function getPrettyString()
  17197. {
  17198. return $this->getPrettyName().' '.$this->getPrettyVersion();
  17199. }
  17200. public function getFullPrettyVersion($truncate = true)
  17201. {
  17202. if (!$this->isDev() || !in_array($this->getSourceType(), array('hg', 'git'))) {
  17203. return $this->getPrettyVersion();
  17204. }
  17205. if ($truncate && strlen($this->getSourceReference()) === 40) {
  17206. return $this->getPrettyVersion() . ' ' . substr($this->getSourceReference(), 0, 7);
  17207. }
  17208. return $this->getPrettyVersion() . ' ' . $this->getSourceReference();
  17209. }
  17210. public function getStabilityPriority()
  17211. {
  17212. return self::$stabilities[$this->getStability()];
  17213. }
  17214. public function __clone()
  17215. {
  17216. $this->repository = null;
  17217. $this->id = -1;
  17218. }
  17219. public static function packageNameToRegexp($whiteListedPattern, $wrap = '{^%s$}i')
  17220. {
  17221. $cleanedWhiteListedPattern = str_replace('\\*', '.*', preg_quote($whiteListedPattern));
  17222. return sprintf($wrap, $cleanedWhiteListedPattern);
  17223. }
  17224. }
  17225. <?php
  17226. namespace Composer\Package\Comparer;
  17227. class Comparer
  17228. {
  17229. private $source;
  17230. private $update;
  17231. private $changed;
  17232. public function setSource($source)
  17233. {
  17234. $this->source = $source;
  17235. }
  17236. public function setUpdate($update)
  17237. {
  17238. $this->update = $update;
  17239. }
  17240. public function getChanged($toString = false, $explicated = false)
  17241. {
  17242. $changed = $this->changed;
  17243. if (!count($changed)) {
  17244. return false;
  17245. }
  17246. if ($explicated) {
  17247. foreach ($changed as $sectionKey => $itemSection) {
  17248. foreach ($itemSection as $itemKey => $item) {
  17249. $changed[$sectionKey][$itemKey] = $item.' ('.$sectionKey.')';
  17250. }
  17251. }
  17252. }
  17253. if ($toString) {
  17254. foreach ($changed as $sectionKey => $itemSection) {
  17255. foreach ($itemSection as $itemKey => $item) {
  17256. $changed['string'][] = $item."\r\n";
  17257. }
  17258. }
  17259. $changed = implode("\r\n", $changed['string']);
  17260. }
  17261. return $changed;
  17262. }
  17263. public function doCompare()
  17264. {
  17265. $source = array();
  17266. $destination = array();
  17267. $this->changed = array();
  17268. $currentDirectory = getcwd();
  17269. chdir($this->source);
  17270. $source = $this->doTree('.', $source);
  17271. if (!is_array($source)) {
  17272. return;
  17273. }
  17274. chdir($currentDirectory);
  17275. chdir($this->update);
  17276. $destination = $this->doTree('.', $destination);
  17277. if (!is_array($destination)) {
  17278. exit;
  17279. }
  17280. chdir($currentDirectory);
  17281. foreach ($source as $dir => $value) {
  17282. foreach ($value as $file => $hash) {
  17283. if (isset($destination[$dir][$file])) {
  17284. if ($hash !== $destination[$dir][$file]) {
  17285. $this->changed['changed'][] = $dir.'/'.$file;
  17286. }
  17287. } else {
  17288. $this->changed['removed'][] = $dir.'/'.$file;
  17289. }
  17290. }
  17291. }
  17292. foreach ($destination as $dir => $value) {
  17293. foreach ($value as $file => $hash) {
  17294. if (!isset($source[$dir][$file])) {
  17295. $this->changed['added'][] = $dir.'/'.$file;
  17296. }
  17297. }
  17298. }
  17299. }
  17300. private function doTree($dir, &$array)
  17301. {
  17302. if ($dh = opendir($dir)) {
  17303. while ($file = readdir($dh)) {
  17304. if ($file !== '.' && $file !== '..') {
  17305. if (is_dir($dir.'/'.$file)) {
  17306. if (!count($array)) {
  17307. $array[0] = 'Temp';
  17308. }
  17309. if (!$this->doTree($dir.'/'.$file, $array)) {
  17310. return false;
  17311. }
  17312. } else {
  17313. if (filesize($dir.'/'.$file)) {
  17314. set_time_limit(30);
  17315. $array[$dir][$file] = md5_file($dir.'/'.$file);
  17316. }
  17317. }
  17318. }
  17319. }
  17320. if (count($array) > 1 && isset($array['0'])) {
  17321. unset($array['0']);
  17322. }
  17323. return $array;
  17324. }
  17325. return false;
  17326. }
  17327. }
  17328. <?php
  17329. namespace Composer\Package;
  17330. class CompletePackage extends Package implements CompletePackageInterface
  17331. {
  17332. protected $repositories;
  17333. protected $license = array();
  17334. protected $keywords;
  17335. protected $authors;
  17336. protected $description;
  17337. protected $homepage;
  17338. protected $scripts = array();
  17339. protected $support = array();
  17340. protected $abandoned = false;
  17341. public function setScripts(array $scripts)
  17342. {
  17343. $this->scripts = $scripts;
  17344. }
  17345. public function getScripts()
  17346. {
  17347. return $this->scripts;
  17348. }
  17349. public function setRepositories($repositories)
  17350. {
  17351. $this->repositories = $repositories;
  17352. }
  17353. public function getRepositories()
  17354. {
  17355. return $this->repositories;
  17356. }
  17357. public function setLicense(array $license)
  17358. {
  17359. $this->license = $license;
  17360. }
  17361. public function getLicense()
  17362. {
  17363. return $this->license;
  17364. }
  17365. public function setKeywords(array $keywords)
  17366. {
  17367. $this->keywords = $keywords;
  17368. }
  17369. public function getKeywords()
  17370. {
  17371. return $this->keywords;
  17372. }
  17373. public function setAuthors(array $authors)
  17374. {
  17375. $this->authors = $authors;
  17376. }
  17377. public function getAuthors()
  17378. {
  17379. return $this->authors;
  17380. }
  17381. public function setDescription($description)
  17382. {
  17383. $this->description = $description;
  17384. }
  17385. public function getDescription()
  17386. {
  17387. return $this->description;
  17388. }
  17389. public function setHomepage($homepage)
  17390. {
  17391. $this->homepage = $homepage;
  17392. }
  17393. public function getHomepage()
  17394. {
  17395. return $this->homepage;
  17396. }
  17397. public function setSupport(array $support)
  17398. {
  17399. $this->support = $support;
  17400. }
  17401. public function getSupport()
  17402. {
  17403. return $this->support;
  17404. }
  17405. public function isAbandoned()
  17406. {
  17407. return (bool) $this->abandoned;
  17408. }
  17409. public function setAbandoned($abandoned)
  17410. {
  17411. $this->abandoned = $abandoned;
  17412. }
  17413. public function getReplacementPackage()
  17414. {
  17415. return is_string($this->abandoned) ? $this->abandoned : null;
  17416. }
  17417. }
  17418. <?php
  17419. namespace Composer\Package;
  17420. interface CompletePackageInterface extends PackageInterface
  17421. {
  17422. public function getScripts();
  17423. public function getRepositories();
  17424. public function getLicense();
  17425. public function getKeywords();
  17426. public function getDescription();
  17427. public function getHomepage();
  17428. public function getAuthors();
  17429. public function getSupport();
  17430. public function isAbandoned();
  17431. public function getReplacementPackage();
  17432. }
  17433. <?php
  17434. namespace Composer\Package\Dumper;
  17435. use Composer\Package\BasePackage;
  17436. use Composer\Package\PackageInterface;
  17437. use Composer\Package\CompletePackageInterface;
  17438. use Composer\Package\RootPackageInterface;
  17439. class ArrayDumper
  17440. {
  17441. public function dump(PackageInterface $package)
  17442. {
  17443. $keys = array(
  17444. 'binaries' => 'bin',
  17445. 'type',
  17446. 'extra',
  17447. 'installationSource' => 'installation-source',
  17448. 'autoload',
  17449. 'devAutoload' => 'autoload-dev',
  17450. 'notificationUrl' => 'notification-url',
  17451. 'includePaths' => 'include-path',
  17452. );
  17453. $data = array();
  17454. $data['name'] = $package->getPrettyName();
  17455. $data['version'] = $package->getPrettyVersion();
  17456. $data['version_normalized'] = $package->getVersion();
  17457. if ($package->getTargetDir()) {
  17458. $data['target-dir'] = $package->getTargetDir();
  17459. }
  17460. if ($package->getSourceType()) {
  17461. $data['source']['type'] = $package->getSourceType();
  17462. $data['source']['url'] = $package->getSourceUrl();
  17463. if (null !== ($value = $package->getSourceReference())) {
  17464. $data['source']['reference'] = $value;
  17465. }
  17466. if ($mirrors = $package->getSourceMirrors()) {
  17467. $data['source']['mirrors'] = $mirrors;
  17468. }
  17469. }
  17470. if ($package->getDistType()) {
  17471. $data['dist']['type'] = $package->getDistType();
  17472. $data['dist']['url'] = $package->getDistUrl();
  17473. if (null !== ($value = $package->getDistReference())) {
  17474. $data['dist']['reference'] = $value;
  17475. }
  17476. if (null !== ($value = $package->getDistSha1Checksum())) {
  17477. $data['dist']['shasum'] = $value;
  17478. }
  17479. if ($mirrors = $package->getDistMirrors()) {
  17480. $data['dist']['mirrors'] = $mirrors;
  17481. }
  17482. }
  17483. if ($package->getArchiveExcludes()) {
  17484. $data['archive']['exclude'] = $package->getArchiveExcludes();
  17485. }
  17486. foreach (BasePackage::$supportedLinkTypes as $type => $opts) {
  17487. if ($links = $package->{'get'.ucfirst($opts['method'])}()) {
  17488. foreach ($links as $link) {
  17489. $data[$type][$link->getTarget()] = $link->getPrettyConstraint();
  17490. }
  17491. ksort($data[$type]);
  17492. }
  17493. }
  17494. if ($packages = $package->getSuggests()) {
  17495. ksort($packages);
  17496. $data['suggest'] = $packages;
  17497. }
  17498. if ($package->getReleaseDate()) {
  17499. $data['time'] = $package->getReleaseDate()->format(DATE_RFC3339);
  17500. }
  17501. $data = $this->dumpValues($package, $keys, $data);
  17502. if ($package instanceof CompletePackageInterface) {
  17503. $keys = array(
  17504. 'scripts',
  17505. 'license',
  17506. 'authors',
  17507. 'description',
  17508. 'homepage',
  17509. 'keywords',
  17510. 'repositories',
  17511. 'support',
  17512. );
  17513. $data = $this->dumpValues($package, $keys, $data);
  17514. if (isset($data['keywords']) && is_array($data['keywords'])) {
  17515. sort($data['keywords']);
  17516. }
  17517. if ($package->isAbandoned()) {
  17518. $data['abandoned'] = $package->getReplacementPackage() ?: true;
  17519. }
  17520. }
  17521. if ($package instanceof RootPackageInterface) {
  17522. $minimumStability = $package->getMinimumStability();
  17523. if ($minimumStability) {
  17524. $data['minimum-stability'] = $minimumStability;
  17525. }
  17526. }
  17527. if (count($package->getTransportOptions()) > 0) {
  17528. $data['transport-options'] = $package->getTransportOptions();
  17529. }
  17530. return $data;
  17531. }
  17532. private function dumpValues(PackageInterface $package, array $keys, array $data)
  17533. {
  17534. foreach ($keys as $method => $key) {
  17535. if (is_numeric($method)) {
  17536. $method = $key;
  17537. }
  17538. $getter = 'get'.ucfirst($method);
  17539. $value = $package->$getter();
  17540. if (null !== $value && !(is_array($value) && 0 === count($value))) {
  17541. $data[$key] = $value;
  17542. }
  17543. }
  17544. return $data;
  17545. }
  17546. }
  17547. <?php
  17548. namespace Composer\Package;
  17549. use Composer\Semver\Constraint\ConstraintInterface;
  17550. class Link
  17551. {
  17552. protected $source;
  17553. protected $target;
  17554. protected $constraint;
  17555. protected $description;
  17556. protected $prettyConstraint;
  17557. public function __construct($source, $target, ConstraintInterface $constraint = null, $description = 'relates to', $prettyConstraint = null)
  17558. {
  17559. $this->source = strtolower($source);
  17560. $this->target = strtolower($target);
  17561. $this->constraint = $constraint;
  17562. $this->description = $description;
  17563. $this->prettyConstraint = $prettyConstraint;
  17564. }
  17565. public function getDescription()
  17566. {
  17567. return $this->description;
  17568. }
  17569. public function getSource()
  17570. {
  17571. return $this->source;
  17572. }
  17573. public function getTarget()
  17574. {
  17575. return $this->target;
  17576. }
  17577. public function getConstraint()
  17578. {
  17579. return $this->constraint;
  17580. }
  17581. public function getPrettyConstraint()
  17582. {
  17583. if (null === $this->prettyConstraint) {
  17584. throw new \UnexpectedValueException(sprintf('Link %s has been misconfigured and had no prettyConstraint given.', $this));
  17585. }
  17586. return $this->prettyConstraint;
  17587. }
  17588. public function __toString()
  17589. {
  17590. return $this->source.' '.$this->description.' '.$this->target.' ('.$this->constraint.')';
  17591. }
  17592. public function getPrettyString(PackageInterface $sourcePackage)
  17593. {
  17594. return $sourcePackage->getPrettyString().' '.$this->description.' '.$this->target.' '.$this->constraint->getPrettyString().'';
  17595. }
  17596. }
  17597. <?php
  17598. namespace Composer\Package\LinkConstraint;
  17599. use Composer\Semver\Constraint\EmptyConstraint as SemverEmptyConstraint;
  17600. trigger_error('The ' . __NAMESPACE__ . '\EmptyConstraint class is deprecated, use Composer\Semver\Constraint\EmptyConstraint instead.', E_USER_DEPRECATED);
  17601. class EmptyConstraint extends SemverEmptyConstraint implements LinkConstraintInterface
  17602. {
  17603. }
  17604. <?php
  17605. namespace Composer\Package\LinkConstraint;
  17606. use Composer\Semver\Constraint\ConstraintInterface;
  17607. trigger_error('The ' . __NAMESPACE__ . '\LinkConstraintInterface interface is deprecated, use Composer\Semver\Constraint\ConstraintInterface instead.', E_USER_DEPRECATED);
  17608. interface LinkConstraintInterface extends ConstraintInterface
  17609. {
  17610. }
  17611. <?php
  17612. namespace Composer\Package\LinkConstraint;
  17613. use Composer\Semver\Constraint\MultiConstraint as SemverMultiConstraint;
  17614. trigger_error('The ' . __NAMESPACE__ . '\MultiConstraint class is deprecated, use Composer\Semver\Constraint\MultiConstraint instead.', E_USER_DEPRECATED);
  17615. class MultiConstraint extends SemverMultiConstraint implements LinkConstraintInterface
  17616. {
  17617. }
  17618. <?php
  17619. namespace Composer\Package\LinkConstraint;
  17620. use Composer\Semver\Constraint\AbstractConstraint;
  17621. trigger_error('The ' . __NAMESPACE__ . '\SpecificConstraint abstract class is deprecated, there is no replacement for it.', E_USER_DEPRECATED);
  17622. abstract class SpecificConstraint extends AbstractConstraint implements LinkConstraintInterface
  17623. {
  17624. }
  17625. <?php
  17626. namespace Composer\Package\LinkConstraint;
  17627. use Composer\Semver\Constraint\Constraint;
  17628. trigger_error('The ' . __NAMESPACE__ . '\VersionConstraint class is deprecated, use Composer\Semver\Constraint\Constraint instead.', E_USER_DEPRECATED);
  17629. class VersionConstraint extends Constraint implements LinkConstraintInterface
  17630. {
  17631. }
  17632. <?php
  17633. namespace Composer\Package\Loader;
  17634. use Composer\Package;
  17635. use Composer\Package\AliasPackage;
  17636. use Composer\Package\Link;
  17637. use Composer\Package\RootAliasPackage;
  17638. use Composer\Package\RootPackageInterface;
  17639. use Composer\Package\Version\VersionParser;
  17640. use Composer\Semver\VersionParser as SemverVersionParser;
  17641. class ArrayLoader implements LoaderInterface
  17642. {
  17643. protected $versionParser;
  17644. protected $loadOptions;
  17645. public function __construct(SemverVersionParser $parser = null, $loadOptions = false)
  17646. {
  17647. if (!$parser) {
  17648. $parser = new VersionParser;
  17649. }
  17650. $this->versionParser = $parser;
  17651. $this->loadOptions = $loadOptions;
  17652. }
  17653. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  17654. {
  17655. if (!isset($config['name'])) {
  17656. throw new \UnexpectedValueException('Unknown package has no name defined ('.json_encode($config).').');
  17657. }
  17658. if (!isset($config['version'])) {
  17659. throw new \UnexpectedValueException('Package '.$config['name'].' has no version defined.');
  17660. }
  17661. if (isset($config['version_normalized'])) {
  17662. $version = $config['version_normalized'];
  17663. } else {
  17664. $version = $this->versionParser->normalize($config['version']);
  17665. }
  17666. $package = new $class($config['name'], $version, $config['version']);
  17667. $package->setType(isset($config['type']) ? strtolower($config['type']) : 'library');
  17668. if (isset($config['target-dir'])) {
  17669. $package->setTargetDir($config['target-dir']);
  17670. }
  17671. if (isset($config['extra']) && is_array($config['extra'])) {
  17672. $package->setExtra($config['extra']);
  17673. }
  17674. if (isset($config['bin'])) {
  17675. foreach ((array) $config['bin'] as $key => $bin) {
  17676. $config['bin'][$key] = ltrim($bin, '/');
  17677. }
  17678. $package->setBinaries((array) $config['bin']);
  17679. }
  17680. if (isset($config['installation-source'])) {
  17681. $package->setInstallationSource($config['installation-source']);
  17682. }
  17683. if (isset($config['source'])) {
  17684. if (!isset($config['source']['type']) || !isset($config['source']['url']) || !isset($config['source']['reference'])) {
  17685. throw new \UnexpectedValueException(sprintf(
  17686. "Package %s's source key should be specified as {\"type\": ..., \"url\": ..., \"reference\": ...},\n%s given.",
  17687. $config['name'],
  17688. json_encode($config['source'])
  17689. ));
  17690. }
  17691. $package->setSourceType($config['source']['type']);
  17692. $package->setSourceUrl($config['source']['url']);
  17693. $package->setSourceReference(isset($config['source']['reference']) ? $config['source']['reference'] : null);
  17694. if (isset($config['source']['mirrors'])) {
  17695. $package->setSourceMirrors($config['source']['mirrors']);
  17696. }
  17697. }
  17698. if (isset($config['dist'])) {
  17699. if (!isset($config['dist']['type'])
  17700. || !isset($config['dist']['url'])) {
  17701. throw new \UnexpectedValueException(sprintf(
  17702. "Package %s's dist key should be specified as ".
  17703. "{\"type\": ..., \"url\": ..., \"reference\": ..., \"shasum\": ...},\n%s given.",
  17704. $config['name'],
  17705. json_encode($config['dist'])
  17706. ));
  17707. }
  17708. $package->setDistType($config['dist']['type']);
  17709. $package->setDistUrl($config['dist']['url']);
  17710. $package->setDistReference(isset($config['dist']['reference']) ? $config['dist']['reference'] : null);
  17711. $package->setDistSha1Checksum(isset($config['dist']['shasum']) ? $config['dist']['shasum'] : null);
  17712. if (isset($config['dist']['mirrors'])) {
  17713. $package->setDistMirrors($config['dist']['mirrors']);
  17714. }
  17715. }
  17716. foreach (Package\BasePackage::$supportedLinkTypes as $type => $opts) {
  17717. if (isset($config[$type])) {
  17718. $method = 'set'.ucfirst($opts['method']);
  17719. $package->{$method}(
  17720. $this->parseLinks(
  17721. $package->getName(),
  17722. $package->getPrettyVersion(),
  17723. $opts['description'],
  17724. $config[$type]
  17725. )
  17726. );
  17727. }
  17728. }
  17729. if (isset($config['suggest']) && is_array($config['suggest'])) {
  17730. foreach ($config['suggest'] as $target => $reason) {
  17731. if ('self.version' === trim($reason)) {
  17732. $config['suggest'][$target] = $package->getPrettyVersion();
  17733. }
  17734. }
  17735. $package->setSuggests($config['suggest']);
  17736. }
  17737. if (isset($config['autoload'])) {
  17738. $package->setAutoload($config['autoload']);
  17739. }
  17740. if (isset($config['autoload-dev'])) {
  17741. $package->setDevAutoload($config['autoload-dev']);
  17742. }
  17743. if (isset($config['include-path'])) {
  17744. $package->setIncludePaths($config['include-path']);
  17745. }
  17746. if (!empty($config['time'])) {
  17747. $time = preg_match('/^\d++$/D', $config['time']) ? '@'.$config['time'] : $config['time'];
  17748. try {
  17749. $date = new \DateTime($time, new \DateTimeZone('UTC'));
  17750. $package->setReleaseDate($date);
  17751. } catch (\Exception $e) {
  17752. }
  17753. }
  17754. if (!empty($config['notification-url'])) {
  17755. $package->setNotificationUrl($config['notification-url']);
  17756. }
  17757. if (!empty($config['archive']['exclude'])) {
  17758. $package->setArchiveExcludes($config['archive']['exclude']);
  17759. }
  17760. if ($package instanceof Package\CompletePackageInterface) {
  17761. if (isset($config['scripts']) && is_array($config['scripts'])) {
  17762. foreach ($config['scripts'] as $event => $listeners) {
  17763. $config['scripts'][$event] = (array) $listeners;
  17764. }
  17765. if (isset($config['scripts']['composer'])) {
  17766. trigger_error('The `composer` script name is reserved for internal use, please avoid defining it', E_USER_DEPRECATED);
  17767. }
  17768. $package->setScripts($config['scripts']);
  17769. }
  17770. if (!empty($config['description']) && is_string($config['description'])) {
  17771. $package->setDescription($config['description']);
  17772. }
  17773. if (!empty($config['homepage']) && is_string($config['homepage'])) {
  17774. $package->setHomepage($config['homepage']);
  17775. }
  17776. if (!empty($config['keywords']) && is_array($config['keywords'])) {
  17777. $package->setKeywords($config['keywords']);
  17778. }
  17779. if (!empty($config['license'])) {
  17780. $package->setLicense(is_array($config['license']) ? $config['license'] : array($config['license']));
  17781. }
  17782. if (!empty($config['authors']) && is_array($config['authors'])) {
  17783. $package->setAuthors($config['authors']);
  17784. }
  17785. if (isset($config['support'])) {
  17786. $package->setSupport($config['support']);
  17787. }
  17788. if (isset($config['abandoned'])) {
  17789. $package->setAbandoned($config['abandoned']);
  17790. }
  17791. }
  17792. if ($aliasNormalized = $this->getBranchAlias($config)) {
  17793. if ($package instanceof RootPackageInterface) {
  17794. $package = new RootAliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  17795. } else {
  17796. $package = new AliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  17797. }
  17798. }
  17799. if ($this->loadOptions && isset($config['transport-options'])) {
  17800. $package->setTransportOptions($config['transport-options']);
  17801. }
  17802. return $package;
  17803. }
  17804. public function parseLinks($source, $sourceVersion, $description, $links)
  17805. {
  17806. $res = array();
  17807. foreach ($links as $target => $constraint) {
  17808. if (!is_string($constraint)) {
  17809. throw new \UnexpectedValueException('Link constraint in '.$source.' '.$description.' > '.$target.' should be a string, got '.gettype($constraint) . ' (' . var_export($constraint, true) . ')');
  17810. }
  17811. if ('self.version' === $constraint) {
  17812. $parsedConstraint = $this->versionParser->parseConstraints($sourceVersion);
  17813. } else {
  17814. $parsedConstraint = $this->versionParser->parseConstraints($constraint);
  17815. }
  17816. $res[strtolower($target)] = new Link($source, $target, $parsedConstraint, $description, $constraint);
  17817. }
  17818. return $res;
  17819. }
  17820. public function getBranchAlias(array $config)
  17821. {
  17822. if (('dev-' !== substr($config['version'], 0, 4) && '-dev' !== substr($config['version'], -4))
  17823. || !isset($config['extra']['branch-alias'])
  17824. || !is_array($config['extra']['branch-alias'])
  17825. ) {
  17826. return;
  17827. }
  17828. foreach ($config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  17829. if ('-dev' !== substr($targetBranch, -4)) {
  17830. continue;
  17831. }
  17832. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  17833. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  17834. continue;
  17835. }
  17836. if (strtolower($config['version']) !== strtolower($sourceBranch)) {
  17837. continue;
  17838. }
  17839. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  17840. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  17841. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  17842. ) {
  17843. continue;
  17844. }
  17845. return $validatedTargetBranch;
  17846. }
  17847. }
  17848. }
  17849. <?php
  17850. namespace Composer\Package\Loader;
  17851. class InvalidPackageException extends \Exception
  17852. {
  17853. private $errors;
  17854. private $warnings;
  17855. private $data;
  17856. public function __construct(array $errors, array $warnings, array $data)
  17857. {
  17858. $this->errors = $errors;
  17859. $this->warnings = $warnings;
  17860. $this->data = $data;
  17861. parent::__construct("Invalid package information: \n".implode("\n", array_merge($errors, $warnings)));
  17862. }
  17863. public function getData()
  17864. {
  17865. return $this->data;
  17866. }
  17867. public function getErrors()
  17868. {
  17869. return $this->errors;
  17870. }
  17871. public function getWarnings()
  17872. {
  17873. return $this->warnings;
  17874. }
  17875. }
  17876. <?php
  17877. namespace Composer\Package\Loader;
  17878. use Composer\Json\JsonFile;
  17879. class JsonLoader
  17880. {
  17881. private $loader;
  17882. public function __construct(LoaderInterface $loader)
  17883. {
  17884. $this->loader = $loader;
  17885. }
  17886. public function load($json)
  17887. {
  17888. if ($json instanceof JsonFile) {
  17889. $config = $json->read();
  17890. } elseif (file_exists($json)) {
  17891. $config = JsonFile::parseJson(file_get_contents($json), $json);
  17892. } elseif (is_string($json)) {
  17893. $config = JsonFile::parseJson($json);
  17894. }
  17895. return $this->loader->load($config);
  17896. }
  17897. }
  17898. <?php
  17899. namespace Composer\Package\Loader;
  17900. interface LoaderInterface
  17901. {
  17902. public function load(array $package, $class = 'Composer\Package\CompletePackage');
  17903. }
  17904. <?php
  17905. namespace Composer\Package\Loader;
  17906. use Composer\Package\BasePackage;
  17907. use Composer\Package\AliasPackage;
  17908. use Composer\Config;
  17909. use Composer\IO\IOInterface;
  17910. use Composer\Package\RootPackageInterface;
  17911. use Composer\Repository\RepositoryFactory;
  17912. use Composer\Package\Version\VersionGuesser;
  17913. use Composer\Package\Version\VersionParser;
  17914. use Composer\Repository\RepositoryManager;
  17915. use Composer\Util\ProcessExecutor;
  17916. class RootPackageLoader extends ArrayLoader
  17917. {
  17918. private $manager;
  17919. private $config;
  17920. private $versionGuesser;
  17921. private $io;
  17922. public function __construct(RepositoryManager $manager, Config $config, VersionParser $parser = null, VersionGuesser $versionGuesser = null, IOInterface $io = null)
  17923. {
  17924. parent::__construct($parser);
  17925. $this->manager = $manager;
  17926. $this->config = $config;
  17927. $this->versionGuesser = $versionGuesser ?: new VersionGuesser($config, new ProcessExecutor(), $this->versionParser);
  17928. $this->io = $io;
  17929. }
  17930. public function load(array $config, $class = 'Composer\Package\RootPackage', $cwd = null)
  17931. {
  17932. if (!isset($config['name'])) {
  17933. $config['name'] = '__root__';
  17934. } elseif ($this->io) {
  17935. if ($err = ValidatingArrayLoader::hasPackageNamingError($config['name'])) {
  17936. $this->io->writeError('<warning>Deprecation warning: Your package name '.$err.' Make sure you fix this as Composer 2.0 will error.</warning>');
  17937. }
  17938. }
  17939. $autoVersioned = false;
  17940. if (!isset($config['version'])) {
  17941. $commit = null;
  17942. if (getenv('COMPOSER_ROOT_VERSION')) {
  17943. $config['version'] = getenv('COMPOSER_ROOT_VERSION');
  17944. } else {
  17945. $versionData = $this->versionGuesser->guessVersion($config, $cwd ?: getcwd());
  17946. if ($versionData) {
  17947. $config['version'] = $versionData['pretty_version'];
  17948. $config['version_normalized'] = $versionData['version'];
  17949. $commit = $versionData['commit'];
  17950. }
  17951. }
  17952. if (!isset($config['version'])) {
  17953. $config['version'] = '1.0.0';
  17954. $autoVersioned = true;
  17955. }
  17956. if ($commit) {
  17957. $config['source'] = array(
  17958. 'type' => '',
  17959. 'url' => '',
  17960. 'reference' => $commit,
  17961. );
  17962. $config['dist'] = array(
  17963. 'type' => '',
  17964. 'url' => '',
  17965. 'reference' => $commit,
  17966. );
  17967. }
  17968. }
  17969. $realPackage = $package = parent::load($config, $class);
  17970. if ($realPackage instanceof AliasPackage) {
  17971. $realPackage = $package->getAliasOf();
  17972. }
  17973. if ($autoVersioned) {
  17974. $realPackage->replaceVersion($realPackage->getVersion(), 'No version set (parsed as 1.0.0)');
  17975. }
  17976. if (isset($config['minimum-stability'])) {
  17977. $realPackage->setMinimumStability(VersionParser::normalizeStability($config['minimum-stability']));
  17978. }
  17979. $aliases = array();
  17980. $stabilityFlags = array();
  17981. $references = array();
  17982. foreach (array('require', 'require-dev') as $linkType) {
  17983. if (isset($config[$linkType])) {
  17984. $linkInfo = BasePackage::$supportedLinkTypes[$linkType];
  17985. $method = 'get'.ucfirst($linkInfo['method']);
  17986. $links = array();
  17987. foreach ($realPackage->$method() as $link) {
  17988. $links[$link->getTarget()] = $link->getConstraint()->getPrettyString();
  17989. }
  17990. $aliases = $this->extractAliases($links, $aliases);
  17991. $stabilityFlags = $this->extractStabilityFlags($links, $stabilityFlags, $realPackage->getMinimumStability());
  17992. $references = $this->extractReferences($links, $references);
  17993. }
  17994. }
  17995. if ($this->io) {
  17996. foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
  17997. if (isset($config[$linkType])) {
  17998. foreach ($config[$linkType] as $linkName => $constraint) {
  17999. if ($err = ValidatingArrayLoader::hasPackageNamingError($linkName, true)) {
  18000. $this->io->writeError('<warning>Deprecation warning: '.$linkType.'.'.$err.' Make sure you fix this as Composer 2.0 will error.</warning>');
  18001. }
  18002. }
  18003. }
  18004. }
  18005. }
  18006. if (isset($links[$config['name']])) {
  18007. throw new \InvalidArgumentException(sprintf('Root package \'%s\' cannot require itself in its composer.json' . PHP_EOL .
  18008. 'Did you accidentally name your root package after an external package?', $config['name']));
  18009. }
  18010. $realPackage->setAliases($aliases);
  18011. $realPackage->setStabilityFlags($stabilityFlags);
  18012. $realPackage->setReferences($references);
  18013. if (isset($config['prefer-stable'])) {
  18014. $realPackage->setPreferStable((bool) $config['prefer-stable']);
  18015. }
  18016. if (isset($config['config'])) {
  18017. $realPackage->setConfig($config['config']);
  18018. }
  18019. $repos = RepositoryFactory::defaultRepos(null, $this->config, $this->manager);
  18020. foreach ($repos as $repo) {
  18021. $this->manager->addRepository($repo);
  18022. }
  18023. $realPackage->setRepositories($this->config->getRepositories());
  18024. return $package;
  18025. }
  18026. private function extractAliases(array $requires, array $aliases)
  18027. {
  18028. foreach ($requires as $reqName => $reqVersion) {
  18029. if (preg_match('{^([^,\s#]+)(?:#[^ ]+)? +as +([^,\s]+)$}', $reqVersion, $match)) {
  18030. $aliases[] = array(
  18031. 'package' => strtolower($reqName),
  18032. 'version' => $this->versionParser->normalize($match[1], $reqVersion),
  18033. 'alias' => $match[2],
  18034. 'alias_normalized' => $this->versionParser->normalize($match[2], $reqVersion),
  18035. );
  18036. }
  18037. }
  18038. return $aliases;
  18039. }
  18040. private function extractStabilityFlags(array $requires, array $stabilityFlags, $minimumStability)
  18041. {
  18042. $stabilities = BasePackage::$stabilities;
  18043. $minimumStability = $stabilities[$minimumStability];
  18044. foreach ($requires as $reqName => $reqVersion) {
  18045. $constraints = array();
  18046. $orSplit = preg_split('{\s*\|\|?\s*}', trim($reqVersion));
  18047. foreach ($orSplit as $orConstraint) {
  18048. $andSplit = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $orConstraint);
  18049. foreach ($andSplit as $andConstraint) {
  18050. $constraints[] = $andConstraint;
  18051. }
  18052. }
  18053. $match = false;
  18054. foreach ($constraints as $constraint) {
  18055. if (preg_match('{^[^@]*?@('.implode('|', array_keys($stabilities)).')$}i', $constraint, $match)) {
  18056. $name = strtolower($reqName);
  18057. $stability = $stabilities[VersionParser::normalizeStability($match[1])];
  18058. if (isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) {
  18059. continue;
  18060. }
  18061. $stabilityFlags[$name] = $stability;
  18062. $match = true;
  18063. }
  18064. }
  18065. if ($match) {
  18066. continue;
  18067. }
  18068. foreach ($constraints as $constraint) {
  18069. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $constraint);
  18070. if (preg_match('{^[^,\s@]+$}', $reqVersion) && 'stable' !== ($stabilityName = VersionParser::parseStability($reqVersion))) {
  18071. $name = strtolower($reqName);
  18072. $stability = $stabilities[$stabilityName];
  18073. if ((isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) || ($minimumStability > $stability)) {
  18074. continue;
  18075. }
  18076. $stabilityFlags[$name] = $stability;
  18077. }
  18078. }
  18079. }
  18080. return $stabilityFlags;
  18081. }
  18082. private function extractReferences(array $requires, array $references)
  18083. {
  18084. foreach ($requires as $reqName => $reqVersion) {
  18085. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $reqVersion);
  18086. if (preg_match('{^[^,\s@]+?#([a-f0-9]+)$}', $reqVersion, $match) && 'dev' === VersionParser::parseStability($reqVersion)) {
  18087. $name = strtolower($reqName);
  18088. $references[$name] = $match[1];
  18089. }
  18090. }
  18091. return $references;
  18092. }
  18093. }
  18094. <?php
  18095. namespace Composer\Package\Loader;
  18096. use Composer\Package\BasePackage;
  18097. use Composer\Semver\Constraint\Constraint;
  18098. use Composer\Package\Version\VersionParser;
  18099. use Composer\Repository\PlatformRepository;
  18100. use Composer\Spdx\SpdxLicenses;
  18101. class ValidatingArrayLoader implements LoaderInterface
  18102. {
  18103. const CHECK_ALL = 3;
  18104. const CHECK_UNBOUND_CONSTRAINTS = 1;
  18105. const CHECK_STRICT_CONSTRAINTS = 2;
  18106. private $loader;
  18107. private $versionParser;
  18108. private $errors;
  18109. private $warnings;
  18110. private $config;
  18111. private $strictName;
  18112. private $flags;
  18113. public function __construct(LoaderInterface $loader, $strictName = true, VersionParser $parser = null, $flags = 0)
  18114. {
  18115. $this->loader = $loader;
  18116. $this->versionParser = $parser ?: new VersionParser();
  18117. $this->strictName = $strictName;
  18118. $this->flags = $flags;
  18119. }
  18120. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  18121. {
  18122. $this->errors = array();
  18123. $this->warnings = array();
  18124. $this->config = $config;
  18125. if ($err = self::hasPackageNamingError($config['name'])) {
  18126. $this->warnings[] = 'Deprecation warning: Your package name '.$err.' Make sure you fix this as Composer 2.0 will error.';
  18127. }
  18128. if ($this->strictName) {
  18129. $this->validateRegex('name', '[A-Za-z0-9][A-Za-z0-9_.-]*/[A-Za-z0-9][A-Za-z0-9_.-]*', true);
  18130. } else {
  18131. $this->validateString('name', true);
  18132. }
  18133. if (!empty($this->config['version'])) {
  18134. try {
  18135. $this->versionParser->normalize($this->config['version']);
  18136. } catch (\Exception $e) {
  18137. $this->errors[] = 'version : invalid value ('.$this->config['version'].'): '.$e->getMessage();
  18138. unset($this->config['version']);
  18139. }
  18140. }
  18141. if (!empty($this->config['config']['platform'])) {
  18142. foreach ((array) $this->config['config']['platform'] as $key => $platform) {
  18143. try {
  18144. $this->versionParser->normalize($platform);
  18145. } catch (\Exception $e) {
  18146. $this->errors[] = 'config.platform.' . $key . ' : invalid value ('.$platform.'): '.$e->getMessage();
  18147. }
  18148. }
  18149. }
  18150. $this->validateRegex('type', '[A-Za-z0-9-]+');
  18151. $this->validateString('target-dir');
  18152. $this->validateArray('extra');
  18153. if (isset($this->config['bin'])) {
  18154. if (is_string($this->config['bin'])) {
  18155. $this->validateString('bin');
  18156. } else {
  18157. $this->validateFlatArray('bin');
  18158. }
  18159. }
  18160. $this->validateArray('scripts');
  18161. $this->validateString('description');
  18162. $this->validateUrl('homepage');
  18163. $this->validateFlatArray('keywords', '[\p{N}\p{L} ._-]+');
  18164. $releaseDate = null;
  18165. $this->validateString('time');
  18166. if (!empty($this->config['time'])) {
  18167. try {
  18168. $releaseDate = new \DateTime($this->config['time'], new \DateTimeZone('UTC'));
  18169. } catch (\Exception $e) {
  18170. $this->errors[] = 'time : invalid value ('.$this->config['time'].'): '.$e->getMessage();
  18171. unset($this->config['time']);
  18172. }
  18173. }
  18174. if (isset($this->config['license']) && (!$releaseDate || $releaseDate->getTimestamp() >= strtotime('-8days'))) {
  18175. if (is_array($this->config['license']) || is_string($this->config['license'])) {
  18176. $licenses = (array) $this->config['license'];
  18177. foreach ($licenses as $key => $license) {
  18178. if ('proprietary' === $license) {
  18179. unset($licenses[$key]);
  18180. }
  18181. }
  18182. $licenseValidator = new SpdxLicenses();
  18183. if (count($licenses) === 1 && !$licenseValidator->validate($licenses) && $licenseValidator->validate(trim($licenses[0]))) {
  18184. $this->warnings[] = sprintf(
  18185. 'License %s must not contain extra spaces, make sure to trim it.',
  18186. json_encode($this->config['license'])
  18187. );
  18188. } elseif (array() !== $licenses && !$licenseValidator->validate($licenses)) {
  18189. $this->warnings[] = sprintf(
  18190. 'License %s is not a valid SPDX license identifier, see https://spdx.org/licenses/ if you use an open license.' . PHP_EOL .
  18191. 'If the software is closed-source, you may use "proprietary" as license.',
  18192. json_encode($this->config['license'])
  18193. );
  18194. }
  18195. }
  18196. }
  18197. if ($this->validateArray('authors') && !empty($this->config['authors'])) {
  18198. foreach ($this->config['authors'] as $key => $author) {
  18199. if (!is_array($author)) {
  18200. $this->errors[] = 'authors.'.$key.' : should be an array, '.gettype($author).' given';
  18201. unset($this->config['authors'][$key]);
  18202. continue;
  18203. }
  18204. foreach (array('homepage', 'email', 'name', 'role') as $authorData) {
  18205. if (isset($author[$authorData]) && !is_string($author[$authorData])) {
  18206. $this->errors[] = 'authors.'.$key.'.'.$authorData.' : invalid value, must be a string';
  18207. unset($this->config['authors'][$key][$authorData]);
  18208. }
  18209. }
  18210. if (isset($author['homepage']) && !$this->filterUrl($author['homepage'])) {
  18211. $this->warnings[] = 'authors.'.$key.'.homepage : invalid value ('.$author['homepage'].'), must be an http/https URL';
  18212. unset($this->config['authors'][$key]['homepage']);
  18213. }
  18214. if (isset($author['email']) && !filter_var($author['email'], FILTER_VALIDATE_EMAIL)) {
  18215. $this->warnings[] = 'authors.'.$key.'.email : invalid value ('.$author['email'].'), must be a valid email address';
  18216. unset($this->config['authors'][$key]['email']);
  18217. }
  18218. if (empty($this->config['authors'][$key])) {
  18219. unset($this->config['authors'][$key]);
  18220. }
  18221. }
  18222. if (empty($this->config['authors'])) {
  18223. unset($this->config['authors']);
  18224. }
  18225. }
  18226. if ($this->validateArray('support') && !empty($this->config['support'])) {
  18227. foreach (array('issues', 'forum', 'wiki', 'source', 'email', 'irc', 'docs', 'rss', 'chat') as $key) {
  18228. if (isset($this->config['support'][$key]) && !is_string($this->config['support'][$key])) {
  18229. $this->errors[] = 'support.'.$key.' : invalid value, must be a string';
  18230. unset($this->config['support'][$key]);
  18231. }
  18232. }
  18233. if (isset($this->config['support']['email']) && !filter_var($this->config['support']['email'], FILTER_VALIDATE_EMAIL)) {
  18234. $this->warnings[] = 'support.email : invalid value ('.$this->config['support']['email'].'), must be a valid email address';
  18235. unset($this->config['support']['email']);
  18236. }
  18237. if (isset($this->config['support']['irc']) && !$this->filterUrl($this->config['support']['irc'], array('irc'))) {
  18238. $this->warnings[] = 'support.irc : invalid value ('.$this->config['support']['irc'].'), must be a irc://<server>/<channel> URL';
  18239. unset($this->config['support']['irc']);
  18240. }
  18241. foreach (array('issues', 'forum', 'wiki', 'source', 'docs', 'chat') as $key) {
  18242. if (isset($this->config['support'][$key]) && !$this->filterUrl($this->config['support'][$key])) {
  18243. $this->warnings[] = 'support.'.$key.' : invalid value ('.$this->config['support'][$key].'), must be an http/https URL';
  18244. unset($this->config['support'][$key]);
  18245. }
  18246. }
  18247. if (empty($this->config['support'])) {
  18248. unset($this->config['support']);
  18249. }
  18250. }
  18251. $unboundConstraint = new Constraint('=', $this->versionParser->normalize('dev-master'));
  18252. $stableConstraint = new Constraint('=', '1.0.0');
  18253. foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
  18254. if ($this->validateArray($linkType) && isset($this->config[$linkType])) {
  18255. foreach ($this->config[$linkType] as $package => $constraint) {
  18256. if ($err = self::hasPackageNamingError($package, true)) {
  18257. $this->warnings[] = 'Deprecation warning: '.$linkType.'.'.$err.' Make sure you fix this as Composer 2.0 will error.';
  18258. } elseif (!preg_match('{^[A-Za-z0-9_./-]+$}', $package)) {
  18259. $this->warnings[] = $linkType.'.'.$package.' : invalid key, package names must be strings containing only [A-Za-z0-9_./-]';
  18260. }
  18261. if (!is_string($constraint)) {
  18262. $this->errors[] = $linkType.'.'.$package.' : invalid value, must be a string containing a version constraint';
  18263. unset($this->config[$linkType][$package]);
  18264. } elseif ('self.version' !== $constraint) {
  18265. try {
  18266. $linkConstraint = $this->versionParser->parseConstraints($constraint);
  18267. } catch (\Exception $e) {
  18268. $this->errors[] = $linkType.'.'.$package.' : invalid version constraint ('.$e->getMessage().')';
  18269. unset($this->config[$linkType][$package]);
  18270. continue;
  18271. }
  18272. if (
  18273. ($this->flags & self::CHECK_UNBOUND_CONSTRAINTS)
  18274. && 'require' === $linkType
  18275. && $linkConstraint->matches($unboundConstraint)
  18276. && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $package)
  18277. ) {
  18278. $this->warnings[] = $linkType.'.'.$package.' : unbound version constraints ('.$constraint.') should be avoided';
  18279. } elseif (
  18280. ($this->flags & self::CHECK_STRICT_CONSTRAINTS)
  18281. && 'require' === $linkType
  18282. && substr($linkConstraint, 0, 1) === '='
  18283. && $stableConstraint->versionCompare($stableConstraint, $linkConstraint, '<=')
  18284. ) {
  18285. $this->warnings[] = $linkType.'.'.$package.' : exact version constraints ('.$constraint.') should be avoided if the package follows semantic versioning';
  18286. }
  18287. }
  18288. }
  18289. }
  18290. }
  18291. if ($this->validateArray('suggest') && !empty($this->config['suggest'])) {
  18292. foreach ($this->config['suggest'] as $package => $description) {
  18293. if (!is_string($description)) {
  18294. $this->errors[] = 'suggest.'.$package.' : invalid value, must be a string describing why the package is suggested';
  18295. unset($this->config['suggest'][$package]);
  18296. }
  18297. }
  18298. }
  18299. if ($this->validateString('minimum-stability') && !empty($this->config['minimum-stability'])) {
  18300. if (!isset(BasePackage::$stabilities[$this->config['minimum-stability']])) {
  18301. $this->errors[] = 'minimum-stability : invalid value ('.$this->config['minimum-stability'].'), must be one of '.implode(', ', array_keys(BasePackage::$stabilities));
  18302. unset($this->config['minimum-stability']);
  18303. }
  18304. }
  18305. if ($this->validateArray('autoload') && !empty($this->config['autoload'])) {
  18306. $types = array('psr-0', 'psr-4', 'classmap', 'files', 'exclude-from-classmap');
  18307. foreach ($this->config['autoload'] as $type => $typeConfig) {
  18308. if (!in_array($type, $types)) {
  18309. $this->errors[] = 'autoload : invalid value ('.$type.'), must be one of '.implode(', ', $types);
  18310. unset($this->config['autoload'][$type]);
  18311. }
  18312. if ($type === 'psr-4') {
  18313. foreach ($typeConfig as $namespace => $dirs) {
  18314. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  18315. $this->errors[] = 'autoload.psr-4 : invalid value ('.$namespace.'), namespaces must end with a namespace separator, should be '.$namespace.'\\\\';
  18316. }
  18317. }
  18318. }
  18319. }
  18320. }
  18321. if (!empty($this->config['autoload']['psr-4']) && !empty($this->config['target-dir'])) {
  18322. $this->errors[] = 'target-dir : this can not be used together with the autoload.psr-4 setting, remove target-dir to upgrade to psr-4';
  18323. unset($this->config['autoload']['psr-4']);
  18324. }
  18325. $this->validateFlatArray('include-path');
  18326. $this->validateArray('transport-options');
  18327. if (isset($this->config['extra']['branch-alias'])) {
  18328. if (!is_array($this->config['extra']['branch-alias'])) {
  18329. $this->errors[] = 'extra.branch-alias : must be an array of versions => aliases';
  18330. } else {
  18331. foreach ($this->config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  18332. if ('-dev' !== substr($targetBranch, -4)) {
  18333. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must end in -dev';
  18334. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  18335. continue;
  18336. }
  18337. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  18338. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  18339. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must be a parseable number like 2.0-dev';
  18340. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  18341. continue;
  18342. }
  18343. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  18344. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  18345. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  18346. ) {
  18347. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') is not a valid numeric alias for this version';
  18348. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  18349. }
  18350. }
  18351. }
  18352. }
  18353. if ($this->errors) {
  18354. throw new InvalidPackageException($this->errors, $this->warnings, $config);
  18355. }
  18356. $package = $this->loader->load($this->config, $class);
  18357. $this->config = null;
  18358. return $package;
  18359. }
  18360. public function getWarnings()
  18361. {
  18362. return $this->warnings;
  18363. }
  18364. public function getErrors()
  18365. {
  18366. return $this->errors;
  18367. }
  18368. public static function hasPackageNamingError($name, $isLink = false)
  18369. {
  18370. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  18371. return;
  18372. }
  18373. if (!preg_match('{^[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9]([_.-]?[a-z0-9]+)*$}iD', $name)) {
  18374. return $name.' is invalid, it should have a vendor name, a forward slash, and a package name. The vendor and package name can be words separated by -, . or _. The complete name should match "[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9]([_.-]?[a-z0-9]+)*".';
  18375. }
  18376. $reservedNames = array('nul', 'con', 'prn', 'aux', 'com1', 'com2', 'com3', 'com4', 'com5', 'com6', 'com7', 'com8', 'com9', 'lpt1', 'lpt2', 'lpt3', 'lpt4', 'lpt5', 'lpt6', 'lpt7', 'lpt8', 'lpt9');
  18377. $bits = explode('/', strtolower($name));
  18378. if (in_array($bits[0], $reservedNames, true) || in_array($bits[1], $reservedNames, true)) {
  18379. return $name.' is reserved, package and vendor names can not match any of: '.implode(', ', $reservedNames).'.';
  18380. }
  18381. if (preg_match('{\.json$}', $name)) {
  18382. return $name.' is invalid, package names can not end in .json, consider renaming it or perhaps using a -json suffix instead.';
  18383. }
  18384. if (preg_match('{[A-Z]}', $name)) {
  18385. if ($isLink) {
  18386. return $name.' is invalid, it should not contain uppercase characters. Please use '.strtolower($name).' instead.';
  18387. }
  18388. $suggestName = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
  18389. $suggestName = strtolower($suggestName);
  18390. return $name.' is invalid, it should not contain uppercase characters. We suggest using '.$suggestName.' instead.';
  18391. }
  18392. }
  18393. private function validateRegex($property, $regex, $mandatory = false)
  18394. {
  18395. if (!$this->validateString($property, $mandatory)) {
  18396. return false;
  18397. }
  18398. if (!preg_match('{^'.$regex.'$}u', $this->config[$property])) {
  18399. $message = $property.' : invalid value ('.$this->config[$property].'), must match '.$regex;
  18400. if ($mandatory) {
  18401. $this->errors[] = $message;
  18402. } else {
  18403. $this->warnings[] = $message;
  18404. }
  18405. unset($this->config[$property]);
  18406. return false;
  18407. }
  18408. return true;
  18409. }
  18410. private function validateString($property, $mandatory = false)
  18411. {
  18412. if (isset($this->config[$property]) && !is_string($this->config[$property])) {
  18413. $this->errors[] = $property.' : should be a string, '.gettype($this->config[$property]).' given';
  18414. unset($this->config[$property]);
  18415. return false;
  18416. }
  18417. if (!isset($this->config[$property]) || trim($this->config[$property]) === '') {
  18418. if ($mandatory) {
  18419. $this->errors[] = $property.' : must be present';
  18420. }
  18421. unset($this->config[$property]);
  18422. return false;
  18423. }
  18424. return true;
  18425. }
  18426. private function validateArray($property, $mandatory = false)
  18427. {
  18428. if (isset($this->config[$property]) && !is_array($this->config[$property])) {
  18429. $this->errors[] = $property.' : should be an array, '.gettype($this->config[$property]).' given';
  18430. unset($this->config[$property]);
  18431. return false;
  18432. }
  18433. if (!isset($this->config[$property]) || !count($this->config[$property])) {
  18434. if ($mandatory) {
  18435. $this->errors[] = $property.' : must be present and contain at least one element';
  18436. }
  18437. unset($this->config[$property]);
  18438. return false;
  18439. }
  18440. return true;
  18441. }
  18442. private function validateFlatArray($property, $regex = null, $mandatory = false)
  18443. {
  18444. if (!$this->validateArray($property, $mandatory)) {
  18445. return false;
  18446. }
  18447. $pass = true;
  18448. foreach ($this->config[$property] as $key => $value) {
  18449. if (!is_string($value) && !is_numeric($value)) {
  18450. $this->errors[] = $property.'.'.$key.' : must be a string or int, '.gettype($value).' given';
  18451. unset($this->config[$property][$key]);
  18452. $pass = false;
  18453. continue;
  18454. }
  18455. if ($regex && !preg_match('{^'.$regex.'$}u', $value)) {
  18456. $this->warnings[] = $property.'.'.$key.' : invalid value ('.$value.'), must match '.$regex;
  18457. unset($this->config[$property][$key]);
  18458. $pass = false;
  18459. }
  18460. }
  18461. return $pass;
  18462. }
  18463. private function validateUrl($property, $mandatory = false)
  18464. {
  18465. if (!$this->validateString($property, $mandatory)) {
  18466. return false;
  18467. }
  18468. if (!$this->filterUrl($this->config[$property])) {
  18469. $this->warnings[] = $property.' : invalid value ('.$this->config[$property].'), must be an http/https URL';
  18470. unset($this->config[$property]);
  18471. return false;
  18472. }
  18473. return true;
  18474. }
  18475. private function filterUrl($value, array $schemes = array('http', 'https'))
  18476. {
  18477. if ($value === '') {
  18478. return true;
  18479. }
  18480. $bits = parse_url($value);
  18481. if (empty($bits['scheme']) || empty($bits['host'])) {
  18482. return false;
  18483. }
  18484. if (!in_array($bits['scheme'], $schemes, true)) {
  18485. return false;
  18486. }
  18487. return true;
  18488. }
  18489. }
  18490. <?php
  18491. namespace Composer\Package;
  18492. use Composer\Json\JsonFile;
  18493. use Composer\Installer\InstallationManager;
  18494. use Composer\Repository\RepositoryManager;
  18495. use Composer\Util\ProcessExecutor;
  18496. use Composer\Repository\ArrayRepository;
  18497. use Composer\Package\Dumper\ArrayDumper;
  18498. use Composer\Package\Loader\ArrayLoader;
  18499. use Composer\Util\Git as GitUtil;
  18500. use Composer\IO\IOInterface;
  18501. use Seld\JsonLint\ParsingException;
  18502. class Locker
  18503. {
  18504. private $lockFile;
  18505. private $repositoryManager;
  18506. private $installationManager;
  18507. private $hash;
  18508. private $contentHash;
  18509. private $loader;
  18510. private $dumper;
  18511. private $process;
  18512. private $lockDataCache;
  18513. public function __construct(IOInterface $io, JsonFile $lockFile, RepositoryManager $repositoryManager, InstallationManager $installationManager, $composerFileContents)
  18514. {
  18515. $this->lockFile = $lockFile;
  18516. $this->repositoryManager = $repositoryManager;
  18517. $this->installationManager = $installationManager;
  18518. $this->hash = md5($composerFileContents);
  18519. $this->contentHash = self::getContentHash($composerFileContents);
  18520. $this->loader = new ArrayLoader(null, true);
  18521. $this->dumper = new ArrayDumper();
  18522. $this->process = new ProcessExecutor($io);
  18523. }
  18524. public static function getContentHash($composerFileContents)
  18525. {
  18526. $content = json_decode($composerFileContents, true);
  18527. $relevantKeys = array(
  18528. 'name',
  18529. 'version',
  18530. 'require',
  18531. 'require-dev',
  18532. 'conflict',
  18533. 'replace',
  18534. 'provide',
  18535. 'minimum-stability',
  18536. 'prefer-stable',
  18537. 'repositories',
  18538. 'extra',
  18539. );
  18540. $relevantContent = array();
  18541. foreach (array_intersect($relevantKeys, array_keys($content)) as $key) {
  18542. $relevantContent[$key] = $content[$key];
  18543. }
  18544. if (isset($content['config']['platform'])) {
  18545. $relevantContent['config']['platform'] = $content['config']['platform'];
  18546. }
  18547. ksort($relevantContent);
  18548. return md5(json_encode($relevantContent));
  18549. }
  18550. public function isLocked()
  18551. {
  18552. if (!$this->lockFile->exists()) {
  18553. return false;
  18554. }
  18555. $data = $this->getLockData();
  18556. return isset($data['packages']);
  18557. }
  18558. public function isFresh()
  18559. {
  18560. $lock = $this->lockFile->read();
  18561. if (!empty($lock['content-hash'])) {
  18562. return $this->contentHash === $lock['content-hash'];
  18563. }
  18564. if (!empty($lock['hash'])) {
  18565. return $this->hash === $lock['hash'];
  18566. }
  18567. return false;
  18568. }
  18569. public function getLockedRepository($withDevReqs = false)
  18570. {
  18571. $lockData = $this->getLockData();
  18572. $packages = new ArrayRepository();
  18573. $lockedPackages = $lockData['packages'];
  18574. if ($withDevReqs) {
  18575. if (isset($lockData['packages-dev'])) {
  18576. $lockedPackages = array_merge($lockedPackages, $lockData['packages-dev']);
  18577. } else {
  18578. 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.');
  18579. }
  18580. }
  18581. if (empty($lockedPackages)) {
  18582. return $packages;
  18583. }
  18584. if (isset($lockedPackages[0]['name'])) {
  18585. foreach ($lockedPackages as $info) {
  18586. $packages->addPackage($this->loader->load($info));
  18587. }
  18588. return $packages;
  18589. }
  18590. 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.');
  18591. }
  18592. public function getPlatformRequirements($withDevReqs = false)
  18593. {
  18594. $lockData = $this->getLockData();
  18595. $requirements = array();
  18596. if (!empty($lockData['platform'])) {
  18597. $requirements = $this->loader->parseLinks(
  18598. '__ROOT__',
  18599. '1.0.0',
  18600. 'requires',
  18601. isset($lockData['platform']) ? $lockData['platform'] : array()
  18602. );
  18603. }
  18604. if ($withDevReqs && !empty($lockData['platform-dev'])) {
  18605. $devRequirements = $this->loader->parseLinks(
  18606. '__ROOT__',
  18607. '1.0.0',
  18608. 'requires',
  18609. isset($lockData['platform-dev']) ? $lockData['platform-dev'] : array()
  18610. );
  18611. $requirements = array_merge($requirements, $devRequirements);
  18612. }
  18613. return $requirements;
  18614. }
  18615. public function getMinimumStability()
  18616. {
  18617. $lockData = $this->getLockData();
  18618. return isset($lockData['minimum-stability']) ? $lockData['minimum-stability'] : 'stable';
  18619. }
  18620. public function getStabilityFlags()
  18621. {
  18622. $lockData = $this->getLockData();
  18623. return isset($lockData['stability-flags']) ? $lockData['stability-flags'] : array();
  18624. }
  18625. public function getPreferStable()
  18626. {
  18627. $lockData = $this->getLockData();
  18628. return isset($lockData['prefer-stable']) ? $lockData['prefer-stable'] : null;
  18629. }
  18630. public function getPreferLowest()
  18631. {
  18632. $lockData = $this->getLockData();
  18633. return isset($lockData['prefer-lowest']) ? $lockData['prefer-lowest'] : null;
  18634. }
  18635. public function getPlatformOverrides()
  18636. {
  18637. $lockData = $this->getLockData();
  18638. return isset($lockData['platform-overrides']) ? $lockData['platform-overrides'] : array();
  18639. }
  18640. public function getAliases()
  18641. {
  18642. $lockData = $this->getLockData();
  18643. return isset($lockData['aliases']) ? $lockData['aliases'] : array();
  18644. }
  18645. public function getLockData()
  18646. {
  18647. if (null !== $this->lockDataCache) {
  18648. return $this->lockDataCache;
  18649. }
  18650. if (!$this->lockFile->exists()) {
  18651. throw new \LogicException('No lockfile found. Unable to read locked packages');
  18652. }
  18653. return $this->lockDataCache = $this->lockFile->read();
  18654. }
  18655. public function setLockData(array $packages, $devPackages, array $platformReqs, $platformDevReqs, array $aliases, $minimumStability, array $stabilityFlags, $preferStable, $preferLowest, array $platformOverrides)
  18656. {
  18657. $lock = array(
  18658. '_readme' => array('This file locks the dependencies of your project to a known state',
  18659. 'Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies',
  18660. 'This file is @gener'.'ated automatically', ),
  18661. 'content-hash' => $this->contentHash,
  18662. 'packages' => null,
  18663. 'packages-dev' => null,
  18664. 'aliases' => array(),
  18665. 'minimum-stability' => $minimumStability,
  18666. 'stability-flags' => $stabilityFlags,
  18667. 'prefer-stable' => $preferStable,
  18668. 'prefer-lowest' => $preferLowest,
  18669. );
  18670. foreach ($aliases as $package => $versions) {
  18671. foreach ($versions as $version => $alias) {
  18672. $lock['aliases'][] = array(
  18673. 'alias' => $alias['alias'],
  18674. 'alias_normalized' => $alias['alias_normalized'],
  18675. 'version' => $version,
  18676. 'package' => $package,
  18677. );
  18678. }
  18679. }
  18680. $lock['packages'] = $this->lockPackages($packages);
  18681. if (null !== $devPackages) {
  18682. $lock['packages-dev'] = $this->lockPackages($devPackages);
  18683. }
  18684. $lock['platform'] = $platformReqs;
  18685. $lock['platform-dev'] = $platformDevReqs;
  18686. if ($platformOverrides) {
  18687. $lock['platform-overrides'] = $platformOverrides;
  18688. }
  18689. if (empty($lock['packages']) && empty($lock['packages-dev']) && empty($lock['platform']) && empty($lock['platform-dev'])) {
  18690. if ($this->lockFile->exists()) {
  18691. unlink($this->lockFile->getPath());
  18692. }
  18693. return false;
  18694. }
  18695. try {
  18696. $isLocked = $this->isLocked();
  18697. } catch (ParsingException $e) {
  18698. $isLocked = false;
  18699. }
  18700. if (!$isLocked || $lock !== $this->getLockData()) {
  18701. $this->lockFile->write($lock);
  18702. $this->lockDataCache = null;
  18703. return true;
  18704. }
  18705. return false;
  18706. }
  18707. private function lockPackages(array $packages)
  18708. {
  18709. $locked = array();
  18710. foreach ($packages as $package) {
  18711. if ($package instanceof AliasPackage) {
  18712. continue;
  18713. }
  18714. $name = $package->getPrettyName();
  18715. $version = $package->getPrettyVersion();
  18716. if (!$name || !$version) {
  18717. throw new \LogicException(sprintf(
  18718. 'Package "%s" has no version or name and can not be locked',
  18719. $package
  18720. ));
  18721. }
  18722. $spec = $this->dumper->dump($package);
  18723. unset($spec['version_normalized']);
  18724. $time = isset($spec['time']) ? $spec['time'] : null;
  18725. unset($spec['time']);
  18726. if ($package->isDev() && $package->getInstallationSource() === 'source') {
  18727. $time = $this->getPackageTime($package) ?: $time;
  18728. }
  18729. if (null !== $time) {
  18730. $spec['time'] = $time;
  18731. }
  18732. unset($spec['installation-source']);
  18733. $locked[] = $spec;
  18734. }
  18735. usort($locked, function ($a, $b) {
  18736. $comparison = strcmp($a['name'], $b['name']);
  18737. if (0 !== $comparison) {
  18738. return $comparison;
  18739. }
  18740. return strcmp($a['version'], $b['version']);
  18741. });
  18742. return $locked;
  18743. }
  18744. private function getPackageTime(PackageInterface $package)
  18745. {
  18746. if (!function_exists('proc_open')) {
  18747. return null;
  18748. }
  18749. $path = realpath($this->installationManager->getInstallPath($package));
  18750. $sourceType = $package->getSourceType();
  18751. $datetime = null;
  18752. if ($path && in_array($sourceType, array('git', 'hg'))) {
  18753. $sourceRef = $package->getSourceReference() ?: $package->getDistReference();
  18754. switch ($sourceType) {
  18755. case 'git':
  18756. GitUtil::cleanEnv();
  18757. if (0 === $this->process->execute('git log -n1 --pretty=%ct '.ProcessExecutor::escape($sourceRef), $output, $path) && preg_match('{^\s*\d+\s*$}', $output)) {
  18758. $datetime = new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  18759. }
  18760. break;
  18761. case 'hg':
  18762. if (0 === $this->process->execute('hg log --template "{date|hgdate}" -r '.ProcessExecutor::escape($sourceRef), $output, $path) && preg_match('{^\s*(\d+)\s*}', $output, $match)) {
  18763. $datetime = new \DateTime('@'.$match[1], new \DateTimeZone('UTC'));
  18764. }
  18765. break;
  18766. }
  18767. }
  18768. return $datetime ? $datetime->format(DATE_RFC3339) : null;
  18769. }
  18770. }
  18771. <?php
  18772. namespace Composer\Package;
  18773. use Composer\Package\Version\VersionParser;
  18774. use Composer\Util\ComposerMirror;
  18775. class Package extends BasePackage
  18776. {
  18777. protected $type;
  18778. protected $targetDir;
  18779. protected $installationSource;
  18780. protected $sourceType;
  18781. protected $sourceUrl;
  18782. protected $sourceReference;
  18783. protected $sourceMirrors;
  18784. protected $distType;
  18785. protected $distUrl;
  18786. protected $distReference;
  18787. protected $distSha1Checksum;
  18788. protected $distMirrors;
  18789. protected $version;
  18790. protected $prettyVersion;
  18791. protected $releaseDate;
  18792. protected $extra = array();
  18793. protected $binaries = array();
  18794. protected $dev;
  18795. protected $stability;
  18796. protected $notificationUrl;
  18797. protected $requires = array();
  18798. protected $conflicts = array();
  18799. protected $provides = array();
  18800. protected $replaces = array();
  18801. protected $devRequires = array();
  18802. protected $suggests = array();
  18803. protected $autoload = array();
  18804. protected $devAutoload = array();
  18805. protected $includePaths = array();
  18806. protected $archiveExcludes = array();
  18807. public function __construct($name, $version, $prettyVersion)
  18808. {
  18809. parent::__construct($name);
  18810. $this->version = $version;
  18811. $this->prettyVersion = $prettyVersion;
  18812. $this->stability = VersionParser::parseStability($version);
  18813. $this->dev = $this->stability === 'dev';
  18814. }
  18815. public function isDev()
  18816. {
  18817. return $this->dev;
  18818. }
  18819. public function setType($type)
  18820. {
  18821. $this->type = $type;
  18822. }
  18823. public function getType()
  18824. {
  18825. return $this->type ?: 'library';
  18826. }
  18827. public function getStability()
  18828. {
  18829. return $this->stability;
  18830. }
  18831. public function setTargetDir($targetDir)
  18832. {
  18833. $this->targetDir = $targetDir;
  18834. }
  18835. public function getTargetDir()
  18836. {
  18837. if (null === $this->targetDir) {
  18838. return;
  18839. }
  18840. return ltrim(preg_replace('{ (?:^|[\\\\/]+) \.\.? (?:[\\\\/]+|$) (?:\.\.? (?:[\\\\/]+|$) )*}x', '/', $this->targetDir), '/');
  18841. }
  18842. public function setExtra(array $extra)
  18843. {
  18844. $this->extra = $extra;
  18845. }
  18846. public function getExtra()
  18847. {
  18848. return $this->extra;
  18849. }
  18850. public function setBinaries(array $binaries)
  18851. {
  18852. $this->binaries = $binaries;
  18853. }
  18854. public function getBinaries()
  18855. {
  18856. return $this->binaries;
  18857. }
  18858. public function setInstallationSource($type)
  18859. {
  18860. $this->installationSource = $type;
  18861. }
  18862. public function getInstallationSource()
  18863. {
  18864. return $this->installationSource;
  18865. }
  18866. public function setSourceType($type)
  18867. {
  18868. $this->sourceType = $type;
  18869. }
  18870. public function getSourceType()
  18871. {
  18872. return $this->sourceType;
  18873. }
  18874. public function setSourceUrl($url)
  18875. {
  18876. $this->sourceUrl = $url;
  18877. }
  18878. public function getSourceUrl()
  18879. {
  18880. return $this->sourceUrl;
  18881. }
  18882. public function setSourceReference($reference)
  18883. {
  18884. $this->sourceReference = $reference;
  18885. }
  18886. public function getSourceReference()
  18887. {
  18888. return $this->sourceReference;
  18889. }
  18890. public function setSourceMirrors($mirrors)
  18891. {
  18892. $this->sourceMirrors = $mirrors;
  18893. }
  18894. public function getSourceMirrors()
  18895. {
  18896. return $this->sourceMirrors;
  18897. }
  18898. public function getSourceUrls()
  18899. {
  18900. return $this->getUrls($this->sourceUrl, $this->sourceMirrors, $this->sourceReference, $this->sourceType, 'source');
  18901. }
  18902. public function setDistType($type)
  18903. {
  18904. $this->distType = $type;
  18905. }
  18906. public function getDistType()
  18907. {
  18908. return $this->distType;
  18909. }
  18910. public function setDistUrl($url)
  18911. {
  18912. $this->distUrl = $url;
  18913. }
  18914. public function getDistUrl()
  18915. {
  18916. return $this->distUrl;
  18917. }
  18918. public function setDistReference($reference)
  18919. {
  18920. $this->distReference = $reference;
  18921. }
  18922. public function getDistReference()
  18923. {
  18924. return $this->distReference;
  18925. }
  18926. public function setDistSha1Checksum($sha1checksum)
  18927. {
  18928. $this->distSha1Checksum = $sha1checksum;
  18929. }
  18930. public function getDistSha1Checksum()
  18931. {
  18932. return $this->distSha1Checksum;
  18933. }
  18934. public function setDistMirrors($mirrors)
  18935. {
  18936. $this->distMirrors = $mirrors;
  18937. }
  18938. public function getDistMirrors()
  18939. {
  18940. return $this->distMirrors;
  18941. }
  18942. public function getDistUrls()
  18943. {
  18944. return $this->getUrls($this->distUrl, $this->distMirrors, $this->distReference, $this->distType, 'dist');
  18945. }
  18946. public function getVersion()
  18947. {
  18948. return $this->version;
  18949. }
  18950. public function getPrettyVersion()
  18951. {
  18952. return $this->prettyVersion;
  18953. }
  18954. public function setReleaseDate(\DateTime $releaseDate)
  18955. {
  18956. $this->releaseDate = $releaseDate;
  18957. }
  18958. public function getReleaseDate()
  18959. {
  18960. return $this->releaseDate;
  18961. }
  18962. public function setRequires(array $requires)
  18963. {
  18964. $this->requires = $requires;
  18965. }
  18966. public function getRequires()
  18967. {
  18968. return $this->requires;
  18969. }
  18970. public function setConflicts(array $conflicts)
  18971. {
  18972. $this->conflicts = $conflicts;
  18973. }
  18974. public function getConflicts()
  18975. {
  18976. return $this->conflicts;
  18977. }
  18978. public function setProvides(array $provides)
  18979. {
  18980. $this->provides = $provides;
  18981. }
  18982. public function getProvides()
  18983. {
  18984. return $this->provides;
  18985. }
  18986. public function setReplaces(array $replaces)
  18987. {
  18988. $this->replaces = $replaces;
  18989. }
  18990. public function getReplaces()
  18991. {
  18992. return $this->replaces;
  18993. }
  18994. public function setDevRequires(array $devRequires)
  18995. {
  18996. $this->devRequires = $devRequires;
  18997. }
  18998. public function getDevRequires()
  18999. {
  19000. return $this->devRequires;
  19001. }
  19002. public function setSuggests(array $suggests)
  19003. {
  19004. $this->suggests = $suggests;
  19005. }
  19006. public function getSuggests()
  19007. {
  19008. return $this->suggests;
  19009. }
  19010. public function setAutoload(array $autoload)
  19011. {
  19012. $this->autoload = $autoload;
  19013. }
  19014. public function getAutoload()
  19015. {
  19016. return $this->autoload;
  19017. }
  19018. public function setDevAutoload(array $devAutoload)
  19019. {
  19020. $this->devAutoload = $devAutoload;
  19021. }
  19022. public function getDevAutoload()
  19023. {
  19024. return $this->devAutoload;
  19025. }
  19026. public function setIncludePaths(array $includePaths)
  19027. {
  19028. $this->includePaths = $includePaths;
  19029. }
  19030. public function getIncludePaths()
  19031. {
  19032. return $this->includePaths;
  19033. }
  19034. public function setNotificationUrl($notificationUrl)
  19035. {
  19036. $this->notificationUrl = $notificationUrl;
  19037. }
  19038. public function getNotificationUrl()
  19039. {
  19040. return $this->notificationUrl;
  19041. }
  19042. public function setArchiveExcludes(array $excludes)
  19043. {
  19044. $this->archiveExcludes = $excludes;
  19045. }
  19046. public function getArchiveExcludes()
  19047. {
  19048. return $this->archiveExcludes;
  19049. }
  19050. public function replaceVersion($version, $prettyVersion)
  19051. {
  19052. $this->version = $version;
  19053. $this->prettyVersion = $prettyVersion;
  19054. $this->stability = VersionParser::parseStability($version);
  19055. $this->dev = $this->stability === 'dev';
  19056. }
  19057. protected function getUrls($url, $mirrors, $ref, $type, $urlType)
  19058. {
  19059. if (!$url) {
  19060. return array();
  19061. }
  19062. $urls = array($url);
  19063. if ($mirrors) {
  19064. foreach ($mirrors as $mirror) {
  19065. if ($urlType === 'dist') {
  19066. $mirrorUrl = ComposerMirror::processUrl($mirror['url'], $this->name, $this->version, $ref, $type);
  19067. } elseif ($urlType === 'source' && $type === 'git') {
  19068. $mirrorUrl = ComposerMirror::processGitUrl($mirror['url'], $this->name, $url, $type);
  19069. } elseif ($urlType === 'source' && $type === 'hg') {
  19070. $mirrorUrl = ComposerMirror::processHgUrl($mirror['url'], $this->name, $url, $type);
  19071. }
  19072. if (!in_array($mirrorUrl, $urls)) {
  19073. $func = $mirror['preferred'] ? 'array_unshift' : 'array_push';
  19074. $func($urls, $mirrorUrl);
  19075. }
  19076. }
  19077. }
  19078. return $urls;
  19079. }
  19080. }
  19081. <?php
  19082. namespace Composer\Package;
  19083. use Composer\Repository\RepositoryInterface;
  19084. interface PackageInterface
  19085. {
  19086. public function getName();
  19087. public function getPrettyName();
  19088. public function getNames();
  19089. public function setId($id);
  19090. public function getId();
  19091. public function isDev();
  19092. public function getType();
  19093. public function getTargetDir();
  19094. public function getExtra();
  19095. public function setInstallationSource($type);
  19096. public function getInstallationSource();
  19097. public function getSourceType();
  19098. public function getSourceUrl();
  19099. public function getSourceUrls();
  19100. public function getSourceReference();
  19101. public function getSourceMirrors();
  19102. public function getDistType();
  19103. public function getDistUrl();
  19104. public function getDistUrls();
  19105. public function getDistReference();
  19106. public function getDistSha1Checksum();
  19107. public function getDistMirrors();
  19108. public function getVersion();
  19109. public function getPrettyVersion();
  19110. public function getFullPrettyVersion($truncate = true);
  19111. public function getReleaseDate();
  19112. public function getStability();
  19113. public function getRequires();
  19114. public function getConflicts();
  19115. public function getProvides();
  19116. public function getReplaces();
  19117. public function getDevRequires();
  19118. public function getSuggests();
  19119. public function getAutoload();
  19120. public function getDevAutoload();
  19121. public function getIncludePaths();
  19122. public function setRepository(RepositoryInterface $repository);
  19123. public function getRepository();
  19124. public function getBinaries();
  19125. public function getUniqueName();
  19126. public function getNotificationUrl();
  19127. public function __toString();
  19128. public function getPrettyString();
  19129. public function getArchiveExcludes();
  19130. public function getTransportOptions();
  19131. public function setSourceReference($reference);
  19132. public function setDistUrl($url);
  19133. public function setDistType($type);
  19134. public function setDistReference($reference);
  19135. }
  19136. <?php
  19137. namespace Composer\Package;
  19138. class RootAliasPackage extends AliasPackage implements RootPackageInterface
  19139. {
  19140. public function __construct(RootPackageInterface $aliasOf, $version, $prettyVersion)
  19141. {
  19142. parent::__construct($aliasOf, $version, $prettyVersion);
  19143. }
  19144. public function getAliases()
  19145. {
  19146. return $this->aliasOf->getAliases();
  19147. }
  19148. public function getMinimumStability()
  19149. {
  19150. return $this->aliasOf->getMinimumStability();
  19151. }
  19152. public function getStabilityFlags()
  19153. {
  19154. return $this->aliasOf->getStabilityFlags();
  19155. }
  19156. public function getReferences()
  19157. {
  19158. return $this->aliasOf->getReferences();
  19159. }
  19160. public function getPreferStable()
  19161. {
  19162. return $this->aliasOf->getPreferStable();
  19163. }
  19164. public function getConfig()
  19165. {
  19166. return $this->aliasOf->getConfig();
  19167. }
  19168. public function setRequires(array $require)
  19169. {
  19170. $this->requires = $this->replaceSelfVersionDependencies($require, 'requires');
  19171. $this->aliasOf->setRequires($require);
  19172. }
  19173. public function setDevRequires(array $devRequire)
  19174. {
  19175. $this->devRequires = $this->replaceSelfVersionDependencies($devRequire, 'devRequires');
  19176. $this->aliasOf->setDevRequires($devRequire);
  19177. }
  19178. public function setConflicts(array $conflicts)
  19179. {
  19180. $this->conflicts = $this->replaceSelfVersionDependencies($conflicts, 'conflicts');
  19181. $this->aliasOf->setConflicts($conflicts);
  19182. }
  19183. public function setProvides(array $provides)
  19184. {
  19185. $this->provides = $this->replaceSelfVersionDependencies($provides, 'provides');
  19186. $this->aliasOf->setProvides($provides);
  19187. }
  19188. public function setReplaces(array $replaces)
  19189. {
  19190. $this->replaces = $this->replaceSelfVersionDependencies($replaces, 'replaces');
  19191. $this->aliasOf->setReplaces($replaces);
  19192. }
  19193. public function setRepositories($repositories)
  19194. {
  19195. $this->aliasOf->setRepositories($repositories);
  19196. }
  19197. public function setAutoload(array $autoload)
  19198. {
  19199. $this->aliasOf->setAutoload($autoload);
  19200. }
  19201. public function setDevAutoload(array $devAutoload)
  19202. {
  19203. $this->aliasOf->setDevAutoload($devAutoload);
  19204. }
  19205. public function setStabilityFlags(array $stabilityFlags)
  19206. {
  19207. $this->aliasOf->setStabilityFlags($stabilityFlags);
  19208. }
  19209. public function setSuggests(array $suggests)
  19210. {
  19211. $this->aliasOf->setSuggests($suggests);
  19212. }
  19213. public function setExtra(array $extra)
  19214. {
  19215. $this->aliasOf->setExtra($extra);
  19216. }
  19217. public function __clone()
  19218. {
  19219. parent::__clone();
  19220. $this->aliasOf = clone $this->aliasOf;
  19221. }
  19222. }
  19223. <?php
  19224. namespace Composer\Package;
  19225. class RootPackage extends CompletePackage implements RootPackageInterface
  19226. {
  19227. protected $minimumStability = 'stable';
  19228. protected $preferStable = false;
  19229. protected $stabilityFlags = array();
  19230. protected $config = array();
  19231. protected $references = array();
  19232. protected $aliases = array();
  19233. public function setMinimumStability($minimumStability)
  19234. {
  19235. $this->minimumStability = $minimumStability;
  19236. }
  19237. public function getMinimumStability()
  19238. {
  19239. return $this->minimumStability;
  19240. }
  19241. public function setStabilityFlags(array $stabilityFlags)
  19242. {
  19243. $this->stabilityFlags = $stabilityFlags;
  19244. }
  19245. public function getStabilityFlags()
  19246. {
  19247. return $this->stabilityFlags;
  19248. }
  19249. public function setPreferStable($preferStable)
  19250. {
  19251. $this->preferStable = $preferStable;
  19252. }
  19253. public function getPreferStable()
  19254. {
  19255. return $this->preferStable;
  19256. }
  19257. public function setConfig(array $config)
  19258. {
  19259. $this->config = $config;
  19260. }
  19261. public function getConfig()
  19262. {
  19263. return $this->config;
  19264. }
  19265. public function setReferences(array $references)
  19266. {
  19267. $this->references = $references;
  19268. }
  19269. public function getReferences()
  19270. {
  19271. return $this->references;
  19272. }
  19273. public function setAliases(array $aliases)
  19274. {
  19275. $this->aliases = $aliases;
  19276. }
  19277. public function getAliases()
  19278. {
  19279. return $this->aliases;
  19280. }
  19281. }
  19282. <?php
  19283. namespace Composer\Package;
  19284. interface RootPackageInterface extends CompletePackageInterface
  19285. {
  19286. public function getAliases();
  19287. public function getMinimumStability();
  19288. public function getStabilityFlags();
  19289. public function getReferences();
  19290. public function getPreferStable();
  19291. public function getConfig();
  19292. public function setRequires(array $requires);
  19293. public function setDevRequires(array $devRequires);
  19294. public function setConflicts(array $conflicts);
  19295. public function setProvides(array $provides);
  19296. public function setReplaces(array $replaces);
  19297. public function setRepositories($repositories);
  19298. public function setAutoload(array $autoload);
  19299. public function setDevAutoload(array $devAutoload);
  19300. public function setStabilityFlags(array $stabilityFlags);
  19301. public function setSuggests(array $suggests);
  19302. public function setExtra(array $extra);
  19303. }
  19304. <?php
  19305. namespace Composer\Package\Version;
  19306. use Composer\Config;
  19307. use Composer\Repository\Vcs\HgDriver;
  19308. use Composer\IO\NullIO;
  19309. use Composer\Semver\VersionParser as SemverVersionParser;
  19310. use Composer\Util\Git as GitUtil;
  19311. use Composer\Util\ProcessExecutor;
  19312. use Composer\Util\Svn as SvnUtil;
  19313. class VersionGuesser
  19314. {
  19315. private $config;
  19316. private $process;
  19317. private $versionParser;
  19318. public function __construct(Config $config, ProcessExecutor $process, SemverVersionParser $versionParser)
  19319. {
  19320. $this->config = $config;
  19321. $this->process = $process;
  19322. $this->versionParser = $versionParser;
  19323. }
  19324. public function guessVersion(array $packageConfig, $path)
  19325. {
  19326. if (function_exists('proc_open')) {
  19327. $versionData = $this->guessGitVersion($packageConfig, $path);
  19328. if (null !== $versionData && null !== $versionData['version']) {
  19329. return $this->postprocess($versionData);
  19330. }
  19331. $versionData = $this->guessHgVersion($packageConfig, $path);
  19332. if (null !== $versionData && null !== $versionData['version']) {
  19333. return $this->postprocess($versionData);
  19334. }
  19335. $versionData = $this->guessFossilVersion($packageConfig, $path);
  19336. if (null !== $versionData && null !== $versionData['version']) {
  19337. return $this->postprocess($versionData);
  19338. }
  19339. $versionData = $this->guessSvnVersion($packageConfig, $path);
  19340. if (null !== $versionData && null !== $versionData['version']) {
  19341. return $this->postprocess($versionData);
  19342. }
  19343. }
  19344. }
  19345. private function postprocess(array $versionData)
  19346. {
  19347. if ('-dev' === substr($versionData['version'], -4) && preg_match('{\.9{7}}', $versionData['version'])) {
  19348. $versionData['pretty_version'] = preg_replace('{(\.9{7})+}', '.x', $versionData['version']);
  19349. }
  19350. return $versionData;
  19351. }
  19352. private function guessGitVersion(array $packageConfig, $path)
  19353. {
  19354. GitUtil::cleanEnv();
  19355. $commit = null;
  19356. $version = null;
  19357. $prettyVersion = null;
  19358. $isDetached = false;
  19359. if (0 === $this->process->execute('git branch --no-color --no-abbrev -v', $output, $path)) {
  19360. $branches = array();
  19361. $isFeatureBranch = false;
  19362. foreach ($this->process->splitLines($output) as $branch) {
  19363. if ($branch && preg_match('{^(?:\* ) *(\(no branch\)|\(detached from \S+\)|\(HEAD detached at \S+\)|\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  19364. if ($match[1] === '(no branch)' || substr($match[1], 0, 10) === '(detached ' || substr($match[1], 0, 17) === '(HEAD detached at') {
  19365. $version = 'dev-' . $match[2];
  19366. $prettyVersion = $version;
  19367. $isFeatureBranch = true;
  19368. $isDetached = true;
  19369. } else {
  19370. $version = $this->versionParser->normalizeBranch($match[1]);
  19371. $prettyVersion = 'dev-' . $match[1];
  19372. $isFeatureBranch = 0 === strpos($version, 'dev-');
  19373. }
  19374. if ($match[2]) {
  19375. $commit = $match[2];
  19376. }
  19377. }
  19378. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  19379. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  19380. $branches[] = $match[1];
  19381. }
  19382. }
  19383. }
  19384. if ($isFeatureBranch) {
  19385. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'git rev-list %candidate%..%branch%', $path);
  19386. $version = $result['version'];
  19387. $prettyVersion = $result['pretty_version'];
  19388. }
  19389. }
  19390. if (!$version || $isDetached) {
  19391. $result = $this->versionFromGitTags($path);
  19392. if ($result) {
  19393. $version = $result['version'];
  19394. $prettyVersion = $result['pretty_version'];
  19395. }
  19396. }
  19397. if (!$commit) {
  19398. $command = 'git log --pretty="%H" -n1 HEAD';
  19399. if (0 === $this->process->execute($command, $output, $path)) {
  19400. $commit = trim($output) ?: null;
  19401. }
  19402. }
  19403. return array('version' => $version, 'commit' => $commit, 'pretty_version' => $prettyVersion);
  19404. }
  19405. private function versionFromGitTags($path)
  19406. {
  19407. if (0 === $this->process->execute('git describe --exact-match --tags', $output, $path)) {
  19408. try {
  19409. $version = $this->versionParser->normalize(trim($output));
  19410. return array('version' => $version, 'pretty_version' => trim($output));
  19411. } catch (\Exception $e) {
  19412. }
  19413. }
  19414. return null;
  19415. }
  19416. private function guessHgVersion(array $packageConfig, $path)
  19417. {
  19418. if (0 === $this->process->execute('hg branch', $output, $path)) {
  19419. $branch = trim($output);
  19420. $version = $this->versionParser->normalizeBranch($branch);
  19421. $isFeatureBranch = 0 === strpos($version, 'dev-');
  19422. if ('9999999-dev' === $version) {
  19423. return array('version' => $version, 'commit' => null, 'pretty_version' => 'dev-'.$branch);
  19424. }
  19425. if (!$isFeatureBranch) {
  19426. return array('version' => $version, 'commit' => null, 'pretty_version' => $version);
  19427. }
  19428. $driver = new HgDriver(array('url' => $path), new NullIO(), $this->config, $this->process);
  19429. $branches = array_keys($driver->getBranches());
  19430. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'hg log -r "not ancestors(\'%candidate%\') and ancestors(\'%branch%\')" --template "{node}\\n"', $path);
  19431. $result['commit'] = '';
  19432. return $result;
  19433. }
  19434. }
  19435. private function guessFeatureVersion(array $packageConfig, $version, array $branches, $scmCmdline, $path)
  19436. {
  19437. $prettyVersion = $version;
  19438. if ((isset($packageConfig['extra']['branch-alias']) && !isset($packageConfig['extra']['branch-alias'][$version]))
  19439. || strpos(json_encode($packageConfig), '"self.version"')
  19440. ) {
  19441. $branch = preg_replace('{^dev-}', '', $version);
  19442. $length = PHP_INT_MAX;
  19443. $nonFeatureBranches = '';
  19444. if (!empty($packageConfig['non-feature-branches'])) {
  19445. $nonFeatureBranches = implode('|', $packageConfig['non-feature-branches']);
  19446. }
  19447. foreach ($branches as $candidate) {
  19448. if ($candidate === $branch && preg_match('{^(' . $nonFeatureBranches . ')$}', $candidate)) {
  19449. break;
  19450. }
  19451. if ($candidate === $branch || !preg_match('{^(' . $nonFeatureBranches . '|master|trunk|default|develop|\d+\..+)$}', $candidate, $match)) {
  19452. continue;
  19453. }
  19454. $cmdLine = str_replace(array('%candidate%', '%branch%'), array($candidate, $branch), $scmCmdline);
  19455. if (0 !== $this->process->execute($cmdLine, $output, $path)) {
  19456. continue;
  19457. }
  19458. if (strlen($output) < $length) {
  19459. $length = strlen($output);
  19460. $version = $this->versionParser->normalizeBranch($candidate);
  19461. $prettyVersion = 'dev-' . $match[1];
  19462. }
  19463. }
  19464. }
  19465. return array('version' => $version, 'pretty_version' => $prettyVersion);
  19466. }
  19467. private function guessFossilVersion(array $packageConfig, $path)
  19468. {
  19469. $version = null;
  19470. $prettyVersion = null;
  19471. if (0 === $this->process->execute('fossil branch list', $output, $path)) {
  19472. $branch = trim($output);
  19473. $version = $this->versionParser->normalizeBranch($branch);
  19474. $prettyVersion = 'dev-' . $branch;
  19475. }
  19476. if (0 === $this->process->execute('fossil tag list', $output, $path)) {
  19477. try {
  19478. $version = $this->versionParser->normalize(trim($output));
  19479. $prettyVersion = trim($output);
  19480. } catch (\Exception $e) {
  19481. }
  19482. }
  19483. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  19484. }
  19485. private function guessSvnVersion(array $packageConfig, $path)
  19486. {
  19487. SvnUtil::cleanEnv();
  19488. if (0 === $this->process->execute('svn info --xml', $output, $path)) {
  19489. $trunkPath = isset($packageConfig['trunk-path']) ? preg_quote($packageConfig['trunk-path'], '#') : 'trunk';
  19490. $branchesPath = isset($packageConfig['branches-path']) ? preg_quote($packageConfig['branches-path'], '#') : 'branches';
  19491. $tagsPath = isset($packageConfig['tags-path']) ? preg_quote($packageConfig['tags-path'], '#') : 'tags';
  19492. $urlPattern = '#<url>.*/(' . $trunkPath . '|(' . $branchesPath . '|' . $tagsPath . ')/(.*))</url>#';
  19493. if (preg_match($urlPattern, $output, $matches)) {
  19494. if (isset($matches[2]) && ($branchesPath === $matches[2] || $tagsPath === $matches[2])) {
  19495. $version = $this->versionParser->normalizeBranch($matches[3]);
  19496. $prettyVersion = 'dev-' . $matches[3];
  19497. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  19498. }
  19499. $prettyVersion = trim($matches[1]);
  19500. $version = $this->versionParser->normalize($prettyVersion);
  19501. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  19502. }
  19503. }
  19504. }
  19505. }
  19506. <?php
  19507. namespace Composer\Package\Version;
  19508. use Composer\Repository\PlatformRepository;
  19509. use Composer\Semver\VersionParser as SemverVersionParser;
  19510. use Composer\Semver\Semver;
  19511. class VersionParser extends SemverVersionParser
  19512. {
  19513. private static $constraints = array();
  19514. public function parseConstraints($constraints)
  19515. {
  19516. if (!isset(self::$constraints[$constraints])) {
  19517. self::$constraints[$constraints] = parent::parseConstraints($constraints);
  19518. }
  19519. return self::$constraints[$constraints];
  19520. }
  19521. public function parseNameVersionPairs(array $pairs)
  19522. {
  19523. $pairs = array_values($pairs);
  19524. $result = array();
  19525. for ($i = 0, $count = count($pairs); $i < $count; $i++) {
  19526. $pair = preg_replace('{^([^=: ]+)[=: ](.*)$}', '$1 $2', trim($pairs[$i]));
  19527. if (false === strpos($pair, ' ') && isset($pairs[$i + 1]) && false === strpos($pairs[$i + 1], '/') && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $pairs[$i + 1])) {
  19528. $pair .= ' '.$pairs[$i + 1];
  19529. $i++;
  19530. }
  19531. if (strpos($pair, ' ')) {
  19532. list($name, $version) = explode(' ', $pair, 2);
  19533. $result[] = array('name' => $name, 'version' => $version);
  19534. } else {
  19535. $result[] = array('name' => $pair);
  19536. }
  19537. }
  19538. return $result;
  19539. }
  19540. public static function isUpgrade($normalizedFrom, $normalizedTo)
  19541. {
  19542. if (substr($normalizedFrom, 0, 4) === 'dev-' || substr($normalizedTo, 0, 4) === 'dev-') {
  19543. return true;
  19544. }
  19545. $sorted = Semver::sort(array($normalizedTo, $normalizedFrom));
  19546. return $sorted[0] === $normalizedFrom;
  19547. }
  19548. }
  19549. <?php
  19550. namespace Composer\Package\Version;
  19551. use Composer\DependencyResolver\Pool;
  19552. use Composer\Package\BasePackage;
  19553. use Composer\Package\PackageInterface;
  19554. use Composer\Package\Loader\ArrayLoader;
  19555. use Composer\Package\Dumper\ArrayDumper;
  19556. use Composer\Semver\Constraint\Constraint;
  19557. class VersionSelector
  19558. {
  19559. private $pool;
  19560. private $parser;
  19561. public function __construct(Pool $pool)
  19562. {
  19563. $this->pool = $pool;
  19564. }
  19565. public function findBestCandidate($packageName, $targetPackageVersion = null, $targetPhpVersion = null, $preferredStability = 'stable')
  19566. {
  19567. $constraint = $targetPackageVersion ? $this->getParser()->parseConstraints($targetPackageVersion) : null;
  19568. $candidates = $this->pool->whatProvides(strtolower($packageName), $constraint, true);
  19569. if ($targetPhpVersion) {
  19570. $phpConstraint = new Constraint('==', $this->getParser()->normalize($targetPhpVersion));
  19571. $candidates = array_filter($candidates, function ($pkg) use ($phpConstraint) {
  19572. $reqs = $pkg->getRequires();
  19573. return !isset($reqs['php']) || $reqs['php']->getConstraint()->matches($phpConstraint);
  19574. });
  19575. }
  19576. if (!$candidates) {
  19577. return false;
  19578. }
  19579. $package = reset($candidates);
  19580. $minPriority = BasePackage::$stabilities[$preferredStability];
  19581. foreach ($candidates as $candidate) {
  19582. $candidatePriority = $candidate->getStabilityPriority();
  19583. $currentPriority = $package->getStabilityPriority();
  19584. if ($minPriority < $candidatePriority && $currentPriority < $candidatePriority) {
  19585. continue;
  19586. }
  19587. if ($minPriority < $candidatePriority && $candidatePriority < $currentPriority) {
  19588. $package = $candidate;
  19589. continue;
  19590. }
  19591. if ($minPriority >= $candidatePriority && $minPriority < $currentPriority) {
  19592. $package = $candidate;
  19593. continue;
  19594. }
  19595. if (version_compare($package->getVersion(), $candidate->getVersion(), '<')) {
  19596. $package = $candidate;
  19597. }
  19598. }
  19599. return $package;
  19600. }
  19601. public function findRecommendedRequireVersion(PackageInterface $package)
  19602. {
  19603. $version = $package->getVersion();
  19604. if (!$package->isDev()) {
  19605. return $this->transformVersion($version, $package->getPrettyVersion(), $package->getStability());
  19606. }
  19607. $loader = new ArrayLoader($this->getParser());
  19608. $dumper = new ArrayDumper();
  19609. $extra = $loader->getBranchAlias($dumper->dump($package));
  19610. if ($extra) {
  19611. $extra = preg_replace('{^(\d+\.\d+\.\d+)(\.9999999)-dev$}', '$1.0', $extra, -1, $count);
  19612. if ($count) {
  19613. $extra = str_replace('.9999999', '.0', $extra);
  19614. return $this->transformVersion($extra, $extra, 'dev');
  19615. }
  19616. }
  19617. return $package->getPrettyVersion();
  19618. }
  19619. private function transformVersion($version, $prettyVersion, $stability)
  19620. {
  19621. $semanticVersionParts = explode('.', $version);
  19622. if (count($semanticVersionParts) == 4 && preg_match('{^0\D?}', $semanticVersionParts[3])) {
  19623. if ($semanticVersionParts[0] === '0') {
  19624. unset($semanticVersionParts[3]);
  19625. } else {
  19626. unset($semanticVersionParts[2], $semanticVersionParts[3]);
  19627. }
  19628. $version = implode('.', $semanticVersionParts);
  19629. } else {
  19630. return $prettyVersion;
  19631. }
  19632. if ($stability != 'stable') {
  19633. $version .= '@'.$stability;
  19634. }
  19635. return '^' . $version;
  19636. }
  19637. private function getParser()
  19638. {
  19639. if ($this->parser === null) {
  19640. $this->parser = new VersionParser();
  19641. }
  19642. return $this->parser;
  19643. }
  19644. }
  19645. <?php
  19646. namespace Composer\Plugin\Capability;
  19647. interface Capability
  19648. {
  19649. }
  19650. <?php
  19651. namespace Composer\Plugin\Capability;
  19652. interface CommandProvider extends Capability
  19653. {
  19654. public function getCommands();
  19655. }
  19656. <?php
  19657. namespace Composer\Plugin;
  19658. interface Capable
  19659. {
  19660. public function getCapabilities();
  19661. }
  19662. <?php
  19663. namespace Composer\Plugin;
  19664. use Composer\EventDispatcher\Event;
  19665. use Symfony\Component\Console\Input\InputInterface;
  19666. use Symfony\Component\Console\Output\OutputInterface;
  19667. class CommandEvent extends Event
  19668. {
  19669. private $commandName;
  19670. private $input;
  19671. private $output;
  19672. public function __construct($name, $commandName, $input, $output, array $args = array(), array $flags = array())
  19673. {
  19674. parent::__construct($name, $args, $flags);
  19675. $this->commandName = $commandName;
  19676. $this->input = $input;
  19677. $this->output = $output;
  19678. }
  19679. public function getInput()
  19680. {
  19681. return $this->input;
  19682. }
  19683. public function getOutput()
  19684. {
  19685. return $this->output;
  19686. }
  19687. public function getCommandName()
  19688. {
  19689. return $this->commandName;
  19690. }
  19691. }
  19692. <?php
  19693. namespace Composer\Plugin;
  19694. class PluginEvents
  19695. {
  19696. const INIT = 'init';
  19697. const COMMAND = 'command';
  19698. const PRE_FILE_DOWNLOAD = 'pre-file-download';
  19699. const PRE_COMMAND_RUN = 'pre-command-run';
  19700. }
  19701. <?php
  19702. namespace Composer\Plugin;
  19703. use Composer\Composer;
  19704. use Composer\IO\IOInterface;
  19705. interface PluginInterface
  19706. {
  19707. const PLUGIN_API_VERSION = '1.1.0';
  19708. public function activate(Composer $composer, IOInterface $io);
  19709. }
  19710. <?php
  19711. namespace Composer\Plugin;
  19712. use Composer\Composer;
  19713. use Composer\EventDispatcher\EventSubscriberInterface;
  19714. use Composer\IO\IOInterface;
  19715. use Composer\Package\CompletePackage;
  19716. use Composer\Package\Package;
  19717. use Composer\Package\Version\VersionParser;
  19718. use Composer\Repository\RepositoryInterface;
  19719. use Composer\Package\PackageInterface;
  19720. use Composer\Package\Link;
  19721. use Composer\Semver\Constraint\Constraint;
  19722. use Composer\DependencyResolver\Pool;
  19723. use Composer\Plugin\Capability\Capability;
  19724. use Composer\Util\PackageSorter;
  19725. class PluginManager
  19726. {
  19727. protected $composer;
  19728. protected $io;
  19729. protected $globalComposer;
  19730. protected $versionParser;
  19731. protected $disablePlugins = false;
  19732. protected $plugins = array();
  19733. protected $registeredPlugins = array();
  19734. private static $classCounter = 0;
  19735. public function __construct(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  19736. {
  19737. $this->io = $io;
  19738. $this->composer = $composer;
  19739. $this->globalComposer = $globalComposer;
  19740. $this->versionParser = new VersionParser();
  19741. $this->disablePlugins = $disablePlugins;
  19742. }
  19743. public function loadInstalledPlugins()
  19744. {
  19745. if ($this->disablePlugins) {
  19746. return;
  19747. }
  19748. $repo = $this->composer->getRepositoryManager()->getLocalRepository();
  19749. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  19750. if ($repo) {
  19751. $this->loadRepository($repo);
  19752. }
  19753. if ($globalRepo) {
  19754. $this->loadRepository($globalRepo);
  19755. }
  19756. }
  19757. public function getPlugins()
  19758. {
  19759. return $this->plugins;
  19760. }
  19761. public function getGlobalComposer()
  19762. {
  19763. return $this->globalComposer;
  19764. }
  19765. public function registerPackage(PackageInterface $package, $failOnMissingClasses = false)
  19766. {
  19767. if ($this->disablePlugins) {
  19768. return;
  19769. }
  19770. if ($package->getType() === 'composer-plugin') {
  19771. $requiresComposer = null;
  19772. foreach ($package->getRequires() as $link) {
  19773. if ('composer-plugin-api' === $link->getTarget()) {
  19774. $requiresComposer = $link->getConstraint();
  19775. break;
  19776. }
  19777. }
  19778. if (!$requiresComposer) {
  19779. throw new \RuntimeException("Plugin ".$package->getName()." is missing a require statement for a version of the composer-plugin-api package.");
  19780. }
  19781. $currentPluginApiVersion = $this->getPluginApiVersion();
  19782. $currentPluginApiConstraint = new Constraint('==', $this->versionParser->normalize($currentPluginApiVersion));
  19783. if ($requiresComposer->getPrettyString() === '1.0.0' && $this->getPluginApiVersion() === '1.0.0') {
  19784. $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>');
  19785. } elseif (!$requiresComposer->matches($currentPluginApiConstraint)) {
  19786. $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>');
  19787. return;
  19788. }
  19789. }
  19790. $oldInstallerPlugin = ($package->getType() === 'composer-installer');
  19791. if (in_array($package->getName(), $this->registeredPlugins)) {
  19792. return;
  19793. }
  19794. $extra = $package->getExtra();
  19795. if (empty($extra['class'])) {
  19796. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  19797. }
  19798. $classes = is_array($extra['class']) ? $extra['class'] : array($extra['class']);
  19799. $localRepo = $this->composer->getRepositoryManager()->getLocalRepository();
  19800. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  19801. $pool = new Pool('dev');
  19802. $pool->addRepository($localRepo);
  19803. if ($globalRepo) {
  19804. $pool->addRepository($globalRepo);
  19805. }
  19806. $autoloadPackages = array($package->getName() => $package);
  19807. $autoloadPackages = $this->collectDependencies($pool, $autoloadPackages, $package);
  19808. $generator = $this->composer->getAutoloadGenerator();
  19809. $autoloads = array();
  19810. foreach ($autoloadPackages as $autoloadPackage) {
  19811. $downloadPath = $this->getInstallPath($autoloadPackage, $globalRepo && $globalRepo->hasPackage($autoloadPackage));
  19812. $autoloads[] = array($autoloadPackage, $downloadPath);
  19813. }
  19814. $map = $generator->parseAutoloads($autoloads, new Package('dummy', '1.0.0.0', '1.0.0'));
  19815. $classLoader = $generator->createLoader($map);
  19816. $classLoader->register();
  19817. foreach ($classes as $class) {
  19818. if (class_exists($class, false)) {
  19819. $class = trim($class, '\\');
  19820. $path = $classLoader->findFile($class);
  19821. $code = file_get_contents($path);
  19822. $separatorPos = strrpos($class, '\\');
  19823. $className = $class;
  19824. if ($separatorPos) {
  19825. $className = substr($class, $separatorPos + 1);
  19826. }
  19827. $code = preg_replace('{^((?:final\s+)?(?:\s*))class\s+('.preg_quote($className).')}mi', '$1class $2_composer_tmp'.self::$classCounter, $code, 1);
  19828. $code = str_replace('__FILE__', var_export($path, true), $code);
  19829. $code = str_replace('__DIR__', var_export(dirname($path), true), $code);
  19830. $code = str_replace('__CLASS__', var_export($class, true), $code);
  19831. $code = preg_replace('/^\s*<\?(php)?/i', '', $code, 1);
  19832. eval($code);
  19833. $class .= '_composer_tmp'.self::$classCounter;
  19834. self::$classCounter++;
  19835. }
  19836. if ($oldInstallerPlugin) {
  19837. $installer = new $class($this->io, $this->composer);
  19838. $this->composer->getInstallationManager()->addInstaller($installer);
  19839. } elseif (class_exists($class)) {
  19840. $plugin = new $class();
  19841. $this->addPlugin($plugin);
  19842. $this->registeredPlugins[] = $package->getName();
  19843. } elseif ($failOnMissingClasses) {
  19844. throw new \UnexpectedValueException('Plugin '.$package->getName().' could not be initialized, class not found: '.$class);
  19845. }
  19846. }
  19847. }
  19848. protected function getPluginApiVersion()
  19849. {
  19850. return PluginInterface::PLUGIN_API_VERSION;
  19851. }
  19852. public function addPlugin(PluginInterface $plugin)
  19853. {
  19854. $this->io->writeError('Loading plugin '.get_class($plugin), true, IOInterface::DEBUG);
  19855. $this->plugins[] = $plugin;
  19856. $plugin->activate($this->composer, $this->io);
  19857. if ($plugin instanceof EventSubscriberInterface) {
  19858. $this->composer->getEventDispatcher()->addSubscriber($plugin);
  19859. }
  19860. }
  19861. private function loadRepository(RepositoryInterface $repo)
  19862. {
  19863. $packages = $repo->getPackages();
  19864. $sortedPackages = array_reverse(PackageSorter::sortPackages($packages));
  19865. foreach ($sortedPackages as $package) {
  19866. if (!($package instanceof CompletePackage)) {
  19867. continue;
  19868. }
  19869. if ('composer-plugin' === $package->getType()) {
  19870. $this->registerPackage($package);
  19871. } elseif ('composer-installer' === $package->getType()) {
  19872. $this->registerPackage($package);
  19873. }
  19874. }
  19875. }
  19876. private function collectDependencies(Pool $pool, array $collected, PackageInterface $package)
  19877. {
  19878. $requires = array_merge(
  19879. $package->getRequires(),
  19880. $package->getDevRequires()
  19881. );
  19882. foreach ($requires as $requireLink) {
  19883. $requiredPackage = $this->lookupInstalledPackage($pool, $requireLink);
  19884. if ($requiredPackage && !isset($collected[$requiredPackage->getName()])) {
  19885. $collected[$requiredPackage->getName()] = $requiredPackage;
  19886. $collected = $this->collectDependencies($pool, $collected, $requiredPackage);
  19887. }
  19888. }
  19889. return $collected;
  19890. }
  19891. private function lookupInstalledPackage(Pool $pool, Link $link)
  19892. {
  19893. $packages = $pool->whatProvides($link->getTarget(), $link->getConstraint());
  19894. return !empty($packages) ? $packages[0] : null;
  19895. }
  19896. private function getInstallPath(PackageInterface $package, $global = false)
  19897. {
  19898. if (!$global) {
  19899. return $this->composer->getInstallationManager()->getInstallPath($package);
  19900. }
  19901. return $this->globalComposer->getInstallationManager()->getInstallPath($package);
  19902. }
  19903. protected function getCapabilityImplementationClassName(PluginInterface $plugin, $capability)
  19904. {
  19905. if (!($plugin instanceof Capable)) {
  19906. return null;
  19907. }
  19908. $capabilities = (array) $plugin->getCapabilities();
  19909. if (!empty($capabilities[$capability]) && is_string($capabilities[$capability]) && trim($capabilities[$capability])) {
  19910. return trim($capabilities[$capability]);
  19911. }
  19912. if (
  19913. array_key_exists($capability, $capabilities)
  19914. && (empty($capabilities[$capability]) || !is_string($capabilities[$capability]) || !trim($capabilities[$capability]))
  19915. ) {
  19916. throw new \UnexpectedValueException('Plugin '.get_class($plugin).' provided invalid capability class name(s), got '.var_export($capabilities[$capability], 1));
  19917. }
  19918. }
  19919. public function getPluginCapability(PluginInterface $plugin, $capabilityClassName, array $ctorArgs = array())
  19920. {
  19921. if ($capabilityClass = $this->getCapabilityImplementationClassName($plugin, $capabilityClassName)) {
  19922. if (!class_exists($capabilityClass)) {
  19923. throw new \RuntimeException("Cannot instantiate Capability, as class $capabilityClass from plugin ".get_class($plugin)." does not exist.");
  19924. }
  19925. $ctorArgs['plugin'] = $plugin;
  19926. $capabilityObj = new $capabilityClass($ctorArgs);
  19927. if (!$capabilityObj instanceof Capability || !$capabilityObj instanceof $capabilityClassName) {
  19928. throw new \RuntimeException(
  19929. 'Class ' . $capabilityClass . ' must implement both Composer\Plugin\Capability\Capability and '. $capabilityClassName . '.'
  19930. );
  19931. }
  19932. return $capabilityObj;
  19933. }
  19934. }
  19935. public function getPluginCapabilities($capabilityClassName, array $ctorArgs = array())
  19936. {
  19937. $capabilities = array();
  19938. foreach ($this->getPlugins() as $plugin) {
  19939. if ($capability = $this->getPluginCapability($plugin, $capabilityClassName, $ctorArgs)) {
  19940. $capabilities[] = $capability;
  19941. }
  19942. }
  19943. return $capabilities;
  19944. }
  19945. }
  19946. <?php
  19947. namespace Composer\Plugin;
  19948. use Composer\EventDispatcher\Event;
  19949. use Symfony\Component\Console\Input\InputInterface;
  19950. class PreCommandRunEvent extends Event
  19951. {
  19952. private $input;
  19953. private $command;
  19954. public function __construct($name, InputInterface $input, $command)
  19955. {
  19956. parent::__construct($name);
  19957. $this->input = $input;
  19958. $this->command = $command;
  19959. }
  19960. public function getInput()
  19961. {
  19962. return $this->input;
  19963. }
  19964. public function getCommand()
  19965. {
  19966. return $this->command;
  19967. }
  19968. }
  19969. <?php
  19970. namespace Composer\Plugin;
  19971. use Composer\EventDispatcher\Event;
  19972. use Composer\Util\RemoteFilesystem;
  19973. class PreFileDownloadEvent extends Event
  19974. {
  19975. private $rfs;
  19976. private $processedUrl;
  19977. public function __construct($name, RemoteFilesystem $rfs, $processedUrl)
  19978. {
  19979. parent::__construct($name);
  19980. $this->rfs = $rfs;
  19981. $this->processedUrl = $processedUrl;
  19982. }
  19983. public function getRemoteFilesystem()
  19984. {
  19985. return $this->rfs;
  19986. }
  19987. public function setRemoteFilesystem(RemoteFilesystem $rfs)
  19988. {
  19989. $this->rfs = $rfs;
  19990. }
  19991. public function getProcessedUrl()
  19992. {
  19993. return $this->processedUrl;
  19994. }
  19995. }
  19996. <?php
  19997. namespace Composer\Question;
  19998. use Symfony\Component\Console\Exception\InvalidArgumentException;
  19999. use Symfony\Component\Console\Question\Question;
  20000. class StrictConfirmationQuestion extends Question
  20001. {
  20002. private $trueAnswerRegex;
  20003. private $falseAnswerRegex;
  20004. public function __construct($question, $default = true, $trueAnswerRegex = '/^y(?:es)?$/i', $falseAnswerRegex = '/^no?$/i')
  20005. {
  20006. parent::__construct($question, (bool) $default);
  20007. $this->trueAnswerRegex = $trueAnswerRegex;
  20008. $this->falseAnswerRegex = $falseAnswerRegex;
  20009. $this->setNormalizer($this->getDefaultNormalizer());
  20010. $this->setValidator($this->getDefaultValidator());
  20011. }
  20012. private function getDefaultNormalizer()
  20013. {
  20014. $default = $this->getDefault();
  20015. $trueRegex = $this->trueAnswerRegex;
  20016. $falseRegex = $this->falseAnswerRegex;
  20017. return function ($answer) use ($default, $trueRegex, $falseRegex) {
  20018. if (is_bool($answer)) {
  20019. return $answer;
  20020. }
  20021. if (empty($answer) && !empty($default)) {
  20022. return $default;
  20023. }
  20024. if (preg_match($trueRegex, $answer)) {
  20025. return true;
  20026. }
  20027. if (preg_match($falseRegex, $answer)) {
  20028. return false;
  20029. }
  20030. return null;
  20031. };
  20032. }
  20033. private function getDefaultValidator()
  20034. {
  20035. return function ($answer) {
  20036. if (!is_bool($answer)) {
  20037. throw new InvalidArgumentException('Please answer yes, y, no, or n.');
  20038. }
  20039. return $answer;
  20040. };
  20041. }
  20042. }
  20043. <?php
  20044. namespace Composer\Repository;
  20045. use Composer\Package\AliasPackage;
  20046. use Composer\Package\PackageInterface;
  20047. use Composer\Package\CompletePackageInterface;
  20048. use Composer\Package\Version\VersionParser;
  20049. use Composer\Semver\Constraint\ConstraintInterface;
  20050. use Composer\Semver\Constraint\Constraint;
  20051. class ArrayRepository extends BaseRepository
  20052. {
  20053. protected $packages;
  20054. public function __construct(array $packages = array())
  20055. {
  20056. foreach ($packages as $package) {
  20057. $this->addPackage($package);
  20058. }
  20059. }
  20060. public function findPackage($name, $constraint)
  20061. {
  20062. $name = strtolower($name);
  20063. if (!$constraint instanceof ConstraintInterface) {
  20064. $versionParser = new VersionParser();
  20065. $constraint = $versionParser->parseConstraints($constraint);
  20066. }
  20067. foreach ($this->getPackages() as $package) {
  20068. if ($name === $package->getName()) {
  20069. $pkgConstraint = new Constraint('==', $package->getVersion());
  20070. if ($constraint->matches($pkgConstraint)) {
  20071. return $package;
  20072. }
  20073. }
  20074. }
  20075. return null;
  20076. }
  20077. public function findPackages($name, $constraint = null)
  20078. {
  20079. $name = strtolower($name);
  20080. $packages = array();
  20081. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  20082. $versionParser = new VersionParser();
  20083. $constraint = $versionParser->parseConstraints($constraint);
  20084. }
  20085. foreach ($this->getPackages() as $package) {
  20086. if ($name === $package->getName()) {
  20087. $pkgConstraint = new Constraint('==', $package->getVersion());
  20088. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  20089. $packages[] = $package;
  20090. }
  20091. }
  20092. }
  20093. return $packages;
  20094. }
  20095. public function search($query, $mode = 0, $type = null)
  20096. {
  20097. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  20098. $matches = array();
  20099. foreach ($this->getPackages() as $package) {
  20100. $name = $package->getName();
  20101. if (isset($matches[$name])) {
  20102. continue;
  20103. }
  20104. if (preg_match($regex, $name)
  20105. || ($mode === self::SEARCH_FULLTEXT && $package instanceof CompletePackageInterface && preg_match($regex, implode(' ', (array) $package->getKeywords()) . ' ' . $package->getDescription()))
  20106. ) {
  20107. if (null !== $type && $package->getType() !== $type) {
  20108. continue;
  20109. }
  20110. $matches[$name] = array(
  20111. 'name' => $package->getPrettyName(),
  20112. 'description' => $package instanceof CompletePackageInterface ? $package->getDescription() : null,
  20113. );
  20114. }
  20115. }
  20116. return array_values($matches);
  20117. }
  20118. public function hasPackage(PackageInterface $package)
  20119. {
  20120. $packageId = $package->getUniqueName();
  20121. foreach ($this->getPackages() as $repoPackage) {
  20122. if ($packageId === $repoPackage->getUniqueName()) {
  20123. return true;
  20124. }
  20125. }
  20126. return false;
  20127. }
  20128. public function addPackage(PackageInterface $package)
  20129. {
  20130. if (null === $this->packages) {
  20131. $this->initialize();
  20132. }
  20133. $package->setRepository($this);
  20134. $this->packages[] = $package;
  20135. if ($package instanceof AliasPackage) {
  20136. $aliasedPackage = $package->getAliasOf();
  20137. if (null === $aliasedPackage->getRepository()) {
  20138. $this->addPackage($aliasedPackage);
  20139. }
  20140. }
  20141. }
  20142. protected function createAliasPackage(PackageInterface $package, $alias, $prettyAlias)
  20143. {
  20144. return new AliasPackage($package instanceof AliasPackage ? $package->getAliasOf() : $package, $alias, $prettyAlias);
  20145. }
  20146. public function removePackage(PackageInterface $package)
  20147. {
  20148. $packageId = $package->getUniqueName();
  20149. foreach ($this->getPackages() as $key => $repoPackage) {
  20150. if ($packageId === $repoPackage->getUniqueName()) {
  20151. array_splice($this->packages, $key, 1);
  20152. return;
  20153. }
  20154. }
  20155. }
  20156. public function getPackages()
  20157. {
  20158. if (null === $this->packages) {
  20159. $this->initialize();
  20160. }
  20161. return $this->packages;
  20162. }
  20163. public function count()
  20164. {
  20165. return count($this->packages);
  20166. }
  20167. protected function initialize()
  20168. {
  20169. $this->packages = array();
  20170. }
  20171. }
  20172. <?php
  20173. namespace Composer\Repository;
  20174. use Composer\IO\IOInterface;
  20175. use Composer\Json\JsonFile;
  20176. use Composer\Package\Loader\ArrayLoader;
  20177. use Composer\Package\Loader\LoaderInterface;
  20178. use Composer\Util\Zip;
  20179. class ArtifactRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  20180. {
  20181. protected $loader;
  20182. protected $lookup;
  20183. protected $repoConfig;
  20184. private $io;
  20185. public function __construct(array $repoConfig, IOInterface $io)
  20186. {
  20187. parent::__construct();
  20188. if (!extension_loaded('zip')) {
  20189. throw new \RuntimeException('The artifact repository requires PHP\'s zip extension');
  20190. }
  20191. $this->loader = new ArrayLoader();
  20192. $this->lookup = $repoConfig['url'];
  20193. $this->io = $io;
  20194. $this->repoConfig = $repoConfig;
  20195. }
  20196. public function getRepoConfig()
  20197. {
  20198. return $this->repoConfig;
  20199. }
  20200. protected function initialize()
  20201. {
  20202. parent::initialize();
  20203. $this->scanDirectory($this->lookup);
  20204. }
  20205. private function scanDirectory($path)
  20206. {
  20207. $io = $this->io;
  20208. $directory = new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
  20209. $iterator = new \RecursiveIteratorIterator($directory);
  20210. $regex = new \RegexIterator($iterator, '/^.+\.(zip|phar)$/i');
  20211. foreach ($regex as $file) {
  20212. if (!$file->isFile()) {
  20213. continue;
  20214. }
  20215. $package = $this->getComposerInformation($file);
  20216. if (!$package) {
  20217. $io->writeError("File <comment>{$file->getBasename()}</comment> doesn't seem to hold a package", true, IOInterface::VERBOSE);
  20218. continue;
  20219. }
  20220. $template = 'Found package <info>%s</info> (<comment>%s</comment>) in file <info>%s</info>';
  20221. $io->writeError(sprintf($template, $package->getName(), $package->getPrettyVersion(), $file->getBasename()), true, IOInterface::VERBOSE);
  20222. $this->addPackage($package);
  20223. }
  20224. }
  20225. private function getComposerInformation(\SplFileInfo $file)
  20226. {
  20227. $json = Zip::getComposerJson($file->getPathname());
  20228. if (null === $json) {
  20229. return false;
  20230. }
  20231. $package = JsonFile::parseJson($json, $file->getPathname().'#composer.json');
  20232. $package['dist'] = array(
  20233. 'type' => 'zip',
  20234. 'url' => strtr($file->getPathname(), '\\', '/'),
  20235. 'shasum' => sha1_file($file->getRealPath()),
  20236. );
  20237. try {
  20238. $package = $this->loader->load($package);
  20239. } catch (\UnexpectedValueException $e) {
  20240. throw new \UnexpectedValueException('Failed loading package in '.$file.': '.$e->getMessage(), 0, $e);
  20241. }
  20242. return $package;
  20243. }
  20244. }
  20245. <?php
  20246. namespace Composer\Repository;
  20247. use Composer\Package\RootPackageInterface;
  20248. use Composer\Semver\Constraint\ConstraintInterface;
  20249. use Composer\Semver\Constraint\Constraint;
  20250. use Composer\Package\Link;
  20251. abstract class BaseRepository implements RepositoryInterface
  20252. {
  20253. public function getDependents($needle, $constraint = null, $invert = false, $recurse = true, $packagesFound = null)
  20254. {
  20255. $needles = array_map('strtolower', (array) $needle);
  20256. $results = array();
  20257. if (null === $packagesFound) {
  20258. $packagesFound = $needles;
  20259. }
  20260. $rootPackage = null;
  20261. foreach ($this->getPackages() as $package) {
  20262. if ($package instanceof RootPackageInterface) {
  20263. $rootPackage = $package;
  20264. break;
  20265. }
  20266. }
  20267. foreach ($this->getPackages() as $package) {
  20268. $links = $package->getRequires();
  20269. $packagesInTree = $packagesFound;
  20270. if (!$invert) {
  20271. $links += $package->getReplaces();
  20272. foreach ($package->getReplaces() as $link) {
  20273. foreach ($needles as $needle) {
  20274. if ($link->getSource() === $needle) {
  20275. if ($constraint === null || ($link->getConstraint()->matches($constraint) === !$invert)) {
  20276. if (in_array($link->getTarget(), $packagesInTree)) {
  20277. $results[] = array($package, $link, false);
  20278. continue;
  20279. }
  20280. $packagesInTree[] = $link->getTarget();
  20281. $dependents = $recurse ? $this->getDependents($link->getTarget(), null, false, true, $packagesInTree) : array();
  20282. $results[] = array($package, $link, $dependents);
  20283. $needles[] = $link->getTarget();
  20284. }
  20285. }
  20286. }
  20287. }
  20288. }
  20289. if ($package instanceof RootPackageInterface) {
  20290. $links += $package->getDevRequires();
  20291. }
  20292. foreach ($links as $link) {
  20293. foreach ($needles as $needle) {
  20294. if ($link->getTarget() === $needle) {
  20295. if ($constraint === null || ($link->getConstraint()->matches($constraint) === !$invert)) {
  20296. if (in_array($link->getSource(), $packagesInTree)) {
  20297. $results[] = array($package, $link, false);
  20298. continue;
  20299. }
  20300. $packagesInTree[] = $link->getSource();
  20301. $dependents = $recurse ? $this->getDependents($link->getSource(), null, false, true, $packagesInTree) : array();
  20302. $results[] = array($package, $link, $dependents);
  20303. }
  20304. }
  20305. }
  20306. }
  20307. if ($invert && in_array($package->getName(), $needles)) {
  20308. foreach ($package->getConflicts() as $link) {
  20309. foreach ($this->findPackages($link->getTarget()) as $pkg) {
  20310. $version = new Constraint('=', $pkg->getVersion());
  20311. if ($link->getConstraint()->matches($version) === $invert) {
  20312. $results[] = array($package, $link, false);
  20313. }
  20314. }
  20315. }
  20316. }
  20317. if ($invert && $constraint && in_array($package->getName(), $needles) && $constraint->matches(new Constraint('=', $package->getVersion()))) {
  20318. foreach ($package->getRequires() as $link) {
  20319. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  20320. if ($this->findPackage($link->getTarget(), $link->getConstraint())) {
  20321. continue;
  20322. }
  20323. $platformPkg = $this->findPackage($link->getTarget(), '*');
  20324. $description = $platformPkg ? 'but '.$platformPkg->getPrettyVersion().' is installed' : 'but it is missing';
  20325. $results[] = array($package, new Link($package->getName(), $link->getTarget(), null, 'requires', $link->getPrettyConstraint().' '.$description), false);
  20326. continue;
  20327. }
  20328. foreach ($this->getPackages() as $pkg) {
  20329. if (!in_array($link->getTarget(), $pkg->getNames())) {
  20330. continue;
  20331. }
  20332. $version = new Constraint('=', $pkg->getVersion());
  20333. if (!$link->getConstraint()->matches($version)) {
  20334. if ($rootPackage) {
  20335. foreach (array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()) as $rootReq) {
  20336. if (in_array($rootReq->getTarget(), $pkg->getNames()) && !$rootReq->getConstraint()->matches($link->getConstraint())) {
  20337. $results[] = array($package, $link, false);
  20338. $results[] = array($rootPackage, $rootReq, false);
  20339. continue 3;
  20340. }
  20341. }
  20342. $results[] = array($package, $link, false);
  20343. $results[] = array($rootPackage, new Link($rootPackage->getName(), $link->getTarget(), null, 'does not require', 'but ' . $pkg->getPrettyVersion() . ' is installed'), false);
  20344. } else {
  20345. $results[] = array($package, $link, false);
  20346. }
  20347. }
  20348. continue 2;
  20349. }
  20350. }
  20351. }
  20352. }
  20353. ksort($results);
  20354. return $results;
  20355. }
  20356. }
  20357. <?php
  20358. namespace Composer\Repository;
  20359. use Composer\Package\Loader\ArrayLoader;
  20360. use Composer\Package\PackageInterface;
  20361. use Composer\Package\AliasPackage;
  20362. use Composer\Package\Version\VersionParser;
  20363. use Composer\DependencyResolver\Pool;
  20364. use Composer\Json\JsonFile;
  20365. use Composer\Cache;
  20366. use Composer\Config;
  20367. use Composer\Composer;
  20368. use Composer\Factory;
  20369. use Composer\IO\IOInterface;
  20370. use Composer\Util\RemoteFilesystem;
  20371. use Composer\Plugin\PluginEvents;
  20372. use Composer\Plugin\PreFileDownloadEvent;
  20373. use Composer\EventDispatcher\EventDispatcher;
  20374. use Composer\Downloader\TransportException;
  20375. use Composer\Semver\Constraint\ConstraintInterface;
  20376. use Composer\Semver\Constraint\Constraint;
  20377. class ComposerRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  20378. {
  20379. protected $config;
  20380. protected $repoConfig;
  20381. protected $options;
  20382. protected $url;
  20383. protected $baseUrl;
  20384. protected $io;
  20385. protected $rfs;
  20386. protected $cache;
  20387. protected $notifyUrl;
  20388. protected $searchUrl;
  20389. protected $hasProviders = false;
  20390. protected $providersUrl;
  20391. protected $lazyProvidersUrl;
  20392. protected $providerListing;
  20393. protected $providers = array();
  20394. protected $providersByUid = array();
  20395. protected $loader;
  20396. protected $rootAliases;
  20397. protected $allowSslDowngrade = false;
  20398. protected $eventDispatcher;
  20399. protected $sourceMirrors;
  20400. protected $distMirrors;
  20401. private $degradedMode = false;
  20402. private $rootData;
  20403. private $hasPartialPackages;
  20404. private $partialPackagesByName;
  20405. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  20406. {
  20407. parent::__construct();
  20408. if (!preg_match('{^[\w.]+\??://}', $repoConfig['url'])) {
  20409. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  20410. }
  20411. $repoConfig['url'] = rtrim($repoConfig['url'], '/');
  20412. if ('https?' === substr($repoConfig['url'], 0, 6)) {
  20413. $repoConfig['url'] = (extension_loaded('openssl') ? 'https' : 'http') . substr($repoConfig['url'], 6);
  20414. }
  20415. $urlBits = parse_url($repoConfig['url']);
  20416. if ($urlBits === false || empty($urlBits['scheme'])) {
  20417. throw new \UnexpectedValueException('Invalid url given for Composer repository: '.$repoConfig['url']);
  20418. }
  20419. if (!isset($repoConfig['options'])) {
  20420. $repoConfig['options'] = array();
  20421. }
  20422. if (isset($repoConfig['allow_ssl_downgrade']) && true === $repoConfig['allow_ssl_downgrade']) {
  20423. $this->allowSslDowngrade = true;
  20424. }
  20425. $this->config = $config;
  20426. $this->options = $repoConfig['options'];
  20427. $this->url = $repoConfig['url'];
  20428. if (preg_match('{^(?P<proto>https?)://packagist\.org/?$}i', $this->url, $match)) {
  20429. $this->url = $match['proto'].'://repo.packagist.org';
  20430. }
  20431. $this->baseUrl = rtrim(preg_replace('{(?:/[^/\\\\]+\.json)?(?:[?#].*)?$}', '', $this->url), '/');
  20432. $this->io = $io;
  20433. $this->cache = new Cache($io, $config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->url), 'a-z0-9.$');
  20434. $this->loader = new ArrayLoader();
  20435. if ($rfs && $this->options) {
  20436. $rfs = clone $rfs;
  20437. $rfs->setOptions($this->options);
  20438. }
  20439. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $this->config, $this->options);
  20440. $this->eventDispatcher = $eventDispatcher;
  20441. $this->repoConfig = $repoConfig;
  20442. }
  20443. public function getRepoConfig()
  20444. {
  20445. return $this->repoConfig;
  20446. }
  20447. public function setRootAliases(array $rootAliases)
  20448. {
  20449. $this->rootAliases = $rootAliases;
  20450. }
  20451. public function findPackage($name, $constraint)
  20452. {
  20453. if (!$this->hasProviders()) {
  20454. return parent::findPackage($name, $constraint);
  20455. }
  20456. $name = strtolower($name);
  20457. if (!$constraint instanceof ConstraintInterface) {
  20458. $versionParser = new VersionParser();
  20459. $constraint = $versionParser->parseConstraints($constraint);
  20460. }
  20461. foreach ($this->getProviderNames() as $providerName) {
  20462. if ($name === $providerName) {
  20463. $packages = $this->whatProvides(new Pool('dev'), $providerName);
  20464. foreach ($packages as $package) {
  20465. if ($name === $package->getName()) {
  20466. $pkgConstraint = new Constraint('==', $package->getVersion());
  20467. if ($constraint->matches($pkgConstraint)) {
  20468. return $package;
  20469. }
  20470. }
  20471. }
  20472. break;
  20473. }
  20474. }
  20475. }
  20476. public function findPackages($name, $constraint = null)
  20477. {
  20478. if (!$this->hasProviders()) {
  20479. return parent::findPackages($name, $constraint);
  20480. }
  20481. $name = strtolower($name);
  20482. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  20483. $versionParser = new VersionParser();
  20484. $constraint = $versionParser->parseConstraints($constraint);
  20485. }
  20486. $packages = array();
  20487. foreach ($this->getProviderNames() as $providerName) {
  20488. if ($name === $providerName) {
  20489. $candidates = $this->whatProvides(new Pool('dev'), $providerName);
  20490. foreach ($candidates as $package) {
  20491. if ($name === $package->getName()) {
  20492. $pkgConstraint = new Constraint('==', $package->getVersion());
  20493. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  20494. $packages[] = $package;
  20495. }
  20496. }
  20497. }
  20498. break;
  20499. }
  20500. }
  20501. return $packages;
  20502. }
  20503. public function getPackages()
  20504. {
  20505. if ($this->hasProviders()) {
  20506. throw new \LogicException('Composer repositories that have providers can not load the complete list of packages, use getProviderNames instead.');
  20507. }
  20508. return parent::getPackages();
  20509. }
  20510. public function search($query, $mode = 0, $type = null)
  20511. {
  20512. $this->loadRootServerFile();
  20513. if ($this->searchUrl && $mode === self::SEARCH_FULLTEXT) {
  20514. $url = str_replace(array('%query%', '%type%'), array($query, $type), $this->searchUrl);
  20515. $origin = RemoteFilesystem::getOrigin($url);
  20516. $json = $this->rfs->getContents($origin, $url, false);
  20517. $search = JsonFile::parseJson($json, $url);
  20518. if (empty($search['results'])) {
  20519. return array();
  20520. }
  20521. $results = array();
  20522. foreach ($search['results'] as $result) {
  20523. if (empty($result['virtual'])) {
  20524. $results[] = $result;
  20525. }
  20526. }
  20527. return $results;
  20528. }
  20529. if ($this->hasProviders()) {
  20530. $results = array();
  20531. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  20532. foreach ($this->getProviderNames() as $name) {
  20533. if (preg_match($regex, $name)) {
  20534. $results[] = array('name' => $name);
  20535. }
  20536. }
  20537. return $results;
  20538. }
  20539. return parent::search($query, $mode);
  20540. }
  20541. public function getProviderNames()
  20542. {
  20543. $this->loadRootServerFile();
  20544. if (null === $this->providerListing) {
  20545. $this->loadProviderListings($this->loadRootServerFile());
  20546. }
  20547. if ($this->lazyProvidersUrl) {
  20548. return array();
  20549. }
  20550. if ($this->providersUrl) {
  20551. return array_keys($this->providerListing);
  20552. }
  20553. return array();
  20554. }
  20555. protected function configurePackageTransportOptions(PackageInterface $package)
  20556. {
  20557. foreach ($package->getDistUrls() as $url) {
  20558. if (strpos($url, $this->baseUrl) === 0) {
  20559. $package->setTransportOptions($this->options);
  20560. return;
  20561. }
  20562. }
  20563. }
  20564. public function hasProviders()
  20565. {
  20566. $this->loadRootServerFile();
  20567. return $this->hasProviders;
  20568. }
  20569. public function resetPackageIds()
  20570. {
  20571. foreach ($this->providersByUid as $package) {
  20572. if ($package instanceof AliasPackage) {
  20573. $package->getAliasOf()->setId(-1);
  20574. }
  20575. $package->setId(-1);
  20576. }
  20577. }
  20578. public function whatProvides(Pool $pool, $name, $bypassFilters = false)
  20579. {
  20580. if (isset($this->providers[$name]) && !$bypassFilters) {
  20581. return $this->providers[$name];
  20582. }
  20583. if ($this->hasPartialPackages && null === $this->partialPackagesByName) {
  20584. $this->initializePartialPackages();
  20585. }
  20586. if (!$this->hasPartialPackages || !isset($this->partialPackagesByName[$name])) {
  20587. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name) || '__root__' === $name || 'composer-plugin-api' === $name) {
  20588. return array();
  20589. }
  20590. if (null === $this->providerListing) {
  20591. $this->loadProviderListings($this->loadRootServerFile());
  20592. }
  20593. $useLastModifiedCheck = false;
  20594. if ($this->lazyProvidersUrl && !isset($this->providerListing[$name])) {
  20595. $hash = null;
  20596. $url = str_replace('%package%', $name, $this->lazyProvidersUrl);
  20597. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  20598. $useLastModifiedCheck = true;
  20599. } elseif ($this->providersUrl) {
  20600. if (!isset($this->providerListing[$name])) {
  20601. return array();
  20602. }
  20603. $hash = $this->providerListing[$name]['sha256'];
  20604. $url = str_replace(array('%package%', '%hash%'), array($name, $hash), $this->providersUrl);
  20605. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  20606. } else {
  20607. return array();
  20608. }
  20609. $packages = null;
  20610. if ($cacheKey) {
  20611. if (!$useLastModifiedCheck && $hash && $this->cache->sha256($cacheKey) === $hash) {
  20612. $packages = json_decode($this->cache->read($cacheKey), true);
  20613. } elseif ($useLastModifiedCheck) {
  20614. if ($contents = $this->cache->read($cacheKey)) {
  20615. $contents = json_decode($contents, true);
  20616. if (isset($contents['last-modified'])) {
  20617. $response = $this->fetchFileIfLastModified($url, $cacheKey, $contents['last-modified']);
  20618. if (true === $response) {
  20619. $packages = $contents;
  20620. } elseif ($response) {
  20621. $packages = $response;
  20622. }
  20623. }
  20624. }
  20625. }
  20626. }
  20627. if (!$packages) {
  20628. try {
  20629. $packages = $this->fetchFile($url, $cacheKey, $hash, $useLastModifiedCheck);
  20630. } catch (TransportException $e) {
  20631. if ($e->getStatusCode() === 404 && $this->lazyProvidersUrl) {
  20632. $packages = array('packages' => array());
  20633. } else {
  20634. throw $e;
  20635. }
  20636. }
  20637. }
  20638. $loadingPartialPackage = false;
  20639. } else {
  20640. $packages = array('packages' => array('versions' => $this->partialPackagesByName[$name]));
  20641. $loadingPartialPackage = true;
  20642. }
  20643. $this->providers[$name] = array();
  20644. foreach ($packages['packages'] as $versions) {
  20645. foreach ($versions as $version) {
  20646. if (!$loadingPartialPackage && $this->hasPartialPackages && isset($this->partialPackagesByName[$version['name']])) {
  20647. continue;
  20648. }
  20649. if (isset($this->providersByUid[$version['uid']])) {
  20650. if (!isset($this->providers[$name][$version['uid']])) {
  20651. if ($this->providersByUid[$version['uid']] instanceof AliasPackage) {
  20652. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']]->getAliasOf();
  20653. $this->providers[$name][$version['uid'].'-alias'] = $this->providersByUid[$version['uid']];
  20654. } else {
  20655. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']];
  20656. }
  20657. if (isset($this->providersByUid[$version['uid'].'-root'])) {
  20658. $this->providers[$name][$version['uid'].'-root'] = $this->providersByUid[$version['uid'].'-root'];
  20659. }
  20660. }
  20661. } else {
  20662. if (!$bypassFilters && !$pool->isPackageAcceptable(strtolower($version['name']), VersionParser::parseStability($version['version']))) {
  20663. continue;
  20664. }
  20665. $package = $this->createPackage($version, 'Composer\Package\CompletePackage');
  20666. $package->setRepository($this);
  20667. if ($package instanceof AliasPackage) {
  20668. $aliased = $package->getAliasOf();
  20669. $aliased->setRepository($this);
  20670. $this->providers[$name][$version['uid']] = $aliased;
  20671. $this->providers[$name][$version['uid'].'-alias'] = $package;
  20672. $this->providersByUid[$version['uid']] = $package;
  20673. } else {
  20674. $this->providers[$name][$version['uid']] = $package;
  20675. $this->providersByUid[$version['uid']] = $package;
  20676. }
  20677. unset($rootAliasData);
  20678. if (isset($this->rootAliases[$package->getName()][$package->getVersion()])) {
  20679. $rootAliasData = $this->rootAliases[$package->getName()][$package->getVersion()];
  20680. } elseif ($package instanceof AliasPackage && isset($this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()])) {
  20681. $rootAliasData = $this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()];
  20682. }
  20683. if (isset($rootAliasData)) {
  20684. $alias = $this->createAliasPackage($package, $rootAliasData['alias_normalized'], $rootAliasData['alias']);
  20685. $alias->setRepository($this);
  20686. $this->providers[$name][$version['uid'].'-root'] = $alias;
  20687. $this->providersByUid[$version['uid'].'-root'] = $alias;
  20688. }
  20689. }
  20690. }
  20691. }
  20692. $result = $this->providers[$name];
  20693. if ($bypassFilters) {
  20694. foreach ($this->providers[$name] as $uid => $provider) {
  20695. unset($this->providersByUid[$uid]);
  20696. }
  20697. unset($this->providers[$name]);
  20698. }
  20699. return $result;
  20700. }
  20701. protected function initialize()
  20702. {
  20703. parent::initialize();
  20704. $repoData = $this->loadDataFromServer();
  20705. foreach ($repoData as $package) {
  20706. $this->addPackage($this->createPackage($package, 'Composer\Package\CompletePackage'));
  20707. }
  20708. }
  20709. public function addPackage(PackageInterface $package)
  20710. {
  20711. parent::addPackage($package);
  20712. $this->configurePackageTransportOptions($package);
  20713. }
  20714. protected function loadRootServerFile()
  20715. {
  20716. if (null !== $this->rootData) {
  20717. return $this->rootData;
  20718. }
  20719. if (!extension_loaded('openssl') && 'https' === substr($this->url, 0, 5)) {
  20720. throw new \RuntimeException('You must enable the openssl extension in your php.ini to load information from '.$this->url);
  20721. }
  20722. $jsonUrlParts = parse_url($this->url);
  20723. if (isset($jsonUrlParts['path']) && false !== strpos($jsonUrlParts['path'], '.json')) {
  20724. $jsonUrl = $this->url;
  20725. } else {
  20726. $jsonUrl = $this->url . '/packages.json';
  20727. }
  20728. $data = $this->fetchFile($jsonUrl, 'packages.json');
  20729. if (!empty($data['notify-batch'])) {
  20730. $this->notifyUrl = $this->canonicalizeUrl($data['notify-batch']);
  20731. } elseif (!empty($data['notify'])) {
  20732. $this->notifyUrl = $this->canonicalizeUrl($data['notify']);
  20733. }
  20734. if (!empty($data['search'])) {
  20735. $this->searchUrl = $this->canonicalizeUrl($data['search']);
  20736. }
  20737. if (!empty($data['mirrors'])) {
  20738. foreach ($data['mirrors'] as $mirror) {
  20739. if (!empty($mirror['git-url'])) {
  20740. $this->sourceMirrors['git'][] = array('url' => $mirror['git-url'], 'preferred' => !empty($mirror['preferred']));
  20741. }
  20742. if (!empty($mirror['hg-url'])) {
  20743. $this->sourceMirrors['hg'][] = array('url' => $mirror['hg-url'], 'preferred' => !empty($mirror['preferred']));
  20744. }
  20745. if (!empty($mirror['dist-url'])) {
  20746. $this->distMirrors[] = array(
  20747. 'url' => $this->canonicalizeUrl($mirror['dist-url']),
  20748. 'preferred' => !empty($mirror['preferred']),
  20749. );
  20750. }
  20751. }
  20752. }
  20753. if (!empty($data['providers-lazy-url'])) {
  20754. $this->lazyProvidersUrl = $this->canonicalizeUrl($data['providers-lazy-url']);
  20755. $this->hasProviders = true;
  20756. $this->hasPartialPackages = !empty($data['packages']) && is_array($data['packages']);
  20757. }
  20758. if ($this->allowSslDowngrade) {
  20759. $this->url = str_replace('https://', 'http://', $this->url);
  20760. $this->baseUrl = str_replace('https://', 'http://', $this->baseUrl);
  20761. }
  20762. if (!empty($data['providers-url'])) {
  20763. $this->providersUrl = $this->canonicalizeUrl($data['providers-url']);
  20764. $this->hasProviders = true;
  20765. }
  20766. if (!empty($data['providers']) || !empty($data['providers-includes'])) {
  20767. $this->hasProviders = true;
  20768. }
  20769. if (preg_match('{^https?://repo\.packagist\.org/?$}i', $this->url) && !empty($this->repoConfig['force-lazy-providers'])) {
  20770. $this->url = 'https://repo.packagist.org';
  20771. $this->baseUrl = 'https://repo.packagist.org';
  20772. $this->lazyProvidersUrl = $this->canonicalizeUrl('https://repo.packagist.org/p/%package%.json');
  20773. $this->providersUrl = null;
  20774. } elseif (!empty($this->repoConfig['force-lazy-providers'])) {
  20775. $this->lazyProvidersUrl = $this->canonicalizeUrl('/p/%package%.json');
  20776. $this->providersUrl = null;
  20777. }
  20778. return $this->rootData = $data;
  20779. }
  20780. protected function canonicalizeUrl($url)
  20781. {
  20782. if ('/' === $url[0]) {
  20783. if (preg_match('{^[^:]++://[^/]*+}', $this->url, $matches)) {
  20784. return $matches[0] . $url;
  20785. }
  20786. return $this->url;
  20787. }
  20788. return $url;
  20789. }
  20790. protected function loadDataFromServer()
  20791. {
  20792. $data = $this->loadRootServerFile();
  20793. return $this->loadIncludes($data);
  20794. }
  20795. protected function loadProviderListings($data)
  20796. {
  20797. if (isset($data['providers'])) {
  20798. if (!is_array($this->providerListing)) {
  20799. $this->providerListing = array();
  20800. }
  20801. $this->providerListing = array_merge($this->providerListing, $data['providers']);
  20802. }
  20803. if ($this->providersUrl && isset($data['provider-includes'])) {
  20804. $includes = $data['provider-includes'];
  20805. foreach ($includes as $include => $metadata) {
  20806. $url = $this->baseUrl . '/' . str_replace('%hash%', $metadata['sha256'], $include);
  20807. $cacheKey = str_replace(array('%hash%','$'), '', $include);
  20808. if ($this->cache->sha256($cacheKey) === $metadata['sha256']) {
  20809. $includedData = json_decode($this->cache->read($cacheKey), true);
  20810. } else {
  20811. $includedData = $this->fetchFile($url, $cacheKey, $metadata['sha256']);
  20812. }
  20813. $this->loadProviderListings($includedData);
  20814. }
  20815. }
  20816. }
  20817. protected function loadIncludes($data)
  20818. {
  20819. $packages = array();
  20820. if (!isset($data['packages']) && !isset($data['includes'])) {
  20821. foreach ($data as $pkg) {
  20822. foreach ($pkg['versions'] as $metadata) {
  20823. $packages[] = $metadata;
  20824. }
  20825. }
  20826. return $packages;
  20827. }
  20828. if (isset($data['packages'])) {
  20829. foreach ($data['packages'] as $package => $versions) {
  20830. foreach ($versions as $version => $metadata) {
  20831. $packages[] = $metadata;
  20832. }
  20833. }
  20834. }
  20835. if (isset($data['includes'])) {
  20836. foreach ($data['includes'] as $include => $metadata) {
  20837. if ($this->cache->sha1($include) === $metadata['sha1']) {
  20838. $includedData = json_decode($this->cache->read($include), true);
  20839. } else {
  20840. $includedData = $this->fetchFile($include);
  20841. }
  20842. $packages = array_merge($packages, $this->loadIncludes($includedData));
  20843. }
  20844. }
  20845. return $packages;
  20846. }
  20847. protected function createPackage(array $data, $class = 'Composer\Package\CompletePackage')
  20848. {
  20849. try {
  20850. if (!isset($data['notification-url'])) {
  20851. $data['notification-url'] = $this->notifyUrl;
  20852. }
  20853. $package = $this->loader->load($data, $class);
  20854. if (isset($this->sourceMirrors[$package->getSourceType()])) {
  20855. $package->setSourceMirrors($this->sourceMirrors[$package->getSourceType()]);
  20856. }
  20857. $package->setDistMirrors($this->distMirrors);
  20858. $this->configurePackageTransportOptions($package);
  20859. return $package;
  20860. } catch (\Exception $e) {
  20861. 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);
  20862. }
  20863. }
  20864. protected function fetchFile($filename, $cacheKey = null, $sha256 = null, $storeLastModifiedTime = false)
  20865. {
  20866. if (null === $cacheKey) {
  20867. $cacheKey = $filename;
  20868. $filename = $this->baseUrl.'/'.$filename;
  20869. }
  20870. if (($pos = strpos($filename, '$')) && preg_match('{^https?://.*}i', $filename)) {
  20871. $filename = substr($filename, 0, $pos) . '%24' . substr($filename, $pos + 1);
  20872. }
  20873. $retries = 3;
  20874. while ($retries--) {
  20875. try {
  20876. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  20877. if ($this->eventDispatcher) {
  20878. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  20879. }
  20880. $origin = RemoteFilesystem::getOrigin($filename);
  20881. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  20882. $json = $rfs->getContents($origin, $filename, false);
  20883. if ($sha256 && $sha256 !== hash('sha256', $json)) {
  20884. if ($this->allowSslDowngrade) {
  20885. $this->url = str_replace('http://', 'https://', $this->url);
  20886. $this->baseUrl = str_replace('http://', 'https://', $this->baseUrl);
  20887. $filename = str_replace('http://', 'https://', $filename);
  20888. }
  20889. if ($retries) {
  20890. usleep(100000);
  20891. continue;
  20892. }
  20893. 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.');
  20894. }
  20895. $data = JsonFile::parseJson($json, $filename);
  20896. RemoteFilesystem::outputWarnings($this->io, $this->url, $data);
  20897. if ($cacheKey) {
  20898. if ($storeLastModifiedTime) {
  20899. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  20900. if ($lastModifiedDate) {
  20901. $data['last-modified'] = $lastModifiedDate;
  20902. $json = json_encode($data);
  20903. }
  20904. }
  20905. $this->cache->write($cacheKey, $json);
  20906. }
  20907. break;
  20908. } catch (\Exception $e) {
  20909. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  20910. throw $e;
  20911. }
  20912. if ($retries) {
  20913. usleep(100000);
  20914. continue;
  20915. }
  20916. if ($e instanceof RepositorySecurityException) {
  20917. throw $e;
  20918. }
  20919. if ($cacheKey && ($contents = $this->cache->read($cacheKey))) {
  20920. if (!$this->degradedMode) {
  20921. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  20922. $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>');
  20923. }
  20924. $this->degradedMode = true;
  20925. $data = JsonFile::parseJson($contents, $this->cache->getRoot().$cacheKey);
  20926. break;
  20927. }
  20928. throw $e;
  20929. }
  20930. }
  20931. return $data;
  20932. }
  20933. protected function fetchFileIfLastModified($filename, $cacheKey, $lastModifiedTime)
  20934. {
  20935. $retries = 3;
  20936. while ($retries--) {
  20937. try {
  20938. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  20939. if ($this->eventDispatcher) {
  20940. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  20941. }
  20942. $origin = RemoteFilesystem::getOrigin($filename);
  20943. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  20944. $options = array('http' => array('header' => array('If-Modified-Since: '.$lastModifiedTime)));
  20945. $json = $rfs->getContents($origin, $filename, false, $options);
  20946. if ($json === '' && $rfs->findStatusCode($rfs->getLastHeaders()) === 304) {
  20947. return true;
  20948. }
  20949. $data = JsonFile::parseJson($json, $filename);
  20950. RemoteFilesystem::outputWarnings($this->io, $this->url, $data);
  20951. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  20952. if ($lastModifiedDate) {
  20953. $data['last-modified'] = $lastModifiedDate;
  20954. $json = json_encode($data);
  20955. }
  20956. $this->cache->write($cacheKey, $json);
  20957. return $data;
  20958. } catch (\Exception $e) {
  20959. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  20960. throw $e;
  20961. }
  20962. if ($retries) {
  20963. usleep(100000);
  20964. continue;
  20965. }
  20966. if (!$this->degradedMode) {
  20967. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  20968. $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>');
  20969. }
  20970. $this->degradedMode = true;
  20971. return true;
  20972. }
  20973. }
  20974. }
  20975. private function initializePartialPackages()
  20976. {
  20977. $rootData = $this->loadRootServerFile();
  20978. $this->partialPackagesByName = array();
  20979. foreach ($rootData['packages'] as $package => $versions) {
  20980. $package = strtolower($package);
  20981. foreach ($versions as $version) {
  20982. $this->partialPackagesByName[$package][] = $version;
  20983. if (!empty($version['provide']) && is_array($version['provide'])) {
  20984. foreach ($version['provide'] as $provided => $providedVersion) {
  20985. $this->partialPackagesByName[strtolower($provided)][] = $version;
  20986. }
  20987. }
  20988. if (!empty($version['replace']) && is_array($version['replace'])) {
  20989. foreach ($version['replace'] as $provided => $providedVersion) {
  20990. $this->partialPackagesByName[strtolower($provided)][] = $version;
  20991. }
  20992. }
  20993. }
  20994. }
  20995. $this->rootData = true;
  20996. }
  20997. }
  20998. <?php
  20999. namespace Composer\Repository;
  21000. use Composer\Package\PackageInterface;
  21001. class CompositeRepository extends BaseRepository
  21002. {
  21003. private $repositories;
  21004. public function __construct(array $repositories)
  21005. {
  21006. $this->repositories = array();
  21007. foreach ($repositories as $repo) {
  21008. $this->addRepository($repo);
  21009. }
  21010. }
  21011. public function getRepositories()
  21012. {
  21013. return $this->repositories;
  21014. }
  21015. public function hasPackage(PackageInterface $package)
  21016. {
  21017. foreach ($this->repositories as $repository) {
  21018. if ($repository->hasPackage($package)) {
  21019. return true;
  21020. }
  21021. }
  21022. return false;
  21023. }
  21024. public function findPackage($name, $constraint)
  21025. {
  21026. foreach ($this->repositories as $repository) {
  21027. $package = $repository->findPackage($name, $constraint);
  21028. if (null !== $package) {
  21029. return $package;
  21030. }
  21031. }
  21032. return null;
  21033. }
  21034. public function findPackages($name, $constraint = null)
  21035. {
  21036. $packages = array();
  21037. foreach ($this->repositories as $repository) {
  21038. $packages[] = $repository->findPackages($name, $constraint);
  21039. }
  21040. return $packages ? call_user_func_array('array_merge', $packages) : array();
  21041. }
  21042. public function search($query, $mode = 0, $type = null)
  21043. {
  21044. $matches = array();
  21045. foreach ($this->repositories as $repository) {
  21046. $matches[] = $repository->search($query, $mode, $type);
  21047. }
  21048. return $matches ? call_user_func_array('array_merge', $matches) : array();
  21049. }
  21050. public function getPackages()
  21051. {
  21052. $packages = array();
  21053. foreach ($this->repositories as $repository) {
  21054. $packages[] = $repository->getPackages();
  21055. }
  21056. return $packages ? call_user_func_array('array_merge', $packages) : array();
  21057. }
  21058. public function removePackage(PackageInterface $package)
  21059. {
  21060. foreach ($this->repositories as $repository) {
  21061. $repository->removePackage($package);
  21062. }
  21063. }
  21064. public function count()
  21065. {
  21066. $total = 0;
  21067. foreach ($this->repositories as $repository) {
  21068. $total += $repository->count();
  21069. }
  21070. return $total;
  21071. }
  21072. public function addRepository(RepositoryInterface $repository)
  21073. {
  21074. if ($repository instanceof self) {
  21075. foreach ($repository->getRepositories() as $repo) {
  21076. $this->addRepository($repo);
  21077. }
  21078. } else {
  21079. $this->repositories[] = $repository;
  21080. }
  21081. }
  21082. }
  21083. <?php
  21084. namespace Composer\Repository;
  21085. interface ConfigurableRepositoryInterface
  21086. {
  21087. public function getRepoConfig();
  21088. }
  21089. <?php
  21090. namespace Composer\Repository;
  21091. use Composer\Json\JsonFile;
  21092. use Composer\Package\Loader\ArrayLoader;
  21093. use Composer\Package\Dumper\ArrayDumper;
  21094. class FilesystemRepository extends WritableArrayRepository
  21095. {
  21096. private $file;
  21097. public function __construct(JsonFile $repositoryFile)
  21098. {
  21099. parent::__construct();
  21100. $this->file = $repositoryFile;
  21101. }
  21102. protected function initialize()
  21103. {
  21104. parent::initialize();
  21105. if (!$this->file->exists()) {
  21106. return;
  21107. }
  21108. try {
  21109. $packages = $this->file->read();
  21110. if (isset($packages['packages'])) {
  21111. $packages = $packages['packages'];
  21112. }
  21113. if (!is_array($packages)) {
  21114. throw new \UnexpectedValueException('Could not parse package list from the repository');
  21115. }
  21116. } catch (\Exception $e) {
  21117. throw new InvalidRepositoryException('Invalid repository data in '.$this->file->getPath().', packages could not be loaded: ['.get_class($e).'] '.$e->getMessage());
  21118. }
  21119. $loader = new ArrayLoader(null, true);
  21120. foreach ($packages as $packageData) {
  21121. $package = $loader->load($packageData);
  21122. $this->addPackage($package);
  21123. }
  21124. }
  21125. public function reload()
  21126. {
  21127. $this->packages = null;
  21128. $this->initialize();
  21129. }
  21130. public function write()
  21131. {
  21132. $data = array();
  21133. $dumper = new ArrayDumper();
  21134. foreach ($this->getCanonicalPackages() as $package) {
  21135. $data[] = $dumper->dump($package);
  21136. }
  21137. usort($data, function ($a, $b) {
  21138. return strcmp($a['name'], $b['name']);
  21139. });
  21140. $this->file->write($data);
  21141. }
  21142. }
  21143. <?php
  21144. namespace Composer\Repository;
  21145. class InstalledArrayRepository extends WritableArrayRepository implements InstalledRepositoryInterface
  21146. {
  21147. }
  21148. <?php
  21149. namespace Composer\Repository;
  21150. class InstalledFilesystemRepository extends FilesystemRepository implements InstalledRepositoryInterface
  21151. {
  21152. }
  21153. <?php
  21154. namespace Composer\Repository;
  21155. interface InstalledRepositoryInterface extends WritableRepositoryInterface
  21156. {
  21157. }
  21158. <?php
  21159. namespace Composer\Repository;
  21160. class InvalidRepositoryException extends \Exception
  21161. {
  21162. }
  21163. <?php
  21164. namespace Composer\Repository;
  21165. use Composer\Package\Loader\ArrayLoader;
  21166. use Composer\Package\Loader\ValidatingArrayLoader;
  21167. class PackageRepository extends ArrayRepository
  21168. {
  21169. private $config;
  21170. public function __construct(array $config)
  21171. {
  21172. parent::__construct();
  21173. $this->config = $config['package'];
  21174. if (!is_numeric(key($this->config))) {
  21175. $this->config = array($this->config);
  21176. }
  21177. }
  21178. protected function initialize()
  21179. {
  21180. parent::initialize();
  21181. $loader = new ValidatingArrayLoader(new ArrayLoader(null, true), false);
  21182. foreach ($this->config as $package) {
  21183. try {
  21184. $package = $loader->load($package);
  21185. } catch (\Exception $e) {
  21186. throw new InvalidRepositoryException('A repository of type "package" contains an invalid package definition: '.$e->getMessage()."\n\nInvalid package definition:\n".json_encode($package));
  21187. }
  21188. $this->addPackage($package);
  21189. }
  21190. }
  21191. }
  21192. <?php
  21193. namespace Composer\Repository;
  21194. use Composer\Config;
  21195. use Composer\IO\IOInterface;
  21196. use Composer\Json\JsonFile;
  21197. use Composer\Package\Loader\ArrayLoader;
  21198. use Composer\Package\Version\VersionGuesser;
  21199. use Composer\Package\Version\VersionParser;
  21200. use Composer\Util\Platform;
  21201. use Composer\Util\ProcessExecutor;
  21202. class PathRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  21203. {
  21204. private $loader;
  21205. private $versionGuesser;
  21206. private $url;
  21207. private $repoConfig;
  21208. private $process;
  21209. private $options;
  21210. public function __construct(array $repoConfig, IOInterface $io, Config $config)
  21211. {
  21212. if (!isset($repoConfig['url'])) {
  21213. throw new \RuntimeException('You must specify the `url` configuration for the path repository');
  21214. }
  21215. $this->loader = new ArrayLoader(null, true);
  21216. $this->url = Platform::expandPath($repoConfig['url']);
  21217. $this->process = new ProcessExecutor($io);
  21218. $this->versionGuesser = new VersionGuesser($config, $this->process, new VersionParser());
  21219. $this->repoConfig = $repoConfig;
  21220. $this->options = isset($repoConfig['options']) ? $repoConfig['options'] : array();
  21221. parent::__construct();
  21222. }
  21223. public function getRepoConfig()
  21224. {
  21225. return $this->repoConfig;
  21226. }
  21227. protected function initialize()
  21228. {
  21229. parent::initialize();
  21230. $urlMatches = $this->getUrlMatches();
  21231. if (empty($urlMatches)) {
  21232. throw new \RuntimeException('The `url` supplied for the path (' . $this->url . ') repository does not exist');
  21233. }
  21234. foreach ($urlMatches as $url) {
  21235. $path = realpath($url) . DIRECTORY_SEPARATOR;
  21236. $composerFilePath = $path.'composer.json';
  21237. if (!file_exists($composerFilePath)) {
  21238. continue;
  21239. }
  21240. $json = file_get_contents($composerFilePath);
  21241. $package = JsonFile::parseJson($json, $composerFilePath);
  21242. $package['dist'] = array(
  21243. 'type' => 'path',
  21244. 'url' => $url,
  21245. 'reference' => sha1($json . serialize($this->options)),
  21246. );
  21247. $package['transport-options'] = $this->options;
  21248. if (!isset($package['version']) && ($rootVersion = getenv('COMPOSER_ROOT_VERSION'))) {
  21249. if (
  21250. 0 === $this->process->execute('git rev-parse HEAD', $ref1, $path)
  21251. && 0 === $this->process->execute('git rev-parse HEAD', $ref2)
  21252. && $ref1 === $ref2
  21253. ) {
  21254. $package['version'] = $rootVersion;
  21255. }
  21256. }
  21257. if (!isset($package['version'])) {
  21258. $versionData = $this->versionGuesser->guessVersion($package, $path);
  21259. if (is_array($versionData) && $versionData['pretty_version']) {
  21260. $package['version'] = $versionData['pretty_version'];
  21261. } else {
  21262. $package['version'] = 'dev-master';
  21263. }
  21264. }
  21265. $output = '';
  21266. if (is_dir($path . DIRECTORY_SEPARATOR . '.git') && 0 === $this->process->execute('git log -n1 --pretty=%H', $output, $path)) {
  21267. $package['dist']['reference'] = trim($output);
  21268. }
  21269. $package = $this->loader->load($package);
  21270. $this->addPackage($package);
  21271. }
  21272. }
  21273. private function getUrlMatches()
  21274. {
  21275. $flags = GLOB_MARK | GLOB_ONLYDIR;
  21276. if (defined('GLOB_BRACE')) {
  21277. $flags |= GLOB_BRACE;
  21278. } elseif (strpos($this->url, '{') !== false || strpos($this->url, '}') !== false) {
  21279. throw new \RuntimeException('The operating system does not support GLOB_BRACE which is required for the url '. $this->url);
  21280. }
  21281. return array_map(function ($val) {
  21282. return rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $val), '/');
  21283. }, glob($this->url, $flags));
  21284. }
  21285. }
  21286. <?php
  21287. namespace Composer\Repository\Pear;
  21288. use Composer\Util\RemoteFilesystem;
  21289. abstract class BaseChannelReader
  21290. {
  21291. const CHANNEL_NS = 'http://pear.php.net/channel-1.0';
  21292. const ALL_CATEGORIES_NS = 'http://pear.php.net/dtd/rest.allcategories';
  21293. const CATEGORY_PACKAGES_INFO_NS = 'http://pear.php.net/dtd/rest.categorypackageinfo';
  21294. const ALL_PACKAGES_NS = 'http://pear.php.net/dtd/rest.allpackages';
  21295. const ALL_RELEASES_NS = 'http://pear.php.net/dtd/rest.allreleases';
  21296. const PACKAGE_INFO_NS = 'http://pear.php.net/dtd/rest.package';
  21297. private $rfs;
  21298. protected function __construct(RemoteFilesystem $rfs)
  21299. {
  21300. $this->rfs = $rfs;
  21301. }
  21302. protected function requestContent($origin, $path)
  21303. {
  21304. $url = rtrim($origin, '/') . '/' . ltrim($path, '/');
  21305. $content = $this->rfs->getContents($origin, $url, false);
  21306. if (!$content) {
  21307. throw new \UnexpectedValueException('The PEAR channel at ' . $url . ' did not respond.');
  21308. }
  21309. return str_replace('http://pear.php.net/rest/', 'https://pear.php.net/rest/', $content);
  21310. }
  21311. protected function requestXml($origin, $path)
  21312. {
  21313. $xml = simplexml_load_string($this->requestContent($origin, $path), "SimpleXMLElement", LIBXML_NOERROR);
  21314. if (false === $xml) {
  21315. throw new \UnexpectedValueException(sprintf('The PEAR channel at ' . $origin . ' is broken. (Invalid XML at file `%s`)', $path));
  21316. }
  21317. return $xml;
  21318. }
  21319. }
  21320. <?php
  21321. namespace Composer\Repository\Pear;
  21322. class ChannelInfo
  21323. {
  21324. private $name;
  21325. private $alias;
  21326. private $packages;
  21327. public function __construct($name, $alias, array $packages)
  21328. {
  21329. $this->name = $name;
  21330. $this->alias = $alias;
  21331. $this->packages = $packages;
  21332. }
  21333. public function getName()
  21334. {
  21335. return $this->name;
  21336. }
  21337. public function getAlias()
  21338. {
  21339. return $this->alias;
  21340. }
  21341. public function getPackages()
  21342. {
  21343. return $this->packages;
  21344. }
  21345. }
  21346. <?php
  21347. namespace Composer\Repository\Pear;
  21348. use Composer\Util\RemoteFilesystem;
  21349. class ChannelReader extends BaseChannelReader
  21350. {
  21351. private $readerMap;
  21352. public function __construct(RemoteFilesystem $rfs)
  21353. {
  21354. parent::__construct($rfs);
  21355. $rest10reader = new ChannelRest10Reader($rfs);
  21356. $rest11reader = new ChannelRest11Reader($rfs);
  21357. $this->readerMap = array(
  21358. 'REST1.3' => $rest11reader,
  21359. 'REST1.2' => $rest11reader,
  21360. 'REST1.1' => $rest11reader,
  21361. 'REST1.0' => $rest10reader,
  21362. );
  21363. }
  21364. public function read($url)
  21365. {
  21366. $xml = $this->requestXml($url, "/channel.xml");
  21367. $channelName = (string) $xml->name;
  21368. $channelAlias = (string) $xml->suggestedalias;
  21369. $supportedVersions = array_keys($this->readerMap);
  21370. $selectedRestVersion = $this->selectRestVersion($xml, $supportedVersions);
  21371. if (!$selectedRestVersion) {
  21372. throw new \UnexpectedValueException(sprintf('PEAR repository %s does not supports any of %s protocols.', $url, implode(', ', $supportedVersions)));
  21373. }
  21374. $reader = $this->readerMap[$selectedRestVersion['version']];
  21375. $packageDefinitions = $reader->read($selectedRestVersion['baseUrl']);
  21376. return new ChannelInfo($channelName, $channelAlias, $packageDefinitions);
  21377. }
  21378. private function selectRestVersion($channelXml, $supportedVersions)
  21379. {
  21380. $channelXml->registerXPathNamespace('ns', self::CHANNEL_NS);
  21381. foreach ($supportedVersions as $version) {
  21382. $xpathTest = "ns:servers/ns:*/ns:rest/ns:baseurl[@type='{$version}']";
  21383. $testResult = $channelXml->xpath($xpathTest);
  21384. foreach ($testResult as $result) {
  21385. $result = (string) $result;
  21386. if (preg_match('{^https://}i', $result)) {
  21387. return array('version' => $version, 'baseUrl' => $result);
  21388. }
  21389. }
  21390. if (count($testResult) > 0) {
  21391. return array('version' => $version, 'baseUrl' => (string) $testResult[0]);
  21392. }
  21393. }
  21394. return null;
  21395. }
  21396. }
  21397. <?php
  21398. namespace Composer\Repository\Pear;
  21399. use Composer\Downloader\TransportException;
  21400. class ChannelRest10Reader extends BaseChannelReader
  21401. {
  21402. private $dependencyReader;
  21403. public function __construct($rfs)
  21404. {
  21405. parent::__construct($rfs);
  21406. $this->dependencyReader = new PackageDependencyParser();
  21407. }
  21408. public function read($baseUrl)
  21409. {
  21410. return $this->readPackages($baseUrl);
  21411. }
  21412. private function readPackages($baseUrl)
  21413. {
  21414. $result = array();
  21415. $xmlPath = '/p/packages.xml';
  21416. $xml = $this->requestXml($baseUrl, $xmlPath);
  21417. $xml->registerXPathNamespace('ns', self::ALL_PACKAGES_NS);
  21418. foreach ($xml->xpath('ns:p') as $node) {
  21419. $packageName = (string) $node;
  21420. $packageInfo = $this->readPackage($baseUrl, $packageName);
  21421. $result[] = $packageInfo;
  21422. }
  21423. return $result;
  21424. }
  21425. private function readPackage($baseUrl, $packageName)
  21426. {
  21427. $xmlPath = '/p/' . strtolower($packageName) . '/info.xml';
  21428. $xml = $this->requestXml($baseUrl, $xmlPath);
  21429. $xml->registerXPathNamespace('ns', self::PACKAGE_INFO_NS);
  21430. $channelName = (string) $xml->c;
  21431. $packageName = (string) $xml->n;
  21432. $license = (string) $xml->l;
  21433. $shortDescription = (string) $xml->s;
  21434. $description = (string) $xml->d;
  21435. return new PackageInfo(
  21436. $channelName,
  21437. $packageName,
  21438. $license,
  21439. $shortDescription,
  21440. $description,
  21441. $this->readPackageReleases($baseUrl, $packageName)
  21442. );
  21443. }
  21444. private function readPackageReleases($baseUrl, $packageName)
  21445. {
  21446. $result = array();
  21447. try {
  21448. $xmlPath = '/r/' . strtolower($packageName) . '/allreleases.xml';
  21449. $xml = $this->requestXml($baseUrl, $xmlPath);
  21450. $xml->registerXPathNamespace('ns', self::ALL_RELEASES_NS);
  21451. foreach ($xml->xpath('ns:r') as $node) {
  21452. $releaseVersion = (string) $node->v;
  21453. $releaseStability = (string) $node->s;
  21454. try {
  21455. $result[$releaseVersion] = new ReleaseInfo(
  21456. $releaseStability,
  21457. $this->readPackageReleaseDependencies($baseUrl, $packageName, $releaseVersion)
  21458. );
  21459. } catch (TransportException $exception) {
  21460. if ($exception->getCode() != 404) {
  21461. throw $exception;
  21462. }
  21463. }
  21464. }
  21465. } catch (TransportException $exception) {
  21466. if ($exception->getCode() != 404) {
  21467. throw $exception;
  21468. }
  21469. }
  21470. return $result;
  21471. }
  21472. private function readPackageReleaseDependencies($baseUrl, $packageName, $version)
  21473. {
  21474. $dependencyReader = new PackageDependencyParser();
  21475. $depthPath = '/r/' . strtolower($packageName) . '/deps.' . $version . '.txt';
  21476. $content = $this->requestContent($baseUrl, $depthPath);
  21477. $dependencyArray = unserialize($content);
  21478. return $dependencyReader->buildDependencyInfo($dependencyArray);
  21479. }
  21480. }
  21481. <?php
  21482. namespace Composer\Repository\Pear;
  21483. class ChannelRest11Reader extends BaseChannelReader
  21484. {
  21485. private $dependencyReader;
  21486. public function __construct($rfs)
  21487. {
  21488. parent::__construct($rfs);
  21489. $this->dependencyReader = new PackageDependencyParser();
  21490. }
  21491. public function read($baseUrl)
  21492. {
  21493. return $this->readChannelPackages($baseUrl);
  21494. }
  21495. private function readChannelPackages($baseUrl)
  21496. {
  21497. $result = array();
  21498. $xml = $this->requestXml($baseUrl, "/c/categories.xml");
  21499. $xml->registerXPathNamespace('ns', self::ALL_CATEGORIES_NS);
  21500. foreach ($xml->xpath('ns:c') as $node) {
  21501. $categoryName = (string) $node;
  21502. $categoryPackages = $this->readCategoryPackages($baseUrl, $categoryName);
  21503. $result = array_merge($result, $categoryPackages);
  21504. }
  21505. return $result;
  21506. }
  21507. private function readCategoryPackages($baseUrl, $categoryName)
  21508. {
  21509. $result = array();
  21510. $categoryPath = '/c/'.urlencode($categoryName).'/packagesinfo.xml';
  21511. $xml = $this->requestXml($baseUrl, $categoryPath);
  21512. $xml->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  21513. foreach ($xml->xpath('ns:pi') as $node) {
  21514. $packageInfo = $this->parsePackage($node);
  21515. $result[] = $packageInfo;
  21516. }
  21517. return $result;
  21518. }
  21519. private function parsePackage($packageInfo)
  21520. {
  21521. $packageInfo->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  21522. $channelName = (string) $packageInfo->p->c;
  21523. $packageName = (string) $packageInfo->p->n;
  21524. $license = (string) $packageInfo->p->l;
  21525. $shortDescription = (string) $packageInfo->p->s;
  21526. $description = (string) $packageInfo->p->d;
  21527. $dependencies = array();
  21528. foreach ($packageInfo->xpath('ns:deps') as $node) {
  21529. $dependencyVersion = (string) $node->v;
  21530. $dependencyArray = unserialize((string) $node->d);
  21531. $dependencyInfo = $this->dependencyReader->buildDependencyInfo($dependencyArray);
  21532. $dependencies[$dependencyVersion] = $dependencyInfo;
  21533. }
  21534. $releases = array();
  21535. $releasesInfo = $packageInfo->xpath('ns:a/ns:r');
  21536. if ($releasesInfo) {
  21537. foreach ($releasesInfo as $node) {
  21538. $releaseVersion = (string) $node->v;
  21539. $releaseStability = (string) $node->s;
  21540. $releases[$releaseVersion] = new ReleaseInfo(
  21541. $releaseStability,
  21542. isset($dependencies[$releaseVersion]) ? $dependencies[$releaseVersion] : new DependencyInfo(array(), array())
  21543. );
  21544. }
  21545. }
  21546. return new PackageInfo(
  21547. $channelName,
  21548. $packageName,
  21549. $license,
  21550. $shortDescription,
  21551. $description,
  21552. $releases
  21553. );
  21554. }
  21555. }
  21556. <?php
  21557. namespace Composer\Repository\Pear;
  21558. class DependencyConstraint
  21559. {
  21560. private $type;
  21561. private $constraint;
  21562. private $channelName;
  21563. private $packageName;
  21564. public function __construct($type, $constraint, $channelName, $packageName)
  21565. {
  21566. $this->type = $type;
  21567. $this->constraint = $constraint;
  21568. $this->channelName = $channelName;
  21569. $this->packageName = $packageName;
  21570. }
  21571. public function getChannelName()
  21572. {
  21573. return $this->channelName;
  21574. }
  21575. public function getConstraint()
  21576. {
  21577. return $this->constraint;
  21578. }
  21579. public function getPackageName()
  21580. {
  21581. return $this->packageName;
  21582. }
  21583. public function getType()
  21584. {
  21585. return $this->type;
  21586. }
  21587. }
  21588. <?php
  21589. namespace Composer\Repository\Pear;
  21590. class DependencyInfo
  21591. {
  21592. private $requires;
  21593. private $optionals;
  21594. public function __construct($requires, $optionals)
  21595. {
  21596. $this->requires = $requires;
  21597. $this->optionals = $optionals;
  21598. }
  21599. public function getRequires()
  21600. {
  21601. return $this->requires;
  21602. }
  21603. public function getOptionals()
  21604. {
  21605. return $this->optionals;
  21606. }
  21607. }
  21608. <?php
  21609. namespace Composer\Repository\Pear;
  21610. class PackageDependencyParser
  21611. {
  21612. public function buildDependencyInfo($depArray)
  21613. {
  21614. if (!is_array($depArray)) {
  21615. return new DependencyInfo(array(), array());
  21616. }
  21617. if (!$this->isHash($depArray)) {
  21618. return new DependencyInfo($this->buildDependency10Info($depArray), array());
  21619. }
  21620. return $this->buildDependency20Info($depArray);
  21621. }
  21622. private function buildDependency10Info($depArray)
  21623. {
  21624. static $dep10toOperatorMap = array('has' => '==', 'eq' => '==', 'ge' => '>=', 'gt' => '>', 'le' => '<=', 'lt' => '<', 'not' => '!=');
  21625. $result = array();
  21626. foreach ($depArray as $depItem) {
  21627. if (empty($depItem['rel']) || !array_key_exists($depItem['rel'], $dep10toOperatorMap)) {
  21628. continue;
  21629. }
  21630. $depType = !empty($depItem['optional']) && 'yes' == $depItem['optional']
  21631. ? 'optional'
  21632. : 'required';
  21633. $depType = 'not' == $depItem['rel']
  21634. ? 'conflicts'
  21635. : $depType;
  21636. $depVersion = !empty($depItem['version']) ? $this->parseVersion($depItem['version']) : '*';
  21637. $depVersionConstraint = ('has' == $depItem['rel'] || 'not' == $depItem['rel']) && '*' == $depVersion
  21638. ? '*'
  21639. : $dep10toOperatorMap[$depItem['rel']] . $depVersion;
  21640. switch ($depItem['type']) {
  21641. case 'php':
  21642. $depChannelName = 'php';
  21643. $depPackageName = '';
  21644. break;
  21645. case 'pkg':
  21646. $depChannelName = !empty($depItem['channel']) ? $depItem['channel'] : 'pear.php.net';
  21647. $depPackageName = $depItem['name'];
  21648. break;
  21649. case 'ext':
  21650. $depChannelName = 'ext';
  21651. $depPackageName = $depItem['name'];
  21652. break;
  21653. case 'os':
  21654. case 'sapi':
  21655. $depChannelName = '';
  21656. $depPackageName = '';
  21657. break;
  21658. default:
  21659. $depChannelName = '';
  21660. $depPackageName = '';
  21661. break;
  21662. }
  21663. if ('' != $depChannelName) {
  21664. $result[] = new DependencyConstraint(
  21665. $depType,
  21666. $depVersionConstraint,
  21667. $depChannelName,
  21668. $depPackageName
  21669. );
  21670. }
  21671. }
  21672. return $result;
  21673. }
  21674. private function buildDependency20Info($depArray)
  21675. {
  21676. $result = array();
  21677. $optionals = array();
  21678. $defaultOptionals = array();
  21679. foreach ($depArray as $depType => $depTypeGroup) {
  21680. if (!is_array($depTypeGroup)) {
  21681. continue;
  21682. }
  21683. if ('required' == $depType || 'optional' == $depType) {
  21684. foreach ($depTypeGroup as $depItemType => $depItem) {
  21685. switch ($depItemType) {
  21686. case 'php':
  21687. $result[] = new DependencyConstraint(
  21688. $depType,
  21689. $this->parse20VersionConstraint($depItem),
  21690. 'php',
  21691. ''
  21692. );
  21693. break;
  21694. case 'package':
  21695. $deps = $this->buildDepPackageConstraints($depItem, $depType);
  21696. $result = array_merge($result, $deps);
  21697. break;
  21698. case 'extension':
  21699. $deps = $this->buildDepExtensionConstraints($depItem, $depType);
  21700. $result = array_merge($result, $deps);
  21701. break;
  21702. case 'subpackage':
  21703. $deps = $this->buildDepPackageConstraints($depItem, 'replaces');
  21704. $defaultOptionals += $deps;
  21705. break;
  21706. case 'os':
  21707. case 'pearinstaller':
  21708. break;
  21709. default:
  21710. break;
  21711. }
  21712. }
  21713. } elseif ('group' == $depType) {
  21714. if ($this->isHash($depTypeGroup)) {
  21715. $depTypeGroup = array($depTypeGroup);
  21716. }
  21717. foreach ($depTypeGroup as $depItem) {
  21718. $groupName = $depItem['attribs']['name'];
  21719. if (!isset($optionals[$groupName])) {
  21720. $optionals[$groupName] = array();
  21721. }
  21722. if (isset($depItem['subpackage'])) {
  21723. $optionals[$groupName] += $this->buildDepPackageConstraints($depItem['subpackage'], 'replaces');
  21724. } else {
  21725. $result += $this->buildDepPackageConstraints($depItem['package'], 'optional');
  21726. }
  21727. }
  21728. }
  21729. }
  21730. if (count($defaultOptionals) > 0) {
  21731. $optionals['*'] = $defaultOptionals;
  21732. }
  21733. return new DependencyInfo($result, $optionals);
  21734. }
  21735. private function buildDepExtensionConstraints($depItem, $depType)
  21736. {
  21737. if ($this->isHash($depItem)) {
  21738. $depItem = array($depItem);
  21739. }
  21740. $result = array();
  21741. foreach ($depItem as $subDepItem) {
  21742. $depChannelName = 'ext';
  21743. $depPackageName = $subDepItem['name'];
  21744. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  21745. $result[] = new DependencyConstraint(
  21746. $depType,
  21747. $depVersionConstraint,
  21748. $depChannelName,
  21749. $depPackageName
  21750. );
  21751. }
  21752. return $result;
  21753. }
  21754. private function buildDepPackageConstraints($depItem, $depType)
  21755. {
  21756. if ($this->isHash($depItem)) {
  21757. $depItem = array($depItem);
  21758. }
  21759. $result = array();
  21760. foreach ($depItem as $subDepItem) {
  21761. if (!array_key_exists('channel', $subDepItem)) {
  21762. $subDepItem['channel'] = $subDepItem['uri'];
  21763. }
  21764. $depChannelName = $subDepItem['channel'];
  21765. $depPackageName = $subDepItem['name'];
  21766. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  21767. if (isset($subDepItem['conflicts'])) {
  21768. $depType = 'conflicts';
  21769. }
  21770. $result[] = new DependencyConstraint(
  21771. $depType,
  21772. $depVersionConstraint,
  21773. $depChannelName,
  21774. $depPackageName
  21775. );
  21776. }
  21777. return $result;
  21778. }
  21779. private function parse20VersionConstraint(array $data)
  21780. {
  21781. static $dep20toOperatorMap = array('has' => '==', 'min' => '>=', 'max' => '<=', 'exclude' => '!=');
  21782. $versions = array();
  21783. $values = array_intersect_key($data, $dep20toOperatorMap);
  21784. if (0 == count($values)) {
  21785. return '*';
  21786. }
  21787. if (isset($values['min']) && isset($values['exclude']) && $data['min'] == $data['exclude']) {
  21788. $versions[] = '>' . $this->parseVersion($values['min']);
  21789. } elseif (isset($values['max']) && isset($values['exclude']) && $data['max'] == $data['exclude']) {
  21790. $versions[] = '<' . $this->parseVersion($values['max']);
  21791. } else {
  21792. foreach ($values as $op => $version) {
  21793. if ('exclude' == $op && is_array($version)) {
  21794. foreach ($version as $versionPart) {
  21795. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($versionPart);
  21796. }
  21797. } else {
  21798. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($version);
  21799. }
  21800. }
  21801. }
  21802. return implode(',', $versions);
  21803. }
  21804. private function parseVersion($version)
  21805. {
  21806. if (preg_match('{^v?(\d{1,3})(\.\d+)?(\.\d+)?(\.\d+)?}i', $version, $matches)) {
  21807. $version = $matches[1]
  21808. .(!empty($matches[2]) ? $matches[2] : '.0')
  21809. .(!empty($matches[3]) ? $matches[3] : '.0')
  21810. .(!empty($matches[4]) ? $matches[4] : '.0');
  21811. return $version;
  21812. }
  21813. return null;
  21814. }
  21815. private function isHash(array $array)
  21816. {
  21817. return !array_key_exists(1, $array) && !array_key_exists(0, $array);
  21818. }
  21819. }
  21820. <?php
  21821. namespace Composer\Repository\Pear;
  21822. class PackageInfo
  21823. {
  21824. private $channelName;
  21825. private $packageName;
  21826. private $license;
  21827. private $shortDescription;
  21828. private $description;
  21829. private $releases;
  21830. public function __construct($channelName, $packageName, $license, $shortDescription, $description, $releases)
  21831. {
  21832. $this->channelName = $channelName;
  21833. $this->packageName = $packageName;
  21834. $this->license = $license;
  21835. $this->shortDescription = $shortDescription;
  21836. $this->description = $description;
  21837. $this->releases = $releases;
  21838. }
  21839. public function getChannelName()
  21840. {
  21841. return $this->channelName;
  21842. }
  21843. public function getPackageName()
  21844. {
  21845. return $this->packageName;
  21846. }
  21847. public function getDescription()
  21848. {
  21849. return $this->description;
  21850. }
  21851. public function getShortDescription()
  21852. {
  21853. return $this->shortDescription;
  21854. }
  21855. public function getLicense()
  21856. {
  21857. return $this->license;
  21858. }
  21859. public function getReleases()
  21860. {
  21861. return $this->releases;
  21862. }
  21863. }
  21864. <?php
  21865. namespace Composer\Repository\Pear;
  21866. class ReleaseInfo
  21867. {
  21868. private $stability;
  21869. private $dependencyInfo;
  21870. public function __construct($stability, $dependencyInfo)
  21871. {
  21872. $this->stability = $stability;
  21873. $this->dependencyInfo = $dependencyInfo;
  21874. }
  21875. public function getDependencyInfo()
  21876. {
  21877. return $this->dependencyInfo;
  21878. }
  21879. public function getStability()
  21880. {
  21881. return $this->stability;
  21882. }
  21883. }
  21884. <?php
  21885. namespace Composer\Repository;
  21886. use Composer\IO\IOInterface;
  21887. use Composer\Semver\VersionParser as SemverVersionParser;
  21888. use Composer\Package\Version\VersionParser;
  21889. use Composer\Repository\Pear\ChannelReader;
  21890. use Composer\Package\CompletePackage;
  21891. use Composer\Repository\Pear\ChannelInfo;
  21892. use Composer\EventDispatcher\EventDispatcher;
  21893. use Composer\Package\Link;
  21894. use Composer\Semver\Constraint\Constraint;
  21895. use Composer\Util\RemoteFilesystem;
  21896. use Composer\Config;
  21897. use Composer\Factory;
  21898. class PearRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  21899. {
  21900. private $url;
  21901. private $io;
  21902. private $rfs;
  21903. private $versionParser;
  21904. private $repoConfig;
  21905. private $vendorAlias;
  21906. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, RemoteFilesystem $rfs = null)
  21907. {
  21908. parent::__construct();
  21909. if (!preg_match('{^https?://}', $repoConfig['url'])) {
  21910. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  21911. }
  21912. $urlBits = parse_url($repoConfig['url']);
  21913. if (empty($urlBits['scheme']) || empty($urlBits['host'])) {
  21914. throw new \UnexpectedValueException('Invalid url given for PEAR repository: '.$repoConfig['url']);
  21915. }
  21916. $this->url = rtrim($repoConfig['url'], '/');
  21917. $this->io = $io;
  21918. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  21919. $this->vendorAlias = isset($repoConfig['vendor-alias']) ? $repoConfig['vendor-alias'] : null;
  21920. $this->versionParser = new VersionParser();
  21921. $this->repoConfig = $repoConfig;
  21922. }
  21923. public function getRepoConfig()
  21924. {
  21925. return $this->repoConfig;
  21926. }
  21927. protected function initialize()
  21928. {
  21929. parent::initialize();
  21930. $this->io->writeError('Initializing PEAR repository '.$this->url);
  21931. $reader = new ChannelReader($this->rfs);
  21932. try {
  21933. $channelInfo = $reader->read($this->url);
  21934. } catch (\Exception $e) {
  21935. $this->io->writeError('<warning>PEAR repository from '.$this->url.' could not be loaded. '.$e->getMessage().'</warning>');
  21936. return;
  21937. }
  21938. $packages = $this->buildComposerPackages($channelInfo, $this->versionParser);
  21939. foreach ($packages as $package) {
  21940. $this->addPackage($package);
  21941. }
  21942. }
  21943. private function buildComposerPackages(ChannelInfo $channelInfo, SemverVersionParser $versionParser)
  21944. {
  21945. $result = array();
  21946. foreach ($channelInfo->getPackages() as $packageDefinition) {
  21947. foreach ($packageDefinition->getReleases() as $version => $releaseInfo) {
  21948. try {
  21949. $normalizedVersion = $versionParser->normalize($version);
  21950. } catch (\UnexpectedValueException $e) {
  21951. $this->io->writeError('Could not load '.$packageDefinition->getPackageName().' '.$version.': '.$e->getMessage(), true, IOInterface::VERBOSE);
  21952. continue;
  21953. }
  21954. $composerPackageName = $this->buildComposerPackageName($packageDefinition->getChannelName(), $packageDefinition->getPackageName());
  21955. $urlBits = parse_url($this->url);
  21956. $scheme = (isset($urlBits['scheme']) && 'https' === $urlBits['scheme'] && extension_loaded('openssl')) ? 'https' : 'http';
  21957. $distUrl = "{$scheme}://{$packageDefinition->getChannelName()}/get/{$packageDefinition->getPackageName()}-{$version}.tgz";
  21958. $requires = array();
  21959. $suggests = array();
  21960. $conflicts = array();
  21961. $replaces = array();
  21962. if ($channelInfo->getName() == $packageDefinition->getChannelName()) {
  21963. $composerPackageAlias = $this->buildComposerPackageName($channelInfo->getAlias(), $packageDefinition->getPackageName());
  21964. $aliasConstraint = new Constraint('==', $normalizedVersion);
  21965. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  21966. }
  21967. if (!empty($this->vendorAlias)
  21968. && ($this->vendorAlias != 'pear-'.$channelInfo->getAlias() || $channelInfo->getName() != $packageDefinition->getChannelName())
  21969. ) {
  21970. $composerPackageAlias = "{$this->vendorAlias}/{$packageDefinition->getPackageName()}";
  21971. $aliasConstraint = new Constraint('==', $normalizedVersion);
  21972. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  21973. }
  21974. foreach ($releaseInfo->getDependencyInfo()->getRequires() as $dependencyConstraint) {
  21975. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  21976. $constraint = $versionParser->parseConstraints($dependencyConstraint->getConstraint());
  21977. $link = new Link($composerPackageName, $dependencyPackageName, $constraint, $dependencyConstraint->getType(), $dependencyConstraint->getConstraint());
  21978. switch ($dependencyConstraint->getType()) {
  21979. case 'required':
  21980. $requires[] = $link;
  21981. break;
  21982. case 'conflicts':
  21983. $conflicts[] = $link;
  21984. break;
  21985. case 'replaces':
  21986. $replaces[] = $link;
  21987. break;
  21988. }
  21989. }
  21990. foreach ($releaseInfo->getDependencyInfo()->getOptionals() as $group => $dependencyConstraints) {
  21991. foreach ($dependencyConstraints as $dependencyConstraint) {
  21992. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  21993. $suggests[$group.'-'.$dependencyPackageName] = $dependencyConstraint->getConstraint();
  21994. }
  21995. }
  21996. $package = new CompletePackage($composerPackageName, $normalizedVersion, $version);
  21997. $package->setType('pear-library');
  21998. $package->setDescription($packageDefinition->getDescription());
  21999. $package->setLicense(array($packageDefinition->getLicense()));
  22000. $package->setDistType('file');
  22001. $package->setDistUrl($distUrl);
  22002. $package->setAutoload(array('classmap' => array('')));
  22003. $package->setIncludePaths(array('/'));
  22004. $package->setRequires($requires);
  22005. $package->setConflicts($conflicts);
  22006. $package->setSuggests($suggests);
  22007. $package->setReplaces($replaces);
  22008. $result[] = $package;
  22009. }
  22010. }
  22011. return $result;
  22012. }
  22013. private function buildComposerPackageName($channelName, $packageName)
  22014. {
  22015. if ('php' === $channelName) {
  22016. return "php";
  22017. }
  22018. if ('ext' === $channelName) {
  22019. return "ext-{$packageName}";
  22020. }
  22021. return "pear-{$channelName}/{$packageName}";
  22022. }
  22023. }
  22024. <?php
  22025. namespace Composer\Repository;
  22026. use Composer\Package\CompletePackage;
  22027. use Composer\Package\PackageInterface;
  22028. use Composer\Package\Version\VersionParser;
  22029. use Composer\Plugin\PluginInterface;
  22030. use Composer\Util\ProcessExecutor;
  22031. use Composer\Util\Silencer;
  22032. use Composer\Util\Platform;
  22033. use Composer\XdebugHandler\XdebugHandler;
  22034. use Symfony\Component\Process\ExecutableFinder;
  22035. class PlatformRepository extends ArrayRepository
  22036. {
  22037. const PLATFORM_PACKAGE_REGEX = '{^(?:php(?:-64bit|-ipv6|-zts|-debug)?|hhvm|(?:ext|lib)-[a-z0-9](?:[_.-]?[a-z0-9]+)*|composer-plugin-api)$}iD';
  22038. private $versionParser;
  22039. private $overrides = array();
  22040. private $process;
  22041. public function __construct(array $packages = array(), array $overrides = array(), ProcessExecutor $process = null)
  22042. {
  22043. $this->process = $process === null ? (new ProcessExecutor()) : $process;
  22044. foreach ($overrides as $name => $version) {
  22045. $this->overrides[strtolower($name)] = array('name' => $name, 'version' => $version);
  22046. }
  22047. parent::__construct($packages);
  22048. }
  22049. protected function initialize()
  22050. {
  22051. parent::initialize();
  22052. $this->versionParser = new VersionParser();
  22053. foreach ($this->overrides as $override) {
  22054. if (!preg_match(self::PLATFORM_PACKAGE_REGEX, $override['name'])) {
  22055. throw new \InvalidArgumentException('Invalid platform package name in config.platform: '.$override['name']);
  22056. }
  22057. $this->addOverriddenPackage($override);
  22058. }
  22059. $prettyVersion = PluginInterface::PLUGIN_API_VERSION;
  22060. $version = $this->versionParser->normalize($prettyVersion);
  22061. $composerPluginApi = new CompletePackage('composer-plugin-api', $version, $prettyVersion);
  22062. $composerPluginApi->setDescription('The Composer Plugin API');
  22063. $this->addPackage($composerPluginApi);
  22064. try {
  22065. $prettyVersion = PHP_VERSION;
  22066. $version = $this->versionParser->normalize($prettyVersion);
  22067. } catch (\UnexpectedValueException $e) {
  22068. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', PHP_VERSION);
  22069. $version = $this->versionParser->normalize($prettyVersion);
  22070. }
  22071. $php = new CompletePackage('php', $version, $prettyVersion);
  22072. $php->setDescription('The PHP interpreter');
  22073. $this->addPackage($php);
  22074. if (PHP_DEBUG) {
  22075. $phpdebug = new CompletePackage('php-debug', $version, $prettyVersion);
  22076. $phpdebug->setDescription('The PHP interpreter, with debugging symbols');
  22077. $this->addPackage($phpdebug);
  22078. }
  22079. if (defined('PHP_ZTS') && PHP_ZTS) {
  22080. $phpzts = new CompletePackage('php-zts', $version, $prettyVersion);
  22081. $phpzts->setDescription('The PHP interpreter, with Zend Thread Safety');
  22082. $this->addPackage($phpzts);
  22083. }
  22084. if (PHP_INT_SIZE === 8) {
  22085. $php64 = new CompletePackage('php-64bit', $version, $prettyVersion);
  22086. $php64->setDescription('The PHP interpreter, 64bit');
  22087. $this->addPackage($php64);
  22088. }
  22089. if (defined('AF_INET6') || Silencer::call('inet_pton', '::') !== false) {
  22090. $phpIpv6 = new CompletePackage('php-ipv6', $version, $prettyVersion);
  22091. $phpIpv6->setDescription('The PHP interpreter, with IPv6 support');
  22092. $this->addPackage($phpIpv6);
  22093. }
  22094. $loadedExtensions = get_loaded_extensions();
  22095. foreach ($loadedExtensions as $name) {
  22096. if (in_array($name, array('standard', 'Core'))) {
  22097. continue;
  22098. }
  22099. $reflExt = new \ReflectionExtension($name);
  22100. $prettyVersion = $reflExt->getVersion();
  22101. $this->addExtension($name, $prettyVersion);
  22102. }
  22103. if (!in_array('xdebug', $loadedExtensions, true) && ($prettyVersion = XdebugHandler::getSkippedVersion())) {
  22104. $this->addExtension('xdebug', $prettyVersion);
  22105. }
  22106. foreach ($loadedExtensions as $name) {
  22107. $prettyVersion = null;
  22108. $description = 'The '.$name.' PHP library';
  22109. switch ($name) {
  22110. case 'curl':
  22111. $curlVersion = curl_version();
  22112. $prettyVersion = $curlVersion['version'];
  22113. break;
  22114. case 'iconv':
  22115. $prettyVersion = ICONV_VERSION;
  22116. break;
  22117. case 'intl':
  22118. $name = 'ICU';
  22119. if (defined('INTL_ICU_VERSION')) {
  22120. $prettyVersion = INTL_ICU_VERSION;
  22121. } else {
  22122. $reflector = new \ReflectionExtension('intl');
  22123. ob_start();
  22124. $reflector->info();
  22125. $output = ob_get_clean();
  22126. preg_match('/^ICU version => (.*)$/m', $output, $matches);
  22127. $prettyVersion = $matches[1];
  22128. }
  22129. break;
  22130. case 'imagick':
  22131. $imagick = new \Imagick();
  22132. $imageMagickVersion = $imagick->getVersion();
  22133. preg_match('/^ImageMagick ([\d.]+)(?:-(\d+))?/', $imageMagickVersion['versionString'], $matches);
  22134. if (isset($matches[2])) {
  22135. $prettyVersion = "{$matches[1]}.{$matches[2]}";
  22136. } else {
  22137. $prettyVersion = $matches[1];
  22138. }
  22139. break;
  22140. case 'libxml':
  22141. $prettyVersion = LIBXML_DOTTED_VERSION;
  22142. break;
  22143. case 'openssl':
  22144. $prettyVersion = preg_replace_callback('{^(?:OpenSSL|LibreSSL)?\s*([0-9.]+)([a-z]*).*}i', function ($match) {
  22145. if (empty($match[2])) {
  22146. return $match[1];
  22147. }
  22148. if (!preg_match('{^z*[a-z]$}', $match[2])) {
  22149. return 0;
  22150. }
  22151. $len = strlen($match[2]);
  22152. $patchVersion = ($len - 1) * 26;
  22153. $patchVersion += ord($match[2][$len - 1]) - 96;
  22154. return $match[1].'.'.$patchVersion;
  22155. }, OPENSSL_VERSION_TEXT);
  22156. $description = OPENSSL_VERSION_TEXT;
  22157. break;
  22158. case 'pcre':
  22159. $prettyVersion = preg_replace('{^(\S+).*}', '$1', PCRE_VERSION);
  22160. break;
  22161. case 'uuid':
  22162. $prettyVersion = phpversion('uuid');
  22163. break;
  22164. case 'xsl':
  22165. $prettyVersion = LIBXSLT_DOTTED_VERSION;
  22166. break;
  22167. default:
  22168. continue 2;
  22169. }
  22170. try {
  22171. $version = $this->versionParser->normalize($prettyVersion);
  22172. } catch (\UnexpectedValueException $e) {
  22173. continue;
  22174. }
  22175. $lib = new CompletePackage('lib-'.$name, $version, $prettyVersion);
  22176. $lib->setDescription($description);
  22177. $this->addPackage($lib);
  22178. }
  22179. $hhvmVersion = defined('HHVM_VERSION') ? HHVM_VERSION : null;
  22180. if ($hhvmVersion === null && !Platform::isWindows()) {
  22181. $finder = new ExecutableFinder();
  22182. $hhvm = $finder->find('hhvm');
  22183. if ($hhvm !== null) {
  22184. $exitCode = $this->process->execute(
  22185. ProcessExecutor::escape($hhvm).
  22186. ' --php -d hhvm.jit=0 -r "echo HHVM_VERSION;" 2>/dev/null',
  22187. $hhvmVersion
  22188. );
  22189. if ($exitCode !== 0) {
  22190. $hhvmVersion = null;
  22191. }
  22192. }
  22193. }
  22194. if ($hhvmVersion) {
  22195. try {
  22196. $prettyVersion = $hhvmVersion;
  22197. $version = $this->versionParser->normalize($prettyVersion);
  22198. } catch (\UnexpectedValueException $e) {
  22199. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', $hhvmVersion);
  22200. $version = $this->versionParser->normalize($prettyVersion);
  22201. }
  22202. $hhvm = new CompletePackage('hhvm', $version, $prettyVersion);
  22203. $hhvm->setDescription('The HHVM Runtime (64bit)');
  22204. $this->addPackage($hhvm);
  22205. }
  22206. }
  22207. public function addPackage(PackageInterface $package)
  22208. {
  22209. if (isset($this->overrides[$package->getName()])) {
  22210. $overrider = $this->findPackage($package->getName(), '*');
  22211. if ($package->getVersion() === $overrider->getVersion()) {
  22212. $actualText = 'same as actual';
  22213. } else {
  22214. $actualText = 'actual: '.$package->getPrettyVersion();
  22215. }
  22216. $overrider->setDescription($overrider->getDescription().' ('.$actualText.')');
  22217. return;
  22218. }
  22219. if (isset($this->overrides['php']) && 0 === strpos($package->getName(), 'php-')) {
  22220. $overrider = $this->addOverriddenPackage($this->overrides['php'], $package->getPrettyName());
  22221. if ($package->getVersion() === $overrider->getVersion()) {
  22222. $actualText = 'same as actual';
  22223. } else {
  22224. $actualText = 'actual: '.$package->getPrettyVersion();
  22225. }
  22226. $overrider->setDescription($overrider->getDescription().' ('.$actualText.')');
  22227. return;
  22228. }
  22229. parent::addPackage($package);
  22230. }
  22231. private function addOverriddenPackage(array $override, $name = null)
  22232. {
  22233. $version = $this->versionParser->normalize($override['version']);
  22234. $package = new CompletePackage($name ?: $override['name'], $version, $override['version']);
  22235. $package->setDescription('Package overridden via config.platform');
  22236. $package->setExtra(array('config.platform' => true));
  22237. parent::addPackage($package);
  22238. return $package;
  22239. }
  22240. private function addExtension($name, $prettyVersion)
  22241. {
  22242. $extraDescription = null;
  22243. try {
  22244. $version = $this->versionParser->normalize($prettyVersion);
  22245. } catch (\UnexpectedValueException $e) {
  22246. $extraDescription = ' (actual version: '.$prettyVersion.')';
  22247. if (preg_match('{^(\d+\.\d+\.\d+(?:\.\d+)?)}', $prettyVersion, $match)) {
  22248. $prettyVersion = $match[1];
  22249. } else {
  22250. $prettyVersion = '0';
  22251. }
  22252. $version = $this->versionParser->normalize($prettyVersion);
  22253. }
  22254. $packageName = $this->buildPackageName($name);
  22255. $ext = new CompletePackage($packageName, $version, $prettyVersion);
  22256. $ext->setDescription('The '.$name.' PHP extension'.$extraDescription);
  22257. $this->addPackage($ext);
  22258. }
  22259. private function buildPackageName($name)
  22260. {
  22261. return 'ext-' . str_replace(' ', '-', $name);
  22262. }
  22263. }
  22264. <?php
  22265. namespace Composer\Repository;
  22266. use Composer\Factory;
  22267. use Composer\IO\IOInterface;
  22268. use Composer\Config;
  22269. use Composer\EventDispatcher\EventDispatcher;
  22270. use Composer\Util\RemoteFilesystem;
  22271. use Composer\Json\JsonFile;
  22272. class RepositoryFactory
  22273. {
  22274. public static function configFromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
  22275. {
  22276. if (0 === strpos($repository, 'http')) {
  22277. $repoConfig = array('type' => 'composer', 'url' => $repository);
  22278. } elseif ("json" === pathinfo($repository, PATHINFO_EXTENSION)) {
  22279. $json = new JsonFile($repository, Factory::createRemoteFilesystem($io, $config));
  22280. $data = $json->read();
  22281. if (!empty($data['packages']) || !empty($data['includes']) || !empty($data['provider-includes'])) {
  22282. $repoConfig = array('type' => 'composer', 'url' => 'file://' . strtr(realpath($repository), '\\', '/'));
  22283. } elseif ($allowFilesystem) {
  22284. $repoConfig = array('type' => 'filesystem', 'json' => $json);
  22285. } else {
  22286. throw new \InvalidArgumentException("Invalid repository URL ($repository) given. This file does not contain a valid composer repository.");
  22287. }
  22288. } elseif ('{' === substr($repository, 0, 1)) {
  22289. $repoConfig = JsonFile::parseJson($repository);
  22290. } else {
  22291. throw new \InvalidArgumentException("Invalid repository url ($repository) given. Has to be a .json file, an http url or a JSON object.");
  22292. }
  22293. return $repoConfig;
  22294. }
  22295. public static function fromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
  22296. {
  22297. $repoConfig = static::configFromString($io, $config, $repository, $allowFilesystem);
  22298. return static::createRepo($io, $config, $repoConfig);
  22299. }
  22300. public static function createRepo(IOInterface $io, Config $config, array $repoConfig)
  22301. {
  22302. $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
  22303. $repos = static::createRepos($rm, array($repoConfig));
  22304. return reset($repos);
  22305. }
  22306. public static function defaultRepos(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  22307. {
  22308. if (!$config) {
  22309. $config = Factory::createConfig($io);
  22310. }
  22311. if ($io) {
  22312. $io->loadConfiguration($config);
  22313. }
  22314. if (!$rm) {
  22315. if (!$io) {
  22316. throw new \InvalidArgumentException('This function requires either an IOInterface or a RepositoryManager');
  22317. }
  22318. $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
  22319. }
  22320. return static::createRepos($rm, $config->getRepositories());
  22321. }
  22322. public static function manager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  22323. {
  22324. $rm = new RepositoryManager($io, $config, $eventDispatcher, $rfs);
  22325. $rm->setRepositoryClass('composer', 'Composer\Repository\ComposerRepository');
  22326. $rm->setRepositoryClass('vcs', 'Composer\Repository\VcsRepository');
  22327. $rm->setRepositoryClass('package', 'Composer\Repository\PackageRepository');
  22328. $rm->setRepositoryClass('pear', 'Composer\Repository\PearRepository');
  22329. $rm->setRepositoryClass('git', 'Composer\Repository\VcsRepository');
  22330. $rm->setRepositoryClass('git-bitbucket', 'Composer\Repository\VcsRepository');
  22331. $rm->setRepositoryClass('github', 'Composer\Repository\VcsRepository');
  22332. $rm->setRepositoryClass('gitlab', 'Composer\Repository\VcsRepository');
  22333. $rm->setRepositoryClass('svn', 'Composer\Repository\VcsRepository');
  22334. $rm->setRepositoryClass('fossil', 'Composer\Repository\VcsRepository');
  22335. $rm->setRepositoryClass('perforce', 'Composer\Repository\VcsRepository');
  22336. $rm->setRepositoryClass('hg', 'Composer\Repository\VcsRepository');
  22337. $rm->setRepositoryClass('hg-bitbucket', 'Composer\Repository\VcsRepository');
  22338. $rm->setRepositoryClass('artifact', 'Composer\Repository\ArtifactRepository');
  22339. $rm->setRepositoryClass('path', 'Composer\Repository\PathRepository');
  22340. return $rm;
  22341. }
  22342. private static function createRepos(RepositoryManager $rm, array $repoConfigs)
  22343. {
  22344. $repos = array();
  22345. foreach ($repoConfigs as $index => $repo) {
  22346. if (is_string($repo)) {
  22347. throw new \UnexpectedValueException('"repositories" should be an array of repository definitions, only a single repository was given');
  22348. }
  22349. if (!is_array($repo)) {
  22350. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') should be an array, '.gettype($repo).' given');
  22351. }
  22352. if (!isset($repo['type'])) {
  22353. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') must have a type defined');
  22354. }
  22355. $name = is_int($index) && isset($repo['url']) ? preg_replace('{^https?://}i', '', $repo['url']) : $index;
  22356. while (isset($repos[$name])) {
  22357. $name .= '2';
  22358. }
  22359. if ($repo['type'] === 'filesystem') {
  22360. $repos[$name] = new FilesystemRepository($repo['json']);
  22361. } else {
  22362. $repos[$name] = $rm->createRepository($repo['type'], $repo, $index);
  22363. }
  22364. }
  22365. return $repos;
  22366. }
  22367. }
  22368. <?php
  22369. namespace Composer\Repository;
  22370. use Composer\Package\PackageInterface;
  22371. interface RepositoryInterface extends \Countable
  22372. {
  22373. const SEARCH_FULLTEXT = 0;
  22374. const SEARCH_NAME = 1;
  22375. public function hasPackage(PackageInterface $package);
  22376. public function findPackage($name, $constraint);
  22377. public function findPackages($name, $constraint = null);
  22378. public function getPackages();
  22379. public function search($query, $mode = 0);
  22380. }
  22381. <?php
  22382. namespace Composer\Repository;
  22383. use Composer\IO\IOInterface;
  22384. use Composer\Config;
  22385. use Composer\EventDispatcher\EventDispatcher;
  22386. use Composer\Package\PackageInterface;
  22387. use Composer\Util\RemoteFilesystem;
  22388. class RepositoryManager
  22389. {
  22390. private $localRepository;
  22391. private $repositories = array();
  22392. private $repositoryClasses = array();
  22393. private $io;
  22394. private $config;
  22395. private $eventDispatcher;
  22396. private $rfs;
  22397. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  22398. {
  22399. $this->io = $io;
  22400. $this->config = $config;
  22401. $this->eventDispatcher = $eventDispatcher;
  22402. $this->rfs = $rfs;
  22403. }
  22404. public function findPackage($name, $constraint)
  22405. {
  22406. foreach ($this->repositories as $repository) {
  22407. if ($package = $repository->findPackage($name, $constraint)) {
  22408. return $package;
  22409. }
  22410. }
  22411. return null;
  22412. }
  22413. public function findPackages($name, $constraint)
  22414. {
  22415. $packages = array();
  22416. foreach ($this->getRepositories() as $repository) {
  22417. $packages = array_merge($packages, $repository->findPackages($name, $constraint));
  22418. }
  22419. return $packages;
  22420. }
  22421. public function addRepository(RepositoryInterface $repository)
  22422. {
  22423. $this->repositories[] = $repository;
  22424. }
  22425. public function prependRepository(RepositoryInterface $repository)
  22426. {
  22427. array_unshift($this->repositories, $repository);
  22428. }
  22429. public function createRepository($type, $config, $name = null)
  22430. {
  22431. if (!isset($this->repositoryClasses[$type])) {
  22432. throw new \InvalidArgumentException('Repository type is not registered: '.$type);
  22433. }
  22434. if (isset($config['packagist']) && false === $config['packagist']) {
  22435. $this->io->writeError('<warning>Repository "'.$name.'" ('.json_encode($config).') has a packagist key which should be in its own repository definition</warning>');
  22436. }
  22437. $class = $this->repositoryClasses[$type];
  22438. $reflMethod = new \ReflectionMethod($class, '__construct');
  22439. $params = $reflMethod->getParameters();
  22440. if (isset($params[4]) && $params[4]->getClass() && $params[4]->getClass()->getName() === 'Composer\Util\RemoteFilesystem') {
  22441. return new $class($config, $this->io, $this->config, $this->eventDispatcher, $this->rfs);
  22442. }
  22443. return new $class($config, $this->io, $this->config, $this->eventDispatcher);
  22444. }
  22445. public function setRepositoryClass($type, $class)
  22446. {
  22447. $this->repositoryClasses[$type] = $class;
  22448. }
  22449. public function getRepositories()
  22450. {
  22451. return $this->repositories;
  22452. }
  22453. public function setLocalRepository(WritableRepositoryInterface $repository)
  22454. {
  22455. $this->localRepository = $repository;
  22456. }
  22457. public function getLocalRepository()
  22458. {
  22459. return $this->localRepository;
  22460. }
  22461. }
  22462. <?php
  22463. namespace Composer\Repository;
  22464. class RepositorySecurityException extends \Exception
  22465. {
  22466. }
  22467. <?php
  22468. namespace Composer\Repository\Vcs;
  22469. use Composer\Cache;
  22470. use Composer\Downloader\TransportException;
  22471. use Composer\Json\JsonFile;
  22472. use Composer\Util\Bitbucket;
  22473. abstract class BitbucketDriver extends VcsDriver
  22474. {
  22475. protected $cache;
  22476. protected $owner;
  22477. protected $repository;
  22478. protected $hasIssues;
  22479. protected $rootIdentifier;
  22480. protected $tags;
  22481. protected $branches;
  22482. protected $infoCache = array();
  22483. protected $branchesUrl = '';
  22484. protected $tagsUrl = '';
  22485. protected $homeUrl = '';
  22486. protected $website = '';
  22487. protected $cloneHttpsUrl = '';
  22488. protected $fallbackDriver;
  22489. protected $vcsType;
  22490. public function initialize()
  22491. {
  22492. preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+?)(\.git|/?)$#i', $this->url, $match);
  22493. $this->owner = $match[1];
  22494. $this->repository = $match[2];
  22495. $this->originUrl = 'bitbucket.org';
  22496. $this->cache = new Cache(
  22497. $this->io,
  22498. implode('/', array(
  22499. $this->config->get('cache-repo-dir'),
  22500. $this->originUrl,
  22501. $this->owner,
  22502. $this->repository,
  22503. ))
  22504. );
  22505. }
  22506. public function getUrl()
  22507. {
  22508. if ($this->fallbackDriver) {
  22509. return $this->fallbackDriver->getUrl();
  22510. }
  22511. return $this->cloneHttpsUrl;
  22512. }
  22513. protected function getRepoData()
  22514. {
  22515. $resource = sprintf(
  22516. 'https://api.bitbucket.org/2.0/repositories/%s/%s?%s',
  22517. $this->owner,
  22518. $this->repository,
  22519. http_build_query(
  22520. array('fields' => '-project,-owner'),
  22521. null,
  22522. '&'
  22523. )
  22524. );
  22525. $repoData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource, true), $resource);
  22526. if ($this->fallbackDriver) {
  22527. return false;
  22528. }
  22529. $this->parseCloneUrls($repoData['links']['clone']);
  22530. $this->hasIssues = !empty($repoData['has_issues']);
  22531. $this->branchesUrl = $repoData['links']['branches']['href'];
  22532. $this->tagsUrl = $repoData['links']['tags']['href'];
  22533. $this->homeUrl = $repoData['links']['html']['href'];
  22534. $this->website = $repoData['website'];
  22535. $this->vcsType = $repoData['scm'];
  22536. return true;
  22537. }
  22538. public function getComposerInformation($identifier)
  22539. {
  22540. if ($this->fallbackDriver) {
  22541. return $this->fallbackDriver->getComposerInformation($identifier);
  22542. }
  22543. if (!isset($this->infoCache[$identifier])) {
  22544. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  22545. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  22546. }
  22547. $composer = $this->getBaseComposerInformation($identifier);
  22548. if ($composer) {
  22549. if (!isset($composer['support']['source'])) {
  22550. $label = array_search(
  22551. $identifier,
  22552. $this->getTags()
  22553. ) ?: array_search(
  22554. $identifier,
  22555. $this->getBranches()
  22556. ) ?: $identifier;
  22557. if (array_key_exists($label, $tags = $this->getTags())) {
  22558. $hash = $tags[$label];
  22559. } elseif (array_key_exists($label, $branches = $this->getBranches())) {
  22560. $hash = $branches[$label];
  22561. }
  22562. if (! isset($hash)) {
  22563. $composer['support']['source'] = sprintf(
  22564. 'https://%s/%s/%s/src',
  22565. $this->originUrl,
  22566. $this->owner,
  22567. $this->repository
  22568. );
  22569. } else {
  22570. $composer['support']['source'] = sprintf(
  22571. 'https://%s/%s/%s/src/%s/?at=%s',
  22572. $this->originUrl,
  22573. $this->owner,
  22574. $this->repository,
  22575. $hash,
  22576. $label
  22577. );
  22578. }
  22579. }
  22580. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  22581. $composer['support']['issues'] = sprintf(
  22582. 'https://%s/%s/%s/issues',
  22583. $this->originUrl,
  22584. $this->owner,
  22585. $this->repository
  22586. );
  22587. }
  22588. if (!isset($composer['homepage'])) {
  22589. $composer['homepage'] = empty($this->website) ? $this->homeUrl : $this->website;
  22590. }
  22591. }
  22592. $this->infoCache[$identifier] = $composer;
  22593. if ($this->shouldCache($identifier)) {
  22594. $this->cache->write($identifier, json_encode($composer));
  22595. }
  22596. }
  22597. return $this->infoCache[$identifier];
  22598. }
  22599. public function getFileContent($file, $identifier)
  22600. {
  22601. if ($this->fallbackDriver) {
  22602. return $this->fallbackDriver->getFileContent($file, $identifier);
  22603. }
  22604. if (strpos($identifier, '/') !== false) {
  22605. $branches = $this->getBranches();
  22606. if (isset($branches[$identifier])) {
  22607. $identifier = $branches[$identifier];
  22608. }
  22609. }
  22610. $resource = sprintf(
  22611. 'https://api.bitbucket.org/2.0/repositories/%s/%s/src/%s/%s',
  22612. $this->owner,
  22613. $this->repository,
  22614. $identifier,
  22615. $file
  22616. );
  22617. return $this->getContentsWithOAuthCredentials($resource);
  22618. }
  22619. public function getChangeDate($identifier)
  22620. {
  22621. if ($this->fallbackDriver) {
  22622. return $this->fallbackDriver->getChangeDate($identifier);
  22623. }
  22624. if (strpos($identifier, '/') !== false) {
  22625. $branches = $this->getBranches();
  22626. if (isset($branches[$identifier])) {
  22627. $identifier = $branches[$identifier];
  22628. }
  22629. }
  22630. $resource = sprintf(
  22631. 'https://api.bitbucket.org/2.0/repositories/%s/%s/commit/%s?fields=date',
  22632. $this->owner,
  22633. $this->repository,
  22634. $identifier
  22635. );
  22636. $commit = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  22637. return new \DateTime($commit['date']);
  22638. }
  22639. public function getSource($identifier)
  22640. {
  22641. if ($this->fallbackDriver) {
  22642. return $this->fallbackDriver->getSource($identifier);
  22643. }
  22644. return array('type' => $this->vcsType, 'url' => $this->getUrl(), 'reference' => $identifier);
  22645. }
  22646. public function getDist($identifier)
  22647. {
  22648. if ($this->fallbackDriver) {
  22649. return $this->fallbackDriver->getDist($identifier);
  22650. }
  22651. $url = sprintf(
  22652. 'https://bitbucket.org/%s/%s/get/%s.zip',
  22653. $this->owner,
  22654. $this->repository,
  22655. $identifier
  22656. );
  22657. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  22658. }
  22659. public function getTags()
  22660. {
  22661. if ($this->fallbackDriver) {
  22662. return $this->fallbackDriver->getTags();
  22663. }
  22664. if (null === $this->tags) {
  22665. $this->tags = array();
  22666. $resource = sprintf(
  22667. '%s?%s',
  22668. $this->tagsUrl,
  22669. http_build_query(
  22670. array(
  22671. 'pagelen' => 100,
  22672. 'fields' => 'values.name,values.target.hash,next',
  22673. 'sort' => '-target.date',
  22674. ),
  22675. null,
  22676. '&'
  22677. )
  22678. );
  22679. $hasNext = true;
  22680. while ($hasNext) {
  22681. $tagsData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  22682. foreach ($tagsData['values'] as $data) {
  22683. $this->tags[$data['name']] = $data['target']['hash'];
  22684. }
  22685. if (empty($tagsData['next'])) {
  22686. $hasNext = false;
  22687. } else {
  22688. $resource = $tagsData['next'];
  22689. }
  22690. }
  22691. if ($this->vcsType === 'hg') {
  22692. unset($this->tags['tip']);
  22693. }
  22694. }
  22695. return $this->tags;
  22696. }
  22697. public function getBranches()
  22698. {
  22699. if ($this->fallbackDriver) {
  22700. return $this->fallbackDriver->getBranches();
  22701. }
  22702. if (null === $this->branches) {
  22703. $this->branches = array();
  22704. $resource = sprintf(
  22705. '%s?%s',
  22706. $this->branchesUrl,
  22707. http_build_query(
  22708. array(
  22709. 'pagelen' => 100,
  22710. 'fields' => 'values.name,values.target.hash,values.heads,next',
  22711. 'sort' => '-target.date',
  22712. ),
  22713. null,
  22714. '&'
  22715. )
  22716. );
  22717. $hasNext = true;
  22718. while ($hasNext) {
  22719. $branchData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  22720. foreach ($branchData['values'] as $data) {
  22721. if ($this->vcsType === 'hg' && empty($data['heads'])) {
  22722. continue;
  22723. }
  22724. $this->branches[$data['name']] = $data['target']['hash'];
  22725. }
  22726. if (empty($branchData['next'])) {
  22727. $hasNext = false;
  22728. } else {
  22729. $resource = $branchData['next'];
  22730. }
  22731. }
  22732. }
  22733. return $this->branches;
  22734. }
  22735. protected function getContentsWithOAuthCredentials($url, $fetchingRepoData = false)
  22736. {
  22737. try {
  22738. return parent::getContents($url);
  22739. } catch (TransportException $e) {
  22740. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process, $this->remoteFilesystem);
  22741. if (403 === $e->getCode() || (401 === $e->getCode() && strpos($e->getMessage(), 'Could not authenticate against') === 0)) {
  22742. if (!$this->io->hasAuthentication($this->originUrl)
  22743. && $bitbucketUtil->authorizeOAuth($this->originUrl)
  22744. ) {
  22745. return parent::getContents($url);
  22746. }
  22747. if (!$this->io->isInteractive() && $fetchingRepoData) {
  22748. return $this->attemptCloneFallback();
  22749. }
  22750. }
  22751. throw $e;
  22752. }
  22753. }
  22754. abstract protected function generateSshUrl();
  22755. protected function attemptCloneFallback()
  22756. {
  22757. try {
  22758. $this->setupFallbackDriver($this->generateSshUrl());
  22759. } catch (\RuntimeException $e) {
  22760. $this->fallbackDriver = null;
  22761. $this->io->writeError(
  22762. '<error>Failed to clone the ' . $this->generateSshUrl() . ' repository, try running in interactive mode'
  22763. . ' so that you can enter your Bitbucket OAuth consumer credentials</error>'
  22764. );
  22765. throw $e;
  22766. }
  22767. }
  22768. abstract protected function setupFallbackDriver($url);
  22769. protected function parseCloneUrls(array $cloneLinks)
  22770. {
  22771. foreach ($cloneLinks as $cloneLink) {
  22772. if ($cloneLink['name'] === 'https') {
  22773. $this->cloneHttpsUrl = preg_replace('/https:\/\/([^@]+@)?/', 'https://', $cloneLink['href']);
  22774. }
  22775. }
  22776. }
  22777. protected function getMainBranchData()
  22778. {
  22779. $resource = sprintf(
  22780. 'https://api.bitbucket.org/2.0/repositories/%s/%s?fields=mainbranch',
  22781. $this->owner,
  22782. $this->repository
  22783. );
  22784. $data = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  22785. if (isset($data['mainbranch'])) {
  22786. return $data['mainbranch'];
  22787. }
  22788. return null;
  22789. }
  22790. }
  22791. <?php
  22792. namespace Composer\Repository\Vcs;
  22793. use Composer\Cache;
  22794. use Composer\Config;
  22795. use Composer\Util\ProcessExecutor;
  22796. use Composer\Util\Filesystem;
  22797. use Composer\IO\IOInterface;
  22798. class FossilDriver extends VcsDriver
  22799. {
  22800. protected $tags;
  22801. protected $branches;
  22802. protected $rootIdentifier;
  22803. protected $repoFile;
  22804. protected $checkoutDir;
  22805. protected $infoCache = array();
  22806. public function initialize()
  22807. {
  22808. $this->checkFossil();
  22809. $this->config->prohibitUrlByConfig($this->url, $this->io);
  22810. if (Filesystem::isLocalPath($this->url) && is_dir($this->url)) {
  22811. $this->checkoutDir = $this->url;
  22812. } else {
  22813. if (!Cache::isUsable($this->config->get('cache-repo-dir')) || !Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  22814. throw new \RuntimeException('FossilDriver requires a usable cache directory, and it looks like you set it to be disabled');
  22815. }
  22816. $localName = preg_replace('{[^a-z0-9]}i', '-', $this->url);
  22817. $this->repoFile = $this->config->get('cache-repo-dir') . '/' . $localName . '.fossil';
  22818. $this->checkoutDir = $this->config->get('cache-vcs-dir') . '/' . $localName . '/';
  22819. $this->updateLocalRepo();
  22820. }
  22821. $this->getTags();
  22822. $this->getBranches();
  22823. }
  22824. protected function checkFossil()
  22825. {
  22826. if (0 !== $this->process->execute('fossil version', $ignoredOutput)) {
  22827. throw new \RuntimeException("fossil was not found, check that it is installed and in your PATH env.\n\n" . $this->process->getErrorOutput());
  22828. }
  22829. }
  22830. protected function updateLocalRepo()
  22831. {
  22832. $fs = new Filesystem();
  22833. $fs->ensureDirectoryExists($this->checkoutDir);
  22834. if (!is_writable(dirname($this->checkoutDir))) {
  22835. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$this->checkoutDir.'" directory is not writable by the current user.');
  22836. }
  22837. if (is_file($this->repoFile) && is_dir($this->checkoutDir) && 0 === $this->process->execute('fossil info', $output, $this->checkoutDir)) {
  22838. if (0 !== $this->process->execute('fossil pull', $output, $this->checkoutDir)) {
  22839. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  22840. }
  22841. } else {
  22842. $fs->removeDirectory($this->checkoutDir);
  22843. $fs->remove($this->repoFile);
  22844. $fs->ensureDirectoryExists($this->checkoutDir);
  22845. if (0 !== $this->process->execute(sprintf('fossil clone %s %s', ProcessExecutor::escape($this->url), ProcessExecutor::escape($this->repoFile)), $output)) {
  22846. $output = $this->process->getErrorOutput();
  22847. throw new \RuntimeException('Failed to clone '.$this->url.' to repository ' . $this->repoFile . "\n\n" .$output);
  22848. }
  22849. if (0 !== $this->process->execute(sprintf('fossil open %s --nested', ProcessExecutor::escape($this->repoFile)), $output, $this->checkoutDir)) {
  22850. $output = $this->process->getErrorOutput();
  22851. throw new \RuntimeException('Failed to open repository '.$this->repoFile.' in ' . $this->checkoutDir . "\n\n" .$output);
  22852. }
  22853. }
  22854. }
  22855. public function getRootIdentifier()
  22856. {
  22857. if (null === $this->rootIdentifier) {
  22858. $this->rootIdentifier = 'trunk';
  22859. }
  22860. return $this->rootIdentifier;
  22861. }
  22862. public function getUrl()
  22863. {
  22864. return $this->url;
  22865. }
  22866. public function getSource($identifier)
  22867. {
  22868. return array('type' => 'fossil', 'url' => $this->getUrl(), 'reference' => $identifier);
  22869. }
  22870. public function getDist($identifier)
  22871. {
  22872. return null;
  22873. }
  22874. public function getFileContent($file, $identifier)
  22875. {
  22876. $command = sprintf('fossil cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  22877. $this->process->execute($command, $content, $this->checkoutDir);
  22878. if (!trim($content)) {
  22879. return null;
  22880. }
  22881. return $content;
  22882. }
  22883. public function getChangeDate($identifier)
  22884. {
  22885. $this->process->execute('fossil finfo -b -n 1 composer.json', $output, $this->checkoutDir);
  22886. list($ckout, $date, $message) = explode(' ', trim($output), 3);
  22887. return new \DateTime($date, new \DateTimeZone('UTC'));
  22888. }
  22889. public function getTags()
  22890. {
  22891. if (null === $this->tags) {
  22892. $tags = array();
  22893. $this->process->execute('fossil tag list', $output, $this->checkoutDir);
  22894. foreach ($this->process->splitLines($output) as $tag) {
  22895. $tags[$tag] = $tag;
  22896. }
  22897. $this->tags = $tags;
  22898. }
  22899. return $this->tags;
  22900. }
  22901. public function getBranches()
  22902. {
  22903. if (null === $this->branches) {
  22904. $branches = array();
  22905. $bookmarks = array();
  22906. $this->process->execute('fossil branch list', $output, $this->checkoutDir);
  22907. foreach ($this->process->splitLines($output) as $branch) {
  22908. $branch = trim(preg_replace('/^\*/', '', trim($branch)));
  22909. $branches[$branch] = $branch;
  22910. }
  22911. $this->branches = $branches;
  22912. }
  22913. return $this->branches;
  22914. }
  22915. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22916. {
  22917. if (preg_match('#(^(?:https?|ssh)://(?:[^@]@)?(?:chiselapp\.com|fossil\.))#i', $url)) {
  22918. return true;
  22919. }
  22920. if (preg_match('!/fossil/|\.fossil!', $url)) {
  22921. return true;
  22922. }
  22923. if (Filesystem::isLocalPath($url)) {
  22924. $url = Filesystem::getPlatformPath($url);
  22925. if (!is_dir($url)) {
  22926. return false;
  22927. }
  22928. $process = new ProcessExecutor($io);
  22929. if ($process->execute('fossil info', $output, $url) === 0) {
  22930. return true;
  22931. }
  22932. }
  22933. return false;
  22934. }
  22935. }
  22936. <?php
  22937. namespace Composer\Repository\Vcs;
  22938. use Composer\Config;
  22939. use Composer\IO\IOInterface;
  22940. class GitBitbucketDriver extends BitbucketDriver
  22941. {
  22942. public function getRootIdentifier()
  22943. {
  22944. if ($this->fallbackDriver) {
  22945. return $this->fallbackDriver->getRootIdentifier();
  22946. }
  22947. if (null === $this->rootIdentifier) {
  22948. if (! $this->getRepoData()) {
  22949. return $this->fallbackDriver->getRootIdentifier();
  22950. }
  22951. if ($this->vcsType !== 'git') {
  22952. throw new \RuntimeException(
  22953. $this->url.' does not appear to be a git repository, use '.
  22954. $this->cloneHttpsUrl.' if this is a mercurial bitbucket repository'
  22955. );
  22956. }
  22957. $mainBranchData = $this->getMainBranchData();
  22958. $this->rootIdentifier = !empty($mainBranchData['name']) ? $mainBranchData['name'] : 'master';
  22959. }
  22960. return $this->rootIdentifier;
  22961. }
  22962. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22963. {
  22964. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/(.+?)\.git$#i', $url)) {
  22965. return false;
  22966. }
  22967. if (!extension_loaded('openssl')) {
  22968. $io->writeError('Skipping Bitbucket git driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  22969. return false;
  22970. }
  22971. return true;
  22972. }
  22973. protected function setupFallbackDriver($url)
  22974. {
  22975. $this->fallbackDriver = new GitDriver(
  22976. array('url' => $url),
  22977. $this->io,
  22978. $this->config,
  22979. $this->process,
  22980. $this->remoteFilesystem
  22981. );
  22982. $this->fallbackDriver->initialize();
  22983. }
  22984. protected function generateSshUrl()
  22985. {
  22986. return 'git@' . $this->originUrl . ':' . $this->owner.'/'.$this->repository.'.git';
  22987. }
  22988. }
  22989. <?php
  22990. namespace Composer\Repository\Vcs;
  22991. use Composer\Util\ProcessExecutor;
  22992. use Composer\Util\Filesystem;
  22993. use Composer\Util\Git as GitUtil;
  22994. use Composer\IO\IOInterface;
  22995. use Composer\Cache;
  22996. use Composer\Config;
  22997. class GitDriver extends VcsDriver
  22998. {
  22999. protected $cache;
  23000. protected $tags;
  23001. protected $branches;
  23002. protected $rootIdentifier;
  23003. protected $repoDir;
  23004. protected $infoCache = array();
  23005. public function initialize()
  23006. {
  23007. if (Filesystem::isLocalPath($this->url)) {
  23008. $this->url = preg_replace('{[\\/]\.git/?$}', '', $this->url);
  23009. $this->repoDir = $this->url;
  23010. $cacheUrl = realpath($this->url);
  23011. } else {
  23012. if (!Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  23013. throw new \RuntimeException('GitDriver requires a usable cache directory, and it looks like you set it to be disabled');
  23014. }
  23015. $this->repoDir = $this->config->get('cache-vcs-dir') . '/' . preg_replace('{[^a-z0-9.]}i', '-', $this->url) . '/';
  23016. GitUtil::cleanEnv();
  23017. $fs = new Filesystem();
  23018. $fs->ensureDirectoryExists(dirname($this->repoDir));
  23019. if (!is_writable(dirname($this->repoDir))) {
  23020. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.dirname($this->repoDir).'" directory is not writable by the current user.');
  23021. }
  23022. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $this->url)) {
  23023. 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.');
  23024. }
  23025. $gitUtil = new GitUtil($this->io, $this->config, $this->process, $fs);
  23026. if (!$gitUtil->syncMirror($this->url, $this->repoDir)) {
  23027. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated</error>');
  23028. }
  23029. $cacheUrl = $this->url;
  23030. }
  23031. $this->getTags();
  23032. $this->getBranches();
  23033. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $cacheUrl));
  23034. }
  23035. public function getRootIdentifier()
  23036. {
  23037. if (null === $this->rootIdentifier) {
  23038. $this->rootIdentifier = 'master';
  23039. $this->process->execute('git branch --no-color', $output, $this->repoDir);
  23040. $branches = $this->process->splitLines($output);
  23041. if (!in_array('* master', $branches)) {
  23042. foreach ($branches as $branch) {
  23043. if ($branch && preg_match('{^\* +(\S+)}', $branch, $match)) {
  23044. $this->rootIdentifier = $match[1];
  23045. break;
  23046. }
  23047. }
  23048. }
  23049. }
  23050. return $this->rootIdentifier;
  23051. }
  23052. public function getUrl()
  23053. {
  23054. return $this->url;
  23055. }
  23056. public function getSource($identifier)
  23057. {
  23058. return array('type' => 'git', 'url' => $this->getUrl(), 'reference' => $identifier);
  23059. }
  23060. public function getDist($identifier)
  23061. {
  23062. return null;
  23063. }
  23064. public function getFileContent($file, $identifier)
  23065. {
  23066. $resource = sprintf('%s:%s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  23067. $this->process->execute(sprintf('git show %s', $resource), $content, $this->repoDir);
  23068. if (!trim($content)) {
  23069. return null;
  23070. }
  23071. return $content;
  23072. }
  23073. public function getChangeDate($identifier)
  23074. {
  23075. $this->process->execute(sprintf(
  23076. 'git log -1 --format=%%at %s',
  23077. ProcessExecutor::escape($identifier)
  23078. ), $output, $this->repoDir);
  23079. return new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  23080. }
  23081. public function getTags()
  23082. {
  23083. if (null === $this->tags) {
  23084. $this->tags = array();
  23085. $this->process->execute('git show-ref --tags --dereference', $output, $this->repoDir);
  23086. foreach ($output = $this->process->splitLines($output) as $tag) {
  23087. if ($tag && preg_match('{^([a-f0-9]{40}) refs/tags/(\S+?)(\^\{\})?$}', $tag, $match)) {
  23088. $this->tags[$match[2]] = $match[1];
  23089. }
  23090. }
  23091. }
  23092. return $this->tags;
  23093. }
  23094. public function getBranches()
  23095. {
  23096. if (null === $this->branches) {
  23097. $branches = array();
  23098. $this->process->execute('git branch --no-color --no-abbrev -v', $output, $this->repoDir);
  23099. foreach ($this->process->splitLines($output) as $branch) {
  23100. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  23101. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+)(?: .*)?$}', $branch, $match)) {
  23102. $branches[$match[1]] = $match[2];
  23103. }
  23104. }
  23105. }
  23106. $this->branches = $branches;
  23107. }
  23108. return $this->branches;
  23109. }
  23110. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23111. {
  23112. if (preg_match('#(^git://|\.git/?$|git(?:olite)?@|//git\.|//github.com/)#i', $url)) {
  23113. return true;
  23114. }
  23115. if (Filesystem::isLocalPath($url)) {
  23116. $url = Filesystem::getPlatformPath($url);
  23117. if (!is_dir($url)) {
  23118. return false;
  23119. }
  23120. $process = new ProcessExecutor($io);
  23121. if ($process->execute('git tag', $output, $url) === 0) {
  23122. return true;
  23123. }
  23124. }
  23125. if (!$deep) {
  23126. return false;
  23127. }
  23128. $process = new ProcessExecutor($io);
  23129. return $process->execute('git ls-remote --heads ' . ProcessExecutor::escape($url), $output) === 0;
  23130. }
  23131. }
  23132. <?php
  23133. namespace Composer\Repository\Vcs;
  23134. use Composer\Config;
  23135. use Composer\Downloader\TransportException;
  23136. use Composer\Json\JsonFile;
  23137. use Composer\Cache;
  23138. use Composer\IO\IOInterface;
  23139. use Composer\Util\GitHub;
  23140. class GitHubDriver extends VcsDriver
  23141. {
  23142. protected $cache;
  23143. protected $owner;
  23144. protected $repository;
  23145. protected $tags;
  23146. protected $branches;
  23147. protected $rootIdentifier;
  23148. protected $repoData;
  23149. protected $hasIssues;
  23150. protected $infoCache = array();
  23151. protected $isPrivate = false;
  23152. protected $gitDriver;
  23153. public function initialize()
  23154. {
  23155. preg_match('#^(?:(?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/(.+?)(?:\.git|/)?$#', $this->url, $match);
  23156. $this->owner = $match[3];
  23157. $this->repository = $match[4];
  23158. $this->originUrl = strtolower(!empty($match[1]) ? $match[1] : $match[2]);
  23159. if ($this->originUrl === 'www.github.com') {
  23160. $this->originUrl = 'github.com';
  23161. }
  23162. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
  23163. if ( $this->config->get('use-github-api') === false || (isset($this->repoConfig['no-api']) && $this->repoConfig['no-api'] ) ){
  23164. $this->setupGitDriver($this->url);
  23165. return;
  23166. }
  23167. $this->fetchRootIdentifier();
  23168. }
  23169. public function getRepositoryUrl()
  23170. {
  23171. return 'https://'.$this->originUrl.'/'.$this->owner.'/'.$this->repository;
  23172. }
  23173. public function getRootIdentifier()
  23174. {
  23175. if ($this->gitDriver) {
  23176. return $this->gitDriver->getRootIdentifier();
  23177. }
  23178. return $this->rootIdentifier;
  23179. }
  23180. public function getUrl()
  23181. {
  23182. if ($this->gitDriver) {
  23183. return $this->gitDriver->getUrl();
  23184. }
  23185. return 'https://' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
  23186. }
  23187. protected function getApiUrl()
  23188. {
  23189. if ('github.com' === $this->originUrl) {
  23190. $apiUrl = 'api.github.com';
  23191. } else {
  23192. $apiUrl = $this->originUrl . '/api/v3';
  23193. }
  23194. return 'https://' . $apiUrl;
  23195. }
  23196. public function getSource($identifier)
  23197. {
  23198. if ($this->gitDriver) {
  23199. return $this->gitDriver->getSource($identifier);
  23200. }
  23201. if ($this->isPrivate) {
  23202. $url = $this->generateSshUrl();
  23203. } else {
  23204. $url = $this->getUrl();
  23205. }
  23206. return array('type' => 'git', 'url' => $url, 'reference' => $identifier);
  23207. }
  23208. public function getDist($identifier)
  23209. {
  23210. $url = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/zipball/'.$identifier;
  23211. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  23212. }
  23213. public function getComposerInformation($identifier)
  23214. {
  23215. if ($this->gitDriver) {
  23216. return $this->gitDriver->getComposerInformation($identifier);
  23217. }
  23218. if (!isset($this->infoCache[$identifier])) {
  23219. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  23220. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  23221. }
  23222. $composer = $this->getBaseComposerInformation($identifier);
  23223. if ($composer) {
  23224. if (!isset($composer['support']['source'])) {
  23225. $label = array_search($identifier, $this->getTags()) ?: array_search($identifier, $this->getBranches()) ?: $identifier;
  23226. $composer['support']['source'] = sprintf('https://%s/%s/%s/tree/%s', $this->originUrl, $this->owner, $this->repository, $label);
  23227. }
  23228. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  23229. $composer['support']['issues'] = sprintf('https://%s/%s/%s/issues', $this->originUrl, $this->owner, $this->repository);
  23230. }
  23231. }
  23232. if ($this->shouldCache($identifier)) {
  23233. $this->cache->write($identifier, json_encode($composer));
  23234. }
  23235. $this->infoCache[$identifier] = $composer;
  23236. }
  23237. return $this->infoCache[$identifier];
  23238. }
  23239. public function getFileContent($file, $identifier)
  23240. {
  23241. if ($this->gitDriver) {
  23242. return $this->gitDriver->getFileContent($file, $identifier);
  23243. }
  23244. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/' . $file . '?ref='.urlencode($identifier);
  23245. $resource = JsonFile::parseJson($this->getContents($resource));
  23246. if (empty($resource['content']) || $resource['encoding'] !== 'base64' || !($content = base64_decode($resource['content']))) {
  23247. throw new \RuntimeException('Could not retrieve ' . $file . ' for '.$identifier);
  23248. }
  23249. return $content;
  23250. }
  23251. public function getChangeDate($identifier)
  23252. {
  23253. if ($this->gitDriver) {
  23254. return $this->gitDriver->getChangeDate($identifier);
  23255. }
  23256. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/commits/'.urlencode($identifier);
  23257. $commit = JsonFile::parseJson($this->getContents($resource), $resource);
  23258. return new \DateTime($commit['commit']['committer']['date']);
  23259. }
  23260. public function getTags()
  23261. {
  23262. if ($this->gitDriver) {
  23263. return $this->gitDriver->getTags();
  23264. }
  23265. if (null === $this->tags) {
  23266. $this->tags = array();
  23267. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/tags?per_page=100';
  23268. do {
  23269. $tagsData = JsonFile::parseJson($this->getContents($resource), $resource);
  23270. foreach ($tagsData as $tag) {
  23271. $this->tags[$tag['name']] = $tag['commit']['sha'];
  23272. }
  23273. $resource = $this->getNextPage();
  23274. } while ($resource);
  23275. }
  23276. return $this->tags;
  23277. }
  23278. public function getBranches()
  23279. {
  23280. if ($this->gitDriver) {
  23281. return $this->gitDriver->getBranches();
  23282. }
  23283. if (null === $this->branches) {
  23284. $this->branches = array();
  23285. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/git/refs/heads?per_page=100';
  23286. $branchBlacklist = array('gh-pages');
  23287. do {
  23288. $branchData = JsonFile::parseJson($this->getContents($resource), $resource);
  23289. foreach ($branchData as $branch) {
  23290. $name = substr($branch['ref'], 11);
  23291. if (!in_array($name, $branchBlacklist)) {
  23292. $this->branches[$name] = $branch['object']['sha'];
  23293. }
  23294. }
  23295. $resource = $this->getNextPage();
  23296. } while ($resource);
  23297. }
  23298. return $this->branches;
  23299. }
  23300. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23301. {
  23302. if (!preg_match('#^((?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/(.+?)(?:\.git|/)?$#', $url, $matches)) {
  23303. return false;
  23304. }
  23305. $originUrl = !empty($matches[2]) ? $matches[2] : $matches[3];
  23306. if (!in_array(strtolower(preg_replace('{^www\.}i', '', $originUrl)), $config->get('github-domains'))) {
  23307. return false;
  23308. }
  23309. if (!extension_loaded('openssl')) {
  23310. $io->writeError('Skipping GitHub driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  23311. return false;
  23312. }
  23313. return true;
  23314. }
  23315. public function getRepoData()
  23316. {
  23317. $this->fetchRootIdentifier();
  23318. return $this->repoData;
  23319. }
  23320. protected function generateSshUrl()
  23321. {
  23322. if (false !== strpos($this->originUrl, ':')) {
  23323. return 'ssh://git@' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
  23324. }
  23325. return 'git@' . $this->originUrl . ':'.$this->owner.'/'.$this->repository.'.git';
  23326. }
  23327. protected function getContents($url, $fetchingRepoData = false)
  23328. {
  23329. try {
  23330. return parent::getContents($url);
  23331. } catch (TransportException $e) {
  23332. $gitHubUtil = new GitHub($this->io, $this->config, $this->process, $this->remoteFilesystem);
  23333. switch ($e->getCode()) {
  23334. case 401:
  23335. case 404:
  23336. if (!$fetchingRepoData) {
  23337. throw $e;
  23338. }
  23339. if ($gitHubUtil->authorizeOAuth($this->originUrl)) {
  23340. return parent::getContents($url);
  23341. }
  23342. if (!$this->io->isInteractive()) {
  23343. return $this->attemptCloneFallback();
  23344. }
  23345. $scopesIssued = array();
  23346. $scopesNeeded = array();
  23347. if ($headers = $e->getHeaders()) {
  23348. if ($scopes = $this->remoteFilesystem->findHeaderValue($headers, 'X-OAuth-Scopes')) {
  23349. $scopesIssued = explode(' ', $scopes);
  23350. }
  23351. if ($scopes = $this->remoteFilesystem->findHeaderValue($headers, 'X-Accepted-OAuth-Scopes')) {
  23352. $scopesNeeded = explode(' ', $scopes);
  23353. }
  23354. }
  23355. $scopesFailed = array_diff($scopesNeeded, $scopesIssued);
  23356. if (!$headers || !count($scopesNeeded) || count($scopesFailed)) {
  23357. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'Your GitHub credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  23358. }
  23359. return parent::getContents($url);
  23360. case 403:
  23361. if (!$this->io->hasAuthentication($this->originUrl) && $gitHubUtil->authorizeOAuth($this->originUrl)) {
  23362. return parent::getContents($url);
  23363. }
  23364. if (!$this->io->isInteractive() && $fetchingRepoData) {
  23365. return $this->attemptCloneFallback();
  23366. }
  23367. $rateLimited = $gitHubUtil->isRateLimited($e->getHeaders());
  23368. if (!$this->io->hasAuthentication($this->originUrl)) {
  23369. if (!$this->io->isInteractive()) {
  23370. $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>');
  23371. throw $e;
  23372. }
  23373. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'API limit exhausted. Enter your GitHub credentials to get a larger API limit (<info>'.$this->url.'</info>)');
  23374. return parent::getContents($url);
  23375. }
  23376. if ($rateLimited) {
  23377. $rateLimit = $gitHubUtil->getRateLimit($e->getHeaders());
  23378. $this->io->writeError(sprintf(
  23379. '<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>',
  23380. $rateLimit['limit'],
  23381. $rateLimit['reset']
  23382. ));
  23383. }
  23384. throw $e;
  23385. default:
  23386. throw $e;
  23387. }
  23388. }
  23389. }
  23390. protected function fetchRootIdentifier()
  23391. {
  23392. if ($this->repoData) {
  23393. return;
  23394. }
  23395. $repoDataUrl = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository;
  23396. $this->repoData = JsonFile::parseJson($this->getContents($repoDataUrl, true), $repoDataUrl);
  23397. if (null === $this->repoData && null !== $this->gitDriver) {
  23398. return;
  23399. }
  23400. $this->owner = $this->repoData['owner']['login'];
  23401. $this->repository = $this->repoData['name'];
  23402. $this->isPrivate = !empty($this->repoData['private']);
  23403. if (isset($this->repoData['default_branch'])) {
  23404. $this->rootIdentifier = $this->repoData['default_branch'];
  23405. } elseif (isset($this->repoData['master_branch'])) {
  23406. $this->rootIdentifier = $this->repoData['master_branch'];
  23407. } else {
  23408. $this->rootIdentifier = 'master';
  23409. }
  23410. $this->hasIssues = !empty($this->repoData['has_issues']);
  23411. }
  23412. protected function attemptCloneFallback()
  23413. {
  23414. $this->isPrivate = true;
  23415. try {
  23416. $this->setupGitDriver($this->generateSshUrl());
  23417. return;
  23418. } catch (\RuntimeException $e) {
  23419. $this->gitDriver = null;
  23420. $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>');
  23421. throw $e;
  23422. }
  23423. }
  23424. protected function setupGitDriver($url)
  23425. {
  23426. $this->gitDriver = new GitDriver(
  23427. array('url' => $url),
  23428. $this->io,
  23429. $this->config,
  23430. $this->process,
  23431. $this->remoteFilesystem
  23432. );
  23433. $this->gitDriver->initialize();
  23434. }
  23435. protected function getNextPage()
  23436. {
  23437. $headers = $this->remoteFilesystem->getLastHeaders();
  23438. foreach ($headers as $header) {
  23439. if (preg_match('{^link:\s*(.+?)\s*$}i', $header, $match)) {
  23440. $links = explode(',', $match[1]);
  23441. foreach ($links as $link) {
  23442. if (preg_match('{<(.+?)>; *rel="next"}', $link, $match)) {
  23443. return $match[1];
  23444. }
  23445. }
  23446. }
  23447. }
  23448. }
  23449. }
  23450. <?php
  23451. namespace Composer\Repository\Vcs;
  23452. use Composer\Config;
  23453. use Composer\Cache;
  23454. use Composer\IO\IOInterface;
  23455. use Composer\Json\JsonFile;
  23456. use Composer\Downloader\TransportException;
  23457. use Composer\Util\RemoteFilesystem;
  23458. use Composer\Util\GitLab;
  23459. class GitLabDriver extends VcsDriver
  23460. {
  23461. private $scheme;
  23462. private $namespace;
  23463. private $repository;
  23464. private $project;
  23465. private $commits = array();
  23466. private $tags;
  23467. private $branches;
  23468. protected $gitDriver;
  23469. private $isPrivate = true;
  23470. private $hasNonstandardOrigin = false;
  23471. const URL_REGEX = '#^(?:(?P<scheme>https?)://(?P<domain>.+?)(?::(?P<port>[0-9]+))?/|git@(?P<domain2>[^:]+):)(?P<parts>.+)/(?P<repo>[^/]+?)(?:\.git|/)?$#';
  23472. public function initialize()
  23473. {
  23474. if (!preg_match(self::URL_REGEX, $this->url, $match)) {
  23475. throw new \InvalidArgumentException('The URL provided is invalid. It must be the HTTP URL of a GitLab project.');
  23476. }
  23477. $guessedDomain = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  23478. $configuredDomains = $this->config->get('gitlab-domains');
  23479. $urlParts = explode('/', $match['parts']);
  23480. $this->scheme = !empty($match['scheme'])
  23481. ? $match['scheme']
  23482. : (isset($this->repoConfig['secure-http']) && $this->repoConfig['secure-http'] === false ? 'http' : 'https')
  23483. ;
  23484. $this->originUrl = $this->determineOrigin($configuredDomains, $guessedDomain, $urlParts, $match['port']);
  23485. if (false !== strpos($this->originUrl, ':') || false !== strpos($this->originUrl, '/')) {
  23486. $this->hasNonstandardOrigin = true;
  23487. }
  23488. $this->namespace = implode('/', $urlParts);
  23489. $this->repository = preg_replace('#(\.git)$#', '', $match['repo']);
  23490. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->namespace.'/'.$this->repository);
  23491. $this->fetchProject();
  23492. }
  23493. public function setRemoteFilesystem(RemoteFilesystem $remoteFilesystem)
  23494. {
  23495. $this->remoteFilesystem = $remoteFilesystem;
  23496. }
  23497. public function getFileContent($file, $identifier)
  23498. {
  23499. if ($this->gitDriver) {
  23500. return $this->gitDriver->getFileContent($file, $identifier);
  23501. }
  23502. if (!preg_match('{[a-f0-9]{40}}i', $identifier)) {
  23503. $branches = $this->getBranches();
  23504. if (isset($branches[$identifier])) {
  23505. $identifier = $branches[$identifier];
  23506. }
  23507. }
  23508. $resource = $this->getApiUrl().'/repository/files/'.$this->urlEncodeAll($file).'/raw?ref='.$identifier;
  23509. try {
  23510. $content = $this->getContents($resource);
  23511. } catch (TransportException $e) {
  23512. if ($e->getCode() !== 404) {
  23513. throw $e;
  23514. }
  23515. return null;
  23516. }
  23517. return $content;
  23518. }
  23519. public function getChangeDate($identifier)
  23520. {
  23521. if ($this->gitDriver) {
  23522. return $this->gitDriver->getChangeDate($identifier);
  23523. }
  23524. if (isset($this->commits[$identifier])) {
  23525. return new \DateTime($this->commits[$identifier]['committed_date']);
  23526. }
  23527. return new \DateTime();
  23528. }
  23529. public function getRepositoryUrl()
  23530. {
  23531. return $this->isPrivate ? $this->project['ssh_url_to_repo'] : $this->project['http_url_to_repo'];
  23532. }
  23533. public function getUrl()
  23534. {
  23535. if ($this->gitDriver) {
  23536. return $this->gitDriver->getUrl();
  23537. }
  23538. return $this->project['web_url'];
  23539. }
  23540. public function getDist($identifier)
  23541. {
  23542. $url = $this->getApiUrl().'/repository/archive.zip?sha='.$identifier;
  23543. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  23544. }
  23545. public function getSource($identifier)
  23546. {
  23547. if ($this->gitDriver) {
  23548. return $this->gitDriver->getSource($identifier);
  23549. }
  23550. return array('type' => 'git', 'url' => $this->getRepositoryUrl(), 'reference' => $identifier);
  23551. }
  23552. public function getRootIdentifier()
  23553. {
  23554. if ($this->gitDriver) {
  23555. return $this->gitDriver->getRootIdentifier();
  23556. }
  23557. return $this->project['default_branch'];
  23558. }
  23559. public function getBranches()
  23560. {
  23561. if ($this->gitDriver) {
  23562. return $this->gitDriver->getBranches();
  23563. }
  23564. if (!$this->branches) {
  23565. $this->branches = $this->getReferences('branches');
  23566. }
  23567. return $this->branches;
  23568. }
  23569. public function getTags()
  23570. {
  23571. if ($this->gitDriver) {
  23572. return $this->gitDriver->getTags();
  23573. }
  23574. if (!$this->tags) {
  23575. $this->tags = $this->getReferences('tags');
  23576. }
  23577. return $this->tags;
  23578. }
  23579. public function getApiUrl()
  23580. {
  23581. return $this->scheme.'://'.$this->originUrl.'/api/v4/projects/'.$this->urlEncodeAll($this->namespace).'%2F'.$this->urlEncodeAll($this->repository);
  23582. }
  23583. private function urlEncodeAll($string)
  23584. {
  23585. $encoded = '';
  23586. for ($i = 0; isset($string[$i]); $i++) {
  23587. $character = $string[$i];
  23588. if (!ctype_alnum($character) && !in_array($character, array('-', '_'), true)) {
  23589. $character = '%' . sprintf('%02X', ord($character));
  23590. }
  23591. $encoded .= $character;
  23592. }
  23593. return $encoded;
  23594. }
  23595. protected function getReferences($type)
  23596. {
  23597. $perPage = 100;
  23598. $resource = $this->getApiUrl().'/repository/'.$type.'?per_page='.$perPage;
  23599. $references = array();
  23600. do {
  23601. $data = JsonFile::parseJson($this->getContents($resource), $resource);
  23602. foreach ($data as $datum) {
  23603. $references[$datum['name']] = $datum['commit']['id'];
  23604. $this->commits[$datum['commit']['id']] = $datum['commit'];
  23605. }
  23606. if (count($data) >= $perPage) {
  23607. $resource = $this->getNextPage();
  23608. } else {
  23609. $resource = false;
  23610. }
  23611. } while ($resource);
  23612. return $references;
  23613. }
  23614. protected function fetchProject()
  23615. {
  23616. $resource = $this->getApiUrl();
  23617. $this->project = JsonFile::parseJson($this->getContents($resource, true), $resource);
  23618. if (isset($this->project['visibility'])) {
  23619. $this->isPrivate = $this->project['visibility'] !== 'public';
  23620. } else {
  23621. $this->isPrivate = false;
  23622. }
  23623. }
  23624. protected function attemptCloneFallback()
  23625. {
  23626. try {
  23627. if ($this->isPrivate === false) {
  23628. $url = $this->generatePublicUrl();
  23629. } else {
  23630. $url = $this->generateSshUrl();
  23631. }
  23632. $this->setupGitDriver($url);
  23633. return;
  23634. } catch (\RuntimeException $e) {
  23635. $this->gitDriver = null;
  23636. $this->io->writeError('<error>Failed to clone the '.$url.' repository, try running in interactive mode so that you can enter your credentials</error>');
  23637. throw $e;
  23638. }
  23639. }
  23640. protected function generateSshUrl()
  23641. {
  23642. if ($this->hasNonstandardOrigin) {
  23643. return 'ssh://git@'.$this->originUrl.'/'.$this->namespace.'/'.$this->repository.'.git';
  23644. }
  23645. return 'git@' . $this->originUrl . ':'.$this->namespace.'/'.$this->repository.'.git';
  23646. }
  23647. protected function generatePublicUrl()
  23648. {
  23649. return $this->scheme . '://' . $this->originUrl . '/'.$this->namespace.'/'.$this->repository.'.git';
  23650. }
  23651. protected function setupGitDriver($url)
  23652. {
  23653. $this->gitDriver = new GitDriver(
  23654. array('url' => $url),
  23655. $this->io,
  23656. $this->config,
  23657. $this->process,
  23658. $this->remoteFilesystem
  23659. );
  23660. $this->gitDriver->initialize();
  23661. }
  23662. protected function getContents($url, $fetchingRepoData = false)
  23663. {
  23664. try {
  23665. $res = parent::getContents($url);
  23666. if ($fetchingRepoData) {
  23667. $json = JsonFile::parseJson($res, $url);
  23668. if (!isset($json['default_branch'])) {
  23669. if (!empty($json['id'])) {
  23670. $this->isPrivate = false;
  23671. }
  23672. throw new TransportException('GitLab API seems to not be authenticated as it did not return a default_branch', 401);
  23673. }
  23674. }
  23675. return $res;
  23676. } catch (TransportException $e) {
  23677. $gitLabUtil = new GitLab($this->io, $this->config, $this->process, $this->remoteFilesystem);
  23678. switch ($e->getCode()) {
  23679. case 401:
  23680. case 404:
  23681. if (!$fetchingRepoData) {
  23682. throw $e;
  23683. }
  23684. if ($gitLabUtil->authorizeOAuth($this->originUrl)) {
  23685. return parent::getContents($url);
  23686. }
  23687. if (!$this->io->isInteractive()) {
  23688. return $this->attemptCloneFallback();
  23689. }
  23690. $this->io->writeError('<warning>Failed to download ' . $this->namespace . '/' . $this->repository . ':' . $e->getMessage() . '</warning>');
  23691. $gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, 'Your credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  23692. return parent::getContents($url);
  23693. case 403:
  23694. if (!$this->io->hasAuthentication($this->originUrl) && $gitLabUtil->authorizeOAuth($this->originUrl)) {
  23695. return parent::getContents($url);
  23696. }
  23697. if (!$this->io->isInteractive() && $fetchingRepoData) {
  23698. return $this->attemptCloneFallback();
  23699. }
  23700. throw $e;
  23701. default:
  23702. throw $e;
  23703. }
  23704. }
  23705. }
  23706. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23707. {
  23708. if (!preg_match(self::URL_REGEX, $url, $match)) {
  23709. return false;
  23710. }
  23711. $scheme = !empty($match['scheme']) ? $match['scheme'] : null;
  23712. $guessedDomain = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  23713. $urlParts = explode('/', $match['parts']);
  23714. if (false === self::determineOrigin((array) $config->get('gitlab-domains'), $guessedDomain, $urlParts, $match['port'])) {
  23715. return false;
  23716. }
  23717. if ('https' === $scheme && !extension_loaded('openssl')) {
  23718. $io->writeError('Skipping GitLab driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  23719. return false;
  23720. }
  23721. return true;
  23722. }
  23723. private function getNextPage()
  23724. {
  23725. $headers = $this->remoteFilesystem->getLastHeaders();
  23726. foreach ($headers as $header) {
  23727. if (preg_match('{^link:\s*(.+?)\s*$}i', $header, $match)) {
  23728. $links = explode(',', $match[1]);
  23729. foreach ($links as $link) {
  23730. if (preg_match('{<(.+?)>; *rel="next"}', $link, $match)) {
  23731. return $match[1];
  23732. }
  23733. }
  23734. }
  23735. }
  23736. }
  23737. private static function determineOrigin(array $configuredDomains, $guessedDomain, array &$urlParts, $portNumber)
  23738. {
  23739. $guessedDomain = strtolower($guessedDomain);
  23740. if (in_array($guessedDomain, $configuredDomains) || ($portNumber && in_array($guessedDomain.':'.$portNumber, $configuredDomains))) {
  23741. if ($portNumber) {
  23742. return $guessedDomain.':'.$portNumber;
  23743. }
  23744. return $guessedDomain;
  23745. }
  23746. if ($portNumber) {
  23747. $guessedDomain .= ':'.$portNumber;
  23748. }
  23749. while (null !== ($part = array_shift($urlParts))) {
  23750. $guessedDomain .= '/' . $part;
  23751. if (in_array($guessedDomain, $configuredDomains) || ($portNumber && in_array(preg_replace('{:\d+}', '', $guessedDomain), $configuredDomains))) {
  23752. return $guessedDomain;
  23753. }
  23754. }
  23755. return false;
  23756. }
  23757. }
  23758. <?php
  23759. namespace Composer\Repository\Vcs;
  23760. use Composer\Config;
  23761. use Composer\IO\IOInterface;
  23762. class HgBitbucketDriver extends BitbucketDriver
  23763. {
  23764. public function getRootIdentifier()
  23765. {
  23766. if ($this->fallbackDriver) {
  23767. return $this->fallbackDriver->getRootIdentifier();
  23768. }
  23769. if (null === $this->rootIdentifier) {
  23770. if (! $this->getRepoData()) {
  23771. return $this->fallbackDriver->getRootIdentifier();
  23772. }
  23773. if ($this->vcsType !== 'hg') {
  23774. throw new \RuntimeException(
  23775. $this->url.' does not appear to be a mercurial repository, use '.
  23776. $this->cloneHttpsUrl.' if this is a git bitbucket repository'
  23777. );
  23778. }
  23779. $mainBranchData = $this->getMainBranchData();
  23780. $this->rootIdentifier = !empty($mainBranchData['name']) ? $mainBranchData['name'] : 'default';
  23781. }
  23782. return $this->rootIdentifier;
  23783. }
  23784. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23785. {
  23786. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+)/?$#i', $url)) {
  23787. return false;
  23788. }
  23789. if (!extension_loaded('openssl')) {
  23790. $io->writeError('Skipping Bitbucket hg driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  23791. return false;
  23792. }
  23793. return true;
  23794. }
  23795. protected function setupFallbackDriver($url)
  23796. {
  23797. $this->fallbackDriver = new HgDriver(
  23798. array('url' => $url),
  23799. $this->io,
  23800. $this->config,
  23801. $this->process,
  23802. $this->remoteFilesystem
  23803. );
  23804. $this->fallbackDriver->initialize();
  23805. }
  23806. protected function generateSshUrl()
  23807. {
  23808. return 'ssh://hg@' . $this->originUrl . '/' . $this->owner.'/'.$this->repository;
  23809. }
  23810. }
  23811. <?php
  23812. namespace Composer\Repository\Vcs;
  23813. use Composer\Config;
  23814. use Composer\Cache;
  23815. use Composer\Util\Hg as HgUtils;
  23816. use Composer\Util\ProcessExecutor;
  23817. use Composer\Util\Filesystem;
  23818. use Composer\IO\IOInterface;
  23819. class HgDriver extends VcsDriver
  23820. {
  23821. protected $tags;
  23822. protected $branches;
  23823. protected $rootIdentifier;
  23824. protected $repoDir;
  23825. protected $infoCache = array();
  23826. public function initialize()
  23827. {
  23828. if (Filesystem::isLocalPath($this->url)) {
  23829. $this->repoDir = $this->url;
  23830. } else {
  23831. if (!Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  23832. throw new \RuntimeException('HgDriver requires a usable cache directory, and it looks like you set it to be disabled');
  23833. }
  23834. $cacheDir = $this->config->get('cache-vcs-dir');
  23835. $this->repoDir = $cacheDir . '/' . preg_replace('{[^a-z0-9]}i', '-', $this->url) . '/';
  23836. $fs = new Filesystem();
  23837. $fs->ensureDirectoryExists($cacheDir);
  23838. if (!is_writable(dirname($this->repoDir))) {
  23839. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$cacheDir.'" directory is not writable by the current user.');
  23840. }
  23841. $this->config->prohibitUrlByConfig($this->url, $this->io);
  23842. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  23843. if (is_dir($this->repoDir) && 0 === $this->process->execute('hg summary', $output, $this->repoDir)) {
  23844. if (0 !== $this->process->execute('hg pull', $output, $this->repoDir)) {
  23845. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  23846. }
  23847. } else {
  23848. $fs->removeDirectory($this->repoDir);
  23849. $repoDir = $this->repoDir;
  23850. $command = function ($url) use ($repoDir) {
  23851. return sprintf('hg clone --noupdate %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($repoDir));
  23852. };
  23853. $hgUtils->runCommand($command, $this->url, null);
  23854. }
  23855. }
  23856. $this->getTags();
  23857. $this->getBranches();
  23858. }
  23859. public function getRootIdentifier()
  23860. {
  23861. if (null === $this->rootIdentifier) {
  23862. $this->process->execute(sprintf('hg tip --template "{node}"'), $output, $this->repoDir);
  23863. $output = $this->process->splitLines($output);
  23864. $this->rootIdentifier = $output[0];
  23865. }
  23866. return $this->rootIdentifier;
  23867. }
  23868. public function getUrl()
  23869. {
  23870. return $this->url;
  23871. }
  23872. public function getSource($identifier)
  23873. {
  23874. return array('type' => 'hg', 'url' => $this->getUrl(), 'reference' => $identifier);
  23875. }
  23876. public function getDist($identifier)
  23877. {
  23878. return null;
  23879. }
  23880. public function getFileContent($file, $identifier)
  23881. {
  23882. $resource = sprintf('hg cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  23883. $this->process->execute($resource, $content, $this->repoDir);
  23884. if (!trim($content)) {
  23885. return;
  23886. }
  23887. return $content;
  23888. }
  23889. public function getChangeDate($identifier)
  23890. {
  23891. $this->process->execute(
  23892. sprintf(
  23893. 'hg log --template "{date|rfc3339date}" -r %s',
  23894. ProcessExecutor::escape($identifier)
  23895. ),
  23896. $output,
  23897. $this->repoDir
  23898. );
  23899. return new \DateTime(trim($output), new \DateTimeZone('UTC'));
  23900. }
  23901. public function getTags()
  23902. {
  23903. if (null === $this->tags) {
  23904. $tags = array();
  23905. $this->process->execute('hg tags', $output, $this->repoDir);
  23906. foreach ($this->process->splitLines($output) as $tag) {
  23907. if ($tag && preg_match('(^([^\s]+)\s+\d+:(.*)$)', $tag, $match)) {
  23908. $tags[$match[1]] = $match[2];
  23909. }
  23910. }
  23911. unset($tags['tip']);
  23912. $this->tags = $tags;
  23913. }
  23914. return $this->tags;
  23915. }
  23916. public function getBranches()
  23917. {
  23918. if (null === $this->branches) {
  23919. $branches = array();
  23920. $bookmarks = array();
  23921. $this->process->execute('hg branches', $output, $this->repoDir);
  23922. foreach ($this->process->splitLines($output) as $branch) {
  23923. if ($branch && preg_match('(^([^\s]+)\s+\d+:([a-f0-9]+))', $branch, $match)) {
  23924. $branches[$match[1]] = $match[2];
  23925. }
  23926. }
  23927. $this->process->execute('hg bookmarks', $output, $this->repoDir);
  23928. foreach ($this->process->splitLines($output) as $branch) {
  23929. if ($branch && preg_match('(^(?:[\s*]*)([^\s]+)\s+\d+:(.*)$)', $branch, $match)) {
  23930. $bookmarks[$match[1]] = $match[2];
  23931. }
  23932. }
  23933. $this->branches = array_merge($bookmarks, $branches);
  23934. }
  23935. return $this->branches;
  23936. }
  23937. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23938. {
  23939. if (preg_match('#(^(?:https?|ssh)://(?:[^@]+@)?bitbucket.org|https://(?:.*?)\.kilnhg.com)#i', $url)) {
  23940. return true;
  23941. }
  23942. if (Filesystem::isLocalPath($url)) {
  23943. $url = Filesystem::getPlatformPath($url);
  23944. if (!is_dir($url)) {
  23945. return false;
  23946. }
  23947. $process = new ProcessExecutor($io);
  23948. if ($process->execute('hg summary', $output, $url) === 0) {
  23949. return true;
  23950. }
  23951. }
  23952. if (!$deep) {
  23953. return false;
  23954. }
  23955. $processExecutor = new ProcessExecutor($io);
  23956. $exit = $processExecutor->execute(sprintf('hg identify %s', ProcessExecutor::escape($url)), $ignored);
  23957. return $exit === 0;
  23958. }
  23959. }
  23960. <?php
  23961. namespace Composer\Repository\Vcs;
  23962. use Composer\Config;
  23963. use Composer\Cache;
  23964. use Composer\IO\IOInterface;
  23965. use Composer\Util\ProcessExecutor;
  23966. use Composer\Util\Perforce;
  23967. class PerforceDriver extends VcsDriver
  23968. {
  23969. protected $depot;
  23970. protected $branch;
  23971. protected $perforce;
  23972. public function initialize()
  23973. {
  23974. $this->depot = $this->repoConfig['depot'];
  23975. $this->branch = '';
  23976. if (!empty($this->repoConfig['branch'])) {
  23977. $this->branch = $this->repoConfig['branch'];
  23978. }
  23979. $this->initPerforce($this->repoConfig);
  23980. $this->perforce->p4Login();
  23981. $this->perforce->checkStream();
  23982. $this->perforce->writeP4ClientSpec();
  23983. $this->perforce->connectClient();
  23984. return true;
  23985. }
  23986. private function initPerforce($repoConfig)
  23987. {
  23988. if (!empty($this->perforce)) {
  23989. return;
  23990. }
  23991. if (!Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  23992. throw new \RuntimeException('PerforceDriver requires a usable cache directory, and it looks like you set it to be disabled');
  23993. }
  23994. $repoDir = $this->config->get('cache-vcs-dir') . '/' . $this->depot;
  23995. $this->perforce = Perforce::create($repoConfig, $this->getUrl(), $repoDir, $this->process, $this->io);
  23996. }
  23997. public function getFileContent($file, $identifier)
  23998. {
  23999. return $this->perforce->getFileContent($file, $identifier);
  24000. }
  24001. public function getChangeDate($identifier)
  24002. {
  24003. return null;
  24004. }
  24005. public function getRootIdentifier()
  24006. {
  24007. return $this->branch;
  24008. }
  24009. public function getBranches()
  24010. {
  24011. return $this->perforce->getBranches();
  24012. }
  24013. public function getTags()
  24014. {
  24015. return $this->perforce->getTags();
  24016. }
  24017. public function getDist($identifier)
  24018. {
  24019. return null;
  24020. }
  24021. public function getSource($identifier)
  24022. {
  24023. $source = array(
  24024. 'type' => 'perforce',
  24025. 'url' => $this->repoConfig['url'],
  24026. 'reference' => $identifier,
  24027. 'p4user' => $this->perforce->getUser(),
  24028. );
  24029. return $source;
  24030. }
  24031. public function getUrl()
  24032. {
  24033. return $this->url;
  24034. }
  24035. public function hasComposerFile($identifier)
  24036. {
  24037. $composerInfo = $this->perforce->getComposerInformation('//' . $this->depot . '/' . $identifier);
  24038. $composerInfoIdentifier = $identifier;
  24039. return !empty($composerInfo);
  24040. }
  24041. public function getContents($url)
  24042. {
  24043. return false;
  24044. }
  24045. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  24046. {
  24047. if ($deep || preg_match('#\b(perforce|p4)\b#i', $url)) {
  24048. return Perforce::checkServerExists($url, new ProcessExecutor($io));
  24049. }
  24050. return false;
  24051. }
  24052. public function cleanup()
  24053. {
  24054. $this->perforce->cleanupClientSpec();
  24055. $this->perforce = null;
  24056. }
  24057. public function getDepot()
  24058. {
  24059. return $this->depot;
  24060. }
  24061. public function getBranch()
  24062. {
  24063. return $this->branch;
  24064. }
  24065. }
  24066. <?php
  24067. namespace Composer\Repository\Vcs;
  24068. use Composer\Cache;
  24069. use Composer\Config;
  24070. use Composer\Json\JsonFile;
  24071. use Composer\Util\ProcessExecutor;
  24072. use Composer\Util\Filesystem;
  24073. use Composer\Util\Svn as SvnUtil;
  24074. use Composer\IO\IOInterface;
  24075. use Composer\Downloader\TransportException;
  24076. class SvnDriver extends VcsDriver
  24077. {
  24078. protected $cache;
  24079. protected $baseUrl;
  24080. protected $tags;
  24081. protected $branches;
  24082. protected $rootIdentifier;
  24083. protected $infoCache = array();
  24084. protected $trunkPath = 'trunk';
  24085. protected $branchesPath = 'branches';
  24086. protected $tagsPath = 'tags';
  24087. protected $packagePath = '';
  24088. protected $cacheCredentials = true;
  24089. private $util;
  24090. public function initialize()
  24091. {
  24092. $this->url = $this->baseUrl = rtrim(self::normalizeUrl($this->url), '/');
  24093. SvnUtil::cleanEnv();
  24094. if (isset($this->repoConfig['trunk-path'])) {
  24095. $this->trunkPath = $this->repoConfig['trunk-path'];
  24096. }
  24097. if (isset($this->repoConfig['branches-path'])) {
  24098. $this->branchesPath = $this->repoConfig['branches-path'];
  24099. }
  24100. if (isset($this->repoConfig['tags-path'])) {
  24101. $this->tagsPath = $this->repoConfig['tags-path'];
  24102. }
  24103. if (array_key_exists('svn-cache-credentials', $this->repoConfig)) {
  24104. $this->cacheCredentials = (bool) $this->repoConfig['svn-cache-credentials'];
  24105. }
  24106. if (isset($this->repoConfig['package-path'])) {
  24107. $this->packagePath = '/' . trim($this->repoConfig['package-path'], '/');
  24108. }
  24109. if (false !== ($pos = strrpos($this->url, '/' . $this->trunkPath))) {
  24110. $this->baseUrl = substr($this->url, 0, $pos);
  24111. }
  24112. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->baseUrl));
  24113. $this->getBranches();
  24114. $this->getTags();
  24115. }
  24116. public function getRootIdentifier()
  24117. {
  24118. return $this->rootIdentifier ?: $this->trunkPath;
  24119. }
  24120. public function getUrl()
  24121. {
  24122. return $this->url;
  24123. }
  24124. public function getSource($identifier)
  24125. {
  24126. return array('type' => 'svn', 'url' => $this->baseUrl, 'reference' => $identifier);
  24127. }
  24128. public function getDist($identifier)
  24129. {
  24130. return null;
  24131. }
  24132. protected function shouldCache($identifier)
  24133. {
  24134. return $this->cache && preg_match('{@\d+$}', $identifier);
  24135. }
  24136. public function getComposerInformation($identifier)
  24137. {
  24138. if (!isset($this->infoCache[$identifier])) {
  24139. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier.'.json')) {
  24140. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  24141. }
  24142. try {
  24143. $composer = $this->getBaseComposerInformation($identifier);
  24144. } catch (TransportException $e) {
  24145. $message = $e->getMessage();
  24146. if (stripos($message, 'path not found') === false && stripos($message, 'svn: warning: W160013') === false) {
  24147. throw $e;
  24148. }
  24149. $composer = '';
  24150. }
  24151. if ($this->shouldCache($identifier)) {
  24152. $this->cache->write($identifier.'.json', json_encode($composer));
  24153. }
  24154. $this->infoCache[$identifier] = $composer;
  24155. }
  24156. return $this->infoCache[$identifier];
  24157. }
  24158. public function getFileContent($file, $identifier)
  24159. {
  24160. $identifier = '/' . trim($identifier, '/') . '/';
  24161. preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  24162. if (!empty($match[2])) {
  24163. $path = $match[1];
  24164. $rev = $match[2];
  24165. } else {
  24166. $path = $identifier;
  24167. $rev = '';
  24168. }
  24169. try {
  24170. $resource = $path.$file;
  24171. $output = $this->execute('svn cat', $this->baseUrl . $resource . $rev);
  24172. if (!trim($output)) {
  24173. return null;
  24174. }
  24175. } catch (\RuntimeException $e) {
  24176. throw new TransportException($e->getMessage());
  24177. }
  24178. return $output;
  24179. }
  24180. public function getChangeDate($identifier)
  24181. {
  24182. $identifier = '/' . trim($identifier, '/') . '/';
  24183. preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  24184. if (!empty($match[2])) {
  24185. $path = $match[1];
  24186. $rev = $match[2];
  24187. } else {
  24188. $path = $identifier;
  24189. $rev = '';
  24190. }
  24191. $output = $this->execute('svn info', $this->baseUrl . $path . $rev);
  24192. foreach ($this->process->splitLines($output) as $line) {
  24193. if ($line && preg_match('{^Last Changed Date: ([^(]+)}', $line, $match)) {
  24194. return new \DateTime($match[1], new \DateTimeZone('UTC'));
  24195. }
  24196. }
  24197. return null;
  24198. }
  24199. public function getTags()
  24200. {
  24201. if (null === $this->tags) {
  24202. $this->tags = array();
  24203. if ($this->tagsPath !== false) {
  24204. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->tagsPath);
  24205. if ($output) {
  24206. foreach ($this->process->splitLines($output) as $line) {
  24207. $line = trim($line);
  24208. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  24209. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  24210. $this->tags[rtrim($match[2], '/')] = $this->buildIdentifier(
  24211. '/' . $this->tagsPath . '/' . $match[2],
  24212. $match[1]
  24213. );
  24214. }
  24215. }
  24216. }
  24217. }
  24218. }
  24219. }
  24220. return $this->tags;
  24221. }
  24222. public function getBranches()
  24223. {
  24224. if (null === $this->branches) {
  24225. $this->branches = array();
  24226. if (false === $this->trunkPath) {
  24227. $trunkParent = $this->baseUrl . '/';
  24228. } else {
  24229. $trunkParent = $this->baseUrl . '/' . $this->trunkPath;
  24230. }
  24231. $output = $this->execute('svn ls --verbose', $trunkParent);
  24232. if ($output) {
  24233. foreach ($this->process->splitLines($output) as $line) {
  24234. $line = trim($line);
  24235. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  24236. if (isset($match[1]) && isset($match[2]) && $match[2] === './') {
  24237. $this->branches['trunk'] = $this->buildIdentifier(
  24238. '/' . $this->trunkPath,
  24239. $match[1]
  24240. );
  24241. $this->rootIdentifier = $this->branches['trunk'];
  24242. break;
  24243. }
  24244. }
  24245. }
  24246. }
  24247. unset($output);
  24248. if ($this->branchesPath !== false) {
  24249. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->branchesPath);
  24250. if ($output) {
  24251. foreach ($this->process->splitLines(trim($output)) as $line) {
  24252. $line = trim($line);
  24253. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  24254. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  24255. $this->branches[rtrim($match[2], '/')] = $this->buildIdentifier(
  24256. '/' . $this->branchesPath . '/' . $match[2],
  24257. $match[1]
  24258. );
  24259. }
  24260. }
  24261. }
  24262. }
  24263. }
  24264. }
  24265. return $this->branches;
  24266. }
  24267. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  24268. {
  24269. $url = self::normalizeUrl($url);
  24270. if (preg_match('#(^svn://|^svn\+ssh://|svn\.)#i', $url)) {
  24271. return true;
  24272. }
  24273. if (!$deep && !Filesystem::isLocalPath($url)) {
  24274. return false;
  24275. }
  24276. $processExecutor = new ProcessExecutor($io);
  24277. $exit = $processExecutor->execute(
  24278. "svn info --non-interactive ".ProcessExecutor::escape($url),
  24279. $ignoredOutput
  24280. );
  24281. if ($exit === 0) {
  24282. return true;
  24283. }
  24284. if (false !== stripos($processExecutor->getErrorOutput(), 'authorization failed:')) {
  24285. return true;
  24286. }
  24287. if (false !== stripos($processExecutor->getErrorOutput(), 'Authentication failed')) {
  24288. return true;
  24289. }
  24290. return false;
  24291. }
  24292. protected static function normalizeUrl($url)
  24293. {
  24294. $fs = new Filesystem();
  24295. if ($fs->isAbsolutePath($url)) {
  24296. return 'file://' . strtr($url, '\\', '/');
  24297. }
  24298. return $url;
  24299. }
  24300. protected function execute($command, $url)
  24301. {
  24302. if (null === $this->util) {
  24303. $this->util = new SvnUtil($this->baseUrl, $this->io, $this->config, $this->process);
  24304. $this->util->setCacheCredentials($this->cacheCredentials);
  24305. }
  24306. try {
  24307. return $this->util->execute($command, $url);
  24308. } catch (\RuntimeException $e) {
  24309. if (null === $this->util->binaryVersion()) {
  24310. 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());
  24311. }
  24312. throw new \RuntimeException(
  24313. 'Repository '.$this->url.' could not be processed, '.$e->getMessage()
  24314. );
  24315. }
  24316. }
  24317. protected function buildIdentifier($baseDir, $revision)
  24318. {
  24319. return rtrim($baseDir, '/') . $this->packagePath . '/@' . $revision;
  24320. }
  24321. }
  24322. <?php
  24323. namespace Composer\Repository\Vcs;
  24324. use Composer\Cache;
  24325. use Composer\Downloader\TransportException;
  24326. use Composer\Config;
  24327. use Composer\Factory;
  24328. use Composer\IO\IOInterface;
  24329. use Composer\Json\JsonFile;
  24330. use Composer\Util\ProcessExecutor;
  24331. use Composer\Util\RemoteFilesystem;
  24332. use Composer\Util\Filesystem;
  24333. abstract class VcsDriver implements VcsDriverInterface
  24334. {
  24335. protected $url;
  24336. protected $originUrl;
  24337. protected $repoConfig;
  24338. protected $io;
  24339. protected $config;
  24340. protected $process;
  24341. protected $remoteFilesystem;
  24342. protected $infoCache = array();
  24343. protected $cache;
  24344. final public function __construct(array $repoConfig, IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  24345. {
  24346. if (Filesystem::isLocalPath($repoConfig['url'])) {
  24347. $repoConfig['url'] = Filesystem::getPlatformPath($repoConfig['url']);
  24348. }
  24349. $this->url = $repoConfig['url'];
  24350. $this->originUrl = $repoConfig['url'];
  24351. $this->repoConfig = $repoConfig;
  24352. $this->io = $io;
  24353. $this->config = $config;
  24354. $this->process = $process ?: new ProcessExecutor($io);
  24355. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  24356. }
  24357. protected function shouldCache($identifier)
  24358. {
  24359. return $this->cache && preg_match('{[a-f0-9]{40}}i', $identifier);
  24360. }
  24361. public function getComposerInformation($identifier)
  24362. {
  24363. if (!isset($this->infoCache[$identifier])) {
  24364. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  24365. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  24366. }
  24367. $composer = $this->getBaseComposerInformation($identifier);
  24368. if ($this->shouldCache($identifier)) {
  24369. $this->cache->write($identifier, json_encode($composer));
  24370. }
  24371. $this->infoCache[$identifier] = $composer;
  24372. }
  24373. return $this->infoCache[$identifier];
  24374. }
  24375. protected function getBaseComposerInformation($identifier)
  24376. {
  24377. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  24378. if (!$composerFileContent) {
  24379. return null;
  24380. }
  24381. $composer = JsonFile::parseJson($composerFileContent, $identifier . ':composer.json');
  24382. if (empty($composer['time']) && $changeDate = $this->getChangeDate($identifier)) {
  24383. $composer['time'] = $changeDate->format(DATE_RFC3339);
  24384. }
  24385. return $composer;
  24386. }
  24387. public function hasComposerFile($identifier)
  24388. {
  24389. try {
  24390. return (bool) $this->getComposerInformation($identifier);
  24391. } catch (TransportException $e) {
  24392. }
  24393. return false;
  24394. }
  24395. protected function getScheme()
  24396. {
  24397. if (extension_loaded('openssl')) {
  24398. return 'https';
  24399. }
  24400. return 'http';
  24401. }
  24402. protected function getContents($url)
  24403. {
  24404. $options = isset($this->repoConfig['options']) ? $this->repoConfig['options'] : array();
  24405. return $this->remoteFilesystem->getContents($this->originUrl, $url, false, $options);
  24406. }
  24407. public function cleanup()
  24408. {
  24409. return;
  24410. }
  24411. }
  24412. <?php
  24413. namespace Composer\Repository\Vcs;
  24414. use Composer\Config;
  24415. use Composer\IO\IOInterface;
  24416. interface VcsDriverInterface
  24417. {
  24418. public function initialize();
  24419. public function getComposerInformation($identifier);
  24420. public function getFileContent($file, $identifier);
  24421. public function getChangeDate($identifier);
  24422. public function getRootIdentifier();
  24423. public function getBranches();
  24424. public function getTags();
  24425. public function getDist($identifier);
  24426. public function getSource($identifier);
  24427. public function getUrl();
  24428. public function hasComposerFile($identifier);
  24429. public function cleanup();
  24430. public static function supports(IOInterface $io, Config $config, $url, $deep = false);
  24431. }
  24432. <?php
  24433. namespace Composer\Repository;
  24434. use Composer\Downloader\TransportException;
  24435. use Composer\Repository\Vcs\VcsDriverInterface;
  24436. use Composer\Package\Version\VersionParser;
  24437. use Composer\Package\Loader\ArrayLoader;
  24438. use Composer\Package\Loader\ValidatingArrayLoader;
  24439. use Composer\Package\Loader\InvalidPackageException;
  24440. use Composer\Package\Loader\LoaderInterface;
  24441. use Composer\EventDispatcher\EventDispatcher;
  24442. use Composer\IO\IOInterface;
  24443. use Composer\Config;
  24444. class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  24445. {
  24446. protected $url;
  24447. protected $packageName;
  24448. protected $isVerbose;
  24449. protected $isVeryVerbose;
  24450. protected $io;
  24451. protected $config;
  24452. protected $versionParser;
  24453. protected $type;
  24454. protected $loader;
  24455. protected $repoConfig;
  24456. protected $branchErrorOccurred = false;
  24457. private $drivers;
  24458. private $driver;
  24459. private $versionCache;
  24460. private $emptyReferences = array();
  24461. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, array $drivers = null, VersionCacheInterface $versionCache = null)
  24462. {
  24463. parent::__construct();
  24464. $this->drivers = $drivers ?: array(
  24465. 'github' => 'Composer\Repository\Vcs\GitHubDriver',
  24466. 'gitlab' => 'Composer\Repository\Vcs\GitLabDriver',
  24467. 'git-bitbucket' => 'Composer\Repository\Vcs\GitBitbucketDriver',
  24468. 'git' => 'Composer\Repository\Vcs\GitDriver',
  24469. 'hg-bitbucket' => 'Composer\Repository\Vcs\HgBitbucketDriver',
  24470. 'hg' => 'Composer\Repository\Vcs\HgDriver',
  24471. 'perforce' => 'Composer\Repository\Vcs\PerforceDriver',
  24472. 'fossil' => 'Composer\Repository\Vcs\FossilDriver',
  24473. 'svn' => 'Composer\Repository\Vcs\SvnDriver',
  24474. );
  24475. $this->url = $repoConfig['url'];
  24476. $this->io = $io;
  24477. $this->type = isset($repoConfig['type']) ? $repoConfig['type'] : 'vcs';
  24478. $this->isVerbose = $io->isVerbose();
  24479. $this->isVeryVerbose = $io->isVeryVerbose();
  24480. $this->config = $config;
  24481. $this->repoConfig = $repoConfig;
  24482. $this->versionCache = $versionCache;
  24483. }
  24484. public function getRepoConfig()
  24485. {
  24486. return $this->repoConfig;
  24487. }
  24488. public function setLoader(LoaderInterface $loader)
  24489. {
  24490. $this->loader = $loader;
  24491. }
  24492. public function getDriver()
  24493. {
  24494. if ($this->driver) {
  24495. return $this->driver;
  24496. }
  24497. if (isset($this->drivers[$this->type])) {
  24498. $class = $this->drivers[$this->type];
  24499. $this->driver = new $class($this->repoConfig, $this->io, $this->config);
  24500. $this->driver->initialize();
  24501. return $this->driver;
  24502. }
  24503. foreach ($this->drivers as $driver) {
  24504. if ($driver::supports($this->io, $this->config, $this->url)) {
  24505. $this->driver = new $driver($this->repoConfig, $this->io, $this->config);
  24506. $this->driver->initialize();
  24507. return $this->driver;
  24508. }
  24509. }
  24510. foreach ($this->drivers as $driver) {
  24511. if ($driver::supports($this->io, $this->config, $this->url, true)) {
  24512. $this->driver = new $driver($this->repoConfig, $this->io, $this->config);
  24513. $this->driver->initialize();
  24514. return $this->driver;
  24515. }
  24516. }
  24517. }
  24518. public function hadInvalidBranches()
  24519. {
  24520. return $this->branchErrorOccurred;
  24521. }
  24522. public function getEmptyReferences()
  24523. {
  24524. return $this->emptyReferences;
  24525. }
  24526. protected function initialize()
  24527. {
  24528. parent::initialize();
  24529. $isVerbose = $this->isVerbose;
  24530. $isVeryVerbose = $this->isVeryVerbose;
  24531. $driver = $this->getDriver();
  24532. if (!$driver) {
  24533. throw new \InvalidArgumentException('No driver found to handle VCS repository '.$this->url);
  24534. }
  24535. $this->versionParser = new VersionParser;
  24536. if (!$this->loader) {
  24537. $this->loader = new ArrayLoader($this->versionParser);
  24538. }
  24539. try {
  24540. if ($driver->hasComposerFile($driver->getRootIdentifier())) {
  24541. $data = $driver->getComposerInformation($driver->getRootIdentifier());
  24542. $this->packageName = !empty($data['name']) ? $data['name'] : null;
  24543. }
  24544. } catch (\Exception $e) {
  24545. if ($isVeryVerbose) {
  24546. $this->io->writeError('<error>Skipped parsing '.$driver->getRootIdentifier().', '.$e->getMessage().'</error>');
  24547. }
  24548. }
  24549. foreach ($driver->getTags() as $tag => $identifier) {
  24550. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $tag . '</comment>)';
  24551. if ($isVeryVerbose) {
  24552. $this->io->writeError($msg);
  24553. } elseif ($isVerbose) {
  24554. $this->io->overwriteError($msg, false);
  24555. }
  24556. $tag = str_replace('release-', '', $tag);
  24557. $cachedPackage = $this->getCachedPackageVersion($tag, $identifier, $isVerbose, $isVeryVerbose);
  24558. if ($cachedPackage) {
  24559. $this->addPackage($cachedPackage);
  24560. continue;
  24561. } elseif ($cachedPackage === false) {
  24562. $this->emptyReferences[] = $identifier;
  24563. continue;
  24564. }
  24565. if (!$parsedTag = $this->validateTag($tag)) {
  24566. if ($isVeryVerbose) {
  24567. $this->io->writeError('<warning>Skipped tag '.$tag.', invalid tag name</warning>');
  24568. }
  24569. continue;
  24570. }
  24571. try {
  24572. if (!$data = $driver->getComposerInformation($identifier)) {
  24573. if ($isVeryVerbose) {
  24574. $this->io->writeError('<warning>Skipped tag '.$tag.', no composer file</warning>');
  24575. }
  24576. $this->emptyReferences[] = $identifier;
  24577. continue;
  24578. }
  24579. if (isset($data['version'])) {
  24580. $data['version_normalized'] = $this->versionParser->normalize($data['version']);
  24581. } else {
  24582. $data['version'] = $tag;
  24583. $data['version_normalized'] = $parsedTag;
  24584. }
  24585. $data['version'] = preg_replace('{[.-]?dev$}i', '', $data['version']);
  24586. $data['version_normalized'] = preg_replace('{(^dev-|[.-]?dev$)}i', '', $data['version_normalized']);
  24587. if ($data['version_normalized'] !== $parsedTag) {
  24588. if ($isVeryVerbose) {
  24589. $this->io->writeError('<warning>Skipped tag '.$tag.', tag ('.$parsedTag.') does not match version ('.$data['version_normalized'].') in composer.json</warning>');
  24590. }
  24591. continue;
  24592. }
  24593. $tagPackageName = isset($data['name']) ? $data['name'] : $this->packageName;
  24594. if ($existingPackage = $this->findPackage($tagPackageName, $data['version_normalized'])) {
  24595. if ($isVeryVerbose) {
  24596. $this->io->writeError('<warning>Skipped tag '.$tag.', it conflicts with an another tag ('.$existingPackage->getPrettyVersion().') as both resolve to '.$data['version_normalized'].' internally</warning>');
  24597. }
  24598. continue;
  24599. }
  24600. if ($isVeryVerbose) {
  24601. $this->io->writeError('Importing tag '.$tag.' ('.$data['version_normalized'].')');
  24602. }
  24603. $this->addPackage($this->loader->load($this->preProcess($driver, $data, $identifier)));
  24604. } catch (\Exception $e) {
  24605. if ($e instanceof TransportException && $e->getCode() === 404) {
  24606. $this->emptyReferences[] = $identifier;
  24607. }
  24608. if ($isVeryVerbose) {
  24609. $this->io->writeError('<warning>Skipped tag '.$tag.', '.($e instanceof TransportException ? 'no composer file was found' : $e->getMessage()).'</warning>');
  24610. }
  24611. continue;
  24612. }
  24613. }
  24614. if (!$isVeryVerbose) {
  24615. $this->io->overwriteError('', false);
  24616. }
  24617. $branches = $driver->getBranches();
  24618. foreach ($branches as $branch => $identifier) {
  24619. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $branch . '</comment>)';
  24620. if ($isVeryVerbose) {
  24621. $this->io->writeError($msg);
  24622. } elseif ($isVerbose) {
  24623. $this->io->overwriteError($msg, false);
  24624. }
  24625. if ($branch === 'trunk' && isset($branches['master'])) {
  24626. if ($isVeryVerbose) {
  24627. $this->io->writeError('<warning>Skipped branch '.$branch.', can not parse both master and trunk branches as they both resolve to 9999999-dev internally</warning>');
  24628. }
  24629. continue;
  24630. }
  24631. if (!$parsedBranch = $this->validateBranch($branch)) {
  24632. if ($isVeryVerbose) {
  24633. $this->io->writeError('<warning>Skipped branch '.$branch.', invalid name</warning>');
  24634. }
  24635. continue;
  24636. }
  24637. if ('dev-' === substr($parsedBranch, 0, 4) || '9999999-dev' === $parsedBranch) {
  24638. $version = 'dev-' . $branch;
  24639. } else {
  24640. $prefix = substr($branch, 0, 1) === 'v' ? 'v' : '';
  24641. $version = $prefix . preg_replace('{(\.9{7})+}', '.x', $parsedBranch);
  24642. }
  24643. $cachedPackage = $this->getCachedPackageVersion($version, $identifier, $isVerbose, $isVeryVerbose);
  24644. if ($cachedPackage) {
  24645. $this->addPackage($cachedPackage);
  24646. continue;
  24647. } elseif ($cachedPackage === false) {
  24648. $this->emptyReferences[] = $identifier;
  24649. continue;
  24650. }
  24651. try {
  24652. if (!$data = $driver->getComposerInformation($identifier)) {
  24653. if ($isVeryVerbose) {
  24654. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file</warning>');
  24655. }
  24656. $this->emptyReferences[] = $identifier;
  24657. continue;
  24658. }
  24659. $data['version'] = $version;
  24660. $data['version_normalized'] = $parsedBranch;
  24661. if ($isVeryVerbose) {
  24662. $this->io->writeError('Importing branch '.$branch.' ('.$data['version'].')');
  24663. }
  24664. $packageData = $this->preProcess($driver, $data, $identifier);
  24665. $package = $this->loader->load($packageData);
  24666. if ($this->loader instanceof ValidatingArrayLoader && $this->loader->getWarnings()) {
  24667. throw new InvalidPackageException($this->loader->getErrors(), $this->loader->getWarnings(), $packageData);
  24668. }
  24669. $this->addPackage($package);
  24670. } catch (TransportException $e) {
  24671. if ($e->getCode() === 404) {
  24672. $this->emptyReferences[] = $identifier;
  24673. }
  24674. if ($isVeryVerbose) {
  24675. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file was found</warning>');
  24676. }
  24677. continue;
  24678. } catch (\Exception $e) {
  24679. if (!$isVeryVerbose) {
  24680. $this->io->writeError('');
  24681. }
  24682. $this->branchErrorOccurred = true;
  24683. $this->io->writeError('<error>Skipped branch '.$branch.', '.$e->getMessage().'</error>');
  24684. $this->io->writeError('');
  24685. continue;
  24686. }
  24687. }
  24688. $driver->cleanup();
  24689. if (!$isVeryVerbose) {
  24690. $this->io->overwriteError('', false);
  24691. }
  24692. if (!$this->getPackages()) {
  24693. throw new InvalidRepositoryException('No valid composer.json was found in any branch or tag of '.$this->url.', could not load a package from it.');
  24694. }
  24695. }
  24696. protected function preProcess(VcsDriverInterface $driver, array $data, $identifier)
  24697. {
  24698. $dataPackageName = isset($data['name']) ? $data['name'] : null;
  24699. $data['name'] = $this->packageName ?: $dataPackageName;
  24700. if (!isset($data['dist'])) {
  24701. $data['dist'] = $driver->getDist($identifier);
  24702. }
  24703. if (!isset($data['source'])) {
  24704. $data['source'] = $driver->getSource($identifier);
  24705. }
  24706. return $data;
  24707. }
  24708. private function validateBranch($branch)
  24709. {
  24710. try {
  24711. return $this->versionParser->normalizeBranch($branch);
  24712. } catch (\Exception $e) {
  24713. }
  24714. return false;
  24715. }
  24716. private function validateTag($version)
  24717. {
  24718. try {
  24719. return $this->versionParser->normalize($version);
  24720. } catch (\Exception $e) {
  24721. }
  24722. return false;
  24723. }
  24724. private function getCachedPackageVersion($version, $identifier, $isVerbose, $isVeryVerbose)
  24725. {
  24726. if (!$this->versionCache) {
  24727. return;
  24728. }
  24729. $cachedPackage = $this->versionCache->getVersionPackage($version, $identifier);
  24730. if ($cachedPackage === false) {
  24731. if ($isVeryVerbose) {
  24732. $this->io->writeError('<warning>Skipped '.$version.', no composer file (cached from ref '.$identifier.')</warning>');
  24733. }
  24734. return false;
  24735. }
  24736. if ($cachedPackage) {
  24737. $msg = 'Found cached composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $version . '</comment>)';
  24738. if ($isVeryVerbose) {
  24739. $this->io->writeError($msg);
  24740. } elseif ($isVerbose) {
  24741. $this->io->overwriteError($msg, false);
  24742. }
  24743. if ($existingPackage = $this->findPackage($cachedPackage['name'], $cachedPackage['version_normalized'])) {
  24744. if ($isVeryVerbose) {
  24745. $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>');
  24746. }
  24747. $cachedPackage = null;
  24748. }
  24749. }
  24750. if ($cachedPackage) {
  24751. return $this->loader->load($cachedPackage);
  24752. }
  24753. return null;
  24754. }
  24755. }
  24756. <?php
  24757. namespace Composer\Repository;
  24758. interface VersionCacheInterface
  24759. {
  24760. public function getVersionPackage($version, $identifier);
  24761. }
  24762. <?php
  24763. namespace Composer\Repository;
  24764. use Composer\Package\AliasPackage;
  24765. class WritableArrayRepository extends ArrayRepository implements WritableRepositoryInterface
  24766. {
  24767. public function write()
  24768. {
  24769. }
  24770. public function reload()
  24771. {
  24772. }
  24773. public function getCanonicalPackages()
  24774. {
  24775. $packages = $this->getPackages();
  24776. $packagesByName = array();
  24777. foreach ($packages as $package) {
  24778. if (!isset($packagesByName[$package->getName()]) || $packagesByName[$package->getName()] instanceof AliasPackage) {
  24779. $packagesByName[$package->getName()] = $package;
  24780. }
  24781. }
  24782. $canonicalPackages = array();
  24783. foreach ($packagesByName as $package) {
  24784. while ($package instanceof AliasPackage) {
  24785. $package = $package->getAliasOf();
  24786. }
  24787. $canonicalPackages[] = $package;
  24788. }
  24789. return $canonicalPackages;
  24790. }
  24791. }
  24792. <?php
  24793. namespace Composer\Repository;
  24794. use Composer\Package\PackageInterface;
  24795. interface WritableRepositoryInterface extends RepositoryInterface
  24796. {
  24797. public function write();
  24798. public function addPackage(PackageInterface $package);
  24799. public function removePackage(PackageInterface $package);
  24800. public function getCanonicalPackages();
  24801. public function reload();
  24802. }
  24803. <?php
  24804. namespace Composer\Script;
  24805. class CommandEvent extends Event
  24806. {
  24807. }
  24808. <?php
  24809. namespace Composer\Script;
  24810. use Composer\Composer;
  24811. use Composer\IO\IOInterface;
  24812. use Composer\EventDispatcher\Event as BaseEvent;
  24813. class Event extends BaseEvent
  24814. {
  24815. private $composer;
  24816. private $io;
  24817. private $devMode;
  24818. private $originatingEvent;
  24819. public function __construct($name, Composer $composer, IOInterface $io, $devMode = false, array $args = array(), array $flags = array())
  24820. {
  24821. parent::__construct($name, $args, $flags);
  24822. $this->composer = $composer;
  24823. $this->io = $io;
  24824. $this->devMode = $devMode;
  24825. $this->originatingEvent = null;
  24826. }
  24827. public function getComposer()
  24828. {
  24829. return $this->composer;
  24830. }
  24831. public function getIO()
  24832. {
  24833. return $this->io;
  24834. }
  24835. public function isDevMode()
  24836. {
  24837. return $this->devMode;
  24838. }
  24839. public function getOriginatingEvent()
  24840. {
  24841. return $this->originatingEvent;
  24842. }
  24843. public function setOriginatingEvent(BaseEvent $event)
  24844. {
  24845. $this->originatingEvent = $this->calculateOriginatingEvent($event);
  24846. return $this;
  24847. }
  24848. private function calculateOriginatingEvent(BaseEvent $event)
  24849. {
  24850. if ($event instanceof Event && $event->getOriginatingEvent()) {
  24851. return $this->calculateOriginatingEvent($event->getOriginatingEvent());
  24852. }
  24853. return $event;
  24854. }
  24855. }
  24856. <?php
  24857. namespace Composer\Script;
  24858. use Composer\Installer\PackageEvent as BasePackageEvent;
  24859. class PackageEvent extends BasePackageEvent
  24860. {
  24861. }
  24862. <?php
  24863. namespace Composer\Script;
  24864. class ScriptEvents
  24865. {
  24866. const PRE_INSTALL_CMD = 'pre-install-cmd';
  24867. const POST_INSTALL_CMD = 'post-install-cmd';
  24868. const PRE_UPDATE_CMD = 'pre-update-cmd';
  24869. const POST_UPDATE_CMD = 'post-update-cmd';
  24870. const PRE_STATUS_CMD = 'pre-status-cmd';
  24871. const POST_STATUS_CMD = 'post-status-cmd';
  24872. const PRE_AUTOLOAD_DUMP = 'pre-autoload-dump';
  24873. const POST_AUTOLOAD_DUMP = 'post-autoload-dump';
  24874. const POST_ROOT_PACKAGE_INSTALL = 'post-root-package-install';
  24875. const POST_CREATE_PROJECT_CMD = 'post-create-project-cmd';
  24876. const PRE_ARCHIVE_CMD = 'pre-archive-cmd';
  24877. const POST_ARCHIVE_CMD = 'post-archive-cmd';
  24878. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  24879. const POST_PACKAGE_INSTALL = 'post-package-install';
  24880. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  24881. const POST_PACKAGE_UPDATE = 'post-package-update';
  24882. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  24883. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  24884. }
  24885. <?php
  24886. namespace Composer\SelfUpdate;
  24887. class Keys
  24888. {
  24889. public static function fingerprint($path)
  24890. {
  24891. $hash = strtoupper(hash('sha256', preg_replace('{\s}', '', file_get_contents($path))));
  24892. return implode(' ', array(
  24893. substr($hash, 0, 8),
  24894. substr($hash, 8, 8),
  24895. substr($hash, 16, 8),
  24896. substr($hash, 24, 8),
  24897. '',
  24898. substr($hash, 32, 8),
  24899. substr($hash, 40, 8),
  24900. substr($hash, 48, 8),
  24901. substr($hash, 56, 8),
  24902. ));
  24903. }
  24904. }
  24905. <?php
  24906. namespace Composer\SelfUpdate;
  24907. use Composer\Util\RemoteFilesystem;
  24908. use Composer\Config;
  24909. use Composer\Json\JsonFile;
  24910. class Versions
  24911. {
  24912. private $rfs;
  24913. private $config;
  24914. private $channel;
  24915. public function __construct(Config $config, RemoteFilesystem $rfs)
  24916. {
  24917. $this->rfs = $rfs;
  24918. $this->config = $config;
  24919. }
  24920. public function getChannel()
  24921. {
  24922. if ($this->channel) {
  24923. return $this->channel;
  24924. }
  24925. $channelFile = $this->config->get('home').'/update-channel';
  24926. if (file_exists($channelFile)) {
  24927. $channel = trim(file_get_contents($channelFile));
  24928. if (in_array($channel, array('stable', 'preview', 'snapshot'), true)) {
  24929. return $this->channel = $channel;
  24930. }
  24931. }
  24932. return $this->channel = 'stable';
  24933. }
  24934. public function setChannel($channel)
  24935. {
  24936. if (!in_array($channel, array('stable', 'preview', 'snapshot'), true)) {
  24937. throw new \InvalidArgumentException('Invalid channel '.$channel.', must be one of: stable, preview, snapshot');
  24938. }
  24939. $channelFile = $this->config->get('home').'/update-channel';
  24940. $this->channel = $channel;
  24941. file_put_contents($channelFile, $channel.PHP_EOL);
  24942. }
  24943. public function getLatest()
  24944. {
  24945. $protocol = extension_loaded('openssl') ? 'https' : 'http';
  24946. $versions = JsonFile::parseJson($this->rfs->getContents('getcomposer.org', $protocol . '://getcomposer.org/versions', false));
  24947. foreach ($versions[$this->getChannel()] as $version) {
  24948. if ($version['min-php'] <= PHP_VERSION_ID) {
  24949. return $version;
  24950. }
  24951. }
  24952. throw new \LogicException('There is no version of Composer available for your PHP version ('.PHP_VERSION.')');
  24953. }
  24954. }
  24955. <?php
  24956. namespace Composer\Util;
  24957. use Composer\Config;
  24958. use Composer\IO\IOInterface;
  24959. class AuthHelper
  24960. {
  24961. protected $io;
  24962. protected $config;
  24963. public function __construct(IOInterface $io, Config $config)
  24964. {
  24965. $this->io = $io;
  24966. $this->config = $config;
  24967. }
  24968. public function storeAuth($originUrl, $storeAuth)
  24969. {
  24970. $store = false;
  24971. $configSource = $this->config->getAuthConfigSource();
  24972. if ($storeAuth === true) {
  24973. $store = $configSource;
  24974. } elseif ($storeAuth === 'prompt') {
  24975. $answer = $this->io->askAndValidate(
  24976. 'Do you want to store credentials for '.$originUrl.' in '.$configSource->getName().' ? [Yn] ',
  24977. function ($value) {
  24978. $input = strtolower(substr(trim($value), 0, 1));
  24979. if (in_array($input, array('y','n'))) {
  24980. return $input;
  24981. }
  24982. throw new \RuntimeException('Please answer (y)es or (n)o');
  24983. },
  24984. null,
  24985. 'y'
  24986. );
  24987. if ($answer === 'y') {
  24988. $store = $configSource;
  24989. }
  24990. }
  24991. if ($store) {
  24992. $store->addConfigSetting(
  24993. 'http-basic.'.$originUrl,
  24994. $this->io->getAuthentication($originUrl)
  24995. );
  24996. }
  24997. }
  24998. }
  24999. <?php
  25000. namespace Composer\Util;
  25001. use Composer\Factory;
  25002. use Composer\IO\IOInterface;
  25003. use Composer\Config;
  25004. use Composer\Downloader\TransportException;
  25005. class Bitbucket
  25006. {
  25007. private $io;
  25008. private $config;
  25009. private $process;
  25010. private $remoteFilesystem;
  25011. private $token = array();
  25012. private $time;
  25013. const OAUTH2_ACCESS_TOKEN_URL = 'https://bitbucket.org/site/oauth2/access_token';
  25014. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null, $time = null)
  25015. {
  25016. $this->io = $io;
  25017. $this->config = $config;
  25018. $this->process = $process ?: new ProcessExecutor($io);
  25019. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  25020. $this->time = $time;
  25021. }
  25022. public function getToken()
  25023. {
  25024. if (!isset($this->token['access_token'])) {
  25025. return '';
  25026. }
  25027. return $this->token['access_token'];
  25028. }
  25029. public function authorizeOAuth($originUrl)
  25030. {
  25031. if ($originUrl !== 'bitbucket.org') {
  25032. return false;
  25033. }
  25034. if (0 === $this->process->execute('git config bitbucket.accesstoken', $output)) {
  25035. $this->io->setAuthentication($originUrl, 'x-token-auth', trim($output));
  25036. return true;
  25037. }
  25038. return false;
  25039. }
  25040. private function requestAccessToken($originUrl)
  25041. {
  25042. try {
  25043. $json = $this->remoteFilesystem->getContents($originUrl, self::OAUTH2_ACCESS_TOKEN_URL, false, array(
  25044. 'retry-auth-failure' => false,
  25045. 'http' => array(
  25046. 'method' => 'POST',
  25047. 'content' => 'grant_type=client_credentials',
  25048. ),
  25049. ));
  25050. $this->token = json_decode($json, true);
  25051. } catch (TransportException $e) {
  25052. if ($e->getCode() === 400) {
  25053. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  25054. $this->io->writeError('This can have two reasons:');
  25055. $this->io->writeError('1. You are authenticating with a bitbucket username/password combination');
  25056. $this->io->writeError('2. You are using an OAuth consumer, but didn\'t configure a (dummy) callback url');
  25057. return false;
  25058. } elseif (in_array($e->getCode(), array(403, 401))) {
  25059. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  25060. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  25061. return false;
  25062. }
  25063. throw $e;
  25064. }
  25065. return true;
  25066. }
  25067. public function authorizeOAuthInteractively($originUrl, $message = null)
  25068. {
  25069. if ($message) {
  25070. $this->io->writeError($message);
  25071. }
  25072. $url = 'https://confluence.atlassian.com/bitbucket/oauth-on-bitbucket-cloud-238027431.html';
  25073. $this->io->writeError(sprintf('Follow the instructions on %s', $url));
  25074. $this->io->writeError(sprintf('to create a consumer. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  25075. $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)');
  25076. $consumerKey = trim($this->io->askAndHideAnswer('Consumer Key (hidden): '));
  25077. if (!$consumerKey) {
  25078. $this->io->writeError('<warning>No consumer key given, aborting.</warning>');
  25079. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  25080. return false;
  25081. }
  25082. $consumerSecret = trim($this->io->askAndHideAnswer('Consumer Secret (hidden): '));
  25083. if (!$consumerSecret) {
  25084. $this->io->writeError('<warning>No consumer secret given, aborting.</warning>');
  25085. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  25086. return false;
  25087. }
  25088. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  25089. if (!$this->requestAccessToken($originUrl)) {
  25090. return false;
  25091. }
  25092. $this->storeInAuthConfig($originUrl, $consumerKey, $consumerSecret);
  25093. $this->config->getAuthConfigSource()->removeConfigSetting('http-basic.' . $originUrl);
  25094. $this->io->writeError('<info>Consumer stored successfully.</info>');
  25095. return true;
  25096. }
  25097. public function requestToken($originUrl, $consumerKey, $consumerSecret)
  25098. {
  25099. if (!empty($this->token) || $this->getTokenFromConfig($originUrl)) {
  25100. return $this->token['access_token'];
  25101. }
  25102. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  25103. if (!$this->requestAccessToken($originUrl)) {
  25104. return '';
  25105. }
  25106. $this->storeInAuthConfig($originUrl, $consumerKey, $consumerSecret);
  25107. return $this->token['access_token'];
  25108. }
  25109. private function storeInAuthConfig($originUrl, $consumerKey, $consumerSecret)
  25110. {
  25111. $this->config->getConfigSource()->removeConfigSetting('bitbucket-oauth.'.$originUrl);
  25112. $time = null === $this->time ? time() : $this->time;
  25113. $consumer = array(
  25114. "consumer-key" => $consumerKey,
  25115. "consumer-secret" => $consumerSecret,
  25116. "access-token" => $this->token['access_token'],
  25117. "access-token-expiration" => $time + $this->token['expires_in'],
  25118. );
  25119. $this->config->getAuthConfigSource()->addConfigSetting('bitbucket-oauth.'.$originUrl, $consumer);
  25120. }
  25121. private function getTokenFromConfig($originUrl)
  25122. {
  25123. $authConfig = $this->config->get('bitbucket-oauth');
  25124. if (
  25125. !isset($authConfig[$originUrl]['access-token'])
  25126. || !isset($authConfig[$originUrl]['access-token-expiration'])
  25127. || time() > $authConfig[$originUrl]['access-token-expiration']
  25128. ) {
  25129. return false;
  25130. }
  25131. $this->token = array(
  25132. 'access_token' => $authConfig[$originUrl]['access-token'],
  25133. );
  25134. return true;
  25135. }
  25136. }
  25137. <?php
  25138. namespace Composer\Util;
  25139. class ComposerMirror
  25140. {
  25141. public static function processUrl($mirrorUrl, $packageName, $version, $reference, $type)
  25142. {
  25143. if ($reference) {
  25144. $reference = preg_match('{^([a-f0-9]*|%reference%)$}', $reference) ? $reference : md5($reference);
  25145. }
  25146. $version = strpos($version, '/') === false ? $version : md5($version);
  25147. return str_replace(
  25148. array('%package%', '%version%', '%reference%', '%type%'),
  25149. array($packageName, $version, $reference, $type),
  25150. $mirrorUrl
  25151. );
  25152. }
  25153. public static function processGitUrl($mirrorUrl, $packageName, $url, $type)
  25154. {
  25155. if (preg_match('#^(?:(?:https?|git)://github\.com/|git@github\.com:)([^/]+)/(.+?)(?:\.git)?$#', $url, $match)) {
  25156. $url = 'gh-'.$match[1].'/'.$match[2];
  25157. } elseif (preg_match('#^https://bitbucket\.org/([^/]+)/(.+?)(?:\.git)?/?$#', $url, $match)) {
  25158. $url = 'bb-'.$match[1].'/'.$match[2];
  25159. } else {
  25160. $url = preg_replace('{[^a-z0-9_.-]}i', '-', trim($url, '/'));
  25161. }
  25162. return str_replace(
  25163. array('%package%', '%normalizedUrl%', '%type%'),
  25164. array($packageName, $url, $type),
  25165. $mirrorUrl
  25166. );
  25167. }
  25168. public static function processHgUrl($mirrorUrl, $packageName, $url, $type)
  25169. {
  25170. return self::processGitUrl($mirrorUrl, $packageName, $url, $type);
  25171. }
  25172. }
  25173. <?php
  25174. namespace Composer\Util;
  25175. use Composer\Package\Loader\ArrayLoader;
  25176. use Composer\Package\Loader\ValidatingArrayLoader;
  25177. use Composer\Package\Loader\InvalidPackageException;
  25178. use Composer\Json\JsonValidationException;
  25179. use Composer\IO\IOInterface;
  25180. use Composer\Json\JsonFile;
  25181. use Composer\Spdx\SpdxLicenses;
  25182. class ConfigValidator
  25183. {
  25184. private $io;
  25185. public function __construct(IOInterface $io)
  25186. {
  25187. $this->io = $io;
  25188. }
  25189. public function validate($file, $arrayLoaderValidationFlags = ValidatingArrayLoader::CHECK_ALL)
  25190. {
  25191. $errors = array();
  25192. $publishErrors = array();
  25193. $warnings = array();
  25194. $laxValid = false;
  25195. try {
  25196. $json = new JsonFile($file, null, $this->io);
  25197. $manifest = $json->read();
  25198. $json->validateSchema(JsonFile::LAX_SCHEMA);
  25199. $laxValid = true;
  25200. $json->validateSchema();
  25201. } catch (JsonValidationException $e) {
  25202. foreach ($e->getErrors() as $message) {
  25203. if ($laxValid) {
  25204. $publishErrors[] = $message;
  25205. } else {
  25206. $errors[] = $message;
  25207. }
  25208. }
  25209. } catch (\Exception $e) {
  25210. $errors[] = $e->getMessage();
  25211. return array($errors, $publishErrors, $warnings);
  25212. }
  25213. if (empty($manifest['license'])) {
  25214. $warnings[] = 'No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.';
  25215. } else {
  25216. $licenses = (array) $manifest['license'];
  25217. foreach ($licenses as $key => $license) {
  25218. if ('proprietary' === $license) {
  25219. unset($licenses[$key]);
  25220. }
  25221. }
  25222. $licenseValidator = new SpdxLicenses();
  25223. foreach ($licenses as $license) {
  25224. $spdxLicense = $licenseValidator->getLicenseByIdentifier($license);
  25225. if ($spdxLicense && $spdxLicense[3]) {
  25226. if (preg_match('{^[AL]?GPL-[123](\.[01])?\+$}i', $license)) {
  25227. $warnings[] = sprintf(
  25228. 'License "%s" is a deprecated SPDX license identifier, use "'.str_replace('+', '', $license).'-or-later" instead',
  25229. $license
  25230. );
  25231. } elseif (preg_match('{^[AL]?GPL-[123](\.[01])?$}i', $license)) {
  25232. $warnings[] = sprintf(
  25233. 'License "%s" is a deprecated SPDX license identifier, use "'.$license.'-only" or "'.$license.'-or-later" instead',
  25234. $license
  25235. );
  25236. } else {
  25237. $warnings[] = sprintf(
  25238. 'License "%s" is a deprecated SPDX license identifier, see https://spdx.org/licenses/',
  25239. $license
  25240. );
  25241. }
  25242. }
  25243. }
  25244. }
  25245. if (isset($manifest['version'])) {
  25246. $warnings[] = 'The version field is present, it is recommended to leave it out if the package is published on Packagist.';
  25247. }
  25248. if (!empty($manifest['name']) && preg_match('{[A-Z]}', $manifest['name'])) {
  25249. $suggestName = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $manifest['name']);
  25250. $suggestName = strtolower($suggestName);
  25251. $publishErrors[] = sprintf(
  25252. '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.',
  25253. $manifest['name'],
  25254. $suggestName
  25255. );
  25256. }
  25257. if (!empty($manifest['type']) && $manifest['type'] == 'composer-installer') {
  25258. $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.";
  25259. }
  25260. if (isset($manifest['require']) && isset($manifest['require-dev'])) {
  25261. $requireOverrides = array_intersect_key($manifest['require'], $manifest['require-dev']);
  25262. if (!empty($requireOverrides)) {
  25263. $plural = (count($requireOverrides) > 1) ? 'are' : 'is';
  25264. $warnings[] = implode(', ', array_keys($requireOverrides)). " {$plural} required both in require and require-dev, this can lead to unexpected behavior";
  25265. }
  25266. }
  25267. $require = isset($manifest['require']) ? $manifest['require'] : array();
  25268. $requireDev = isset($manifest['require-dev']) ? $manifest['require-dev'] : array();
  25269. $packages = array_merge($require, $requireDev);
  25270. foreach ($packages as $package => $version) {
  25271. if (preg_match('/#/', $version) === 1) {
  25272. $warnings[] = sprintf(
  25273. 'The package "%s" is pointing to a commit-ref, this is bad practice and can cause unforeseen issues.',
  25274. $package
  25275. );
  25276. }
  25277. }
  25278. $scriptsDescriptions = isset($manifest['scripts-descriptions']) ? $manifest['scripts-descriptions'] : array();
  25279. $scripts = isset($manifest['scripts']) ? $manifest['scripts'] : array();
  25280. foreach ($scriptsDescriptions as $scriptName => $scriptDescription) {
  25281. if (!array_key_exists($scriptName, $scripts)) {
  25282. $warnings[] = sprintf(
  25283. 'Description for non-existent script "%s" found in "scripts-descriptions"',
  25284. $scriptName
  25285. );
  25286. }
  25287. }
  25288. if (isset($manifest['autoload']['psr-0'][''])) {
  25289. $warnings[] = "Defining autoload.psr-0 with an empty namespace prefix is a bad idea for performance";
  25290. }
  25291. if (isset($manifest['autoload']['psr-4'][''])) {
  25292. $warnings[] = "Defining autoload.psr-4 with an empty namespace prefix is a bad idea for performance";
  25293. }
  25294. try {
  25295. $loader = new ValidatingArrayLoader(new ArrayLoader(), true, null, $arrayLoaderValidationFlags);
  25296. if (!isset($manifest['version'])) {
  25297. $manifest['version'] = '1.0.0';
  25298. }
  25299. if (!isset($manifest['name'])) {
  25300. $manifest['name'] = 'dummy/dummy';
  25301. }
  25302. $loader->load($manifest);
  25303. } catch (InvalidPackageException $e) {
  25304. $errors = array_merge($errors, $e->getErrors());
  25305. }
  25306. $warnings = array_merge($warnings, $loader->getWarnings());
  25307. return array($errors, $publishErrors, $warnings);
  25308. }
  25309. }
  25310. <?php
  25311. namespace Composer\Util;
  25312. use Composer\IO\IOInterface;
  25313. class ErrorHandler
  25314. {
  25315. private static $io;
  25316. public static function handle($level, $message, $file, $line)
  25317. {
  25318. if (!(error_reporting() & $level)) {
  25319. return;
  25320. }
  25321. if (filter_var(ini_get('xdebug.scream'), FILTER_VALIDATE_BOOLEAN)) {
  25322. $message .= "\n\nWarning: You have xdebug.scream enabled, the warning above may be".
  25323. "\na legitimately suppressed error that you were not supposed to see.";
  25324. }
  25325. if ($level !== E_DEPRECATED && $level !== E_USER_DEPRECATED) {
  25326. throw new \ErrorException($message, 0, $level, $file, $line);
  25327. }
  25328. if (self::$io) {
  25329. self::$io->writeError('<warning>Deprecation Notice: '.$message.' in '.$file.':'.$line.'</warning>');
  25330. if (self::$io->isVerbose()) {
  25331. self::$io->writeError('<warning>Stack trace:</warning>');
  25332. self::$io->writeError(array_filter(array_map(function ($a) {
  25333. if (isset($a['line'], $a['file'])) {
  25334. return '<warning> '.$a['file'].':'.$a['line'].'</warning>';
  25335. }
  25336. return null;
  25337. }, array_slice(debug_backtrace(), 2))));
  25338. }
  25339. }
  25340. return true;
  25341. }
  25342. public static function register(IOInterface $io = null)
  25343. {
  25344. set_error_handler(array(__CLASS__, 'handle'));
  25345. error_reporting(E_ALL | E_STRICT);
  25346. self::$io = $io;
  25347. }
  25348. }
  25349. <?php
  25350. namespace Composer\Util;
  25351. use RecursiveDirectoryIterator;
  25352. use RecursiveIteratorIterator;
  25353. use Symfony\Component\Filesystem\Exception\IOException;
  25354. use Symfony\Component\Finder\Finder;
  25355. class Filesystem
  25356. {
  25357. private $processExecutor;
  25358. public function __construct(ProcessExecutor $executor = null)
  25359. {
  25360. $this->processExecutor = $executor ?: new ProcessExecutor();
  25361. }
  25362. public function remove($file)
  25363. {
  25364. if (is_dir($file)) {
  25365. return $this->removeDirectory($file);
  25366. }
  25367. if (file_exists($file)) {
  25368. return $this->unlink($file);
  25369. }
  25370. return false;
  25371. }
  25372. public function isDirEmpty($dir)
  25373. {
  25374. $finder = Finder::create()
  25375. ->ignoreVCS(false)
  25376. ->ignoreDotFiles(false)
  25377. ->depth(0)
  25378. ->in($dir);
  25379. return count($finder) === 0;
  25380. }
  25381. public function emptyDirectory($dir, $ensureDirectoryExists = true)
  25382. {
  25383. if (file_exists($dir) && is_link($dir)) {
  25384. $this->unlink($dir);
  25385. }
  25386. if ($ensureDirectoryExists) {
  25387. $this->ensureDirectoryExists($dir);
  25388. }
  25389. if (is_dir($dir)) {
  25390. $finder = Finder::create()
  25391. ->ignoreVCS(false)
  25392. ->ignoreDotFiles(false)
  25393. ->depth(0)
  25394. ->in($dir);
  25395. foreach ($finder as $path) {
  25396. $this->remove((string) $path);
  25397. }
  25398. }
  25399. }
  25400. public function removeDirectory($directory)
  25401. {
  25402. if ($this->isSymlinkedDirectory($directory)) {
  25403. return $this->unlinkSymlinkedDirectory($directory);
  25404. }
  25405. if ($this->isJunction($directory)) {
  25406. return $this->removeJunction($directory);
  25407. }
  25408. if (is_link($directory)) {
  25409. return unlink($directory);
  25410. }
  25411. if (!file_exists($directory) || !is_dir($directory)) {
  25412. return true;
  25413. }
  25414. if (preg_match('{^(?:[a-z]:)?[/\\\\]+$}i', $directory)) {
  25415. throw new \RuntimeException('Aborting an attempted deletion of '.$directory.', this was probably not intended, if it is a real use case please report it.');
  25416. }
  25417. if (!function_exists('proc_open')) {
  25418. return $this->removeDirectoryPhp($directory);
  25419. }
  25420. if (Platform::isWindows()) {
  25421. $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape(realpath($directory)));
  25422. } else {
  25423. $cmd = sprintf('rm -rf %s', ProcessExecutor::escape($directory));
  25424. }
  25425. $result = $this->getProcess()->execute($cmd, $output) === 0;
  25426. clearstatcache();
  25427. if ($result && !file_exists($directory)) {
  25428. return true;
  25429. }
  25430. return $this->removeDirectoryPhp($directory);
  25431. }
  25432. public function removeDirectoryPhp($directory)
  25433. {
  25434. try {
  25435. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  25436. } catch (\UnexpectedValueException $e) {
  25437. clearstatcache();
  25438. usleep(100000);
  25439. if (!is_dir($directory)) {
  25440. return true;
  25441. }
  25442. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  25443. }
  25444. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  25445. foreach ($ri as $file) {
  25446. if ($file->isDir()) {
  25447. $this->rmdir($file->getPathname());
  25448. } else {
  25449. $this->unlink($file->getPathname());
  25450. }
  25451. }
  25452. return $this->rmdir($directory);
  25453. }
  25454. public function ensureDirectoryExists($directory)
  25455. {
  25456. if (!is_dir($directory)) {
  25457. if (file_exists($directory)) {
  25458. throw new \RuntimeException(
  25459. $directory.' exists and is not a directory.'
  25460. );
  25461. }
  25462. if (!@mkdir($directory, 0777, true)) {
  25463. throw new \RuntimeException(
  25464. $directory.' does not exist and could not be created.'
  25465. );
  25466. }
  25467. }
  25468. }
  25469. public function unlink($path)
  25470. {
  25471. $unlinked = @$this->unlinkImplementation($path);
  25472. if (!$unlinked) {
  25473. if (Platform::isWindows()) {
  25474. usleep(350000);
  25475. $unlinked = @$this->unlinkImplementation($path);
  25476. }
  25477. if (!$unlinked) {
  25478. $error = error_get_last();
  25479. $message = 'Could not delete '.$path.': ' . @$error['message'];
  25480. if (Platform::isWindows()) {
  25481. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  25482. }
  25483. throw new \RuntimeException($message);
  25484. }
  25485. }
  25486. return true;
  25487. }
  25488. public function rmdir($path)
  25489. {
  25490. $deleted = @rmdir($path);
  25491. if (!$deleted) {
  25492. if (Platform::isWindows()) {
  25493. usleep(350000);
  25494. $deleted = @rmdir($path);
  25495. }
  25496. if (!$deleted) {
  25497. $error = error_get_last();
  25498. $message = 'Could not delete '.$path.': ' . @$error['message'];
  25499. if (Platform::isWindows()) {
  25500. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  25501. }
  25502. throw new \RuntimeException($message);
  25503. }
  25504. }
  25505. return true;
  25506. }
  25507. public function copyThenRemove($source, $target)
  25508. {
  25509. $this->copy($source, $target);
  25510. if (!is_dir($source)) {
  25511. $this->unlink($source);
  25512. return;
  25513. }
  25514. $this->removeDirectoryPhp($source);
  25515. }
  25516. public function copy($source, $target)
  25517. {
  25518. if (!is_dir($source)) {
  25519. return copy($source, $target);
  25520. }
  25521. $it = new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS);
  25522. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::SELF_FIRST);
  25523. $this->ensureDirectoryExists($target);
  25524. $result = true;
  25525. foreach ($ri as $file) {
  25526. $targetPath = $target . DIRECTORY_SEPARATOR . $ri->getSubPathName();
  25527. if ($file->isDir()) {
  25528. $this->ensureDirectoryExists($targetPath);
  25529. } else {
  25530. $result = $result && copy($file->getPathname(), $targetPath);
  25531. }
  25532. }
  25533. return $result;
  25534. }
  25535. public function rename($source, $target)
  25536. {
  25537. if (true === @rename($source, $target)) {
  25538. return;
  25539. }
  25540. if (!function_exists('proc_open')) {
  25541. return $this->copyThenRemove($source, $target);
  25542. }
  25543. if (Platform::isWindows()) {
  25544. $command = sprintf('xcopy %s %s /E /I /Q /Y', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  25545. $result = $this->processExecutor->execute($command, $output);
  25546. clearstatcache();
  25547. if (0 === $result) {
  25548. $this->remove($source);
  25549. return;
  25550. }
  25551. } else {
  25552. $command = sprintf('mv %s %s', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  25553. $result = $this->processExecutor->execute($command, $output);
  25554. clearstatcache();
  25555. if (0 === $result) {
  25556. return;
  25557. }
  25558. }
  25559. return $this->copyThenRemove($source, $target);
  25560. }
  25561. public function findShortestPath($from, $to, $directories = false)
  25562. {
  25563. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  25564. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  25565. }
  25566. $from = lcfirst($this->normalizePath($from));
  25567. $to = lcfirst($this->normalizePath($to));
  25568. if ($directories) {
  25569. $from = rtrim($from, '/') . '/dummy_file';
  25570. }
  25571. if (dirname($from) === dirname($to)) {
  25572. return './'.basename($to);
  25573. }
  25574. $commonPath = $to;
  25575. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath)) {
  25576. $commonPath = strtr(dirname($commonPath), '\\', '/');
  25577. }
  25578. if (0 !== strpos($from, $commonPath) || '/' === $commonPath) {
  25579. return $to;
  25580. }
  25581. $commonPath = rtrim($commonPath, '/') . '/';
  25582. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/');
  25583. $commonPathCode = str_repeat('../', $sourcePathDepth);
  25584. return ($commonPathCode . substr($to, strlen($commonPath))) ?: './';
  25585. }
  25586. public function findShortestPathCode($from, $to, $directories = false, $staticCode = false)
  25587. {
  25588. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  25589. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  25590. }
  25591. $from = lcfirst($this->normalizePath($from));
  25592. $to = lcfirst($this->normalizePath($to));
  25593. if ($from === $to) {
  25594. return $directories ? '__DIR__' : '__FILE__';
  25595. }
  25596. $commonPath = $to;
  25597. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath) && '.' !== $commonPath) {
  25598. $commonPath = strtr(dirname($commonPath), '\\', '/');
  25599. }
  25600. if (0 !== strpos($from, $commonPath) || '/' === $commonPath || '.' === $commonPath) {
  25601. return var_export($to, true);
  25602. }
  25603. $commonPath = rtrim($commonPath, '/') . '/';
  25604. if (strpos($to, $from.'/') === 0) {
  25605. return '__DIR__ . '.var_export(substr($to, strlen($from)), true);
  25606. }
  25607. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/') + $directories;
  25608. if ($staticCode) {
  25609. $commonPathCode = "__DIR__ . '".str_repeat('/..', $sourcePathDepth)."'";
  25610. } else {
  25611. $commonPathCode = str_repeat('dirname(', $sourcePathDepth).'__DIR__'.str_repeat(')', $sourcePathDepth);
  25612. }
  25613. $relTarget = substr($to, strlen($commonPath));
  25614. return $commonPathCode . (strlen($relTarget) ? '.' . var_export('/' . $relTarget, true) : '');
  25615. }
  25616. public function isAbsolutePath($path)
  25617. {
  25618. return substr($path, 0, 1) === '/' || substr($path, 1, 1) === ':' || substr($path, 0, 2) === '\\\\';
  25619. }
  25620. public function size($path)
  25621. {
  25622. if (!file_exists($path)) {
  25623. throw new \RuntimeException("$path does not exist.");
  25624. }
  25625. if (is_dir($path)) {
  25626. return $this->directorySize($path);
  25627. }
  25628. return filesize($path);
  25629. }
  25630. public function normalizePath($path)
  25631. {
  25632. $parts = array();
  25633. $path = strtr($path, '\\', '/');
  25634. $prefix = '';
  25635. $absolute = false;
  25636. if (preg_match('{^( [0-9a-z]{2,}+: (?: // (?: [a-z]: )? )? | [a-z]: )}ix', $path, $match)) {
  25637. $prefix = $match[1];
  25638. $path = substr($path, strlen($prefix));
  25639. }
  25640. if (substr($path, 0, 1) === '/') {
  25641. $absolute = true;
  25642. $path = substr($path, 1);
  25643. }
  25644. $up = false;
  25645. foreach (explode('/', $path) as $chunk) {
  25646. if ('..' === $chunk && ($absolute || $up)) {
  25647. array_pop($parts);
  25648. $up = !(empty($parts) || '..' === end($parts));
  25649. } elseif ('.' !== $chunk && '' !== $chunk) {
  25650. $parts[] = $chunk;
  25651. $up = '..' !== $chunk;
  25652. }
  25653. }
  25654. return $prefix.($absolute ? '/' : '').implode('/', $parts);
  25655. }
  25656. public static function isLocalPath($path)
  25657. {
  25658. return (bool) preg_match('{^(file://(?!//)|/(?!/)|/?[a-z]:[\\\\/]|\.\.[\\\\/]|[a-z0-9_.-]+[\\\\/])}i', $path);
  25659. }
  25660. public static function getPlatformPath($path)
  25661. {
  25662. if (Platform::isWindows()) {
  25663. $path = preg_replace('{^(?:file:///([a-z]):?/)}i', 'file://$1:/', $path);
  25664. }
  25665. return preg_replace('{^file://}i', '', $path);
  25666. }
  25667. protected function directorySize($directory)
  25668. {
  25669. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  25670. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  25671. $size = 0;
  25672. foreach ($ri as $file) {
  25673. if ($file->isFile()) {
  25674. $size += $file->getSize();
  25675. }
  25676. }
  25677. return $size;
  25678. }
  25679. protected function getProcess()
  25680. {
  25681. return $this->processExecutor;
  25682. }
  25683. private function unlinkImplementation($path)
  25684. {
  25685. if (Platform::isWindows() && is_dir($path) && is_link($path)) {
  25686. return rmdir($path);
  25687. }
  25688. return unlink($path);
  25689. }
  25690. public function relativeSymlink($target, $link)
  25691. {
  25692. $cwd = getcwd();
  25693. $relativePath = $this->findShortestPath($link, $target);
  25694. chdir(dirname($link));
  25695. $result = @symlink($relativePath, $link);
  25696. chdir($cwd);
  25697. return $result;
  25698. }
  25699. public function isSymlinkedDirectory($directory)
  25700. {
  25701. if (!is_dir($directory)) {
  25702. return false;
  25703. }
  25704. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  25705. return is_link($resolved);
  25706. }
  25707. private function unlinkSymlinkedDirectory($directory)
  25708. {
  25709. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  25710. return $this->unlink($resolved);
  25711. }
  25712. private function resolveSymlinkedDirectorySymlink($pathname)
  25713. {
  25714. if (!is_dir($pathname)) {
  25715. return $pathname;
  25716. }
  25717. $resolved = rtrim($pathname, '/');
  25718. if (!strlen($resolved)) {
  25719. return $pathname;
  25720. }
  25721. return $resolved;
  25722. }
  25723. public function junction($target, $junction)
  25724. {
  25725. if (!Platform::isWindows()) {
  25726. throw new \LogicException(sprintf('Function %s is not available on non-Windows platform', __CLASS__));
  25727. }
  25728. if (!is_dir($target)) {
  25729. throw new IOException(sprintf('Cannot junction to "%s" as it is not a directory.', $target), 0, null, $target);
  25730. }
  25731. $cmd = sprintf(
  25732. 'mklink /J %s %s',
  25733. ProcessExecutor::escape(str_replace('/', DIRECTORY_SEPARATOR, $junction)),
  25734. ProcessExecutor::escape(realpath($target))
  25735. );
  25736. if ($this->getProcess()->execute($cmd, $output) !== 0) {
  25737. throw new IOException(sprintf('Failed to create junction to "%s" at "%s".', $target, $junction), 0, null, $target);
  25738. }
  25739. clearstatcache(true, $junction);
  25740. }
  25741. public function isJunction($junction)
  25742. {
  25743. if (!Platform::isWindows()) {
  25744. return false;
  25745. }
  25746. clearstatcache(true, $junction);
  25747. if (!is_dir($junction) || is_link($junction)) {
  25748. return false;
  25749. }
  25750. $stat = lstat($junction);
  25751. return $stat ? 0x4000 !== ($stat['mode'] & 0xF000) : false;
  25752. }
  25753. public function removeJunction($junction)
  25754. {
  25755. if (!Platform::isWindows()) {
  25756. return false;
  25757. }
  25758. $junction = rtrim(str_replace('/', DIRECTORY_SEPARATOR, $junction), DIRECTORY_SEPARATOR);
  25759. if (!$this->isJunction($junction)) {
  25760. throw new IOException(sprintf('%s is not a junction and thus cannot be removed as one', $junction));
  25761. }
  25762. return $this->rmdir($junction);
  25763. }
  25764. }
  25765. <?php
  25766. namespace Composer\Util;
  25767. use Composer\Config;
  25768. use Composer\IO\IOInterface;
  25769. class Git
  25770. {
  25771. private static $version;
  25772. protected $io;
  25773. protected $config;
  25774. protected $process;
  25775. protected $filesystem;
  25776. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process, Filesystem $fs)
  25777. {
  25778. $this->io = $io;
  25779. $this->config = $config;
  25780. $this->process = $process;
  25781. $this->filesystem = $fs;
  25782. }
  25783. public function runCommand($commandCallable, $url, $cwd, $initialClone = false)
  25784. {
  25785. $this->config->prohibitUrlByConfig($url, $this->io);
  25786. if ($initialClone) {
  25787. $origCwd = $cwd;
  25788. $cwd = null;
  25789. }
  25790. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $url)) {
  25791. 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.');
  25792. }
  25793. if (!$initialClone) {
  25794. $this->process->execute('git remote -v', $output, $cwd);
  25795. if (preg_match('{^(?:composer|origin)\s+https?://(.+):(.+)@([^/]+)}im', $output, $match) && !$this->io->hasAuthentication($match[3])) {
  25796. $this->io->setAuthentication($match[3], rawurldecode($match[1]), rawurldecode($match[2]));
  25797. }
  25798. }
  25799. $protocols = $this->config->get('github-protocols');
  25800. if (!is_array($protocols)) {
  25801. throw new \RuntimeException('Config value "github-protocols" must be an array, got ' . gettype($protocols));
  25802. }
  25803. if (preg_match('{^(?:https?|git)://' . self::getGitHubDomainsRegex($this->config) . '/(.*)}', $url, $match)) {
  25804. $messages = array();
  25805. foreach ($protocols as $protocol) {
  25806. if ('ssh' === $protocol) {
  25807. $protoUrl = "git@" . $match[1] . ":" . $match[2];
  25808. } else {
  25809. $protoUrl = $protocol . "://" . $match[1] . "/" . $match[2];
  25810. }
  25811. if (0 === $this->process->execute(call_user_func($commandCallable, $protoUrl), $ignoredOutput, $cwd)) {
  25812. return;
  25813. }
  25814. $messages[] = '- ' . $protoUrl . "\n" . preg_replace('#^#m', ' ', $this->process->getErrorOutput());
  25815. if ($initialClone) {
  25816. $this->filesystem->removeDirectory($origCwd);
  25817. }
  25818. }
  25819. $this->throwException('Failed to clone ' . $url . ' via ' . implode(', ', $protocols) . ' protocols, aborting.' . "\n\n" . implode("\n", $messages), $url);
  25820. }
  25821. $bypassSshForGitHub = preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url) && !in_array('ssh', $protocols, true);
  25822. $command = call_user_func($commandCallable, $url);
  25823. $auth = null;
  25824. if ($bypassSshForGitHub || 0 !== $this->process->execute($command, $ignoredOutput, $cwd)) {
  25825. if (preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url, $match)
  25826. || preg_match('{^(https?)://' . self::getGitHubDomainsRegex($this->config) . '/(.*)}', $url, $match)
  25827. ) {
  25828. if (!$this->io->hasAuthentication($match[1])) {
  25829. $gitHubUtil = new GitHub($this->io, $this->config, $this->process);
  25830. $message = 'Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos';
  25831. if (!$gitHubUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  25832. $gitHubUtil->authorizeOAuthInteractively($match[1], $message);
  25833. }
  25834. }
  25835. if ($this->io->hasAuthentication($match[1])) {
  25836. $auth = $this->io->getAuthentication($match[1]);
  25837. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  25838. $command = call_user_func($commandCallable, $authUrl);
  25839. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25840. return;
  25841. }
  25842. }
  25843. } elseif (preg_match('{^https://(bitbucket\.org)/(.*)(\.git)?$}U', $url, $match)) {
  25844. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process);
  25845. if (!$this->io->hasAuthentication($match[1])) {
  25846. $message = 'Enter your Bitbucket credentials to access private repos';
  25847. if (!$bitbucketUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  25848. $bitbucketUtil->authorizeOAuthInteractively($match[1], $message);
  25849. $accessToken = $bitbucketUtil->getToken();
  25850. $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
  25851. }
  25852. } else {
  25853. $auth = $this->io->getAuthentication($match[1]);
  25854. if ($auth['username'] !== 'x-token-auth') {
  25855. $accessToken = $bitbucketUtil->requestToken($match[1], $auth['username'], $auth['password']);
  25856. if (! empty($accessToken)) {
  25857. $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
  25858. }
  25859. }
  25860. }
  25861. if ($this->io->hasAuthentication($match[1])) {
  25862. $auth = $this->io->getAuthentication($match[1]);
  25863. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  25864. $command = call_user_func($commandCallable, $authUrl);
  25865. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25866. return;
  25867. }
  25868. } else {
  25869. $sshUrl = 'git@bitbucket.org:' . $match[2] . '.git';
  25870. $this->io->writeError(' No bitbucket authentication configured. Falling back to ssh.');
  25871. $command = call_user_func($commandCallable, $sshUrl);
  25872. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25873. return;
  25874. }
  25875. }
  25876. } elseif (
  25877. preg_match('{^(git)@' . self::getGitLabDomainsRegex($this->config) . ':(.+?)\.git$}i', $url, $match)
  25878. || preg_match('{^(https?)://' . self::getGitLabDomainsRegex($this->config) . '/(.*)}', $url, $match)
  25879. ) {
  25880. if ($match[1] === 'git') {
  25881. $match[1] = 'https';
  25882. }
  25883. if (!$this->io->hasAuthentication($match[2])) {
  25884. $gitLabUtil = new GitLab($this->io, $this->config, $this->process);
  25885. $message = 'Cloning failed, enter your GitLab credentials to access private repos';
  25886. if (!$gitLabUtil->authorizeOAuth($match[2]) && $this->io->isInteractive()) {
  25887. $gitLabUtil->authorizeOAuthInteractively($match[1], $match[2], $message);
  25888. }
  25889. }
  25890. if ($this->io->hasAuthentication($match[2])) {
  25891. $auth = $this->io->getAuthentication($match[2]);
  25892. if ($auth['password'] === 'private-token' || $auth['password'] === 'oauth2' || $auth['password'] === 'gitlab-ci-token') {
  25893. $authUrl = $match[1] . '://' . rawurlencode($auth['password']) . ':' . rawurlencode($auth['username']) . '@' . $match[2] . '/' . $match[3];
  25894. } else {
  25895. $authUrl = $match[1] . '://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[2] . '/' . $match[3];
  25896. }
  25897. $command = call_user_func($commandCallable, $authUrl);
  25898. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25899. return;
  25900. }
  25901. }
  25902. } elseif ($this->isAuthenticationFailure($url, $match)) {
  25903. if (strpos($match[2], '@')) {
  25904. list($authParts, $match[2]) = explode('@', $match[2], 2);
  25905. }
  25906. $storeAuth = false;
  25907. if ($this->io->hasAuthentication($match[2])) {
  25908. $auth = $this->io->getAuthentication($match[2]);
  25909. } elseif ($this->io->isInteractive()) {
  25910. $defaultUsername = null;
  25911. if (isset($authParts) && $authParts) {
  25912. if (false !== strpos($authParts, ':')) {
  25913. list($defaultUsername, ) = explode(':', $authParts, 2);
  25914. } else {
  25915. $defaultUsername = $authParts;
  25916. }
  25917. }
  25918. $this->io->writeError(' Authentication required (<info>' . $match[2] . '</info>):');
  25919. $auth = array(
  25920. 'username' => $this->io->ask(' Username: ', $defaultUsername),
  25921. 'password' => $this->io->askAndHideAnswer(' Password: '),
  25922. );
  25923. $storeAuth = $this->config->get('store-auths');
  25924. }
  25925. if ($auth) {
  25926. $authUrl = $match[1] . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[2] . $match[3];
  25927. $command = call_user_func($commandCallable, $authUrl);
  25928. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25929. $this->io->setAuthentication($match[2], $auth['username'], $auth['password']);
  25930. $authHelper = new AuthHelper($this->io, $this->config);
  25931. $authHelper->storeAuth($match[2], $storeAuth);
  25932. return;
  25933. }
  25934. }
  25935. }
  25936. $errorMsg = $this->process->getErrorOutput();
  25937. if ($initialClone) {
  25938. $this->filesystem->removeDirectory($origCwd);
  25939. }
  25940. $this->throwException('Failed to execute ' . $command . "\n\n" . $errorMsg, $url);
  25941. }
  25942. }
  25943. public function syncMirror($url, $dir)
  25944. {
  25945. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  25946. try {
  25947. $commandCallable = function ($url) {
  25948. $sanitizedUrl = preg_replace('{://([^@]+?):(.+?)@}', '://', $url);
  25949. return sprintf('git remote set-url origin %s && git remote update --prune origin && git remote set-url origin %s', ProcessExecutor::escape($url), ProcessExecutor::escape($sanitizedUrl));
  25950. };
  25951. $this->runCommand($commandCallable, $url, $dir);
  25952. } catch (\Exception $e) {
  25953. return false;
  25954. }
  25955. return true;
  25956. }
  25957. $this->filesystem->removeDirectory($dir);
  25958. $commandCallable = function ($url) use ($dir) {
  25959. return sprintf('git clone --mirror %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($dir));
  25960. };
  25961. $this->runCommand($commandCallable, $url, $dir, true);
  25962. return true;
  25963. }
  25964. public function fetchRefOrSyncMirror($url, $dir, $ref)
  25965. {
  25966. if ($this->checkRefIsInMirror($url, $dir, $ref)) {
  25967. return true;
  25968. }
  25969. if ($this->syncMirror($url, $dir)) {
  25970. return $this->checkRefIsInMirror($url, $dir, $ref);
  25971. }
  25972. return false;
  25973. }
  25974. private function checkRefIsInMirror($url, $dir, $ref)
  25975. {
  25976. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  25977. $escapedRef = ProcessExecutor::escape($ref.'^{commit}');
  25978. $exitCode = $this->process->execute(sprintf('git rev-parse --quiet --verify %s', $escapedRef), $ignoredOutput, $dir);
  25979. if ($exitCode === 0) {
  25980. return true;
  25981. }
  25982. }
  25983. return false;
  25984. }
  25985. private function isAuthenticationFailure($url, &$match)
  25986. {
  25987. if (!preg_match('{^(https?://)([^/]+)(.*)$}i', $url, $match)) {
  25988. return false;
  25989. }
  25990. $authFailures = array(
  25991. 'fatal: Authentication failed',
  25992. 'remote error: Invalid username or password.',
  25993. 'error: 401 Unauthorized',
  25994. 'fatal: unable to access',
  25995. 'fatal: could not read Username',
  25996. );
  25997. $errorOutput = $this->process->getErrorOutput();
  25998. foreach ($authFailures as $authFailure) {
  25999. if (strpos($errorOutput, $authFailure) !== false) {
  26000. return true;
  26001. }
  26002. }
  26003. return false;
  26004. }
  26005. public static function cleanEnv()
  26006. {
  26007. if (PHP_VERSION_ID < 50400 && ini_get('safe_mode') && false === strpos(ini_get('safe_mode_allowed_env_vars'), 'GIT_ASKPASS')) {
  26008. 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');
  26009. }
  26010. if (getenv('GIT_ASKPASS') !== 'echo') {
  26011. putenv('GIT_ASKPASS=echo');
  26012. unset($_SERVER['GIT_ASKPASS']);
  26013. }
  26014. if (getenv('GIT_DIR')) {
  26015. putenv('GIT_DIR');
  26016. unset($_SERVER['GIT_DIR']);
  26017. }
  26018. if (getenv('GIT_WORK_TREE')) {
  26019. putenv('GIT_WORK_TREE');
  26020. unset($_SERVER['GIT_WORK_TREE']);
  26021. }
  26022. if (getenv('LANGUAGE') !== 'C') {
  26023. putenv('LANGUAGE=C');
  26024. }
  26025. putenv("DYLD_LIBRARY_PATH");
  26026. unset($_SERVER['DYLD_LIBRARY_PATH']);
  26027. }
  26028. public static function getGitHubDomainsRegex(Config $config)
  26029. {
  26030. return '(' . implode('|', array_map('preg_quote', $config->get('github-domains'))) . ')';
  26031. }
  26032. public static function getGitLabDomainsRegex(Config $config)
  26033. {
  26034. return '(' . implode('|', array_map('preg_quote', $config->get('gitlab-domains'))) . ')';
  26035. }
  26036. public static function sanitizeUrl($message)
  26037. {
  26038. return preg_replace_callback('{://(?P<user>[^@]+?):(?P<password>.+?)@}', function ($m) {
  26039. if (preg_match('{^[a-f0-9]{12,}$}', $m[1])) {
  26040. return '://***:***@';
  26041. }
  26042. return '://' . $m[1] . ':***@';
  26043. }, $message);
  26044. }
  26045. private function throwException($message, $url)
  26046. {
  26047. clearstatcache();
  26048. if (0 !== $this->process->execute('git --version', $ignoredOutput)) {
  26049. 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()));
  26050. }
  26051. throw new \RuntimeException(self::sanitizeUrl($message));
  26052. }
  26053. public function getVersion()
  26054. {
  26055. if (isset(self::$version)) {
  26056. return self::$version;
  26057. }
  26058. if (0 !== $this->process->execute('git --version', $output)) {
  26059. return;
  26060. }
  26061. if (preg_match('/^git version (\d+(?:\.\d+)+)/m', $output, $matches)) {
  26062. return self::$version = $matches[1];
  26063. }
  26064. }
  26065. }
  26066. <?php
  26067. namespace Composer\Util;
  26068. use Composer\Factory;
  26069. use Composer\IO\IOInterface;
  26070. use Composer\Config;
  26071. use Composer\Downloader\TransportException;
  26072. class GitHub
  26073. {
  26074. protected $io;
  26075. protected $config;
  26076. protected $process;
  26077. protected $remoteFilesystem;
  26078. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  26079. {
  26080. $this->io = $io;
  26081. $this->config = $config;
  26082. $this->process = $process ?: new ProcessExecutor($io);
  26083. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  26084. }
  26085. public function authorizeOAuth($originUrl)
  26086. {
  26087. if (!in_array($originUrl, $this->config->get('github-domains'))) {
  26088. return false;
  26089. }
  26090. if (0 === $this->process->execute('git config github.accesstoken', $output)) {
  26091. $this->io->setAuthentication($originUrl, trim($output), 'x-oauth-basic');
  26092. return true;
  26093. }
  26094. return false;
  26095. }
  26096. public function authorizeOAuthInteractively($originUrl, $message = null)
  26097. {
  26098. if ($message) {
  26099. $this->io->writeError($message);
  26100. }
  26101. $note = 'Composer';
  26102. if ($this->config->get('github-expose-hostname') === true && 0 === $this->process->execute('hostname', $output)) {
  26103. $note .= ' on ' . trim($output);
  26104. }
  26105. $note .= ' ' . date('Y-m-d Hi');
  26106. $url = 'https://'.$originUrl.'/settings/tokens/new?scopes=repo&description=' . str_replace('%20', '+', rawurlencode($note));
  26107. $this->io->writeError(sprintf('Head to %s', $url));
  26108. $this->io->writeError(sprintf('to retrieve a token. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  26109. $token = trim($this->io->askAndHideAnswer('Token (hidden): '));
  26110. if (!$token) {
  26111. $this->io->writeError('<warning>No token given, aborting.</warning>');
  26112. $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
  26113. return false;
  26114. }
  26115. $this->io->setAuthentication($originUrl, $token, 'x-oauth-basic');
  26116. try {
  26117. $apiUrl = ('github.com' === $originUrl) ? 'api.github.com/' : $originUrl . '/api/v3/';
  26118. $this->remoteFilesystem->getContents($originUrl, 'https://'. $apiUrl, false, array(
  26119. 'retry-auth-failure' => false,
  26120. ));
  26121. } catch (TransportException $e) {
  26122. if (in_array($e->getCode(), array(403, 401))) {
  26123. $this->io->writeError('<error>Invalid token provided.</error>');
  26124. $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
  26125. return false;
  26126. }
  26127. throw $e;
  26128. }
  26129. $this->config->getConfigSource()->removeConfigSetting('github-oauth.'.$originUrl);
  26130. $this->config->getAuthConfigSource()->addConfigSetting('github-oauth.'.$originUrl, $token);
  26131. $this->io->writeError('<info>Token stored successfully.</info>');
  26132. return true;
  26133. }
  26134. public function getRateLimit(array $headers)
  26135. {
  26136. $rateLimit = array(
  26137. 'limit' => '?',
  26138. 'reset' => '?',
  26139. );
  26140. foreach ($headers as $header) {
  26141. $header = trim($header);
  26142. if (false === strpos($header, 'X-RateLimit-')) {
  26143. continue;
  26144. }
  26145. list($type, $value) = explode(':', $header, 2);
  26146. switch ($type) {
  26147. case 'X-RateLimit-Limit':
  26148. $rateLimit['limit'] = (int) trim($value);
  26149. break;
  26150. case 'X-RateLimit-Reset':
  26151. $rateLimit['reset'] = date('Y-m-d H:i:s', (int) trim($value));
  26152. break;
  26153. }
  26154. }
  26155. return $rateLimit;
  26156. }
  26157. public function isRateLimited(array $headers)
  26158. {
  26159. foreach ($headers as $header) {
  26160. if (preg_match('{^X-RateLimit-Remaining: *0$}i', trim($header))) {
  26161. return true;
  26162. }
  26163. }
  26164. return false;
  26165. }
  26166. }
  26167. <?php
  26168. namespace Composer\Util;
  26169. use Composer\IO\IOInterface;
  26170. use Composer\Config;
  26171. use Composer\Factory;
  26172. use Composer\Downloader\TransportException;
  26173. use Composer\Json\JsonFile;
  26174. class GitLab
  26175. {
  26176. protected $io;
  26177. protected $config;
  26178. protected $process;
  26179. protected $remoteFilesystem;
  26180. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  26181. {
  26182. $this->io = $io;
  26183. $this->config = $config;
  26184. $this->process = $process ?: new ProcessExecutor($io);
  26185. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  26186. }
  26187. public function authorizeOAuth($originUrl)
  26188. {
  26189. $bcOriginUrl = preg_replace('{:\d+}', '', $originUrl);
  26190. if (!in_array($originUrl, $this->config->get('gitlab-domains'), true) && !in_array($bcOriginUrl, $this->config->get('gitlab-domains'), true)) {
  26191. return false;
  26192. }
  26193. if (0 === $this->process->execute('git config gitlab.accesstoken', $output)) {
  26194. $this->io->setAuthentication($originUrl, trim($output), 'oauth2');
  26195. return true;
  26196. }
  26197. $authTokens = $this->config->get('gitlab-token');
  26198. if (isset($authTokens[$originUrl])) {
  26199. $this->io->setAuthentication($originUrl, $authTokens[$originUrl], 'private-token');
  26200. return true;
  26201. }
  26202. if (isset($authTokens[$bcOriginUrl])) {
  26203. $this->io->setAuthentication($originUrl, $authTokens[$bcOriginUrl], 'private-token');
  26204. return true;
  26205. }
  26206. return false;
  26207. }
  26208. public function authorizeOAuthInteractively($scheme, $originUrl, $message = null)
  26209. {
  26210. if ($message) {
  26211. $this->io->writeError($message);
  26212. }
  26213. $this->io->writeError(sprintf('A token will be created and stored in "%s", your password will never be stored', $this->config->getAuthConfigSource()->getName()));
  26214. $this->io->writeError('To revoke access to this token you can visit '.$originUrl.'/profile/applications');
  26215. $attemptCounter = 0;
  26216. while ($attemptCounter++ < 5) {
  26217. try {
  26218. $response = $this->createToken($scheme, $originUrl);
  26219. } catch (TransportException $e) {
  26220. if (in_array($e->getCode(), array(403, 401))) {
  26221. if (401 === $e->getCode()) {
  26222. $this->io->writeError('Bad credentials.');
  26223. } else {
  26224. $this->io->writeError('Maximum number of login attempts exceeded. Please try again later.');
  26225. }
  26226. $this->io->writeError('You can also manually create a personal token at '.$scheme.'://'.$originUrl.'/profile/personal_access_tokens');
  26227. $this->io->writeError('Add it using "composer config --global --auth gitlab-token.'.$originUrl.' <token>"');
  26228. continue;
  26229. }
  26230. throw $e;
  26231. }
  26232. $this->io->setAuthentication($originUrl, $response['access_token'], 'oauth2');
  26233. $this->config->getAuthConfigSource()->addConfigSetting('gitlab-oauth.'.$originUrl, $response['access_token']);
  26234. return true;
  26235. }
  26236. throw new \RuntimeException('Invalid GitLab credentials 5 times in a row, aborting.');
  26237. }
  26238. private function createToken($scheme, $originUrl)
  26239. {
  26240. $username = $this->io->ask('Username: ');
  26241. $password = $this->io->askAndHideAnswer('Password: ');
  26242. $headers = array('Content-Type: application/x-www-form-urlencoded');
  26243. $apiUrl = $originUrl;
  26244. $data = http_build_query(array(
  26245. 'username' => $username,
  26246. 'password' => $password,
  26247. 'grant_type' => 'password',
  26248. ), null, '&');
  26249. $options = array(
  26250. 'retry-auth-failure' => false,
  26251. 'http' => array(
  26252. 'method' => 'POST',
  26253. 'header' => $headers,
  26254. 'content' => $data,
  26255. ),
  26256. );
  26257. $json = $this->remoteFilesystem->getContents($originUrl, $scheme.'://'.$apiUrl.'/oauth/token', false, $options);
  26258. $this->io->writeError('Token successfully created');
  26259. return JsonFile::parseJson($json);
  26260. }
  26261. }
  26262. <?php
  26263. namespace Composer\Util;
  26264. use Composer\Config;
  26265. use Composer\IO\IOInterface;
  26266. class Hg
  26267. {
  26268. private $io;
  26269. private $config;
  26270. private $process;
  26271. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process)
  26272. {
  26273. $this->io = $io;
  26274. $this->config = $config;
  26275. $this->process = $process;
  26276. }
  26277. public function runCommand($commandCallable, $url, $cwd)
  26278. {
  26279. $this->config->prohibitUrlByConfig($url, $this->io);
  26280. $command = call_user_func($commandCallable, $url);
  26281. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  26282. return;
  26283. }
  26284. if (preg_match('{^(https?)://((.+)(?:\:(.+))?@)?([^/]+)(/.*)?}mi', $url, $match) && $this->io->hasAuthentication($match[5])) {
  26285. $auth = $this->io->getAuthentication($match[5]);
  26286. $authenticatedUrl = $match[1] . '://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[5] . (!empty($match[6]) ? $match[6] : null);
  26287. $command = call_user_func($commandCallable, $authenticatedUrl);
  26288. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  26289. return;
  26290. }
  26291. $error = $this->process->getErrorOutput();
  26292. } else {
  26293. $error = 'The given URL (' . $url . ') does not match the required format (http(s)://(username:password@)example.com/path-to-repository)';
  26294. }
  26295. $this->throwException('Failed to clone ' . $url . ', ' . "\n\n" . $error, $url);
  26296. }
  26297. public static function sanitizeUrl($message)
  26298. {
  26299. return preg_replace_callback('{://(?P<user>[^@]+?):(?P<password>.+?)@}', function ($m) {
  26300. if (preg_match('{^[a-f0-9]{12,}$}', $m[1])) {
  26301. return '://***:***@';
  26302. }
  26303. return '://' . $m[1] . ':***@';
  26304. }, $message);
  26305. }
  26306. private function throwException($message, $url)
  26307. {
  26308. if (0 !== $this->process->execute('hg --version', $ignoredOutput)) {
  26309. 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()));
  26310. }
  26311. throw new \RuntimeException(self::sanitizeUrl($message));
  26312. }
  26313. }
  26314. <?php
  26315. namespace Composer\Util;
  26316. use Composer\XdebugHandler\XdebugHandler;
  26317. class IniHelper
  26318. {
  26319. public static function getAll()
  26320. {
  26321. return XdebugHandler::getAllIniFiles();
  26322. }
  26323. public static function getMessage()
  26324. {
  26325. $paths = self::getAll();
  26326. if (empty($paths[0])) {
  26327. array_shift($paths);
  26328. }
  26329. $ini = array_shift($paths);
  26330. if (empty($ini)) {
  26331. return 'A php.ini file does not exist. You will have to create one.';
  26332. }
  26333. if (!empty($paths)) {
  26334. return 'Your command-line PHP is using multiple ini files. Run `php --ini` to show them.';
  26335. }
  26336. return 'The php.ini used by your command-line PHP is: '.$ini;
  26337. }
  26338. }
  26339. <?php
  26340. namespace Composer\Util;
  26341. class NoProxyPattern
  26342. {
  26343. protected $rules = array();
  26344. public function __construct($pattern)
  26345. {
  26346. $this->rules = preg_split("/[\s,]+/", $pattern);
  26347. }
  26348. public function test($url)
  26349. {
  26350. $host = parse_url($url, PHP_URL_HOST);
  26351. $port = parse_url($url, PHP_URL_PORT);
  26352. if (empty($port)) {
  26353. switch (parse_url($url, PHP_URL_SCHEME)) {
  26354. case 'http':
  26355. $port = 80;
  26356. break;
  26357. case 'https':
  26358. $port = 443;
  26359. break;
  26360. }
  26361. }
  26362. foreach ($this->rules as $rule) {
  26363. if ($rule == '*') {
  26364. return true;
  26365. }
  26366. $match = false;
  26367. list($ruleHost) = explode(':', $rule);
  26368. list($base) = explode('/', $ruleHost);
  26369. if (filter_var($base, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
  26370. if (!isset($ip)) {
  26371. $ip = gethostbyname($host);
  26372. }
  26373. if (strpos($ruleHost, '/') === false) {
  26374. $match = $ip === $ruleHost;
  26375. } else {
  26376. if ($ip === $host) {
  26377. $match = false;
  26378. } else {
  26379. $match = self::inCIDRBlock($ruleHost, $ip);
  26380. }
  26381. }
  26382. } else {
  26383. $haystack = '.' . trim($host, '.') . '.';
  26384. $needle = '.'. trim($ruleHost, '.') .'.';
  26385. $match = stripos(strrev($haystack), strrev($needle)) === 0;
  26386. }
  26387. if ($match && strpos($rule, ':') !== false) {
  26388. list(, $rulePort) = explode(':', $rule);
  26389. if (!empty($rulePort) && $port != $rulePort) {
  26390. $match = false;
  26391. }
  26392. }
  26393. if ($match) {
  26394. return true;
  26395. }
  26396. }
  26397. return false;
  26398. }
  26399. private static function inCIDRBlock($cidr, $ip)
  26400. {
  26401. list($base, $bits) = explode('/', $cidr);
  26402. list($a, $b, $c, $d) = explode('.', $base);
  26403. $i = ($a << 24) + ($b << 16) + ($c << 8) + $d;
  26404. $mask = $bits == 0 ? 0 : (~0 << (32 - $bits));
  26405. $low = $i & $mask;
  26406. $high = $i | (~$mask & 0xFFFFFFFF);
  26407. list($a, $b, $c, $d) = explode('.', $ip);
  26408. $check = ($a << 24) + ($b << 16) + ($c << 8) + $d;
  26409. return $check >= $low && $check <= $high;
  26410. }
  26411. }
  26412. <?php
  26413. namespace Composer\Util;
  26414. use Composer\Package\Link;
  26415. use Composer\Package\PackageInterface;
  26416. class PackageSorter
  26417. {
  26418. public static function sortPackages(array $packages) {
  26419. $usageList = array();
  26420. foreach ($packages as $package) {
  26421. foreach (array_merge($package->getRequires(), $package->getDevRequires()) as $link) {
  26422. $target = $link->getTarget();
  26423. $usageList[$target][] = $package->getName();
  26424. }
  26425. }
  26426. $computing = array();
  26427. $computed = array();
  26428. $computeImportance = function ($name) use (&$computeImportance, &$computing, &$computed, $usageList) {
  26429. if (isset($computed[$name])) {
  26430. return $computed[$name];
  26431. }
  26432. if (isset($computing[$name])) {
  26433. return 0;
  26434. }
  26435. $computing[$name] = true;
  26436. $weight = 0;
  26437. if (isset($usageList[$name])) {
  26438. foreach ($usageList[$name] as $user) {
  26439. $weight -= 1 - $computeImportance($user);
  26440. }
  26441. }
  26442. unset($computing[$name]);
  26443. $computed[$name] = $weight;
  26444. return $weight;
  26445. };
  26446. $weightList = array();
  26447. foreach ($packages as $name => $package) {
  26448. $weight = $computeImportance($name);
  26449. $weightList[$name] = $weight;
  26450. }
  26451. $stable_sort = function (&$array) {
  26452. static $transform, $restore;
  26453. $i = 0;
  26454. if (!$transform) {
  26455. $transform = function (&$v, $k) use (&$i) {
  26456. $v = array($v, ++$i, $k, $v);
  26457. };
  26458. $restore = function (&$v) {
  26459. $v = $v[3];
  26460. };
  26461. }
  26462. array_walk($array, $transform);
  26463. asort($array);
  26464. array_walk($array, $restore);
  26465. };
  26466. $stable_sort($weightList);
  26467. $sortedPackages = array();
  26468. foreach (array_keys($weightList) as $name) {
  26469. $sortedPackages[] = $packages[$name];
  26470. }
  26471. return $sortedPackages;
  26472. }
  26473. }
  26474. <?php
  26475. namespace Composer\Util;
  26476. use Composer\IO\IOInterface;
  26477. use Symfony\Component\Process\Process;
  26478. class Perforce
  26479. {
  26480. protected $path;
  26481. protected $p4Depot;
  26482. protected $p4Client;
  26483. protected $p4User;
  26484. protected $p4Password;
  26485. protected $p4Port;
  26486. protected $p4Stream;
  26487. protected $p4ClientSpec;
  26488. protected $p4DepotType;
  26489. protected $p4Branch;
  26490. protected $process;
  26491. protected $uniquePerforceClientName;
  26492. protected $windowsFlag;
  26493. protected $commandResult;
  26494. protected $io;
  26495. protected $filesystem;
  26496. public function __construct($repoConfig, $port, $path, ProcessExecutor $process, $isWindows, IOInterface $io)
  26497. {
  26498. $this->windowsFlag = $isWindows;
  26499. $this->p4Port = $port;
  26500. $this->initializePath($path);
  26501. $this->process = $process;
  26502. $this->initialize($repoConfig);
  26503. $this->io = $io;
  26504. }
  26505. public static function create($repoConfig, $port, $path, ProcessExecutor $process, IOInterface $io)
  26506. {
  26507. return new Perforce($repoConfig, $port, $path, $process, Platform::isWindows(), $io);
  26508. }
  26509. public static function checkServerExists($url, ProcessExecutor $processExecutor)
  26510. {
  26511. $output = null;
  26512. return 0 === $processExecutor->execute('p4 -p ' . ProcessExecutor::escape($url) . ' info -s', $output);
  26513. }
  26514. public function initialize($repoConfig)
  26515. {
  26516. $this->uniquePerforceClientName = $this->generateUniquePerforceClientName();
  26517. if (!$repoConfig) {
  26518. return;
  26519. }
  26520. if (isset($repoConfig['unique_perforce_client_name'])) {
  26521. $this->uniquePerforceClientName = $repoConfig['unique_perforce_client_name'];
  26522. }
  26523. if (isset($repoConfig['depot'])) {
  26524. $this->p4Depot = $repoConfig['depot'];
  26525. }
  26526. if (isset($repoConfig['branch'])) {
  26527. $this->p4Branch = $repoConfig['branch'];
  26528. }
  26529. if (isset($repoConfig['p4user'])) {
  26530. $this->p4User = $repoConfig['p4user'];
  26531. } else {
  26532. $this->p4User = $this->getP4variable('P4USER');
  26533. }
  26534. if (isset($repoConfig['p4password'])) {
  26535. $this->p4Password = $repoConfig['p4password'];
  26536. }
  26537. }
  26538. public function initializeDepotAndBranch($depot, $branch)
  26539. {
  26540. if (isset($depot)) {
  26541. $this->p4Depot = $depot;
  26542. }
  26543. if (isset($branch)) {
  26544. $this->p4Branch = $branch;
  26545. }
  26546. }
  26547. public function generateUniquePerforceClientName()
  26548. {
  26549. return gethostname() . "_" . time();
  26550. }
  26551. public function cleanupClientSpec()
  26552. {
  26553. $client = $this->getClient();
  26554. $task = 'client -d ' . ProcessExecutor::escape($client);
  26555. $useP4Client = false;
  26556. $command = $this->generateP4Command($task, $useP4Client);
  26557. $this->executeCommand($command);
  26558. $clientSpec = $this->getP4ClientSpec();
  26559. $fileSystem = $this->getFilesystem();
  26560. $fileSystem->remove($clientSpec);
  26561. }
  26562. protected function executeCommand($command)
  26563. {
  26564. $this->commandResult = '';
  26565. return $this->process->execute($command, $this->commandResult);
  26566. }
  26567. public function getClient()
  26568. {
  26569. if (!isset($this->p4Client)) {
  26570. $cleanStreamName = str_replace(array('//', '/', '@'), array('', '_', ''), $this->getStream());
  26571. $this->p4Client = 'composer_perforce_' . $this->uniquePerforceClientName . '_' . $cleanStreamName;
  26572. }
  26573. return $this->p4Client;
  26574. }
  26575. protected function getPath()
  26576. {
  26577. return $this->path;
  26578. }
  26579. public function initializePath($path)
  26580. {
  26581. $this->path = $path;
  26582. $fs = $this->getFilesystem();
  26583. $fs->ensureDirectoryExists($path);
  26584. }
  26585. protected function getPort()
  26586. {
  26587. return $this->p4Port;
  26588. }
  26589. public function setStream($stream)
  26590. {
  26591. $this->p4Stream = $stream;
  26592. $index = strrpos($stream, '/');
  26593. if ($index > 2) {
  26594. $this->p4DepotType = 'stream';
  26595. }
  26596. }
  26597. public function isStream()
  26598. {
  26599. return (strcmp($this->p4DepotType, 'stream') === 0);
  26600. }
  26601. public function getStream()
  26602. {
  26603. if (!isset($this->p4Stream)) {
  26604. if ($this->isStream()) {
  26605. $this->p4Stream = '//' . $this->p4Depot . '/' . $this->p4Branch;
  26606. } else {
  26607. $this->p4Stream = '//' . $this->p4Depot;
  26608. }
  26609. }
  26610. return $this->p4Stream;
  26611. }
  26612. public function getStreamWithoutLabel($stream)
  26613. {
  26614. $index = strpos($stream, '@');
  26615. if ($index === false) {
  26616. return $stream;
  26617. }
  26618. return substr($stream, 0, $index);
  26619. }
  26620. public function getP4ClientSpec()
  26621. {
  26622. return $this->path . '/' . $this->getClient() . '.p4.spec';
  26623. }
  26624. public function getUser()
  26625. {
  26626. return $this->p4User;
  26627. }
  26628. public function setUser($user)
  26629. {
  26630. $this->p4User = $user;
  26631. }
  26632. public function queryP4User()
  26633. {
  26634. $this->getUser();
  26635. if (strlen($this->p4User) > 0) {
  26636. return;
  26637. }
  26638. $this->p4User = $this->getP4variable('P4USER');
  26639. if (strlen($this->p4User) > 0) {
  26640. return;
  26641. }
  26642. $this->p4User = $this->io->ask('Enter P4 User:');
  26643. if ($this->windowsFlag) {
  26644. $command = 'p4 set P4USER=' . $this->p4User;
  26645. } else {
  26646. $command = 'export P4USER=' . $this->p4User;
  26647. }
  26648. $this->executeCommand($command);
  26649. }
  26650. protected function getP4variable($name)
  26651. {
  26652. if ($this->windowsFlag) {
  26653. $command = 'p4 set';
  26654. $this->executeCommand($command);
  26655. $result = trim($this->commandResult);
  26656. $resArray = explode(PHP_EOL, $result);
  26657. foreach ($resArray as $line) {
  26658. $fields = explode('=', $line);
  26659. if (strcmp($name, $fields[0]) == 0) {
  26660. $index = strpos($fields[1], ' ');
  26661. if ($index === false) {
  26662. $value = $fields[1];
  26663. } else {
  26664. $value = substr($fields[1], 0, $index);
  26665. }
  26666. $value = trim($value);
  26667. return $value;
  26668. }
  26669. }
  26670. return null;
  26671. }
  26672. $command = 'echo $' . $name;
  26673. $this->executeCommand($command);
  26674. $result = trim($this->commandResult);
  26675. return $result;
  26676. }
  26677. public function queryP4Password()
  26678. {
  26679. if (isset($this->p4Password)) {
  26680. return $this->p4Password;
  26681. }
  26682. $password = $this->getP4variable('P4PASSWD');
  26683. if (strlen($password) <= 0) {
  26684. $password = $this->io->askAndHideAnswer('Enter password for Perforce user ' . $this->getUser() . ': ');
  26685. }
  26686. $this->p4Password = $password;
  26687. return $password;
  26688. }
  26689. public function generateP4Command($command, $useClient = true)
  26690. {
  26691. $p4Command = 'p4 ';
  26692. $p4Command .= '-u ' . $this->getUser() . ' ';
  26693. if ($useClient) {
  26694. $p4Command .= '-c ' . $this->getClient() . ' ';
  26695. }
  26696. $p4Command = $p4Command . '-p ' . $this->getPort() . ' ' . $command;
  26697. return $p4Command;
  26698. }
  26699. public function isLoggedIn()
  26700. {
  26701. $command = $this->generateP4Command('login -s', false);
  26702. $exitCode = $this->executeCommand($command);
  26703. if ($exitCode) {
  26704. $errorOutput = $this->process->getErrorOutput();
  26705. $index = strpos($errorOutput, $this->getUser());
  26706. if ($index === false) {
  26707. $index = strpos($errorOutput, 'p4');
  26708. if ($index === false) {
  26709. return false;
  26710. }
  26711. throw new \Exception('p4 command not found in path: ' . $errorOutput);
  26712. }
  26713. throw new \Exception('Invalid user name: ' . $this->getUser());
  26714. }
  26715. return true;
  26716. }
  26717. public function connectClient()
  26718. {
  26719. $p4CreateClientCommand = $this->generateP4Command(
  26720. 'client -i < ' . str_replace(" ", "\\ ", $this->getP4ClientSpec())
  26721. );
  26722. $this->executeCommand($p4CreateClientCommand);
  26723. }
  26724. public function syncCodeBase($sourceReference)
  26725. {
  26726. $prevDir = getcwd();
  26727. chdir($this->path);
  26728. $p4SyncCommand = $this->generateP4Command('sync -f ');
  26729. if (null !== $sourceReference) {
  26730. $p4SyncCommand .= '@' . $sourceReference;
  26731. }
  26732. $this->executeCommand($p4SyncCommand);
  26733. chdir($prevDir);
  26734. }
  26735. public function writeClientSpecToFile($spec)
  26736. {
  26737. fwrite($spec, 'Client: ' . $this->getClient() . PHP_EOL . PHP_EOL);
  26738. fwrite($spec, 'Update: ' . date('Y/m/d H:i:s') . PHP_EOL . PHP_EOL);
  26739. fwrite($spec, 'Access: ' . date('Y/m/d H:i:s') . PHP_EOL);
  26740. fwrite($spec, 'Owner: ' . $this->getUser() . PHP_EOL . PHP_EOL);
  26741. fwrite($spec, 'Description:' . PHP_EOL);
  26742. fwrite($spec, ' Created by ' . $this->getUser() . ' from composer.' . PHP_EOL . PHP_EOL);
  26743. fwrite($spec, 'Root: ' . $this->getPath() . PHP_EOL . PHP_EOL);
  26744. fwrite($spec, 'Options: noallwrite noclobber nocompress unlocked modtime rmdir' . PHP_EOL . PHP_EOL);
  26745. fwrite($spec, 'SubmitOptions: revertunchanged' . PHP_EOL . PHP_EOL);
  26746. fwrite($spec, 'LineEnd: local' . PHP_EOL . PHP_EOL);
  26747. if ($this->isStream()) {
  26748. fwrite($spec, 'Stream:' . PHP_EOL);
  26749. fwrite($spec, ' ' . $this->getStreamWithoutLabel($this->p4Stream) . PHP_EOL);
  26750. } else {
  26751. fwrite(
  26752. $spec,
  26753. 'View: ' . $this->getStream() . '/... //' . $this->getClient() . '/... ' . PHP_EOL
  26754. );
  26755. }
  26756. }
  26757. public function writeP4ClientSpec()
  26758. {
  26759. $clientSpec = $this->getP4ClientSpec();
  26760. $spec = fopen($clientSpec, 'w');
  26761. try {
  26762. $this->writeClientSpecToFile($spec);
  26763. } catch (\Exception $e) {
  26764. fclose($spec);
  26765. throw $e;
  26766. }
  26767. fclose($spec);
  26768. }
  26769. protected function read($pipe, $name)
  26770. {
  26771. if (feof($pipe)) {
  26772. return;
  26773. }
  26774. $line = fgets($pipe);
  26775. while ($line !== false) {
  26776. $line = fgets($pipe);
  26777. }
  26778. }
  26779. public function windowsLogin($password)
  26780. {
  26781. $command = $this->generateP4Command(' login -a');
  26782. if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
  26783. $process = Process::fromShellCommandline($command, null, null, $password);
  26784. } else {
  26785. $process = new Process($command, null, null, $password);
  26786. }
  26787. return $process->run();
  26788. }
  26789. public function p4Login()
  26790. {
  26791. $this->queryP4User();
  26792. if (!$this->isLoggedIn()) {
  26793. $password = $this->queryP4Password();
  26794. if ($this->windowsFlag) {
  26795. $this->windowsLogin($password);
  26796. } else {
  26797. $command = 'echo ' . ProcessExecutor::escape($password) . ' | ' . $this->generateP4Command(' login -a', false);
  26798. $exitCode = $this->executeCommand($command);
  26799. $result = trim($this->commandResult);
  26800. if ($exitCode) {
  26801. throw new \Exception("Error logging in:" . $this->process->getErrorOutput());
  26802. }
  26803. }
  26804. }
  26805. }
  26806. public function getComposerInformation($identifier)
  26807. {
  26808. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  26809. if (!$composerFileContent) {
  26810. return;
  26811. }
  26812. return json_decode($composerFileContent, true);
  26813. }
  26814. public function getFileContent($file, $identifier)
  26815. {
  26816. $path = $this->getFilePath($file, $identifier);
  26817. $command = $this->generateP4Command(' print ' . ProcessExecutor::escape($path));
  26818. $this->executeCommand($command);
  26819. $result = $this->commandResult;
  26820. if (!trim($result)) {
  26821. return null;
  26822. }
  26823. return $result;
  26824. }
  26825. public function getFilePath($file, $identifier)
  26826. {
  26827. $index = strpos($identifier, '@');
  26828. if ($index === false) {
  26829. $path = $identifier. '/' . $file;
  26830. return $path;
  26831. }
  26832. $path = substr($identifier, 0, $index) . '/' . $file . substr($identifier, $index);
  26833. $command = $this->generateP4Command(' files ' . ProcessExecutor::escape($path), false);
  26834. $this->executeCommand($command);
  26835. $result = $this->commandResult;
  26836. $index2 = strpos($result, 'no such file(s).');
  26837. if ($index2 === false) {
  26838. $index3 = strpos($result, 'change');
  26839. if ($index3 !== false) {
  26840. $phrase = trim(substr($result, $index3));
  26841. $fields = explode(' ', $phrase);
  26842. return substr($identifier, 0, $index) . '/' . $file . '@' . $fields[1];
  26843. }
  26844. }
  26845. return null;
  26846. }
  26847. public function getBranches()
  26848. {
  26849. $possibleBranches = array();
  26850. if (!$this->isStream()) {
  26851. $possibleBranches[$this->p4Branch] = $this->getStream();
  26852. } else {
  26853. $command = $this->generateP4Command('streams '.ProcessExecutor::escape('//' . $this->p4Depot . '/...'));
  26854. $this->executeCommand($command);
  26855. $result = $this->commandResult;
  26856. $resArray = explode(PHP_EOL, $result);
  26857. foreach ($resArray as $line) {
  26858. $resBits = explode(' ', $line);
  26859. if (count($resBits) > 4) {
  26860. $branch = preg_replace('/[^A-Za-z0-9 ]/', '', $resBits[4]);
  26861. $possibleBranches[$branch] = $resBits[1];
  26862. }
  26863. }
  26864. }
  26865. $command = $this->generateP4Command('changes '. ProcessExecutor::escape($this->getStream() . '/...'), false);
  26866. $this->executeCommand($command);
  26867. $result = $this->commandResult;
  26868. $resArray = explode(PHP_EOL, $result);
  26869. $lastCommit = $resArray[0];
  26870. $lastCommitArr = explode(' ', $lastCommit);
  26871. $lastCommitNum = $lastCommitArr[1];
  26872. $branches = array('master' => $possibleBranches[$this->p4Branch] . '@'. $lastCommitNum);
  26873. return $branches;
  26874. }
  26875. public function getTags()
  26876. {
  26877. $command = $this->generateP4Command('labels');
  26878. $this->executeCommand($command);
  26879. $result = $this->commandResult;
  26880. $resArray = explode(PHP_EOL, $result);
  26881. $tags = array();
  26882. foreach ($resArray as $line) {
  26883. if (strpos($line, 'Label') !== false) {
  26884. $fields = explode(' ', $line);
  26885. $tags[$fields[1]] = $this->getStream() . '@' . $fields[1];
  26886. }
  26887. }
  26888. return $tags;
  26889. }
  26890. public function checkStream()
  26891. {
  26892. $command = $this->generateP4Command('depots', false);
  26893. $this->executeCommand($command);
  26894. $result = $this->commandResult;
  26895. $resArray = explode(PHP_EOL, $result);
  26896. foreach ($resArray as $line) {
  26897. if (strpos($line, 'Depot') !== false) {
  26898. $fields = explode(' ', $line);
  26899. if (strcmp($this->p4Depot, $fields[1]) === 0) {
  26900. $this->p4DepotType = $fields[3];
  26901. return $this->isStream();
  26902. }
  26903. }
  26904. }
  26905. return false;
  26906. }
  26907. protected function getChangeList($reference)
  26908. {
  26909. $index = strpos($reference, '@');
  26910. if ($index === false) {
  26911. return null;
  26912. }
  26913. $label = substr($reference, $index);
  26914. $command = $this->generateP4Command(' changes -m1 ' . ProcessExecutor::escape($label));
  26915. $this->executeCommand($command);
  26916. $changes = $this->commandResult;
  26917. if (strpos($changes, 'Change') !== 0) {
  26918. return null;
  26919. }
  26920. $fields = explode(' ', $changes);
  26921. return $fields[1];
  26922. }
  26923. public function getCommitLogs($fromReference, $toReference)
  26924. {
  26925. $fromChangeList = $this->getChangeList($fromReference);
  26926. if ($fromChangeList === null) {
  26927. return null;
  26928. }
  26929. $toChangeList = $this->getChangeList($toReference);
  26930. if ($toChangeList === null) {
  26931. return null;
  26932. }
  26933. $index = strpos($fromReference, '@');
  26934. $main = substr($fromReference, 0, $index) . '/...';
  26935. $command = $this->generateP4Command('filelog ' . ProcessExecutor::escape($main . '@' . $fromChangeList. ',' . $toChangeList));
  26936. $this->executeCommand($command);
  26937. return $this->commandResult;
  26938. }
  26939. public function getFilesystem()
  26940. {
  26941. if (empty($this->filesystem)) {
  26942. $this->filesystem = new Filesystem($this->process);
  26943. }
  26944. return $this->filesystem;
  26945. }
  26946. public function setFilesystem(Filesystem $fs)
  26947. {
  26948. $this->filesystem = $fs;
  26949. }
  26950. }
  26951. <?php
  26952. namespace Composer\Util;
  26953. class Platform
  26954. {
  26955. public static function expandPath($path)
  26956. {
  26957. if (preg_match('#^~[\\/]#', $path)) {
  26958. return self::getUserDirectory() . substr($path, 1);
  26959. }
  26960. return preg_replace_callback('#^(\$|(?P<percent>%))(?P<var>\w++)(?(percent)%)(?P<path>.*)#', function ($matches) {
  26961. if (Platform::isWindows() && $matches['var'] == 'HOME') {
  26962. return (getenv('HOME') ?: getenv('USERPROFILE')) . $matches['path'];
  26963. }
  26964. return getenv($matches['var']) . $matches['path'];
  26965. }, $path);
  26966. }
  26967. public static function getUserDirectory()
  26968. {
  26969. if (false !== ($home = getenv('HOME'))) {
  26970. return $home;
  26971. }
  26972. if (self::isWindows() && false !== ($home = getenv('USERPROFILE'))) {
  26973. return $home;
  26974. }
  26975. if (function_exists('posix_getuid') && function_exists('posix_getpwuid')) {
  26976. $info = posix_getpwuid(posix_getuid());
  26977. return $info['dir'];
  26978. }
  26979. throw new \RuntimeException('Could not determine user directory');
  26980. }
  26981. public static function isWindows()
  26982. {
  26983. return defined('PHP_WINDOWS_VERSION_BUILD');
  26984. }
  26985. public static function strlen($str)
  26986. {
  26987. static $useMbString = null;
  26988. if (null === $useMbString) {
  26989. $useMbString = function_exists('mb_strlen') && ini_get('mbstring.func_overload');
  26990. }
  26991. if ($useMbString) {
  26992. return mb_strlen($str, '8bit');
  26993. }
  26994. return strlen($str);
  26995. }
  26996. }
  26997. <?php
  26998. namespace Composer\Util;
  26999. use Composer\IO\IOInterface;
  27000. use Symfony\Component\Process\Process;
  27001. use Symfony\Component\Process\ProcessUtils;
  27002. class ProcessExecutor
  27003. {
  27004. protected static $timeout = 300;
  27005. protected $captureOutput;
  27006. protected $errorOutput;
  27007. protected $io;
  27008. public function __construct(IOInterface $io = null)
  27009. {
  27010. $this->io = $io;
  27011. }
  27012. public function execute($command, &$output = null, $cwd = null)
  27013. {
  27014. if ($this->io && $this->io->isDebug()) {
  27015. $safeCommand = preg_replace_callback('{://(?P<user>[^:/\s]+):(?P<password>[^@\s/]+)@}i', function ($m) {
  27016. if (preg_match('{^[a-f0-9]{12,}$}', $m['user'])) {
  27017. return '://***:***@';
  27018. }
  27019. return '://'.$m['user'].':***@';
  27020. }, $command);
  27021. $safeCommand = preg_replace("{--password (.*[^\\\\]\') }", '--password \'***\' ', $safeCommand);
  27022. $this->io->writeError('Executing command ('.($cwd ?: 'CWD').'): '.$safeCommand);
  27023. }
  27024. if (null === $cwd && Platform::isWindows() && false !== strpos($command, 'git') && getcwd()) {
  27025. $cwd = realpath(getcwd());
  27026. }
  27027. $this->captureOutput = func_num_args() > 1;
  27028. $this->errorOutput = null;
  27029. if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
  27030. $process = Process::fromShellCommandline($command, $cwd, null, null, static::getTimeout());
  27031. } else {
  27032. $process = new Process($command, $cwd, null, null, static::getTimeout());
  27033. }
  27034. $callback = is_callable($output) ? $output : array($this, 'outputHandler');
  27035. $process->run($callback);
  27036. if ($this->captureOutput && !is_callable($output)) {
  27037. $output = $process->getOutput();
  27038. }
  27039. $this->errorOutput = $process->getErrorOutput();
  27040. return $process->getExitCode();
  27041. }
  27042. public function splitLines($output)
  27043. {
  27044. $output = trim($output);
  27045. return ((string) $output === '') ? array() : preg_split('{\r?\n}', $output);
  27046. }
  27047. public function getErrorOutput()
  27048. {
  27049. return $this->errorOutput;
  27050. }
  27051. public function outputHandler($type, $buffer)
  27052. {
  27053. if ($this->captureOutput) {
  27054. return;
  27055. }
  27056. if (null === $this->io) {
  27057. echo $buffer;
  27058. return;
  27059. }
  27060. if (Process::ERR === $type) {
  27061. $this->io->writeError($buffer, false);
  27062. } else {
  27063. $this->io->write($buffer, false);
  27064. }
  27065. }
  27066. public static function getTimeout()
  27067. {
  27068. return static::$timeout;
  27069. }
  27070. public static function setTimeout($timeout)
  27071. {
  27072. static::$timeout = $timeout;
  27073. }
  27074. public static function escape($argument)
  27075. {
  27076. return self::escapeArgument($argument);
  27077. }
  27078. private static function escapeArgument($argument)
  27079. {
  27080. if ('\\' === DIRECTORY_SEPARATOR) {
  27081. if ('' === $argument) {
  27082. return escapeshellarg($argument);
  27083. }
  27084. $escapedArgument = '';
  27085. $quote = false;
  27086. foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
  27087. if ('"' === $part) {
  27088. $escapedArgument .= '\\"';
  27089. } elseif (self::isSurroundedBy($part, '%')) {
  27090. $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%';
  27091. } else {
  27092. if ('\\' === substr($part, -1)) {
  27093. $part .= '\\';
  27094. }
  27095. $quote = true;
  27096. $escapedArgument .= $part;
  27097. }
  27098. }
  27099. if ($quote) {
  27100. $escapedArgument = '"'.$escapedArgument.'"';
  27101. }
  27102. return $escapedArgument;
  27103. }
  27104. return "'".str_replace("'", "'\\''", $argument)."'";
  27105. }
  27106. private static function isSurroundedBy($arg, $char)
  27107. {
  27108. return 2 < strlen($arg) && $char === $arg[0] && $char === $arg[strlen($arg) - 1];
  27109. }
  27110. }
  27111. <?php
  27112. namespace Composer\Util;
  27113. use Composer\Config;
  27114. use Composer\Composer;
  27115. use Composer\Semver\Constraint\Constraint;
  27116. use Composer\Package\Version\VersionParser;
  27117. use Composer\IO\IOInterface;
  27118. use Composer\Downloader\TransportException;
  27119. use Composer\CaBundle\CaBundle;
  27120. use Psr\Log\LoggerInterface;
  27121. class RemoteFilesystem
  27122. {
  27123. private $io;
  27124. private $config;
  27125. private $scheme;
  27126. private $bytesMax;
  27127. private $originUrl;
  27128. private $fileUrl;
  27129. private $fileName;
  27130. private $retry;
  27131. private $progress;
  27132. private $lastProgress;
  27133. private $options = array();
  27134. private $peerCertificateMap = array();
  27135. private $disableTls = false;
  27136. private $retryAuthFailure;
  27137. private $lastHeaders;
  27138. private $storeAuth;
  27139. private $degradedMode = false;
  27140. private $redirects;
  27141. private $maxRedirects = 20;
  27142. private $displayedOriginAuthentications = array();
  27143. public function __construct(IOInterface $io, Config $config = null, array $options = array(), $disableTls = false)
  27144. {
  27145. $this->io = $io;
  27146. if ($disableTls === false) {
  27147. $this->options = $this->getTlsDefaults($options);
  27148. } else {
  27149. $this->disableTls = true;
  27150. }
  27151. $this->options = array_replace_recursive($this->options, $options);
  27152. $this->config = $config;
  27153. }
  27154. public function copy($originUrl, $fileUrl, $fileName, $progress = true, $options = array())
  27155. {
  27156. return $this->get($originUrl, $fileUrl, $options, $fileName, $progress);
  27157. }
  27158. public function getContents($originUrl, $fileUrl, $progress = true, $options = array())
  27159. {
  27160. return $this->get($originUrl, $fileUrl, $options, null, $progress);
  27161. }
  27162. public function getOptions()
  27163. {
  27164. return $this->options;
  27165. }
  27166. public function setOptions(array $options)
  27167. {
  27168. $this->options = array_replace_recursive($this->options, $options);
  27169. }
  27170. public function isTlsDisabled()
  27171. {
  27172. return $this->disableTls === true;
  27173. }
  27174. public function getLastHeaders()
  27175. {
  27176. return $this->lastHeaders;
  27177. }
  27178. public function findHeaderValue(array $headers, $name)
  27179. {
  27180. $value = null;
  27181. foreach ($headers as $header) {
  27182. if (preg_match('{^'.$name.':\s*(.+?)\s*$}i', $header, $match)) {
  27183. $value = $match[1];
  27184. } elseif (preg_match('{^HTTP/}i', $header)) {
  27185. $value = null;
  27186. }
  27187. }
  27188. return $value;
  27189. }
  27190. public function findStatusCode(array $headers)
  27191. {
  27192. $value = null;
  27193. foreach ($headers as $header) {
  27194. if (preg_match('{^HTTP/\S+ (\d+)}i', $header, $match)) {
  27195. $value = (int) $match[1];
  27196. }
  27197. }
  27198. return $value;
  27199. }
  27200. public function findStatusMessage(array $headers)
  27201. {
  27202. $value = null;
  27203. foreach ($headers as $header) {
  27204. if (preg_match('{^HTTP/\S+ \d+}i', $header)) {
  27205. $value = $header;
  27206. }
  27207. }
  27208. return $value;
  27209. }
  27210. protected function get($originUrl, $fileUrl, $additionalOptions = array(), $fileName = null, $progress = true)
  27211. {
  27212. if (strpos($originUrl, '.github.com') === (strlen($originUrl) - 11)) {
  27213. $originUrl = 'github.com';
  27214. }
  27215. if (
  27216. $this->config
  27217. && is_array($this->config->get('gitlab-domains'))
  27218. && false === strpos($originUrl, '/')
  27219. && !in_array($originUrl, $this->config->get('gitlab-domains'))
  27220. ) {
  27221. foreach ($this->config->get('gitlab-domains') as $gitlabDomain) {
  27222. if (0 === strpos($gitlabDomain, $originUrl)) {
  27223. $originUrl = $gitlabDomain;
  27224. break;
  27225. }
  27226. }
  27227. unset($gitlabDomain);
  27228. }
  27229. $this->scheme = parse_url($fileUrl, PHP_URL_SCHEME);
  27230. $this->bytesMax = 0;
  27231. $this->originUrl = $originUrl;
  27232. $this->fileUrl = $fileUrl;
  27233. $this->fileName = $fileName;
  27234. $this->progress = $progress;
  27235. $this->lastProgress = null;
  27236. $this->retryAuthFailure = true;
  27237. $this->lastHeaders = array();
  27238. $this->redirects = 1;
  27239. if (preg_match('{^https?://([^:/]+):([^@/]+)@([^/]+)}i', $fileUrl, $match)) {
  27240. $this->io->setAuthentication($originUrl, rawurldecode($match[1]), rawurldecode($match[2]));
  27241. }
  27242. $tempAdditionalOptions = $additionalOptions;
  27243. if (isset($tempAdditionalOptions['retry-auth-failure'])) {
  27244. $this->retryAuthFailure = (bool) $tempAdditionalOptions['retry-auth-failure'];
  27245. unset($tempAdditionalOptions['retry-auth-failure']);
  27246. }
  27247. $isRedirect = false;
  27248. if (isset($tempAdditionalOptions['redirects'])) {
  27249. $this->redirects = $tempAdditionalOptions['redirects'];
  27250. $isRedirect = true;
  27251. unset($tempAdditionalOptions['redirects']);
  27252. }
  27253. $options = $this->getOptionsForUrl($originUrl, $tempAdditionalOptions);
  27254. unset($tempAdditionalOptions);
  27255. $origFileUrl = $fileUrl;
  27256. if (isset($options['github-token'])) {
  27257. if (preg_match('{^https?://([a-z0-9-]+\.)*github\.com/}', $fileUrl)) {
  27258. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['github-token'];
  27259. }
  27260. unset($options['github-token']);
  27261. }
  27262. if (isset($options['gitlab-token'])) {
  27263. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['gitlab-token'];
  27264. unset($options['gitlab-token']);
  27265. }
  27266. if (isset($options['http'])) {
  27267. $options['http']['ignore_errors'] = true;
  27268. }
  27269. if ($this->degradedMode && substr($fileUrl, 0, 26) === 'http://repo.packagist.org/') {
  27270. $fileUrl = 'http://' . gethostbyname('repo.packagist.org') . substr($fileUrl, 20);
  27271. $degradedPackagist = true;
  27272. }
  27273. $ctx = StreamContextFactory::getContext($fileUrl, $options, array('notification' => array($this, 'callbackGet')));
  27274. $actualContextOptions = stream_context_get_options($ctx);
  27275. $usingProxy = !empty($actualContextOptions['http']['proxy']) ? ' using proxy ' . $actualContextOptions['http']['proxy'] : '';
  27276. $this->io->writeError((substr($origFileUrl, 0, 4) === 'http' ? 'Downloading ' : 'Reading ') . $this->stripCredentialsFromUrl($origFileUrl) . $usingProxy, true, IOInterface::DEBUG);
  27277. unset($origFileUrl, $actualContextOptions);
  27278. if ((!preg_match('{^http://(repo\.)?packagist\.org/p/}', $fileUrl) || (false === strpos($fileUrl, '$') && false === strpos($fileUrl, '%24'))) && empty($degradedPackagist) && $this->config) {
  27279. $this->config->prohibitUrlByConfig($fileUrl, $this->io);
  27280. }
  27281. if ($this->progress && !$isRedirect) {
  27282. $this->io->writeError("Downloading (<comment>connecting...</comment>)", false);
  27283. }
  27284. $errorMessage = '';
  27285. $errorCode = 0;
  27286. $result = false;
  27287. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  27288. if ($errorMessage) {
  27289. $errorMessage .= "\n";
  27290. }
  27291. $errorMessage .= preg_replace('{^file_get_contents\(.*?\): }', '', $msg);
  27292. return true;
  27293. });
  27294. try {
  27295. $result = $this->getRemoteContents($originUrl, $fileUrl, $ctx, $http_response_header);
  27296. if (!empty($http_response_header[0])) {
  27297. $statusCode = $this->findStatusCode($http_response_header);
  27298. if ($statusCode >= 400 && $this->findHeaderValue($http_response_header, 'content-type') === 'application/json') {
  27299. self::outputWarnings($this->io, $originUrl, json_decode($result, true));
  27300. }
  27301. if (in_array($statusCode, array(401, 403)) && $this->retryAuthFailure) {
  27302. $this->promptAuthAndRetry($statusCode, $this->findStatusMessage($http_response_header), null, $http_response_header);
  27303. }
  27304. }
  27305. $contentLength = !empty($http_response_header[0]) ? $this->findHeaderValue($http_response_header, 'content-length') : null;
  27306. if ($contentLength && Platform::strlen($result) < $contentLength) {
  27307. $e = new TransportException('Content-Length mismatch, received '.Platform::strlen($result).' bytes out of the expected '.$contentLength);
  27308. $e->setHeaders($http_response_header);
  27309. $e->setStatusCode($this->findStatusCode($http_response_header));
  27310. $e->setResponse($result);
  27311. $this->io->writeError('Content-Length mismatch, received '.Platform::strlen($result).' out of '.$contentLength.' bytes: (' . base64_encode($result).')', true, IOInterface::DEBUG);
  27312. throw $e;
  27313. }
  27314. if (PHP_VERSION_ID < 50600 && !empty($options['ssl']['peer_fingerprint'])) {
  27315. $params = stream_context_get_params($ctx);
  27316. $expectedPeerFingerprint = $options['ssl']['peer_fingerprint'];
  27317. $peerFingerprint = TlsHelper::getCertificateFingerprint($params['options']['ssl']['peer_certificate']);
  27318. if ($expectedPeerFingerprint !== $peerFingerprint) {
  27319. throw new TransportException('Peer fingerprint did not match');
  27320. }
  27321. }
  27322. } catch (\Exception $e) {
  27323. if ($e instanceof TransportException && !empty($http_response_header[0])) {
  27324. $e->setHeaders($http_response_header);
  27325. $e->setStatusCode($this->findStatusCode($http_response_header));
  27326. }
  27327. if ($e instanceof TransportException && $result !== false) {
  27328. $e->setResponse($result);
  27329. }
  27330. $result = false;
  27331. }
  27332. if ($errorMessage && !filter_var(ini_get('allow_url_fopen'), FILTER_VALIDATE_BOOLEAN)) {
  27333. $errorMessage = 'allow_url_fopen must be enabled in php.ini ('.$errorMessage.')';
  27334. }
  27335. restore_error_handler();
  27336. if (isset($e) && !$this->retry) {
  27337. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  27338. $this->degradedMode = true;
  27339. $this->io->writeError('');
  27340. $this->io->writeError(array(
  27341. '<error>'.$e->getMessage().'</error>',
  27342. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  27343. ));
  27344. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  27345. }
  27346. throw $e;
  27347. }
  27348. $statusCode = null;
  27349. $contentType = null;
  27350. $locationHeader = null;
  27351. if (!empty($http_response_header[0])) {
  27352. $statusCode = $this->findStatusCode($http_response_header);
  27353. $contentType = $this->findHeaderValue($http_response_header, 'content-type');
  27354. $locationHeader = $this->findHeaderValue($http_response_header, 'location');
  27355. }
  27356. if ($originUrl === 'bitbucket.org'
  27357. && !$this->isPublicBitBucketDownload($fileUrl)
  27358. && substr($fileUrl, -4) === '.zip'
  27359. && (!$locationHeader || substr($locationHeader, -4) !== '.zip')
  27360. && $contentType && preg_match('{^text/html\b}i', $contentType)
  27361. ) {
  27362. $result = false;
  27363. if ($this->retryAuthFailure) {
  27364. $this->promptAuthAndRetry(401);
  27365. }
  27366. }
  27367. if ($statusCode === 404
  27368. && $this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)
  27369. && false !== strpos($fileUrl, 'archive.zip')
  27370. ) {
  27371. $result = false;
  27372. if ($this->retryAuthFailure) {
  27373. $this->promptAuthAndRetry(401);
  27374. }
  27375. }
  27376. $hasFollowedRedirect = false;
  27377. if ($statusCode >= 300 && $statusCode <= 399 && $statusCode !== 304 && $this->redirects < $this->maxRedirects) {
  27378. $hasFollowedRedirect = true;
  27379. $result = $this->handleRedirect($http_response_header, $additionalOptions, $result);
  27380. }
  27381. if ($statusCode && $statusCode >= 400 && $statusCode <= 599) {
  27382. if (!$this->retry) {
  27383. if ($this->progress && !$this->retry && !$isRedirect) {
  27384. $this->io->overwriteError("Downloading (<error>failed</error>)", false);
  27385. }
  27386. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded ('.$http_response_header[0].')', $statusCode);
  27387. $e->setHeaders($http_response_header);
  27388. $e->setResponse($result);
  27389. $e->setStatusCode($statusCode);
  27390. throw $e;
  27391. }
  27392. $result = false;
  27393. }
  27394. if ($this->progress && !$this->retry && !$isRedirect) {
  27395. $this->io->overwriteError("Downloading (".($result === false ? '<error>failed</error>' : '<comment>100%</comment>').")", false);
  27396. }
  27397. if ($result && extension_loaded('zlib') && substr($fileUrl, 0, 4) === 'http' && !$hasFollowedRedirect) {
  27398. $contentEncoding = $this->findHeaderValue($http_response_header, 'content-encoding');
  27399. $decode = $contentEncoding && 'gzip' === strtolower($contentEncoding);
  27400. if ($decode) {
  27401. try {
  27402. if (PHP_VERSION_ID >= 50400) {
  27403. $result = zlib_decode($result);
  27404. } else {
  27405. $result = file_get_contents('compress.zlib://data:application/octet-stream;base64,'.base64_encode($result));
  27406. }
  27407. if (!$result) {
  27408. throw new TransportException('Failed to decode zlib stream');
  27409. }
  27410. } catch (\Exception $e) {
  27411. if ($this->degradedMode) {
  27412. throw $e;
  27413. }
  27414. $this->degradedMode = true;
  27415. $this->io->writeError(array(
  27416. '',
  27417. '<error>Failed to decode response: '.$e->getMessage().'</error>',
  27418. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  27419. ));
  27420. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  27421. }
  27422. }
  27423. }
  27424. if (false !== $result && null !== $fileName && !$isRedirect) {
  27425. if ('' === $result) {
  27426. throw new TransportException('"'.$this->fileUrl.'" appears broken, and returned an empty 200 response');
  27427. }
  27428. $errorMessage = '';
  27429. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  27430. if ($errorMessage) {
  27431. $errorMessage .= "\n";
  27432. }
  27433. $errorMessage .= preg_replace('{^file_put_contents\(.*?\): }', '', $msg);
  27434. return true;
  27435. });
  27436. $result = (bool) file_put_contents($fileName, $result);
  27437. restore_error_handler();
  27438. if (false === $result) {
  27439. throw new TransportException('The "'.$this->fileUrl.'" file could not be written to '.$fileName.': '.$errorMessage);
  27440. }
  27441. }
  27442. if (false === $result && false !== strpos($errorMessage, 'Peer certificate') && PHP_VERSION_ID < 50600) {
  27443. if (CaBundle::isOpensslParseSafe()) {
  27444. $certDetails = $this->getCertificateCnAndFp($this->fileUrl, $options);
  27445. if ($certDetails) {
  27446. $this->peerCertificateMap[$this->getUrlAuthority($this->fileUrl)] = $certDetails;
  27447. $this->retry = true;
  27448. }
  27449. } else {
  27450. $this->io->writeError('');
  27451. $this->io->writeError(sprintf(
  27452. '<error>Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.</error>',
  27453. PHP_VERSION
  27454. ));
  27455. }
  27456. }
  27457. if ($this->retry) {
  27458. $this->retry = false;
  27459. $result = $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  27460. if ($this->storeAuth && $this->config) {
  27461. $authHelper = new AuthHelper($this->io, $this->config);
  27462. $authHelper->storeAuth($this->originUrl, $this->storeAuth);
  27463. $this->storeAuth = false;
  27464. }
  27465. return $result;
  27466. }
  27467. if (false === $result) {
  27468. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded: '.$errorMessage, $errorCode);
  27469. if (!empty($http_response_header[0])) {
  27470. $e->setHeaders($http_response_header);
  27471. }
  27472. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  27473. $this->degradedMode = true;
  27474. $this->io->writeError('');
  27475. $this->io->writeError(array(
  27476. '<error>'.$e->getMessage().'</error>',
  27477. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  27478. ));
  27479. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  27480. }
  27481. throw $e;
  27482. }
  27483. if (!empty($http_response_header[0])) {
  27484. $this->lastHeaders = $http_response_header;
  27485. }
  27486. return $result;
  27487. }
  27488. protected function getRemoteContents($originUrl, $fileUrl, $context, array &$responseHeaders = null)
  27489. {
  27490. try {
  27491. $e = null;
  27492. $result = file_get_contents($fileUrl, false, $context);
  27493. } catch (\Throwable $e) {
  27494. } catch (\Exception $e) {
  27495. }
  27496. $responseHeaders = isset($http_response_header) ? $http_response_header : array();
  27497. if (null !== $e) {
  27498. throw $e;
  27499. }
  27500. return $result;
  27501. }
  27502. protected function callbackGet($notificationCode, $severity, $message, $messageCode, $bytesTransferred, $bytesMax)
  27503. {
  27504. switch ($notificationCode) {
  27505. case STREAM_NOTIFY_FAILURE:
  27506. if (400 === $messageCode) {
  27507. throw new TransportException("The '" . $this->fileUrl . "' URL could not be accessed: " . $message, $messageCode);
  27508. }
  27509. break;
  27510. case STREAM_NOTIFY_FILE_SIZE_IS:
  27511. $this->bytesMax = $bytesMax;
  27512. break;
  27513. case STREAM_NOTIFY_PROGRESS:
  27514. if ($this->bytesMax > 0 && $this->progress) {
  27515. $progression = min(100, round($bytesTransferred / $this->bytesMax * 100));
  27516. if ((0 === $progression % 5) && 100 !== $progression && $progression !== $this->lastProgress) {
  27517. $this->lastProgress = $progression;
  27518. $this->io->overwriteError("Downloading (<comment>$progression%</comment>)", false);
  27519. }
  27520. }
  27521. break;
  27522. default:
  27523. break;
  27524. }
  27525. }
  27526. protected function promptAuthAndRetry($httpStatus, $reason = null, $warning = null, $headers = array())
  27527. {
  27528. if ($this->config && in_array($this->originUrl, $this->config->get('github-domains'), true)) {
  27529. $gitHubUtil = new GitHub($this->io, $this->config, null);
  27530. $message = "\n";
  27531. $rateLimited = $gitHubUtil->isRateLimited($headers);
  27532. if ($rateLimited) {
  27533. $rateLimit = $gitHubUtil->getRateLimit($headers);
  27534. if ($this->io->hasAuthentication($this->originUrl)) {
  27535. $message = 'Review your configured GitHub OAuth token or enter a new one to go over the API rate limit.';
  27536. } else {
  27537. $message = 'Create a GitHub OAuth token to go over the API rate limit.';
  27538. }
  27539. $message = sprintf(
  27540. '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.',
  27541. $rateLimit['limit'],
  27542. $rateLimit['reset']
  27543. )."\n";
  27544. } else {
  27545. $message .= 'Could not fetch '.$this->fileUrl.', please ';
  27546. if ($this->io->hasAuthentication($this->originUrl)) {
  27547. $message .= 'review your configured GitHub OAuth token or enter a new one to access private repos';
  27548. } else {
  27549. $message .= 'create a GitHub OAuth token to access private repos';
  27550. }
  27551. }
  27552. if (!$gitHubUtil->authorizeOAuth($this->originUrl)
  27553. && (!$this->io->isInteractive() || !$gitHubUtil->authorizeOAuthInteractively($this->originUrl, $message))
  27554. ) {
  27555. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  27556. }
  27557. } elseif ($this->config && in_array($this->originUrl, $this->config->get('gitlab-domains'), true)) {
  27558. $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');
  27559. $gitLabUtil = new GitLab($this->io, $this->config, null);
  27560. if ($this->io->hasAuthentication($this->originUrl) && ($auth = $this->io->getAuthentication($this->originUrl)) && in_array($auth['password'], array('gitlab-ci-token', 'private-token'), true)) {
  27561. throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
  27562. }
  27563. if (!$gitLabUtil->authorizeOAuth($this->originUrl)
  27564. && (!$this->io->isInteractive() || !$gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, $message))
  27565. ) {
  27566. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  27567. }
  27568. } elseif ($this->config && $this->originUrl === 'bitbucket.org') {
  27569. $askForOAuthToken = true;
  27570. if ($this->io->hasAuthentication($this->originUrl)) {
  27571. $auth = $this->io->getAuthentication($this->originUrl);
  27572. if ($auth['username'] !== 'x-token-auth') {
  27573. $bitbucketUtil = new Bitbucket($this->io, $this->config);
  27574. $accessToken = $bitbucketUtil->requestToken($this->originUrl, $auth['username'], $auth['password']);
  27575. if (!empty($accessToken)) {
  27576. $this->io->setAuthentication($this->originUrl, 'x-token-auth', $accessToken);
  27577. $askForOAuthToken = false;
  27578. }
  27579. } else {
  27580. throw new TransportException('Could not authenticate against ' . $this->originUrl, 401);
  27581. }
  27582. }
  27583. if ($askForOAuthToken) {
  27584. $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');
  27585. $bitBucketUtil = new Bitbucket($this->io, $this->config);
  27586. if (! $bitBucketUtil->authorizeOAuth($this->originUrl)
  27587. && (! $this->io->isInteractive() || !$bitBucketUtil->authorizeOAuthInteractively($this->originUrl, $message))
  27588. ) {
  27589. throw new TransportException('Could not authenticate against ' . $this->originUrl, 401);
  27590. }
  27591. }
  27592. } else {
  27593. if ($httpStatus === 404) {
  27594. return;
  27595. }
  27596. if (!$this->io->isInteractive()) {
  27597. if ($httpStatus === 401) {
  27598. $message = "The '" . $this->fileUrl . "' URL required authentication.\nYou must be using the interactive console to authenticate";
  27599. }
  27600. if ($httpStatus === 403) {
  27601. $message = "The '" . $this->fileUrl . "' URL could not be accessed: " . $reason;
  27602. }
  27603. throw new TransportException($message, $httpStatus);
  27604. }
  27605. if ($this->io->hasAuthentication($this->originUrl)) {
  27606. throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
  27607. }
  27608. $this->io->writeError(' Authentication required (<info>'.$this->originUrl.'</info>):');
  27609. $username = $this->io->ask(' Username: ');
  27610. $password = $this->io->askAndHideAnswer(' Password: ');
  27611. $this->io->setAuthentication($this->originUrl, $username, $password);
  27612. $this->storeAuth = $this->config->get('store-auths');
  27613. }
  27614. $this->retry = true;
  27615. throw new TransportException('RETRY');
  27616. }
  27617. protected function getOptionsForUrl($originUrl, $additionalOptions)
  27618. {
  27619. $tlsOptions = array();
  27620. if ($this->disableTls === false && PHP_VERSION_ID < 50600 && !stream_is_local($this->fileUrl)) {
  27621. $host = parse_url($this->fileUrl, PHP_URL_HOST);
  27622. if (PHP_VERSION_ID < 50304) {
  27623. if ($host === 'github.com' || $host === 'api.github.com') {
  27624. $host = '*.github.com';
  27625. }
  27626. }
  27627. $tlsOptions['ssl']['CN_match'] = $host;
  27628. $tlsOptions['ssl']['SNI_server_name'] = $host;
  27629. $urlAuthority = $this->getUrlAuthority($this->fileUrl);
  27630. if (isset($this->peerCertificateMap[$urlAuthority])) {
  27631. $certMap = $this->peerCertificateMap[$urlAuthority];
  27632. $this->io->writeError('', true, IOInterface::DEBUG);
  27633. $this->io->writeError(sprintf(
  27634. 'Using <info>%s</info> as CN for subjectAltName enabled host <info>%s</info>',
  27635. $certMap['cn'],
  27636. $urlAuthority
  27637. ), true, IOInterface::DEBUG);
  27638. $tlsOptions['ssl']['CN_match'] = $certMap['cn'];
  27639. $tlsOptions['ssl']['peer_fingerprint'] = $certMap['fp'];
  27640. } elseif (!CaBundle::isOpensslParseSafe() && $host === 'repo.packagist.org') {
  27641. $tlsOptions['ssl']['CN_match'] = 'packagist.org';
  27642. }
  27643. }
  27644. $headers = array();
  27645. if (extension_loaded('zlib')) {
  27646. $headers[] = 'Accept-Encoding: gzip';
  27647. }
  27648. $options = array_replace_recursive($this->options, $tlsOptions, $additionalOptions);
  27649. if (!$this->degradedMode) {
  27650. $options['http']['protocol_version'] = 1.1;
  27651. $headers[] = 'Connection: close';
  27652. }
  27653. if ($this->io->hasAuthentication($originUrl)) {
  27654. $authenticationDisplayMessage = null;
  27655. $auth = $this->io->getAuthentication($originUrl);
  27656. if ('github.com' === $originUrl && 'x-oauth-basic' === $auth['password']) {
  27657. $options['github-token'] = $auth['username'];
  27658. $authenticationDisplayMessage = 'Using GitHub token authentication';
  27659. } elseif ($this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)) {
  27660. if ($auth['password'] === 'oauth2') {
  27661. $headers[] = 'Authorization: Bearer '.$auth['username'];
  27662. $authenticationDisplayMessage = 'Using GitLab OAuth token authentication';
  27663. } elseif ($auth['password'] === 'private-token' || $auth['password'] === 'gitlab-ci-token') {
  27664. $headers[] = 'PRIVATE-TOKEN: '.$auth['username'];
  27665. $authenticationDisplayMessage = 'Using GitLab private token authentication';
  27666. }
  27667. } elseif ('bitbucket.org' === $originUrl
  27668. && $this->fileUrl !== Bitbucket::OAUTH2_ACCESS_TOKEN_URL && 'x-token-auth' === $auth['username']
  27669. ) {
  27670. if (!$this->isPublicBitBucketDownload($this->fileUrl)) {
  27671. $headers[] = 'Authorization: Bearer ' . $auth['password'];
  27672. $authenticationDisplayMessage = 'Using Bitbucket OAuth token authentication';
  27673. }
  27674. } else {
  27675. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  27676. $headers[] = 'Authorization: Basic '.$authStr;
  27677. $authenticationDisplayMessage = 'Using HTTP basic authentication with username "' . $auth['username'] . '"';
  27678. }
  27679. if ($authenticationDisplayMessage && !in_array($originUrl, $this->displayedOriginAuthentications, true)) {
  27680. $this->io->writeError($authenticationDisplayMessage, true, IOInterface::DEBUG);
  27681. $this->displayedOriginAuthentications[] = $originUrl;
  27682. }
  27683. }
  27684. $options['http']['follow_location'] = 0;
  27685. if (isset($options['http']['header']) && !is_array($options['http']['header'])) {
  27686. $options['http']['header'] = explode("\r\n", trim($options['http']['header'], "\r\n"));
  27687. }
  27688. foreach ($headers as $header) {
  27689. $options['http']['header'][] = $header;
  27690. }
  27691. return $options;
  27692. }
  27693. private function handleRedirect(array $http_response_header, array $additionalOptions, $result)
  27694. {
  27695. if ($locationHeader = $this->findHeaderValue($http_response_header, 'location')) {
  27696. if (parse_url($locationHeader, PHP_URL_SCHEME)) {
  27697. $targetUrl = $locationHeader;
  27698. } elseif (parse_url($locationHeader, PHP_URL_HOST)) {
  27699. $targetUrl = $this->scheme.':'.$locationHeader;
  27700. } elseif ('/' === $locationHeader[0]) {
  27701. $urlHost = parse_url($this->fileUrl, PHP_URL_HOST);
  27702. $targetUrl = preg_replace('{^(.+(?://|@)'.preg_quote($urlHost).'(?::\d+)?)(?:[/\?].*)?$}', '\1'.$locationHeader, $this->fileUrl);
  27703. } else {
  27704. $targetUrl = preg_replace('{^(.+/)[^/?]*(?:\?.*)?$}', '\1'.$locationHeader, $this->fileUrl);
  27705. }
  27706. }
  27707. if (!empty($targetUrl)) {
  27708. $this->redirects++;
  27709. $this->io->writeError('', true, IOInterface::DEBUG);
  27710. $this->io->writeError(sprintf('Following redirect (%u) %s', $this->redirects, $this->stripCredentialsFromUrl($targetUrl)), true, IOInterface::DEBUG);
  27711. $additionalOptions['redirects'] = $this->redirects;
  27712. return $this->get(parse_url($targetUrl, PHP_URL_HOST), $targetUrl, $additionalOptions, $this->fileName, $this->progress);
  27713. }
  27714. if (!$this->retry) {
  27715. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded, got redirect without Location ('.$http_response_header[0].')');
  27716. $e->setHeaders($http_response_header);
  27717. $e->setResponse($result);
  27718. throw $e;
  27719. }
  27720. return false;
  27721. }
  27722. private function getTlsDefaults(array $options)
  27723. {
  27724. $ciphers = implode(':', array(
  27725. 'ECDHE-RSA-AES128-GCM-SHA256',
  27726. 'ECDHE-ECDSA-AES128-GCM-SHA256',
  27727. 'ECDHE-RSA-AES256-GCM-SHA384',
  27728. 'ECDHE-ECDSA-AES256-GCM-SHA384',
  27729. 'DHE-RSA-AES128-GCM-SHA256',
  27730. 'DHE-DSS-AES128-GCM-SHA256',
  27731. 'kEDH+AESGCM',
  27732. 'ECDHE-RSA-AES128-SHA256',
  27733. 'ECDHE-ECDSA-AES128-SHA256',
  27734. 'ECDHE-RSA-AES128-SHA',
  27735. 'ECDHE-ECDSA-AES128-SHA',
  27736. 'ECDHE-RSA-AES256-SHA384',
  27737. 'ECDHE-ECDSA-AES256-SHA384',
  27738. 'ECDHE-RSA-AES256-SHA',
  27739. 'ECDHE-ECDSA-AES256-SHA',
  27740. 'DHE-RSA-AES128-SHA256',
  27741. 'DHE-RSA-AES128-SHA',
  27742. 'DHE-DSS-AES128-SHA256',
  27743. 'DHE-RSA-AES256-SHA256',
  27744. 'DHE-DSS-AES256-SHA',
  27745. 'DHE-RSA-AES256-SHA',
  27746. 'AES128-GCM-SHA256',
  27747. 'AES256-GCM-SHA384',
  27748. 'AES128-SHA256',
  27749. 'AES256-SHA256',
  27750. 'AES128-SHA',
  27751. 'AES256-SHA',
  27752. 'AES',
  27753. 'CAMELLIA',
  27754. 'DES-CBC3-SHA',
  27755. '!aNULL',
  27756. '!eNULL',
  27757. '!EXPORT',
  27758. '!DES',
  27759. '!RC4',
  27760. '!MD5',
  27761. '!PSK',
  27762. '!aECDH',
  27763. '!EDH-DSS-DES-CBC3-SHA',
  27764. '!EDH-RSA-DES-CBC3-SHA',
  27765. '!KRB5-DES-CBC3-SHA',
  27766. ));
  27767. $defaults = array(
  27768. 'ssl' => array(
  27769. 'ciphers' => $ciphers,
  27770. 'verify_peer' => true,
  27771. 'verify_depth' => 7,
  27772. 'SNI_enabled' => true,
  27773. 'capture_peer_cert' => true,
  27774. ),
  27775. );
  27776. if (isset($options['ssl'])) {
  27777. $defaults['ssl'] = array_replace_recursive($defaults['ssl'], $options['ssl']);
  27778. }
  27779. $caBundleLogger = $this->io instanceof LoggerInterface ? $this->io : null;
  27780. if (!isset($defaults['ssl']['cafile']) && !isset($defaults['ssl']['capath'])) {
  27781. $result = CaBundle::getSystemCaRootBundlePath($caBundleLogger);
  27782. if (is_dir($result)) {
  27783. $defaults['ssl']['capath'] = $result;
  27784. } else {
  27785. $defaults['ssl']['cafile'] = $result;
  27786. }
  27787. }
  27788. if (isset($defaults['ssl']['cafile']) && (!is_readable($defaults['ssl']['cafile']) || !CaBundle::validateCaFile($defaults['ssl']['cafile'], $caBundleLogger))) {
  27789. throw new TransportException('The configured cafile was not valid or could not be read.');
  27790. }
  27791. if (isset($defaults['ssl']['capath']) && (!is_dir($defaults['ssl']['capath']) || !is_readable($defaults['ssl']['capath']))) {
  27792. throw new TransportException('The configured capath was not valid or could not be read.');
  27793. }
  27794. if (PHP_VERSION_ID >= 50413) {
  27795. $defaults['ssl']['disable_compression'] = true;
  27796. }
  27797. return $defaults;
  27798. }
  27799. private function getCertificateCnAndFp($url, $options)
  27800. {
  27801. if (PHP_VERSION_ID >= 50600) {
  27802. throw new \BadMethodCallException(sprintf(
  27803. '%s must not be used on PHP >= 5.6',
  27804. __METHOD__
  27805. ));
  27806. }
  27807. $context = StreamContextFactory::getContext($url, $options, array('options' => array(
  27808. 'ssl' => array(
  27809. 'capture_peer_cert' => true,
  27810. 'verify_peer' => false,
  27811. ), ),
  27812. ));
  27813. if (false === $handle = @fopen($url, 'rb', false, $context)) {
  27814. return;
  27815. }
  27816. fclose($handle);
  27817. $handle = null;
  27818. $params = stream_context_get_params($context);
  27819. if (!empty($params['options']['ssl']['peer_certificate'])) {
  27820. $peerCertificate = $params['options']['ssl']['peer_certificate'];
  27821. if (TlsHelper::checkCertificateHost($peerCertificate, parse_url($url, PHP_URL_HOST), $commonName)) {
  27822. return array(
  27823. 'cn' => $commonName,
  27824. 'fp' => TlsHelper::getCertificateFingerprint($peerCertificate),
  27825. );
  27826. }
  27827. }
  27828. }
  27829. private function getUrlAuthority($url)
  27830. {
  27831. $defaultPorts = array(
  27832. 'ftp' => 21,
  27833. 'http' => 80,
  27834. 'https' => 443,
  27835. 'ssh2.sftp' => 22,
  27836. 'ssh2.scp' => 22,
  27837. );
  27838. $scheme = parse_url($url, PHP_URL_SCHEME);
  27839. if (!isset($defaultPorts[$scheme])) {
  27840. throw new \InvalidArgumentException(sprintf(
  27841. 'Could not get default port for unknown scheme: %s',
  27842. $scheme
  27843. ));
  27844. }
  27845. $defaultPort = $defaultPorts[$scheme];
  27846. $port = parse_url($url, PHP_URL_PORT) ?: $defaultPort;
  27847. return parse_url($url, PHP_URL_HOST).':'.$port;
  27848. }
  27849. private function isPublicBitBucketDownload($urlToBitBucketFile)
  27850. {
  27851. $domain = parse_url($urlToBitBucketFile, PHP_URL_HOST);
  27852. if (strpos($domain, 'bitbucket.org') === false) {
  27853. return true;
  27854. }
  27855. $path = parse_url($urlToBitBucketFile, PHP_URL_PATH);
  27856. $pathParts = explode('/', $path);
  27857. return count($pathParts) >= 4 && $pathParts[3] == 'downloads';
  27858. }
  27859. public static function outputWarnings(IOInterface $io, $url, $data)
  27860. {
  27861. foreach (array('warning', 'info') as $type) {
  27862. if (empty($data[$type])) {
  27863. continue;
  27864. }
  27865. if (!empty($data[$type . '-versions'])) {
  27866. $versionParser = new VersionParser();
  27867. $constraint = $versionParser->parseConstraints($data[$type . '-versions']);
  27868. $composer = new Constraint('==', $versionParser->normalize(Composer::getVersion()));
  27869. if (!$constraint->matches($composer)) {
  27870. continue;
  27871. }
  27872. }
  27873. $io->writeError('<'.$type.'>'.ucfirst($type).' from '.$url.': '.$data[$type].'</'.$type.'>');
  27874. }
  27875. }
  27876. public static function getOrigin($urlOrPath)
  27877. {
  27878. $hostPort = parse_url($urlOrPath, PHP_URL_HOST);
  27879. if (!$hostPort) {
  27880. return $urlOrPath;
  27881. }
  27882. if (parse_url($urlOrPath, PHP_URL_PORT)) {
  27883. $hostPort .= ':'.parse_url($urlOrPath, PHP_URL_PORT);
  27884. }
  27885. return $hostPort;
  27886. }
  27887. private function stripCredentialsFromUrl($url)
  27888. {
  27889. return preg_replace('{([&?]access_token=)[^&]+}', '$1***', $url);
  27890. }
  27891. }
  27892. <?php
  27893. namespace Composer\Util;
  27894. class Silencer
  27895. {
  27896. private static $stack = array();
  27897. public static function suppress($mask = null)
  27898. {
  27899. if (!isset($mask)) {
  27900. $mask = E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE | E_DEPRECATED | E_USER_DEPRECATED | E_STRICT;
  27901. }
  27902. $old = error_reporting();
  27903. self::$stack[] = $old;
  27904. error_reporting($old & ~$mask);
  27905. return $old;
  27906. }
  27907. public static function restore()
  27908. {
  27909. if (!empty(self::$stack)) {
  27910. error_reporting(array_pop(self::$stack));
  27911. }
  27912. }
  27913. public static function call($callable )
  27914. {
  27915. try {
  27916. self::suppress();
  27917. $result = call_user_func_array($callable, array_slice(func_get_args(), 1));
  27918. self::restore();
  27919. return $result;
  27920. } catch (\Exception $e) {
  27921. self::restore();
  27922. throw $e;
  27923. }
  27924. }
  27925. }
  27926. <?php
  27927. namespace Composer\Util;
  27928. use Composer\Spdx\SpdxLicenses;
  27929. trigger_error('The ' . __NAMESPACE__ . '\SpdxLicense class is deprecated, use Composer\Spdx\SpdxLicenses instead.', E_USER_DEPRECATED);
  27930. class SpdxLicense extends SpdxLicenses
  27931. {
  27932. }
  27933. <?php
  27934. namespace Composer\Util;
  27935. use Composer\Composer;
  27936. final class StreamContextFactory
  27937. {
  27938. public static function getContext($url, array $defaultOptions = array(), array $defaultParams = array())
  27939. {
  27940. $options = array('http' => array(
  27941. 'follow_location' => 1,
  27942. 'max_redirects' => 20,
  27943. ));
  27944. if ((PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') && (!empty($_SERVER['HTTP_PROXY']) || !empty($_SERVER['http_proxy']))) {
  27945. $proxy = parse_url(!empty($_SERVER['http_proxy']) ? $_SERVER['http_proxy'] : $_SERVER['HTTP_PROXY']);
  27946. }
  27947. if (!empty($_SERVER['CGI_HTTP_PROXY'])) {
  27948. $proxy = parse_url($_SERVER['CGI_HTTP_PROXY']);
  27949. }
  27950. if (preg_match('{^https://}i', $url) && (!empty($_SERVER['HTTPS_PROXY']) || !empty($_SERVER['https_proxy']))) {
  27951. $proxy = parse_url(!empty($_SERVER['https_proxy']) ? $_SERVER['https_proxy'] : $_SERVER['HTTPS_PROXY']);
  27952. }
  27953. if (!empty($_SERVER['NO_PROXY']) || !empty($_SERVER['no_proxy']) && parse_url($url, PHP_URL_HOST)) {
  27954. $pattern = new NoProxyPattern(!empty($_SERVER['no_proxy']) ? $_SERVER['no_proxy'] : $_SERVER['NO_PROXY']);
  27955. if ($pattern->test($url)) {
  27956. unset($proxy);
  27957. }
  27958. }
  27959. if (!empty($proxy)) {
  27960. $proxyURL = isset($proxy['scheme']) ? $proxy['scheme'] . '://' : '';
  27961. $proxyURL .= isset($proxy['host']) ? $proxy['host'] : '';
  27962. if (isset($proxy['port'])) {
  27963. $proxyURL .= ":" . $proxy['port'];
  27964. } elseif ('http://' == substr($proxyURL, 0, 7)) {
  27965. $proxyURL .= ":80";
  27966. } elseif ('https://' == substr($proxyURL, 0, 8)) {
  27967. $proxyURL .= ":443";
  27968. }
  27969. $proxyURL = str_replace(array('http://', 'https://'), array('tcp://', 'ssl://'), $proxyURL);
  27970. if (0 === strpos($proxyURL, 'ssl:') && !extension_loaded('openssl')) {
  27971. throw new \RuntimeException('You must enable the openssl extension to use a proxy over https');
  27972. }
  27973. $options['http']['proxy'] = $proxyURL;
  27974. switch (parse_url($url, PHP_URL_SCHEME)) {
  27975. case 'http':
  27976. $reqFullUriEnv = getenv('HTTP_PROXY_REQUEST_FULLURI');
  27977. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  27978. $options['http']['request_fulluri'] = true;
  27979. }
  27980. break;
  27981. case 'https':
  27982. $reqFullUriEnv = getenv('HTTPS_PROXY_REQUEST_FULLURI');
  27983. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  27984. $options['http']['request_fulluri'] = true;
  27985. }
  27986. break;
  27987. }
  27988. if ('https' === parse_url($url, PHP_URL_SCHEME)) {
  27989. $options['ssl']['SNI_enabled'] = true;
  27990. if (PHP_VERSION_ID < 50600) {
  27991. $options['ssl']['SNI_server_name'] = parse_url($url, PHP_URL_HOST);
  27992. }
  27993. }
  27994. if (isset($proxy['user'])) {
  27995. $auth = rawurldecode($proxy['user']);
  27996. if (isset($proxy['pass'])) {
  27997. $auth .= ':' . rawurldecode($proxy['pass']);
  27998. }
  27999. $auth = base64_encode($auth);
  28000. if (isset($defaultOptions['http']['header'])) {
  28001. if (is_string($defaultOptions['http']['header'])) {
  28002. $defaultOptions['http']['header'] = array($defaultOptions['http']['header']);
  28003. }
  28004. $defaultOptions['http']['header'][] = "Proxy-Authorization: Basic {$auth}";
  28005. } else {
  28006. $options['http']['header'] = array("Proxy-Authorization: Basic {$auth}");
  28007. }
  28008. }
  28009. }
  28010. $options = array_replace_recursive($options, $defaultOptions);
  28011. if (isset($options['http']['header'])) {
  28012. $options['http']['header'] = self::fixHttpHeaderField($options['http']['header']);
  28013. }
  28014. if (defined('HHVM_VERSION')) {
  28015. $phpVersion = 'HHVM ' . HHVM_VERSION;
  28016. } else {
  28017. $phpVersion = 'PHP ' . PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
  28018. }
  28019. if (!isset($options['http']['header']) || false === stripos(implode('', $options['http']['header']), 'user-agent')) {
  28020. $options['http']['header'][] = sprintf(
  28021. 'User-Agent: Composer/%s (%s; %s; %s%s)',
  28022. Composer::getVersion(),
  28023. function_exists('php_uname') ? php_uname('s') : 'Unknown',
  28024. function_exists('php_uname') ? php_uname('r') : 'Unknown',
  28025. $phpVersion,
  28026. getenv('CI') ? '; CI' : ''
  28027. );
  28028. }
  28029. return stream_context_create($options, $defaultParams);
  28030. }
  28031. private static function fixHttpHeaderField($header)
  28032. {
  28033. if (!is_array($header)) {
  28034. $header = explode("\r\n", $header);
  28035. }
  28036. uasort($header, function ($el) {
  28037. return stripos($el, 'content-type') === 0 ? 1 : -1;
  28038. });
  28039. return $header;
  28040. }
  28041. }
  28042. <?php
  28043. namespace Composer\Util;
  28044. use Composer\Config;
  28045. use Composer\IO\IOInterface;
  28046. class Svn
  28047. {
  28048. const MAX_QTY_AUTH_TRIES = 5;
  28049. protected $credentials;
  28050. protected $hasAuth;
  28051. protected $io;
  28052. protected $url;
  28053. protected $cacheCredentials = true;
  28054. protected $process;
  28055. protected $qtyAuthTries = 0;
  28056. protected $config;
  28057. private static $version;
  28058. public function __construct($url, IOInterface $io, Config $config, ProcessExecutor $process = null)
  28059. {
  28060. $this->url = $url;
  28061. $this->io = $io;
  28062. $this->config = $config;
  28063. $this->process = $process ?: new ProcessExecutor($io);
  28064. }
  28065. public static function cleanEnv()
  28066. {
  28067. putenv("DYLD_LIBRARY_PATH");
  28068. unset($_SERVER['DYLD_LIBRARY_PATH']);
  28069. }
  28070. public function execute($command, $url, $cwd = null, $path = null, $verbose = false)
  28071. {
  28072. $this->config->prohibitUrlByConfig($url, $this->io);
  28073. return $this->executeWithAuthRetry($command, $cwd, $url, $path, $verbose);
  28074. }
  28075. public function executeLocal($command, $path, $cwd = null, $verbose = false)
  28076. {
  28077. return $this->executeWithAuthRetry($command, $cwd, '', $path, $verbose);
  28078. }
  28079. private function executeWithAuthRetry($svnCommand, $cwd, $url, $path, $verbose)
  28080. {
  28081. $command = $this->getCommand($svnCommand, $url, $path);
  28082. $output = null;
  28083. $io = $this->io;
  28084. $handler = function ($type, $buffer) use (&$output, $io, $verbose) {
  28085. if ($type !== 'out') {
  28086. return;
  28087. }
  28088. if ('Redirecting to URL ' === substr($buffer, 0, 19)) {
  28089. return;
  28090. }
  28091. $output .= $buffer;
  28092. if ($verbose) {
  28093. $io->writeError($buffer, false);
  28094. }
  28095. };
  28096. $status = $this->process->execute($command, $handler, $cwd);
  28097. if (0 === $status) {
  28098. return $output;
  28099. }
  28100. $errorOutput = $this->process->getErrorOutput();
  28101. $fullOutput = implode("\n", array($output, $errorOutput));
  28102. if (false === stripos($fullOutput, 'Could not authenticate to server:')
  28103. && false === stripos($fullOutput, 'authorization failed')
  28104. && false === stripos($fullOutput, 'svn: E170001:')
  28105. && false === stripos($fullOutput, 'svn: E215004:')) {
  28106. throw new \RuntimeException($fullOutput);
  28107. }
  28108. if (!$this->hasAuth()) {
  28109. $this->doAuthDance();
  28110. }
  28111. if ($this->qtyAuthTries++ < self::MAX_QTY_AUTH_TRIES) {
  28112. return $this->executeWithAuthRetry($svnCommand, $cwd, $url, $path, $verbose);
  28113. }
  28114. throw new \RuntimeException(
  28115. 'wrong credentials provided ('.$fullOutput.')'
  28116. );
  28117. }
  28118. public function setCacheCredentials($cacheCredentials)
  28119. {
  28120. $this->cacheCredentials = $cacheCredentials;
  28121. }
  28122. protected function doAuthDance()
  28123. {
  28124. if (!$this->io->isInteractive()) {
  28125. throw new \RuntimeException(
  28126. 'can not ask for authentication in non interactive mode'
  28127. );
  28128. }
  28129. $this->io->writeError("The Subversion server ({$this->url}) requested credentials:");
  28130. $this->hasAuth = true;
  28131. $this->credentials['username'] = $this->io->ask("Username: ");
  28132. $this->credentials['password'] = $this->io->askAndHideAnswer("Password: ");
  28133. $this->cacheCredentials = $this->io->askConfirmation("Should Subversion cache these credentials? (yes/no) ", true);
  28134. return $this;
  28135. }
  28136. protected function getCommand($cmd, $url, $path = null)
  28137. {
  28138. $cmd = sprintf(
  28139. '%s %s%s %s',
  28140. $cmd,
  28141. '--non-interactive ',
  28142. $this->getCredentialString(),
  28143. ProcessExecutor::escape($url)
  28144. );
  28145. if ($path) {
  28146. $cmd .= ' ' . ProcessExecutor::escape($path);
  28147. }
  28148. return $cmd;
  28149. }
  28150. protected function getCredentialString()
  28151. {
  28152. if (!$this->hasAuth()) {
  28153. return '';
  28154. }
  28155. return sprintf(
  28156. ' %s--username %s --password %s ',
  28157. $this->getAuthCache(),
  28158. ProcessExecutor::escape($this->getUsername()),
  28159. ProcessExecutor::escape($this->getPassword())
  28160. );
  28161. }
  28162. protected function getPassword()
  28163. {
  28164. if ($this->credentials === null) {
  28165. throw new \LogicException("No svn auth detected.");
  28166. }
  28167. return isset($this->credentials['password']) ? $this->credentials['password'] : '';
  28168. }
  28169. protected function getUsername()
  28170. {
  28171. if ($this->credentials === null) {
  28172. throw new \LogicException("No svn auth detected.");
  28173. }
  28174. return $this->credentials['username'];
  28175. }
  28176. protected function hasAuth()
  28177. {
  28178. if (null !== $this->hasAuth) {
  28179. return $this->hasAuth;
  28180. }
  28181. if (false === $this->createAuthFromConfig()) {
  28182. $this->createAuthFromUrl();
  28183. }
  28184. return $this->hasAuth;
  28185. }
  28186. protected function getAuthCache()
  28187. {
  28188. return $this->cacheCredentials ? '' : '--no-auth-cache ';
  28189. }
  28190. private function createAuthFromConfig()
  28191. {
  28192. if (!$this->config->has('http-basic')) {
  28193. return $this->hasAuth = false;
  28194. }
  28195. $authConfig = $this->config->get('http-basic');
  28196. $host = parse_url($this->url, PHP_URL_HOST);
  28197. if (isset($authConfig[$host])) {
  28198. $this->credentials['username'] = $authConfig[$host]['username'];
  28199. $this->credentials['password'] = $authConfig[$host]['password'];
  28200. return $this->hasAuth = true;
  28201. }
  28202. return $this->hasAuth = false;
  28203. }
  28204. private function createAuthFromUrl()
  28205. {
  28206. $uri = parse_url($this->url);
  28207. if (empty($uri['user'])) {
  28208. return $this->hasAuth = false;
  28209. }
  28210. $this->credentials['username'] = $uri['user'];
  28211. if (!empty($uri['pass'])) {
  28212. $this->credentials['password'] = $uri['pass'];
  28213. }
  28214. return $this->hasAuth = true;
  28215. }
  28216. public function binaryVersion()
  28217. {
  28218. if (!self::$version) {
  28219. if (0 === $this->process->execute('svn --version', $output)) {
  28220. if (preg_match('{(\d+(?:\.\d+)+)}', $output, $match)) {
  28221. self::$version = $match[1];
  28222. }
  28223. }
  28224. }
  28225. return self::$version;
  28226. }
  28227. }
  28228. <?php
  28229. namespace Composer\Util;
  28230. use Composer\CaBundle\CaBundle;
  28231. final class TlsHelper
  28232. {
  28233. public static function checkCertificateHost($certificate, $hostname, &$cn = null)
  28234. {
  28235. $names = self::getCertificateNames($certificate);
  28236. if (empty($names)) {
  28237. return false;
  28238. }
  28239. $combinedNames = array_merge($names['san'], array($names['cn']));
  28240. $hostname = strtolower($hostname);
  28241. foreach ($combinedNames as $certName) {
  28242. $matcher = self::certNameMatcher($certName);
  28243. if ($matcher && $matcher($hostname)) {
  28244. $cn = $names['cn'];
  28245. return true;
  28246. }
  28247. }
  28248. return false;
  28249. }
  28250. public static function getCertificateNames($certificate)
  28251. {
  28252. if (is_array($certificate)) {
  28253. $info = $certificate;
  28254. } elseif (CaBundle::isOpensslParseSafe()) {
  28255. $info = openssl_x509_parse($certificate, false);
  28256. }
  28257. if (!isset($info['subject']['commonName'])) {
  28258. return null;
  28259. }
  28260. $commonName = strtolower($info['subject']['commonName']);
  28261. $subjectAltNames = array();
  28262. if (isset($info['extensions']['subjectAltName'])) {
  28263. $subjectAltNames = preg_split('{\s*,\s*}', $info['extensions']['subjectAltName']);
  28264. $subjectAltNames = array_filter(array_map(function ($name) {
  28265. if (0 === strpos($name, 'DNS:')) {
  28266. return strtolower(ltrim(substr($name, 4)));
  28267. }
  28268. return null;
  28269. }, $subjectAltNames));
  28270. $subjectAltNames = array_values($subjectAltNames);
  28271. }
  28272. return array(
  28273. 'cn' => $commonName,
  28274. 'san' => $subjectAltNames,
  28275. );
  28276. }
  28277. public static function getCertificateFingerprint($certificate)
  28278. {
  28279. $pubkeydetails = openssl_pkey_get_details(openssl_get_publickey($certificate));
  28280. $pubkeypem = $pubkeydetails['key'];
  28281. $start = '-----BEGIN PUBLIC KEY-----';
  28282. $end = '-----END PUBLIC KEY-----';
  28283. $pemtrim = substr($pubkeypem, strpos($pubkeypem, $start) + strlen($start), (strlen($pubkeypem) - strpos($pubkeypem, $end)) * (-1));
  28284. $der = base64_decode($pemtrim);
  28285. return sha1($der);
  28286. }
  28287. public static function isOpensslParseSafe()
  28288. {
  28289. return CaBundle::isOpensslParseSafe();
  28290. }
  28291. private static function certNameMatcher($certName)
  28292. {
  28293. $wildcards = substr_count($certName, '*');
  28294. if (0 === $wildcards) {
  28295. return function ($hostname) use ($certName) {
  28296. return $hostname === $certName;
  28297. };
  28298. }
  28299. if (1 === $wildcards) {
  28300. $components = explode('.', $certName);
  28301. if (3 > count($components)) {
  28302. return;
  28303. }
  28304. $firstComponent = $components[0];
  28305. if ('*' !== $firstComponent[strlen($firstComponent) - 1]) {
  28306. return;
  28307. }
  28308. $wildcardRegex = preg_quote($certName);
  28309. $wildcardRegex = str_replace('\\*', '[a-z0-9-]+', $wildcardRegex);
  28310. $wildcardRegex = "{^{$wildcardRegex}$}";
  28311. return function ($hostname) use ($wildcardRegex) {
  28312. return 1 === preg_match($wildcardRegex, $hostname);
  28313. };
  28314. }
  28315. }
  28316. }
  28317. <?php
  28318. namespace Composer\Util;
  28319. use Composer\Config;
  28320. class Url
  28321. {
  28322. public static function updateDistReference(Config $config, $url, $ref)
  28323. {
  28324. $host = parse_url($url, PHP_URL_HOST);
  28325. if ($host === 'api.github.com' || $host === 'github.com' || $host === 'www.github.com') {
  28326. if (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/(zip|tar)ball/(.+)$}i', $url, $match)) {
  28327. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  28328. } elseif (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/archive/.+\.(zip|tar)(?:\.gz)?$}i', $url, $match)) {
  28329. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  28330. } elseif (preg_match('{^https?://api\.github\.com/repos/([^/]+)/([^/]+)/(zip|tar)ball(?:/.+)?$}i', $url, $match)) {
  28331. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  28332. }
  28333. } elseif ($host === 'bitbucket.org' || $host === 'www.bitbucket.org') {
  28334. if (preg_match('{^https?://(?:www\.)?bitbucket\.org/([^/]+)/([^/]+)/get/(.+)\.(zip|tar\.gz|tar\.bz2)$}i', $url, $match)) {
  28335. $url = 'https://bitbucket.org/' . $match[1] . '/'. $match[2] . '/get/' . $ref . '.' . $match[4];
  28336. }
  28337. } elseif ($host === 'gitlab.com' || $host === 'www.gitlab.com') {
  28338. if (preg_match('{^https?://(?:www\.)?gitlab\.com/api/v[34]/projects/([^/]+)/repository/archive\.(zip|tar\.gz|tar\.bz2|tar)\?sha=.+$}i', $url, $match)) {
  28339. $url = 'https://gitlab.com/api/v4/projects/' . $match[1] . '/repository/archive.' . $match[2] . '?sha=' . $ref;
  28340. }
  28341. } elseif (in_array($host, $config->get('github-domains'), true)) {
  28342. $url = preg_replace('{(/repos/[^/]+/[^/]+/(zip|tar)ball)(?:/.+)?$}i', '$1/'.$ref, $url);
  28343. } elseif (in_array($host, $config->get('gitlab-domains'), true)) {
  28344. $url = preg_replace('{(/api/v[34]/projects/[^/]+/repository/archive\.(?:zip|tar\.gz|tar\.bz2|tar)\?sha=).+$}i', '${1}'.$ref, $url);
  28345. }
  28346. return $url;
  28347. }
  28348. }
  28349. <?php
  28350. namespace Composer\Util;
  28351. class Zip
  28352. {
  28353. public static function getComposerJson($pathToZip)
  28354. {
  28355. if (!extension_loaded('zip')) {
  28356. throw new \RuntimeException('The Zip Util requires PHP\'s zip extension');
  28357. }
  28358. $zip = new \ZipArchive();
  28359. if ($zip->open($pathToZip) !== true) {
  28360. return null;
  28361. }
  28362. if (0 == $zip->numFiles) {
  28363. $zip->close();
  28364. return null;
  28365. }
  28366. $foundFileIndex = self::locateFile($zip, 'composer.json');
  28367. if (false === $foundFileIndex) {
  28368. $zip->close();
  28369. return null;
  28370. }
  28371. $content = null;
  28372. $configurationFileName = $zip->getNameIndex($foundFileIndex);
  28373. $stream = $zip->getStream($configurationFileName);
  28374. if (false !== $stream) {
  28375. $content = stream_get_contents($stream);
  28376. }
  28377. $zip->close();
  28378. return $content;
  28379. }
  28380. private static function locateFile(\ZipArchive $zip, $filename)
  28381. {
  28382. $indexOfShortestMatch = false;
  28383. $lengthOfShortestMatch = -1;
  28384. for ($i = 0; $i < $zip->numFiles; $i++) {
  28385. $stat = $zip->statIndex($i);
  28386. if (strcmp(basename($stat['name']), $filename) === 0) {
  28387. $directoryName = dirname($stat['name']);
  28388. if ($directoryName === '.') {
  28389. return $i;
  28390. }
  28391. if (strpos($directoryName, '\\') !== false ||
  28392. strpos($directoryName, '/') !== false) {
  28393. continue;
  28394. }
  28395. $length = strlen($stat['name']);
  28396. if ($indexOfShortestMatch === false || $length < $lengthOfShortestMatch) {
  28397. $contents = $zip->getFromIndex($i);
  28398. if ($contents !== false) {
  28399. $indexOfShortestMatch = $i;
  28400. $lengthOfShortestMatch = $length;
  28401. }
  28402. }
  28403. }
  28404. }
  28405. return $indexOfShortestMatch;
  28406. }
  28407. }
  28408. <?php
  28409. namespace Composer;
  28410. use Symfony\Component\Console\Output\OutputInterface;
  28411. trigger_error('The ' . __NAMESPACE__ . '\XdebugHandler class is deprecated, use Composer\XdebugHandler\XdebugHandler instead,', E_USER_DEPRECATED);
  28412. class XdebugHandler extends XdebugHandler\XdebugHandler
  28413. {
  28414. const ENV_ALLOW = 'COMPOSER_ALLOW_XDEBUG';
  28415. const ENV_VERSION = 'COMPOSER_XDEBUG_VERSION';
  28416. public function __construct(OutputInterface $output)
  28417. {
  28418. parent::__construct('composer', '--ansi');
  28419. }
  28420. }
  28421. <?php
  28422. function includeIfExists($file)
  28423. {
  28424. return file_exists($file) ? include $file : false;
  28425. }
  28426. if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) {
  28427. echo 'You must set up the project dependencies using `composer install`'.PHP_EOL.
  28428. 'See https://getcomposer.org/download/ for instructions on installing Composer'.PHP_EOL;
  28429. exit(1);
  28430. }
  28431. return $loader;
  28432. <?php
  28433. /*
  28434. * This file is part of Composer.
  28435. *
  28436. * (c) Nils Adermann <naderman@naderman.de>
  28437. * Jordi Boggiano <j.boggiano@seld.be>
  28438. *
  28439. * For the full copyright and license information, please view the LICENSE
  28440. * file that was distributed with this source code.
  28441. */
  28442. namespace Composer\Autoload;
  28443. /**
  28444. * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
  28445. *
  28446. * $loader = new \Composer\Autoload\ClassLoader();
  28447. *
  28448. * // register classes with namespaces
  28449. * $loader->add('Symfony\Component', __DIR__.'/component');
  28450. * $loader->add('Symfony', __DIR__.'/framework');
  28451. *
  28452. * // activate the autoloader
  28453. * $loader->register();
  28454. *
  28455. * // to enable searching the include path (eg. for PEAR packages)
  28456. * $loader->setUseIncludePath(true);
  28457. *
  28458. * In this example, if you try to use a class in the Symfony\Component
  28459. * namespace or one of its children (Symfony\Component\Console for instance),
  28460. * the autoloader will first look for the class under the component/
  28461. * directory, and it will then fallback to the framework/ directory if not
  28462. * found before giving up.
  28463. *
  28464. * This class is loosely based on the Symfony UniversalClassLoader.
  28465. *
  28466. * @author Fabien Potencier <fabien@symfony.com>
  28467. * @author Jordi Boggiano <j.boggiano@seld.be>
  28468. * @see http://www.php-fig.org/psr/psr-0/
  28469. * @see http://www.php-fig.org/psr/psr-4/
  28470. */
  28471. class ClassLoader
  28472. {
  28473. // PSR-4
  28474. private $prefixLengthsPsr4 = array();
  28475. private $prefixDirsPsr4 = array();
  28476. private $fallbackDirsPsr4 = array();
  28477. // PSR-0
  28478. private $prefixesPsr0 = array();
  28479. private $fallbackDirsPsr0 = array();
  28480. private $useIncludePath = false;
  28481. private $classMap = array();
  28482. private $classMapAuthoritative = false;
  28483. private $missingClasses = array();
  28484. private $apcuPrefix;
  28485. public function getPrefixes()
  28486. {
  28487. if (!empty($this->prefixesPsr0)) {
  28488. return call_user_func_array('array_merge', $this->prefixesPsr0);
  28489. }
  28490. return array();
  28491. }
  28492. public function getPrefixesPsr4()
  28493. {
  28494. return $this->prefixDirsPsr4;
  28495. }
  28496. public function getFallbackDirs()
  28497. {
  28498. return $this->fallbackDirsPsr0;
  28499. }
  28500. public function getFallbackDirsPsr4()
  28501. {
  28502. return $this->fallbackDirsPsr4;
  28503. }
  28504. public function getClassMap()
  28505. {
  28506. return $this->classMap;
  28507. }
  28508. /**
  28509. * @param array $classMap Class to filename map
  28510. */
  28511. public function addClassMap(array $classMap)
  28512. {
  28513. if ($this->classMap) {
  28514. $this->classMap = array_merge($this->classMap, $classMap);
  28515. } else {
  28516. $this->classMap = $classMap;
  28517. }
  28518. }
  28519. /**
  28520. * Registers a set of PSR-0 directories for a given prefix, either
  28521. * appending or prepending to the ones previously set for this prefix.
  28522. *
  28523. * @param string $prefix The prefix
  28524. * @param array|string $paths The PSR-0 root directories
  28525. * @param bool $prepend Whether to prepend the directories
  28526. */
  28527. public function add($prefix, $paths, $prepend = false)
  28528. {
  28529. if (!$prefix) {
  28530. if ($prepend) {
  28531. $this->fallbackDirsPsr0 = array_merge(
  28532. (array) $paths,
  28533. $this->fallbackDirsPsr0
  28534. );
  28535. } else {
  28536. $this->fallbackDirsPsr0 = array_merge(
  28537. $this->fallbackDirsPsr0,
  28538. (array) $paths
  28539. );
  28540. }
  28541. return;
  28542. }
  28543. $first = $prefix[0];
  28544. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  28545. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  28546. return;
  28547. }
  28548. if ($prepend) {
  28549. $this->prefixesPsr0[$first][$prefix] = array_merge(
  28550. (array) $paths,
  28551. $this->prefixesPsr0[$first][$prefix]
  28552. );
  28553. } else {
  28554. $this->prefixesPsr0[$first][$prefix] = array_merge(
  28555. $this->prefixesPsr0[$first][$prefix],
  28556. (array) $paths
  28557. );
  28558. }
  28559. }
  28560. /**
  28561. * Registers a set of PSR-4 directories for a given namespace, either
  28562. * appending or prepending to the ones previously set for this namespace.
  28563. *
  28564. * @param string $prefix The prefix/namespace, with trailing '\\'
  28565. * @param array|string $paths The PSR-4 base directories
  28566. * @param bool $prepend Whether to prepend the directories
  28567. *
  28568. * @throws \InvalidArgumentException
  28569. */
  28570. public function addPsr4($prefix, $paths, $prepend = false)
  28571. {
  28572. if (!$prefix) {
  28573. // Register directories for the root namespace.
  28574. if ($prepend) {
  28575. $this->fallbackDirsPsr4 = array_merge(
  28576. (array) $paths,
  28577. $this->fallbackDirsPsr4
  28578. );
  28579. } else {
  28580. $this->fallbackDirsPsr4 = array_merge(
  28581. $this->fallbackDirsPsr4,
  28582. (array) $paths
  28583. );
  28584. }
  28585. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  28586. // Register directories for a new namespace.
  28587. $length = strlen($prefix);
  28588. if ('\\' !== $prefix[$length - 1]) {
  28589. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  28590. }
  28591. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  28592. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  28593. } elseif ($prepend) {
  28594. // Prepend directories for an already registered namespace.
  28595. $this->prefixDirsPsr4[$prefix] = array_merge(
  28596. (array) $paths,
  28597. $this->prefixDirsPsr4[$prefix]
  28598. );
  28599. } else {
  28600. // Append directories for an already registered namespace.
  28601. $this->prefixDirsPsr4[$prefix] = array_merge(
  28602. $this->prefixDirsPsr4[$prefix],
  28603. (array) $paths
  28604. );
  28605. }
  28606. }
  28607. /**
  28608. * Registers a set of PSR-0 directories for a given prefix,
  28609. * replacing any others previously set for this prefix.
  28610. *
  28611. * @param string $prefix The prefix
  28612. * @param array|string $paths The PSR-0 base directories
  28613. */
  28614. public function set($prefix, $paths)
  28615. {
  28616. if (!$prefix) {
  28617. $this->fallbackDirsPsr0 = (array) $paths;
  28618. } else {
  28619. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  28620. }
  28621. }
  28622. /**
  28623. * Registers a set of PSR-4 directories for a given namespace,
  28624. * replacing any others previously set for this namespace.
  28625. *
  28626. * @param string $prefix The prefix/namespace, with trailing '\\'
  28627. * @param array|string $paths The PSR-4 base directories
  28628. *
  28629. * @throws \InvalidArgumentException
  28630. */
  28631. public function setPsr4($prefix, $paths)
  28632. {
  28633. if (!$prefix) {
  28634. $this->fallbackDirsPsr4 = (array) $paths;
  28635. } else {
  28636. $length = strlen($prefix);
  28637. if ('\\' !== $prefix[$length - 1]) {
  28638. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  28639. }
  28640. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  28641. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  28642. }
  28643. }
  28644. /**
  28645. * Turns on searching the include path for class files.
  28646. *
  28647. * @param bool $useIncludePath
  28648. */
  28649. public function setUseIncludePath($useIncludePath)
  28650. {
  28651. $this->useIncludePath = $useIncludePath;
  28652. }
  28653. /**
  28654. * Can be used to check if the autoloader uses the include path to check
  28655. * for classes.
  28656. *
  28657. * @return bool
  28658. */
  28659. public function getUseIncludePath()
  28660. {
  28661. return $this->useIncludePath;
  28662. }
  28663. /**
  28664. * Turns off searching the prefix and fallback directories for classes
  28665. * that have not been registered with the class map.
  28666. *
  28667. * @param bool $classMapAuthoritative
  28668. */
  28669. public function setClassMapAuthoritative($classMapAuthoritative)
  28670. {
  28671. $this->classMapAuthoritative = $classMapAuthoritative;
  28672. }
  28673. /**
  28674. * Should class lookup fail if not found in the current class map?
  28675. *
  28676. * @return bool
  28677. */
  28678. public function isClassMapAuthoritative()
  28679. {
  28680. return $this->classMapAuthoritative;
  28681. }
  28682. /**
  28683. * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
  28684. *
  28685. * @param string|null $apcuPrefix
  28686. */
  28687. public function setApcuPrefix($apcuPrefix)
  28688. {
  28689. $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
  28690. }
  28691. /**
  28692. * The APCu prefix in use, or null if APCu caching is not enabled.
  28693. *
  28694. * @return string|null
  28695. */
  28696. public function getApcuPrefix()
  28697. {
  28698. return $this->apcuPrefix;
  28699. }
  28700. /**
  28701. * Registers this instance as an autoloader.
  28702. *
  28703. * @param bool $prepend Whether to prepend the autoloader or not
  28704. */
  28705. public function register($prepend = false)
  28706. {
  28707. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  28708. }
  28709. /**
  28710. * Unregisters this instance as an autoloader.
  28711. */
  28712. public function unregister()
  28713. {
  28714. spl_autoload_unregister(array($this, 'loadClass'));
  28715. }
  28716. /**
  28717. * Loads the given class or interface.
  28718. *
  28719. * @param string $class The name of the class
  28720. * @return bool|null True if loaded, null otherwise
  28721. */
  28722. public function loadClass($class)
  28723. {
  28724. if ($file = $this->findFile($class)) {
  28725. includeFile($file);
  28726. return true;
  28727. }
  28728. }
  28729. /**
  28730. * Finds the path to the file where the class is defined.
  28731. *
  28732. * @param string $class The name of the class
  28733. *
  28734. * @return string|false The path if found, false otherwise
  28735. */
  28736. public function findFile($class)
  28737. {
  28738. // class map lookup
  28739. if (isset($this->classMap[$class])) {
  28740. return $this->classMap[$class];
  28741. }
  28742. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  28743. return false;
  28744. }
  28745. if (null !== $this->apcuPrefix) {
  28746. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  28747. if ($hit) {
  28748. return $file;
  28749. }
  28750. }
  28751. $file = $this->findFileWithExtension($class, '.php');
  28752. // Search for Hack files if we are running on HHVM
  28753. if (false === $file && defined('HHVM_VERSION')) {
  28754. $file = $this->findFileWithExtension($class, '.hh');
  28755. }
  28756. if (null !== $this->apcuPrefix) {
  28757. apcu_add($this->apcuPrefix.$class, $file);
  28758. }
  28759. if (false === $file) {
  28760. // Remember that this class does not exist.
  28761. $this->missingClasses[$class] = true;
  28762. }
  28763. return $file;
  28764. }
  28765. private function findFileWithExtension($class, $ext)
  28766. {
  28767. // PSR-4 lookup
  28768. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  28769. $first = $class[0];
  28770. if (isset($this->prefixLengthsPsr4[$first])) {
  28771. $subPath = $class;
  28772. while (false !== $lastPos = strrpos($subPath, '\\')) {
  28773. $subPath = substr($subPath, 0, $lastPos);
  28774. $search = $subPath . '\\';
  28775. if (isset($this->prefixDirsPsr4[$search])) {
  28776. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  28777. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  28778. if (file_exists($file = $dir . $pathEnd)) {
  28779. return $file;
  28780. }
  28781. }
  28782. }
  28783. }
  28784. }
  28785. // PSR-4 fallback dirs
  28786. foreach ($this->fallbackDirsPsr4 as $dir) {
  28787. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  28788. return $file;
  28789. }
  28790. }
  28791. // PSR-0 lookup
  28792. if (false !== $pos = strrpos($class, '\\')) {
  28793. // namespaced class name
  28794. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  28795. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  28796. } else {
  28797. // PEAR-like class name
  28798. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  28799. }
  28800. if (isset($this->prefixesPsr0[$first])) {
  28801. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  28802. if (0 === strpos($class, $prefix)) {
  28803. foreach ($dirs as $dir) {
  28804. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  28805. return $file;
  28806. }
  28807. }
  28808. }
  28809. }
  28810. }
  28811. // PSR-0 fallback dirs
  28812. foreach ($this->fallbackDirsPsr0 as $dir) {
  28813. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  28814. return $file;
  28815. }
  28816. }
  28817. // PSR-0 include paths.
  28818. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  28819. return $file;
  28820. }
  28821. return false;
  28822. }
  28823. }
  28824. /**
  28825. * Scope isolated include.
  28826. *
  28827. * Prevents access to $this/self from included files.
  28828. */
  28829. function includeFile($file)
  28830. {
  28831. include $file;
  28832. }
  28833. {
  28834. "$schema": "http://json-schema.org/draft-04/schema#",
  28835. "description": "A representation of packages metadata.",
  28836. "type": "object",
  28837. "oneOf": [
  28838. { "required": [ "packages" ] },
  28839. { "required": [ "providers" ] },
  28840. { "required": [ "provider-includes", "providers-url" ] }
  28841. ],
  28842. "properties": {
  28843. "packages": {
  28844. "type": ["object", "array"],
  28845. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  28846. "additionalProperties": { "$ref": "#/definitions/versions" }
  28847. },
  28848. "providers-url": {
  28849. "type": "string",
  28850. "description": "Endpoint to retrieve provider data from, e.g. '/p/%package%$%hash%.json'."
  28851. },
  28852. "provider-includes": {
  28853. "type": "object",
  28854. "description": "A hashmap of provider listings.",
  28855. "additionalProperties": { "$ref": "#/definitions/provider" }
  28856. },
  28857. "providers": {
  28858. "type": "object",
  28859. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  28860. "additionalProperties": { "$ref": "#/definitions/provider" }
  28861. },
  28862. "notify-batch": {
  28863. "type": "string",
  28864. "description": "Endpoint to call after multiple packages have been installed, e.g. '/downloads/'."
  28865. },
  28866. "search": {
  28867. "type": "string",
  28868. "description": "Endpoint that provides search capabilities, e.g. '/search.json?q=%query%&type=%type%'."
  28869. },
  28870. "warning": {
  28871. "type": "string",
  28872. "description": "A message that will be output by Composer as a warning when this source is consulted."
  28873. }
  28874. },
  28875. "definitions": {
  28876. "versions": {
  28877. "type": "object",
  28878. "description": "A hashmap of versions and their metadata.",
  28879. "additionalProperties": { "$ref": "#/definitions/version" }
  28880. },
  28881. "version": {
  28882. "type": "object",
  28883. "oneOf": [
  28884. { "$ref": "#/definitions/package" },
  28885. { "$ref": "#/definitions/metapackage" }
  28886. ]
  28887. },
  28888. "package-base": {
  28889. "properties": {
  28890. "name": { "type": "string" },
  28891. "type": { "type": "string" },
  28892. "version": { "type": "string" },
  28893. "version_normalized": {
  28894. "type": "string",
  28895. "description": "Normalized version, optional but can save computational time on client side."
  28896. },
  28897. "autoload": { "type": "object" },
  28898. "require": { "type": "object" },
  28899. "replace": { "type": "object" },
  28900. "conflict": { "type": "object" },
  28901. "provide": { "type": "object" },
  28902. "time": { "type": "string" }
  28903. },
  28904. "additionalProperties": true
  28905. },
  28906. "package": {
  28907. "allOf": [
  28908. { "$ref": "#/definitions/package-base" },
  28909. {
  28910. "properties": {
  28911. "dist": { "type": "object" },
  28912. "source": { "type": "object" }
  28913. }
  28914. },
  28915. { "oneOf": [
  28916. { "required": [ "name", "version", "source" ] },
  28917. { "required": [ "name", "version", "dist" ] }
  28918. ] }
  28919. ]
  28920. },
  28921. "metapackage": {
  28922. "allOf": [
  28923. { "$ref": "#/definitions/package-base" },
  28924. {
  28925. "properties": {
  28926. "type": { "type": "string", "enum": [ "metapackage" ] }
  28927. },
  28928. "required": [ "name", "version", "type" ]
  28929. }
  28930. ]
  28931. },
  28932. "provider": {
  28933. "type": "object",
  28934. "properties": {
  28935. "sha256": {
  28936. "type": "string",
  28937. "description": "Hash value that can be used to validate the resource."
  28938. }
  28939. }
  28940. }
  28941. }
  28942. }
  28943. {
  28944. "$schema": "http://json-schema.org/draft-04/schema#",
  28945. "name": "Package",
  28946. "type": "object",
  28947. "additionalProperties": false,
  28948. "required": [ "name", "description" ],
  28949. "properties": {
  28950. "name": {
  28951. "type": "string",
  28952. "description": "Package name, including 'vendor-name/' prefix."
  28953. },
  28954. "type": {
  28955. "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.",
  28956. "type": "string",
  28957. "pattern": "^[a-z0-9-]+$"
  28958. },
  28959. "target-dir": {
  28960. "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.",
  28961. "type": "string"
  28962. },
  28963. "description": {
  28964. "type": "string",
  28965. "description": "Short package description."
  28966. },
  28967. "keywords": {
  28968. "type": "array",
  28969. "items": {
  28970. "type": "string",
  28971. "description": "A tag/keyword that this package relates to."
  28972. }
  28973. },
  28974. "homepage": {
  28975. "type": "string",
  28976. "description": "Homepage URL for the project.",
  28977. "format": "uri"
  28978. },
  28979. "readme": {
  28980. "type": "string",
  28981. "description": "Relative path to the readme document."
  28982. },
  28983. "version": {
  28984. "type": "string",
  28985. "description": "Package version, see https://getcomposer.org/doc/04-schema.md#version for more info on valid schemes.",
  28986. "pattern": "^v?\\d+(((\\.\\d+)?\\.\\d+)?\\.\\d+)?"
  28987. },
  28988. "time": {
  28989. "type": "string",
  28990. "description": "Package release date, in 'YYYY-MM-DD', 'YYYY-MM-DD HH:MM:SS' or 'YYYY-MM-DDTHH:MM:SSZ' format."
  28991. },
  28992. "license": {
  28993. "type": ["string", "array"],
  28994. "description": "License name. Or an array of license names."
  28995. },
  28996. "authors": {
  28997. "$ref": "#/definitions/authors"
  28998. },
  28999. "require": {
  29000. "type": "object",
  29001. "description": "This is a hash of package name (keys) and version constraints (values) that are required to run this package.",
  29002. "additionalProperties": {
  29003. "type": "string"
  29004. }
  29005. },
  29006. "replace": {
  29007. "type": "object",
  29008. "description": "This is a hash of package name (keys) and version constraints (values) that can be replaced by this package.",
  29009. "additionalProperties": {
  29010. "type": "string"
  29011. }
  29012. },
  29013. "conflict": {
  29014. "type": "object",
  29015. "description": "This is a hash of package name (keys) and version constraints (values) that conflict with this package.",
  29016. "additionalProperties": {
  29017. "type": "string"
  29018. }
  29019. },
  29020. "provide": {
  29021. "type": "object",
  29022. "description": "This is a hash of package name (keys) and version constraints (values) that this package provides in addition to this package's name.",
  29023. "additionalProperties": {
  29024. "type": "string"
  29025. }
  29026. },
  29027. "require-dev": {
  29028. "type": "object",
  29029. "description": "This is a hash of package name (keys) and version constraints (values) that this package requires for developing it (testing tools and such).",
  29030. "additionalProperties": {
  29031. "type": "string"
  29032. }
  29033. },
  29034. "suggest": {
  29035. "type": "object",
  29036. "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).",
  29037. "additionalProperties": {
  29038. "type": "string"
  29039. }
  29040. },
  29041. "config": {
  29042. "type": "object",
  29043. "description": "Composer options.",
  29044. "properties": {
  29045. "process-timeout": {
  29046. "type": "integer",
  29047. "description": "The timeout in seconds for process executions, defaults to 300 (5mins)."
  29048. },
  29049. "use-include-path": {
  29050. "type": "boolean",
  29051. "description": "If true, the Composer autoloader will also look for classes in the PHP include path."
  29052. },
  29053. "preferred-install": {
  29054. "type": ["string", "object"],
  29055. "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\"}."
  29056. },
  29057. "notify-on-install": {
  29058. "type": "boolean",
  29059. "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."
  29060. },
  29061. "github-protocols": {
  29062. "type": "array",
  29063. "description": "A list of protocols to use for github.com clones, in priority order, defaults to [\"git\", \"https\", \"http\"].",
  29064. "items": {
  29065. "type": "string"
  29066. }
  29067. },
  29068. "github-oauth": {
  29069. "type": "object",
  29070. "description": "A hash of domain name => github API oauth tokens, typically {\"github.com\":\"<token>\"}.",
  29071. "additionalProperties": {
  29072. "type": "string"
  29073. }
  29074. },
  29075. "gitlab-oauth": {
  29076. "type": "object",
  29077. "description": "A hash of domain name => gitlab API oauth tokens, typically {\"gitlab.com\":\"<token>\"}.",
  29078. "additionalProperties": {
  29079. "type": "string"
  29080. }
  29081. },
  29082. "gitlab-token": {
  29083. "type": "object",
  29084. "description": "A hash of domain name => gitlab private tokens, typically {\"gitlab.com\":\"<token>\"}.",
  29085. "additionalProperties": true
  29086. },
  29087. "disable-tls": {
  29088. "type": "boolean",
  29089. "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."
  29090. },
  29091. "secure-http": {
  29092. "type": "boolean",
  29093. "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."
  29094. },
  29095. "cafile": {
  29096. "type": "string",
  29097. "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."
  29098. },
  29099. "capath": {
  29100. "type": "string",
  29101. "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."
  29102. },
  29103. "http-basic": {
  29104. "type": "object",
  29105. "description": "A hash of domain name => {\"username\": \"...\", \"password\": \"...\"}.",
  29106. "additionalProperties": {
  29107. "type": "object",
  29108. "required": ["username", "password"],
  29109. "properties": {
  29110. "username": {
  29111. "type": "string",
  29112. "description": "The username used for HTTP Basic authentication"
  29113. },
  29114. "password": {
  29115. "type": "string",
  29116. "description": "The password used for HTTP Basic authentication"
  29117. }
  29118. }
  29119. }
  29120. },
  29121. "store-auths": {
  29122. "type": ["string", "boolean"],
  29123. "description": "What to do after prompting for authentication, one of: true (store), false (do not store) or \"prompt\" (ask every time), defaults to prompt."
  29124. },
  29125. "platform": {
  29126. "type": "object",
  29127. "description": "This is a hash of package name (keys) and version (values) that will be used to mock the platform packages on this machine.",
  29128. "additionalProperties": {
  29129. "type": "string"
  29130. }
  29131. },
  29132. "vendor-dir": {
  29133. "type": "string",
  29134. "description": "The location where all packages are installed, defaults to \"vendor\"."
  29135. },
  29136. "bin-dir": {
  29137. "type": "string",
  29138. "description": "The location where all binaries are linked, defaults to \"vendor/bin\"."
  29139. },
  29140. "data-dir": {
  29141. "type": "string",
  29142. "description": "The location where old phar files are stored, defaults to \"$home\" except on XDG Base Directory compliant unixes."
  29143. },
  29144. "cache-dir": {
  29145. "type": "string",
  29146. "description": "The location where all caches are located, defaults to \"~/.composer/cache\" on *nix and \"%LOCALAPPDATA%\\Composer\" on windows."
  29147. },
  29148. "cache-files-dir": {
  29149. "type": "string",
  29150. "description": "The location where files (zip downloads) are cached, defaults to \"{$cache-dir}/files\"."
  29151. },
  29152. "cache-repo-dir": {
  29153. "type": "string",
  29154. "description": "The location where repo (git/hg repo clones) are cached, defaults to \"{$cache-dir}/repo\"."
  29155. },
  29156. "cache-vcs-dir": {
  29157. "type": "string",
  29158. "description": "The location where vcs infos (git clones, github api calls, etc. when reading vcs repos) are cached, defaults to \"{$cache-dir}/vcs\"."
  29159. },
  29160. "cache-ttl": {
  29161. "type": "integer",
  29162. "description": "The default cache time-to-live, defaults to 15552000 (6 months)."
  29163. },
  29164. "cache-files-ttl": {
  29165. "type": "integer",
  29166. "description": "The cache time-to-live for files, defaults to the value of cache-ttl."
  29167. },
  29168. "cache-files-maxsize": {
  29169. "type": ["string", "integer"],
  29170. "description": "The cache max size for the files cache, defaults to \"300MiB\"."
  29171. },
  29172. "bin-compat": {
  29173. "enum": ["auto", "full"],
  29174. "description": "The compatibility of the binaries, defaults to \"auto\" (automatically guessed) and can be \"full\" (compatible with both Windows and Unix-based systems)."
  29175. },
  29176. "discard-changes": {
  29177. "type": ["string", "boolean"],
  29178. "description": "The default style of handling dirty updates, defaults to false and can be any of true, false or \"stash\"."
  29179. },
  29180. "autoloader-suffix": {
  29181. "type": "string",
  29182. "description": "Optional string to be used as a suffix for the generated Composer autoloader. When null a random one will be generated."
  29183. },
  29184. "optimize-autoloader": {
  29185. "type": "boolean",
  29186. "description": "Always optimize when dumping the autoloader."
  29187. },
  29188. "prepend-autoloader": {
  29189. "type": "boolean",
  29190. "description": "If false, the composer autoloader will not be prepended to existing autoloaders, defaults to true."
  29191. },
  29192. "classmap-authoritative": {
  29193. "type": "boolean",
  29194. "description": "If true, the composer autoloader will not scan the filesystem for classes that are not found in the class map, defaults to false."
  29195. },
  29196. "apcu-autoloader": {
  29197. "type": "boolean",
  29198. "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."
  29199. },
  29200. "github-domains": {
  29201. "type": "array",
  29202. "description": "A list of domains to use in github mode. This is used for GitHub Enterprise setups, defaults to [\"github.com\"].",
  29203. "items": {
  29204. "type": "string"
  29205. }
  29206. },
  29207. "github-expose-hostname": {
  29208. "type": "boolean",
  29209. "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."
  29210. },
  29211. "gitlab-domains": {
  29212. "type": "array",
  29213. "description": "A list of domains to use in gitlab mode. This is used for custom GitLab setups, defaults to [\"gitlab.com\"].",
  29214. "items": {
  29215. "type": "string"
  29216. }
  29217. },
  29218. "use-github-api": {
  29219. "type": "boolean",
  29220. "description": "Defaults to true. If set to false, globally disables the use of the GitHub API for all GitHub repositories and clones the repository as it would for any other repository."
  29221. },
  29222. "archive-format": {
  29223. "type": "string",
  29224. "description": "The default archiving format when not provided on cli, defaults to \"tar\"."
  29225. },
  29226. "archive-dir": {
  29227. "type": "string",
  29228. "description": "The default archive path when not provided on cli, defaults to \".\"."
  29229. },
  29230. "htaccess-protect": {
  29231. "type": "boolean",
  29232. "description": "Defaults to true. If set to false, Composer will not create .htaccess files in the composer home, cache, and data directories."
  29233. },
  29234. "sort-packages": {
  29235. "type": "boolean",
  29236. "description": "Defaults to false. If set to true, Composer will sort packages when adding/updating a new dependency."
  29237. },
  29238. "lock": {
  29239. "type": "boolean",
  29240. "description": "Defaults to true. If set to false, Composer will not create a composer.lock file."
  29241. }
  29242. }
  29243. },
  29244. "extra": {
  29245. "type": ["object", "array"],
  29246. "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.",
  29247. "additionalProperties": true
  29248. },
  29249. "autoload": {
  29250. "$ref": "#/definitions/autoload"
  29251. },
  29252. "autoload-dev": {
  29253. "type": "object",
  29254. "description": "Description of additional autoload rules for development purpose (eg. a test suite).",
  29255. "properties": {
  29256. "psr-0": {
  29257. "type": "object",
  29258. "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.",
  29259. "additionalProperties": {
  29260. "type": ["string", "array"],
  29261. "items": {
  29262. "type": "string"
  29263. }
  29264. }
  29265. },
  29266. "psr-4": {
  29267. "type": "object",
  29268. "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.",
  29269. "additionalProperties": {
  29270. "type": ["string", "array"],
  29271. "items": {
  29272. "type": "string"
  29273. }
  29274. }
  29275. },
  29276. "classmap": {
  29277. "type": "array",
  29278. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  29279. },
  29280. "files": {
  29281. "type": "array",
  29282. "description": "This is an array of files that are always required on every request."
  29283. }
  29284. }
  29285. },
  29286. "archive": {
  29287. "type": ["object"],
  29288. "description": "Options for creating package archives for distribution.",
  29289. "properties": {
  29290. "exclude": {
  29291. "type": "array",
  29292. "description": "A list of patterns for paths to exclude or include if prefixed with an exclamation mark."
  29293. }
  29294. }
  29295. },
  29296. "repositories": {
  29297. "type": ["object", "array"],
  29298. "description": "A set of additional repositories where packages can be found.",
  29299. "additionalProperties": {
  29300. "oneOf": [
  29301. { "$ref": "#/definitions/repository" },
  29302. { "type": "boolean", "enum": [false] }
  29303. ]
  29304. },
  29305. "items": {
  29306. "oneOf": [
  29307. { "$ref": "#/definitions/repository" },
  29308. {
  29309. "type": "object",
  29310. "additionalProperties": { "type": "boolean", "enum": [false] },
  29311. "minProperties": 1,
  29312. "maxProperties": 1
  29313. }
  29314. ]
  29315. }
  29316. },
  29317. "minimum-stability": {
  29318. "type": ["string"],
  29319. "description": "The minimum stability the packages must have to be install-able. Possible values are: dev, alpha, beta, RC, stable.",
  29320. "pattern": "^dev|alpha|beta|rc|RC|stable$"
  29321. },
  29322. "prefer-stable": {
  29323. "type": ["boolean"],
  29324. "description": "If set to true, stable packages will be preferred to dev packages when possible, even if the minimum-stability allows unstable packages."
  29325. },
  29326. "bin": {
  29327. "type": ["string", "array"],
  29328. "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
  29329. "items": {
  29330. "type": "string"
  29331. }
  29332. },
  29333. "include-path": {
  29334. "type": ["array"],
  29335. "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.",
  29336. "items": {
  29337. "type": "string"
  29338. }
  29339. },
  29340. "scripts": {
  29341. "type": ["object"],
  29342. "description": "Script listeners that will be executed before/after some events.",
  29343. "properties": {
  29344. "pre-install-cmd": {
  29345. "type": ["array", "string"],
  29346. "description": "Occurs before the install command is executed, contains one or more Class::method callables or shell commands."
  29347. },
  29348. "post-install-cmd": {
  29349. "type": ["array", "string"],
  29350. "description": "Occurs after the install command is executed, contains one or more Class::method callables or shell commands."
  29351. },
  29352. "pre-update-cmd": {
  29353. "type": ["array", "string"],
  29354. "description": "Occurs before the update command is executed, contains one or more Class::method callables or shell commands."
  29355. },
  29356. "post-update-cmd": {
  29357. "type": ["array", "string"],
  29358. "description": "Occurs after the update command is executed, contains one or more Class::method callables or shell commands."
  29359. },
  29360. "pre-status-cmd": {
  29361. "type": ["array", "string"],
  29362. "description": "Occurs before the status command is executed, contains one or more Class::method callables or shell commands."
  29363. },
  29364. "post-status-cmd": {
  29365. "type": ["array", "string"],
  29366. "description": "Occurs after the status command is executed, contains one or more Class::method callables or shell commands."
  29367. },
  29368. "pre-package-install": {
  29369. "type": ["array", "string"],
  29370. "description": "Occurs before a package is installed, contains one or more Class::method callables or shell commands."
  29371. },
  29372. "post-package-install": {
  29373. "type": ["array", "string"],
  29374. "description": "Occurs after a package is installed, contains one or more Class::method callables or shell commands."
  29375. },
  29376. "pre-package-update": {
  29377. "type": ["array", "string"],
  29378. "description": "Occurs before a package is updated, contains one or more Class::method callables or shell commands."
  29379. },
  29380. "post-package-update": {
  29381. "type": ["array", "string"],
  29382. "description": "Occurs after a package is updated, contains one or more Class::method callables or shell commands."
  29383. },
  29384. "pre-package-uninstall": {
  29385. "type": ["array", "string"],
  29386. "description": "Occurs before a package has been uninstalled, contains one or more Class::method callables or shell commands."
  29387. },
  29388. "post-package-uninstall": {
  29389. "type": ["array", "string"],
  29390. "description": "Occurs after a package has been uninstalled, contains one or more Class::method callables or shell commands."
  29391. },
  29392. "pre-autoload-dump": {
  29393. "type": ["array", "string"],
  29394. "description": "Occurs before the autoloader is dumped, contains one or more Class::method callables or shell commands."
  29395. },
  29396. "post-autoload-dump": {
  29397. "type": ["array", "string"],
  29398. "description": "Occurs after the autoloader is dumped, contains one or more Class::method callables or shell commands."
  29399. },
  29400. "post-root-package-install": {
  29401. "type": ["array", "string"],
  29402. "description": "Occurs after the root-package is installed, contains one or more Class::method callables or shell commands."
  29403. },
  29404. "post-create-project-cmd": {
  29405. "type": ["array", "string"],
  29406. "description": "Occurs after the create-project command is executed, contains one or more Class::method callables or shell commands."
  29407. }
  29408. }
  29409. },
  29410. "scripts-descriptions": {
  29411. "type": ["object"],
  29412. "description": "Descriptions for custom commands, shown in console help.",
  29413. "additionalProperties": {
  29414. "type": "string"
  29415. }
  29416. },
  29417. "support": {
  29418. "type": "object",
  29419. "properties": {
  29420. "email": {
  29421. "type": "string",
  29422. "description": "Email address for support.",
  29423. "format": "email"
  29424. },
  29425. "issues": {
  29426. "type": "string",
  29427. "description": "URL to the issue tracker.",
  29428. "format": "uri"
  29429. },
  29430. "forum": {
  29431. "type": "string",
  29432. "description": "URL to the forum.",
  29433. "format": "uri"
  29434. },
  29435. "wiki": {
  29436. "type": "string",
  29437. "description": "URL to the wiki.",
  29438. "format": "uri"
  29439. },
  29440. "irc": {
  29441. "type": "string",
  29442. "description": "IRC channel for support, as irc://server/channel.",
  29443. "format": "uri"
  29444. },
  29445. "chat": {
  29446. "type": "string",
  29447. "description": "URL to the support chat.",
  29448. "format": "uri"
  29449. },
  29450. "source": {
  29451. "type": "string",
  29452. "description": "URL to browse or download the sources.",
  29453. "format": "uri"
  29454. },
  29455. "docs": {
  29456. "type": "string",
  29457. "description": "URL to the documentation.",
  29458. "format": "uri"
  29459. },
  29460. "rss": {
  29461. "type": "string",
  29462. "description": "URL to the RSS feed.",
  29463. "format": "uri"
  29464. }
  29465. }
  29466. },
  29467. "non-feature-branches": {
  29468. "type": ["array"],
  29469. "description": "A set of string or regex patterns for non-numeric branch names that will not be handled as feature branches.",
  29470. "items": {
  29471. "type": "string"
  29472. }
  29473. },
  29474. "abandoned": {
  29475. "type": ["boolean", "string"],
  29476. "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."
  29477. },
  29478. "_comment": {
  29479. "type": ["array", "string"],
  29480. "description": "A key to store comments in"
  29481. }
  29482. },
  29483. "definitions": {
  29484. "authors": {
  29485. "type": "array",
  29486. "description": "List of authors that contributed to the package. This is typically the main maintainers, not the full list.",
  29487. "items": {
  29488. "type": "object",
  29489. "additionalProperties": false,
  29490. "required": [ "name"],
  29491. "properties": {
  29492. "name": {
  29493. "type": "string",
  29494. "description": "Full name of the author."
  29495. },
  29496. "email": {
  29497. "type": "string",
  29498. "description": "Email address of the author.",
  29499. "format": "email"
  29500. },
  29501. "homepage": {
  29502. "type": "string",
  29503. "description": "Homepage URL for the author.",
  29504. "format": "uri"
  29505. },
  29506. "role": {
  29507. "type": "string",
  29508. "description": "Author's role in the project."
  29509. }
  29510. }
  29511. }
  29512. },
  29513. "autoload": {
  29514. "type": "object",
  29515. "description": "Description of how the package can be autoloaded.",
  29516. "properties": {
  29517. "psr-0": {
  29518. "type": "object",
  29519. "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.",
  29520. "additionalProperties": {
  29521. "type": ["string", "array"],
  29522. "items": {
  29523. "type": "string"
  29524. }
  29525. }
  29526. },
  29527. "psr-4": {
  29528. "type": "object",
  29529. "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.",
  29530. "additionalProperties": {
  29531. "type": ["string", "array"],
  29532. "items": {
  29533. "type": "string"
  29534. }
  29535. }
  29536. },
  29537. "classmap": {
  29538. "type": "array",
  29539. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  29540. },
  29541. "files": {
  29542. "type": "array",
  29543. "description": "This is an array of files that are always required on every request."
  29544. },
  29545. "exclude-from-classmap": {
  29546. "type": "array",
  29547. "description": "This is an array of patterns to exclude from autoload classmap generation. (e.g. \"exclude-from-classmap\": [\"/test/\", \"/tests/\", \"/Tests/\"]"
  29548. }
  29549. }
  29550. },
  29551. "repository": {
  29552. "type": "object",
  29553. "oneOf": [
  29554. { "$ref": "#/definitions/composer-repository" },
  29555. { "$ref": "#/definitions/vcs-repository" },
  29556. { "$ref": "#/definitions/path-repository" },
  29557. { "$ref": "#/definitions/artifact-repository" },
  29558. { "$ref": "#/definitions/pear-repository" },
  29559. { "$ref": "#/definitions/package-repository" }
  29560. ]
  29561. },
  29562. "composer-repository": {
  29563. "type": "object",
  29564. "required": ["type", "url"],
  29565. "properties": {
  29566. "type": { "type": "string", "enum": ["composer"] },
  29567. "url": { "type": "string" },
  29568. "options": {
  29569. "type": "object",
  29570. "additionalProperties": true
  29571. },
  29572. "allow_ssl_downgrade": { "type": "boolean" },
  29573. "force-lazy-providers": { "type": "boolean" }
  29574. }
  29575. },
  29576. "vcs-repository": {
  29577. "type": "object",
  29578. "required": ["type", "url"],
  29579. "properties": {
  29580. "type": { "type": "string", "enum": ["vcs", "github", "git", "gitlab", "git-bitbucket", "hg", "hg-bitbucket", "fossil", "perforce", "svn"] },
  29581. "url": { "type": "string" },
  29582. "no-api": { "type": "boolean" },
  29583. "secure-http": { "type": "boolean" },
  29584. "svn-cache-credentials": { "type": "boolean" },
  29585. "trunk-path": { "type": ["string", "boolean"] },
  29586. "branches-path": { "type": ["string", "boolean"] },
  29587. "tags-path": { "type": ["string", "boolean"] },
  29588. "package-path": { "type": "string" },
  29589. "depot": { "type": "string" },
  29590. "branch": { "type": "string" },
  29591. "unique_perforce_client_name": { "type": "string" },
  29592. "p4user": { "type": "string" },
  29593. "p4password": { "type": "string" }
  29594. }
  29595. },
  29596. "path-repository": {
  29597. "type": "object",
  29598. "required": ["type", "url"],
  29599. "properties": {
  29600. "type": { "type": "string", "enum": ["path"] },
  29601. "url": { "type": "string" },
  29602. "options": {
  29603. "type": "object",
  29604. "properties": {
  29605. "symlink": { "type": ["boolean", "null"] }
  29606. },
  29607. "additionalProperties": true
  29608. }
  29609. }
  29610. },
  29611. "artifact-repository": {
  29612. "type": "object",
  29613. "required": ["type", "url"],
  29614. "properties": {
  29615. "type": { "type": "string", "enum": ["artifact"] },
  29616. "url": { "type": "string" }
  29617. }
  29618. },
  29619. "pear-repository": {
  29620. "type": "object",
  29621. "required": ["type", "url"],
  29622. "properties": {
  29623. "type": { "type": "string", "enum": ["pear"] },
  29624. "url": { "type": "string" },
  29625. "vendor-alias": { "type": "string" }
  29626. }
  29627. },
  29628. "package-repository": {
  29629. "type": "object",
  29630. "required": ["type", "package"],
  29631. "properties": {
  29632. "type": { "type": "string", "enum": ["package"] },
  29633. "package": {
  29634. "oneOf": [
  29635. { "$ref": "#/definitions/inline-package" },
  29636. {
  29637. "type": "array",
  29638. "items": { "$ref": "#/definitions/inline-package" }
  29639. }
  29640. ]
  29641. }
  29642. }
  29643. },
  29644. "inline-package": {
  29645. "type": "object",
  29646. "required": ["name", "version"],
  29647. "properties": {
  29648. "name": {
  29649. "type": "string",
  29650. "description": "Package name, including 'vendor-name/' prefix."
  29651. },
  29652. "type": {
  29653. "type": "string"
  29654. },
  29655. "target-dir": {
  29656. "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.",
  29657. "type": "string"
  29658. },
  29659. "description": {
  29660. "type": "string"
  29661. },
  29662. "keywords": {
  29663. "type": "array",
  29664. "items": {
  29665. "type": "string"
  29666. }
  29667. },
  29668. "homepage": {
  29669. "type": "string",
  29670. "format": "uri"
  29671. },
  29672. "version": {
  29673. "type": "string"
  29674. },
  29675. "time": {
  29676. "type": "string"
  29677. },
  29678. "license": {
  29679. "type": [
  29680. "string",
  29681. "array"
  29682. ]
  29683. },
  29684. "authors": {
  29685. "$ref": "#/definitions/authors"
  29686. },
  29687. "require": {
  29688. "type": "object",
  29689. "additionalProperties": {
  29690. "type": "string"
  29691. }
  29692. },
  29693. "replace": {
  29694. "type": "object",
  29695. "additionalProperties": {
  29696. "type": "string"
  29697. }
  29698. },
  29699. "conflict": {
  29700. "type": "object",
  29701. "additionalProperties": {
  29702. "type": "string"
  29703. }
  29704. },
  29705. "provide": {
  29706. "type": "object",
  29707. "additionalProperties": {
  29708. "type": "string"
  29709. }
  29710. },
  29711. "require-dev": {
  29712. "type": "object",
  29713. "additionalProperties": {
  29714. "type": "string"
  29715. }
  29716. },
  29717. "suggest": {
  29718. "type": "object",
  29719. "additionalProperties": {
  29720. "type": "string"
  29721. }
  29722. },
  29723. "extra": {
  29724. "type": ["object", "array"],
  29725. "additionalProperties": true
  29726. },
  29727. "autoload": {
  29728. "$ref": "#/definitions/autoload"
  29729. },
  29730. "archive": {
  29731. "type": ["object"],
  29732. "properties": {
  29733. "exclude": {
  29734. "type": "array"
  29735. }
  29736. }
  29737. },
  29738. "bin": {
  29739. "type": ["string", "array"],
  29740. "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
  29741. "items": {
  29742. "type": "string"
  29743. }
  29744. },
  29745. "include-path": {
  29746. "type": ["array"],
  29747. "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.",
  29748. "items": {
  29749. "type": "string"
  29750. }
  29751. },
  29752. "source": {
  29753. "type": "object",
  29754. "required": ["type", "url", "reference"],
  29755. "properties": {
  29756. "type": {
  29757. "type": "string"
  29758. },
  29759. "url": {
  29760. "type": "string"
  29761. },
  29762. "reference": {
  29763. "type": "string"
  29764. },
  29765. "mirrors": {
  29766. "type": "array"
  29767. }
  29768. }
  29769. },
  29770. "dist": {
  29771. "type": "object",
  29772. "required": ["type", "url"],
  29773. "properties": {
  29774. "type": {
  29775. "type": "string"
  29776. },
  29777. "url": {
  29778. "type": "string"
  29779. },
  29780. "reference": {
  29781. "type": "string"
  29782. },
  29783. "shasum": {
  29784. "type": "string"
  29785. },
  29786. "mirrors": {
  29787. "type": "array"
  29788. }
  29789. }
  29790. }
  29791. },
  29792. "additionalProperties": true
  29793. }
  29794. }
  29795. }
  29796. {
  29797. "389-exception": [
  29798. "389 Directory Server Exception"
  29799. ],
  29800. "Autoconf-exception-2.0": [
  29801. "Autoconf exception 2.0"
  29802. ],
  29803. "Autoconf-exception-3.0": [
  29804. "Autoconf exception 3.0"
  29805. ],
  29806. "Bison-exception-2.2": [
  29807. "Bison exception 2.2"
  29808. ],
  29809. "Bootloader-exception": [
  29810. "Bootloader Distribution Exception"
  29811. ],
  29812. "Classpath-exception-2.0": [
  29813. "Classpath exception 2.0"
  29814. ],
  29815. "CLISP-exception-2.0": [
  29816. "CLISP exception 2.0"
  29817. ],
  29818. "DigiRule-FOSS-exception": [
  29819. "DigiRule FOSS License Exception"
  29820. ],
  29821. "eCos-exception-2.0": [
  29822. "eCos exception 2.0"
  29823. ],
  29824. "Fawkes-Runtime-exception": [
  29825. "Fawkes Runtime Exception"
  29826. ],
  29827. "FLTK-exception": [
  29828. "FLTK exception"
  29829. ],
  29830. "Font-exception-2.0": [
  29831. "Font exception 2.0"
  29832. ],
  29833. "freertos-exception-2.0": [
  29834. "FreeRTOS Exception 2.0"
  29835. ],
  29836. "GCC-exception-2.0": [
  29837. "GCC Runtime Library exception 2.0"
  29838. ],
  29839. "GCC-exception-3.1": [
  29840. "GCC Runtime Library exception 3.1"
  29841. ],
  29842. "gnu-javamail-exception": [
  29843. "GNU JavaMail exception"
  29844. ],
  29845. "GPL-CC-1.0": [
  29846. "GPL Cooperation Commitment 1.0"
  29847. ],
  29848. "i2p-gpl-java-exception": [
  29849. "i2p GPL+Java Exception"
  29850. ],
  29851. "Libtool-exception": [
  29852. "Libtool Exception"
  29853. ],
  29854. "Linux-syscall-note": [
  29855. "Linux Syscall Note"
  29856. ],
  29857. "LLVM-exception": [
  29858. "LLVM Exception"
  29859. ],
  29860. "LZMA-exception": [
  29861. "LZMA exception"
  29862. ],
  29863. "mif-exception": [
  29864. "Macros and Inline Functions Exception"
  29865. ],
  29866. "Nokia-Qt-exception-1.1": [
  29867. "Nokia Qt LGPL exception 1.1"
  29868. ],
  29869. "OCaml-LGPL-linking-exception": [
  29870. "OCaml LGPL Linking Exception"
  29871. ],
  29872. "OCCT-exception-1.0": [
  29873. "Open CASCADE Exception 1.0"
  29874. ],
  29875. "OpenJDK-assembly-exception-1.0": [
  29876. "OpenJDK Assembly exception 1.0"
  29877. ],
  29878. "openvpn-openssl-exception": [
  29879. "OpenVPN OpenSSL Exception"
  29880. ],
  29881. "PS-or-PDF-font-exception-20170817": [
  29882. "PS/PDF font exception (2017-08-17)"
  29883. ],
  29884. "Qt-GPL-exception-1.0": [
  29885. "Qt GPL exception 1.0"
  29886. ],
  29887. "Qt-LGPL-exception-1.1": [
  29888. "Qt LGPL exception 1.1"
  29889. ],
  29890. "Qwt-exception-1.0": [
  29891. "Qwt exception 1.0"
  29892. ],
  29893. "Swift-exception": [
  29894. "Swift Exception"
  29895. ],
  29896. "u-boot-exception-2.0": [
  29897. "U-Boot exception 2.0"
  29898. ],
  29899. "Universal-FOSS-exception-1.0": [
  29900. "Universal FOSS Exception, Version 1.0"
  29901. ],
  29902. "WxWindows-exception-3.1": [
  29903. "WxWindows Library Exception 3.1"
  29904. ]
  29905. }{
  29906. "0BSD": [
  29907. "BSD Zero Clause License",
  29908. true,
  29909. false
  29910. ],
  29911. "AAL": [
  29912. "Attribution Assurance License",
  29913. true,
  29914. false
  29915. ],
  29916. "Abstyles": [
  29917. "Abstyles License",
  29918. false,
  29919. false
  29920. ],
  29921. "Adobe-2006": [
  29922. "Adobe Systems Incorporated Source Code License Agreement",
  29923. false,
  29924. false
  29925. ],
  29926. "Adobe-Glyph": [
  29927. "Adobe Glyph List License",
  29928. false,
  29929. false
  29930. ],
  29931. "ADSL": [
  29932. "Amazon Digital Services License",
  29933. false,
  29934. false
  29935. ],
  29936. "AFL-1.1": [
  29937. "Academic Free License v1.1",
  29938. true,
  29939. false
  29940. ],
  29941. "AFL-1.2": [
  29942. "Academic Free License v1.2",
  29943. true,
  29944. false
  29945. ],
  29946. "AFL-2.0": [
  29947. "Academic Free License v2.0",
  29948. true,
  29949. false
  29950. ],
  29951. "AFL-2.1": [
  29952. "Academic Free License v2.1",
  29953. true,
  29954. false
  29955. ],
  29956. "AFL-3.0": [
  29957. "Academic Free License v3.0",
  29958. true,
  29959. false
  29960. ],
  29961. "Afmparse": [
  29962. "Afmparse License",
  29963. false,
  29964. false
  29965. ],
  29966. "AGPL-1.0": [
  29967. "Affero General Public License v1.0",
  29968. false,
  29969. true
  29970. ],
  29971. "AGPL-1.0-only": [
  29972. "Affero General Public License v1.0 only",
  29973. false,
  29974. false
  29975. ],
  29976. "AGPL-1.0-or-later": [
  29977. "Affero General Public License v1.0 or later",
  29978. false,
  29979. false
  29980. ],
  29981. "AGPL-3.0": [
  29982. "GNU Affero General Public License v3.0",
  29983. true,
  29984. true
  29985. ],
  29986. "AGPL-3.0-only": [
  29987. "GNU Affero General Public License v3.0 only",
  29988. true,
  29989. false
  29990. ],
  29991. "AGPL-3.0-or-later": [
  29992. "GNU Affero General Public License v3.0 or later",
  29993. true,
  29994. false
  29995. ],
  29996. "Aladdin": [
  29997. "Aladdin Free Public License",
  29998. false,
  29999. false
  30000. ],
  30001. "AMDPLPA": [
  30002. "AMD's plpa_map.c License",
  30003. false,
  30004. false
  30005. ],
  30006. "AML": [
  30007. "Apple MIT License",
  30008. false,
  30009. false
  30010. ],
  30011. "AMPAS": [
  30012. "Academy of Motion Picture Arts and Sciences BSD",
  30013. false,
  30014. false
  30015. ],
  30016. "ANTLR-PD": [
  30017. "ANTLR Software Rights Notice",
  30018. false,
  30019. false
  30020. ],
  30021. "Apache-1.0": [
  30022. "Apache License 1.0",
  30023. false,
  30024. false
  30025. ],
  30026. "Apache-1.1": [
  30027. "Apache License 1.1",
  30028. true,
  30029. false
  30030. ],
  30031. "Apache-2.0": [
  30032. "Apache License 2.0",
  30033. true,
  30034. false
  30035. ],
  30036. "APAFML": [
  30037. "Adobe Postscript AFM License",
  30038. false,
  30039. false
  30040. ],
  30041. "APL-1.0": [
  30042. "Adaptive Public License 1.0",
  30043. true,
  30044. false
  30045. ],
  30046. "APSL-1.0": [
  30047. "Apple Public Source License 1.0",
  30048. true,
  30049. false
  30050. ],
  30051. "APSL-1.1": [
  30052. "Apple Public Source License 1.1",
  30053. true,
  30054. false
  30055. ],
  30056. "APSL-1.2": [
  30057. "Apple Public Source License 1.2",
  30058. true,
  30059. false
  30060. ],
  30061. "APSL-2.0": [
  30062. "Apple Public Source License 2.0",
  30063. true,
  30064. false
  30065. ],
  30066. "Artistic-1.0": [
  30067. "Artistic License 1.0",
  30068. true,
  30069. false
  30070. ],
  30071. "Artistic-1.0-cl8": [
  30072. "Artistic License 1.0 w/clause 8",
  30073. true,
  30074. false
  30075. ],
  30076. "Artistic-1.0-Perl": [
  30077. "Artistic License 1.0 (Perl)",
  30078. true,
  30079. false
  30080. ],
  30081. "Artistic-2.0": [
  30082. "Artistic License 2.0",
  30083. true,
  30084. false
  30085. ],
  30086. "Bahyph": [
  30087. "Bahyph License",
  30088. false,
  30089. false
  30090. ],
  30091. "Barr": [
  30092. "Barr License",
  30093. false,
  30094. false
  30095. ],
  30096. "Beerware": [
  30097. "Beerware License",
  30098. false,
  30099. false
  30100. ],
  30101. "BitTorrent-1.0": [
  30102. "BitTorrent Open Source License v1.0",
  30103. false,
  30104. false
  30105. ],
  30106. "BitTorrent-1.1": [
  30107. "BitTorrent Open Source License v1.1",
  30108. false,
  30109. false
  30110. ],
  30111. "blessing": [
  30112. "SQLite Blessing",
  30113. false,
  30114. false
  30115. ],
  30116. "BlueOak-1.0.0": [
  30117. "Blue Oak Model License 1.0.0",
  30118. false,
  30119. false
  30120. ],
  30121. "Borceux": [
  30122. "Borceux license",
  30123. false,
  30124. false
  30125. ],
  30126. "BSD-1-Clause": [
  30127. "BSD 1-Clause License",
  30128. false,
  30129. false
  30130. ],
  30131. "BSD-2-Clause": [
  30132. "BSD 2-Clause \"Simplified\" License",
  30133. true,
  30134. false
  30135. ],
  30136. "BSD-2-Clause-FreeBSD": [
  30137. "BSD 2-Clause FreeBSD License",
  30138. false,
  30139. false
  30140. ],
  30141. "BSD-2-Clause-NetBSD": [
  30142. "BSD 2-Clause NetBSD License",
  30143. false,
  30144. false
  30145. ],
  30146. "BSD-2-Clause-Patent": [
  30147. "BSD-2-Clause Plus Patent License",
  30148. true,
  30149. false
  30150. ],
  30151. "BSD-3-Clause": [
  30152. "BSD 3-Clause \"New\" or \"Revised\" License",
  30153. true,
  30154. false
  30155. ],
  30156. "BSD-3-Clause-Attribution": [
  30157. "BSD with attribution",
  30158. false,
  30159. false
  30160. ],
  30161. "BSD-3-Clause-Clear": [
  30162. "BSD 3-Clause Clear License",
  30163. false,
  30164. false
  30165. ],
  30166. "BSD-3-Clause-LBNL": [
  30167. "Lawrence Berkeley National Labs BSD variant license",
  30168. true,
  30169. false
  30170. ],
  30171. "BSD-3-Clause-No-Nuclear-License": [
  30172. "BSD 3-Clause No Nuclear License",
  30173. false,
  30174. false
  30175. ],
  30176. "BSD-3-Clause-No-Nuclear-License-2014": [
  30177. "BSD 3-Clause No Nuclear License 2014",
  30178. false,
  30179. false
  30180. ],
  30181. "BSD-3-Clause-No-Nuclear-Warranty": [
  30182. "BSD 3-Clause No Nuclear Warranty",
  30183. false,
  30184. false
  30185. ],
  30186. "BSD-3-Clause-Open-MPI": [
  30187. "BSD 3-Clause Open MPI variant",
  30188. false,
  30189. false
  30190. ],
  30191. "BSD-4-Clause": [
  30192. "BSD 4-Clause \"Original\" or \"Old\" License",
  30193. false,
  30194. false
  30195. ],
  30196. "BSD-4-Clause-UC": [
  30197. "BSD-4-Clause (University of California-Specific)",
  30198. false,
  30199. false
  30200. ],
  30201. "BSD-Protection": [
  30202. "BSD Protection License",
  30203. false,
  30204. false
  30205. ],
  30206. "BSD-Source-Code": [
  30207. "BSD Source Code Attribution",
  30208. false,
  30209. false
  30210. ],
  30211. "BSL-1.0": [
  30212. "Boost Software License 1.0",
  30213. true,
  30214. false
  30215. ],
  30216. "bzip2-1.0.5": [
  30217. "bzip2 and libbzip2 License v1.0.5",
  30218. false,
  30219. false
  30220. ],
  30221. "bzip2-1.0.6": [
  30222. "bzip2 and libbzip2 License v1.0.6",
  30223. false,
  30224. false
  30225. ],
  30226. "Caldera": [
  30227. "Caldera License",
  30228. false,
  30229. false
  30230. ],
  30231. "CATOSL-1.1": [
  30232. "Computer Associates Trusted Open Source License 1.1",
  30233. true,
  30234. false
  30235. ],
  30236. "CC-BY-1.0": [
  30237. "Creative Commons Attribution 1.0 Generic",
  30238. false,
  30239. false
  30240. ],
  30241. "CC-BY-2.0": [
  30242. "Creative Commons Attribution 2.0 Generic",
  30243. false,
  30244. false
  30245. ],
  30246. "CC-BY-2.5": [
  30247. "Creative Commons Attribution 2.5 Generic",
  30248. false,
  30249. false
  30250. ],
  30251. "CC-BY-3.0": [
  30252. "Creative Commons Attribution 3.0 Unported",
  30253. false,
  30254. false
  30255. ],
  30256. "CC-BY-4.0": [
  30257. "Creative Commons Attribution 4.0 International",
  30258. false,
  30259. false
  30260. ],
  30261. "CC-BY-NC-1.0": [
  30262. "Creative Commons Attribution Non Commercial 1.0 Generic",
  30263. false,
  30264. false
  30265. ],
  30266. "CC-BY-NC-2.0": [
  30267. "Creative Commons Attribution Non Commercial 2.0 Generic",
  30268. false,
  30269. false
  30270. ],
  30271. "CC-BY-NC-2.5": [
  30272. "Creative Commons Attribution Non Commercial 2.5 Generic",
  30273. false,
  30274. false
  30275. ],
  30276. "CC-BY-NC-3.0": [
  30277. "Creative Commons Attribution Non Commercial 3.0 Unported",
  30278. false,
  30279. false
  30280. ],
  30281. "CC-BY-NC-4.0": [
  30282. "Creative Commons Attribution Non Commercial 4.0 International",
  30283. false,
  30284. false
  30285. ],
  30286. "CC-BY-NC-ND-1.0": [
  30287. "Creative Commons Attribution Non Commercial No Derivatives 1.0 Generic",
  30288. false,
  30289. false
  30290. ],
  30291. "CC-BY-NC-ND-2.0": [
  30292. "Creative Commons Attribution Non Commercial No Derivatives 2.0 Generic",
  30293. false,
  30294. false
  30295. ],
  30296. "CC-BY-NC-ND-2.5": [
  30297. "Creative Commons Attribution Non Commercial No Derivatives 2.5 Generic",
  30298. false,
  30299. false
  30300. ],
  30301. "CC-BY-NC-ND-3.0": [
  30302. "Creative Commons Attribution Non Commercial No Derivatives 3.0 Unported",
  30303. false,
  30304. false
  30305. ],
  30306. "CC-BY-NC-ND-4.0": [
  30307. "Creative Commons Attribution Non Commercial No Derivatives 4.0 International",
  30308. false,
  30309. false
  30310. ],
  30311. "CC-BY-NC-SA-1.0": [
  30312. "Creative Commons Attribution Non Commercial Share Alike 1.0 Generic",
  30313. false,
  30314. false
  30315. ],
  30316. "CC-BY-NC-SA-2.0": [
  30317. "Creative Commons Attribution Non Commercial Share Alike 2.0 Generic",
  30318. false,
  30319. false
  30320. ],
  30321. "CC-BY-NC-SA-2.5": [
  30322. "Creative Commons Attribution Non Commercial Share Alike 2.5 Generic",
  30323. false,
  30324. false
  30325. ],
  30326. "CC-BY-NC-SA-3.0": [
  30327. "Creative Commons Attribution Non Commercial Share Alike 3.0 Unported",
  30328. false,
  30329. false
  30330. ],
  30331. "CC-BY-NC-SA-4.0": [
  30332. "Creative Commons Attribution Non Commercial Share Alike 4.0 International",
  30333. false,
  30334. false
  30335. ],
  30336. "CC-BY-ND-1.0": [
  30337. "Creative Commons Attribution No Derivatives 1.0 Generic",
  30338. false,
  30339. false
  30340. ],
  30341. "CC-BY-ND-2.0": [
  30342. "Creative Commons Attribution No Derivatives 2.0 Generic",
  30343. false,
  30344. false
  30345. ],
  30346. "CC-BY-ND-2.5": [
  30347. "Creative Commons Attribution No Derivatives 2.5 Generic",
  30348. false,
  30349. false
  30350. ],
  30351. "CC-BY-ND-3.0": [
  30352. "Creative Commons Attribution No Derivatives 3.0 Unported",
  30353. false,
  30354. false
  30355. ],
  30356. "CC-BY-ND-4.0": [
  30357. "Creative Commons Attribution No Derivatives 4.0 International",
  30358. false,
  30359. false
  30360. ],
  30361. "CC-BY-SA-1.0": [
  30362. "Creative Commons Attribution Share Alike 1.0 Generic",
  30363. false,
  30364. false
  30365. ],
  30366. "CC-BY-SA-2.0": [
  30367. "Creative Commons Attribution Share Alike 2.0 Generic",
  30368. false,
  30369. false
  30370. ],
  30371. "CC-BY-SA-2.5": [
  30372. "Creative Commons Attribution Share Alike 2.5 Generic",
  30373. false,
  30374. false
  30375. ],
  30376. "CC-BY-SA-3.0": [
  30377. "Creative Commons Attribution Share Alike 3.0 Unported",
  30378. false,
  30379. false
  30380. ],
  30381. "CC-BY-SA-4.0": [
  30382. "Creative Commons Attribution Share Alike 4.0 International",
  30383. false,
  30384. false
  30385. ],
  30386. "CC-PDDC": [
  30387. "Creative Commons Public Domain Dedication and Certification",
  30388. false,
  30389. false
  30390. ],
  30391. "CC0-1.0": [
  30392. "Creative Commons Zero v1.0 Universal",
  30393. false,
  30394. false
  30395. ],
  30396. "CDDL-1.0": [
  30397. "Common Development and Distribution License 1.0",
  30398. true,
  30399. false
  30400. ],
  30401. "CDDL-1.1": [
  30402. "Common Development and Distribution License 1.1",
  30403. false,
  30404. false
  30405. ],
  30406. "CDLA-Permissive-1.0": [
  30407. "Community Data License Agreement Permissive 1.0",
  30408. false,
  30409. false
  30410. ],
  30411. "CDLA-Sharing-1.0": [
  30412. "Community Data License Agreement Sharing 1.0",
  30413. false,
  30414. false
  30415. ],
  30416. "CECILL-1.0": [
  30417. "CeCILL Free Software License Agreement v1.0",
  30418. false,
  30419. false
  30420. ],
  30421. "CECILL-1.1": [
  30422. "CeCILL Free Software License Agreement v1.1",
  30423. false,
  30424. false
  30425. ],
  30426. "CECILL-2.0": [
  30427. "CeCILL Free Software License Agreement v2.0",
  30428. false,
  30429. false
  30430. ],
  30431. "CECILL-2.1": [
  30432. "CeCILL Free Software License Agreement v2.1",
  30433. true,
  30434. false
  30435. ],
  30436. "CECILL-B": [
  30437. "CeCILL-B Free Software License Agreement",
  30438. false,
  30439. false
  30440. ],
  30441. "CECILL-C": [
  30442. "CeCILL-C Free Software License Agreement",
  30443. false,
  30444. false
  30445. ],
  30446. "CERN-OHL-1.1": [
  30447. "CERN Open Hardware License v1.1",
  30448. false,
  30449. false
  30450. ],
  30451. "CERN-OHL-1.2": [
  30452. "CERN Open Hardware Licence v1.2",
  30453. false,
  30454. false
  30455. ],
  30456. "ClArtistic": [
  30457. "Clarified Artistic License",
  30458. false,
  30459. false
  30460. ],
  30461. "CNRI-Jython": [
  30462. "CNRI Jython License",
  30463. false,
  30464. false
  30465. ],
  30466. "CNRI-Python": [
  30467. "CNRI Python License",
  30468. true,
  30469. false
  30470. ],
  30471. "CNRI-Python-GPL-Compatible": [
  30472. "CNRI Python Open Source GPL Compatible License Agreement",
  30473. false,
  30474. false
  30475. ],
  30476. "Condor-1.1": [
  30477. "Condor Public License v1.1",
  30478. false,
  30479. false
  30480. ],
  30481. "copyleft-next-0.3.0": [
  30482. "copyleft-next 0.3.0",
  30483. false,
  30484. false
  30485. ],
  30486. "copyleft-next-0.3.1": [
  30487. "copyleft-next 0.3.1",
  30488. false,
  30489. false
  30490. ],
  30491. "CPAL-1.0": [
  30492. "Common Public Attribution License 1.0",
  30493. true,
  30494. false
  30495. ],
  30496. "CPL-1.0": [
  30497. "Common Public License 1.0",
  30498. true,
  30499. false
  30500. ],
  30501. "CPOL-1.02": [
  30502. "Code Project Open License 1.02",
  30503. false,
  30504. false
  30505. ],
  30506. "Crossword": [
  30507. "Crossword License",
  30508. false,
  30509. false
  30510. ],
  30511. "CrystalStacker": [
  30512. "CrystalStacker License",
  30513. false,
  30514. false
  30515. ],
  30516. "CUA-OPL-1.0": [
  30517. "CUA Office Public License v1.0",
  30518. true,
  30519. false
  30520. ],
  30521. "Cube": [
  30522. "Cube License",
  30523. false,
  30524. false
  30525. ],
  30526. "curl": [
  30527. "curl License",
  30528. false,
  30529. false
  30530. ],
  30531. "D-FSL-1.0": [
  30532. "Deutsche Freie Software Lizenz",
  30533. false,
  30534. false
  30535. ],
  30536. "diffmark": [
  30537. "diffmark license",
  30538. false,
  30539. false
  30540. ],
  30541. "DOC": [
  30542. "DOC License",
  30543. false,
  30544. false
  30545. ],
  30546. "Dotseqn": [
  30547. "Dotseqn License",
  30548. false,
  30549. false
  30550. ],
  30551. "DSDP": [
  30552. "DSDP License",
  30553. false,
  30554. false
  30555. ],
  30556. "dvipdfm": [
  30557. "dvipdfm License",
  30558. false,
  30559. false
  30560. ],
  30561. "ECL-1.0": [
  30562. "Educational Community License v1.0",
  30563. true,
  30564. false
  30565. ],
  30566. "ECL-2.0": [
  30567. "Educational Community License v2.0",
  30568. true,
  30569. false
  30570. ],
  30571. "eCos-2.0": [
  30572. "eCos license version 2.0",
  30573. false,
  30574. true
  30575. ],
  30576. "EFL-1.0": [
  30577. "Eiffel Forum License v1.0",
  30578. true,
  30579. false
  30580. ],
  30581. "EFL-2.0": [
  30582. "Eiffel Forum License v2.0",
  30583. true,
  30584. false
  30585. ],
  30586. "eGenix": [
  30587. "eGenix.com Public License 1.1.0",
  30588. false,
  30589. false
  30590. ],
  30591. "Entessa": [
  30592. "Entessa Public License v1.0",
  30593. true,
  30594. false
  30595. ],
  30596. "EPL-1.0": [
  30597. "Eclipse Public License 1.0",
  30598. true,
  30599. false
  30600. ],
  30601. "EPL-2.0": [
  30602. "Eclipse Public License 2.0",
  30603. true,
  30604. false
  30605. ],
  30606. "ErlPL-1.1": [
  30607. "Erlang Public License v1.1",
  30608. false,
  30609. false
  30610. ],
  30611. "EUDatagrid": [
  30612. "EU DataGrid Software License",
  30613. true,
  30614. false
  30615. ],
  30616. "EUPL-1.0": [
  30617. "European Union Public License 1.0",
  30618. false,
  30619. false
  30620. ],
  30621. "EUPL-1.1": [
  30622. "European Union Public License 1.1",
  30623. true,
  30624. false
  30625. ],
  30626. "EUPL-1.2": [
  30627. "European Union Public License 1.2",
  30628. true,
  30629. false
  30630. ],
  30631. "Eurosym": [
  30632. "Eurosym License",
  30633. false,
  30634. false
  30635. ],
  30636. "Fair": [
  30637. "Fair License",
  30638. true,
  30639. false
  30640. ],
  30641. "Frameworx-1.0": [
  30642. "Frameworx Open License 1.0",
  30643. true,
  30644. false
  30645. ],
  30646. "FreeImage": [
  30647. "FreeImage Public License v1.0",
  30648. false,
  30649. false
  30650. ],
  30651. "FSFAP": [
  30652. "FSF All Permissive License",
  30653. false,
  30654. false
  30655. ],
  30656. "FSFUL": [
  30657. "FSF Unlimited License",
  30658. false,
  30659. false
  30660. ],
  30661. "FSFULLR": [
  30662. "FSF Unlimited License (with License Retention)",
  30663. false,
  30664. false
  30665. ],
  30666. "FTL": [
  30667. "Freetype Project License",
  30668. false,
  30669. false
  30670. ],
  30671. "GFDL-1.1": [
  30672. "GNU Free Documentation License v1.1",
  30673. false,
  30674. true
  30675. ],
  30676. "GFDL-1.1-only": [
  30677. "GNU Free Documentation License v1.1 only",
  30678. false,
  30679. false
  30680. ],
  30681. "GFDL-1.1-or-later": [
  30682. "GNU Free Documentation License v1.1 or later",
  30683. false,
  30684. false
  30685. ],
  30686. "GFDL-1.2": [
  30687. "GNU Free Documentation License v1.2",
  30688. false,
  30689. true
  30690. ],
  30691. "GFDL-1.2-only": [
  30692. "GNU Free Documentation License v1.2 only",
  30693. false,
  30694. false
  30695. ],
  30696. "GFDL-1.2-or-later": [
  30697. "GNU Free Documentation License v1.2 or later",
  30698. false,
  30699. false
  30700. ],
  30701. "GFDL-1.3": [
  30702. "GNU Free Documentation License v1.3",
  30703. false,
  30704. true
  30705. ],
  30706. "GFDL-1.3-only": [
  30707. "GNU Free Documentation License v1.3 only",
  30708. false,
  30709. false
  30710. ],
  30711. "GFDL-1.3-or-later": [
  30712. "GNU Free Documentation License v1.3 or later",
  30713. false,
  30714. false
  30715. ],
  30716. "Giftware": [
  30717. "Giftware License",
  30718. false,
  30719. false
  30720. ],
  30721. "GL2PS": [
  30722. "GL2PS License",
  30723. false,
  30724. false
  30725. ],
  30726. "Glide": [
  30727. "3dfx Glide License",
  30728. false,
  30729. false
  30730. ],
  30731. "Glulxe": [
  30732. "Glulxe License",
  30733. false,
  30734. false
  30735. ],
  30736. "gnuplot": [
  30737. "gnuplot License",
  30738. false,
  30739. false
  30740. ],
  30741. "GPL-1.0": [
  30742. "GNU General Public License v1.0 only",
  30743. false,
  30744. true
  30745. ],
  30746. "GPL-1.0+": [
  30747. "GNU General Public License v1.0 or later",
  30748. false,
  30749. true
  30750. ],
  30751. "GPL-1.0-only": [
  30752. "GNU General Public License v1.0 only",
  30753. false,
  30754. false
  30755. ],
  30756. "GPL-1.0-or-later": [
  30757. "GNU General Public License v1.0 or later",
  30758. false,
  30759. false
  30760. ],
  30761. "GPL-2.0": [
  30762. "GNU General Public License v2.0 only",
  30763. true,
  30764. true
  30765. ],
  30766. "GPL-2.0+": [
  30767. "GNU General Public License v2.0 or later",
  30768. true,
  30769. true
  30770. ],
  30771. "GPL-2.0-only": [
  30772. "GNU General Public License v2.0 only",
  30773. true,
  30774. false
  30775. ],
  30776. "GPL-2.0-or-later": [
  30777. "GNU General Public License v2.0 or later",
  30778. true,
  30779. false
  30780. ],
  30781. "GPL-2.0-with-autoconf-exception": [
  30782. "GNU General Public License v2.0 w/Autoconf exception",
  30783. false,
  30784. true
  30785. ],
  30786. "GPL-2.0-with-bison-exception": [
  30787. "GNU General Public License v2.0 w/Bison exception",
  30788. false,
  30789. true
  30790. ],
  30791. "GPL-2.0-with-classpath-exception": [
  30792. "GNU General Public License v2.0 w/Classpath exception",
  30793. false,
  30794. true
  30795. ],
  30796. "GPL-2.0-with-font-exception": [
  30797. "GNU General Public License v2.0 w/Font exception",
  30798. false,
  30799. true
  30800. ],
  30801. "GPL-2.0-with-GCC-exception": [
  30802. "GNU General Public License v2.0 w/GCC Runtime Library exception",
  30803. false,
  30804. true
  30805. ],
  30806. "GPL-3.0": [
  30807. "GNU General Public License v3.0 only",
  30808. true,
  30809. true
  30810. ],
  30811. "GPL-3.0+": [
  30812. "GNU General Public License v3.0 or later",
  30813. true,
  30814. true
  30815. ],
  30816. "GPL-3.0-only": [
  30817. "GNU General Public License v3.0 only",
  30818. true,
  30819. false
  30820. ],
  30821. "GPL-3.0-or-later": [
  30822. "GNU General Public License v3.0 or later",
  30823. true,
  30824. false
  30825. ],
  30826. "GPL-3.0-with-autoconf-exception": [
  30827. "GNU General Public License v3.0 w/Autoconf exception",
  30828. false,
  30829. true
  30830. ],
  30831. "GPL-3.0-with-GCC-exception": [
  30832. "GNU General Public License v3.0 w/GCC Runtime Library exception",
  30833. true,
  30834. true
  30835. ],
  30836. "gSOAP-1.3b": [
  30837. "gSOAP Public License v1.3b",
  30838. false,
  30839. false
  30840. ],
  30841. "HaskellReport": [
  30842. "Haskell Language Report License",
  30843. false,
  30844. false
  30845. ],
  30846. "HPND": [
  30847. "Historical Permission Notice and Disclaimer",
  30848. true,
  30849. false
  30850. ],
  30851. "HPND-sell-variant": [
  30852. "Historical Permission Notice and Disclaimer - sell variant",
  30853. false,
  30854. false
  30855. ],
  30856. "IBM-pibs": [
  30857. "IBM PowerPC Initialization and Boot Software",
  30858. false,
  30859. false
  30860. ],
  30861. "ICU": [
  30862. "ICU License",
  30863. false,
  30864. false
  30865. ],
  30866. "IJG": [
  30867. "Independent JPEG Group License",
  30868. false,
  30869. false
  30870. ],
  30871. "ImageMagick": [
  30872. "ImageMagick License",
  30873. false,
  30874. false
  30875. ],
  30876. "iMatix": [
  30877. "iMatix Standard Function Library Agreement",
  30878. false,
  30879. false
  30880. ],
  30881. "Imlib2": [
  30882. "Imlib2 License",
  30883. false,
  30884. false
  30885. ],
  30886. "Info-ZIP": [
  30887. "Info-ZIP License",
  30888. false,
  30889. false
  30890. ],
  30891. "Intel": [
  30892. "Intel Open Source License",
  30893. true,
  30894. false
  30895. ],
  30896. "Intel-ACPI": [
  30897. "Intel ACPI Software License Agreement",
  30898. false,
  30899. false
  30900. ],
  30901. "Interbase-1.0": [
  30902. "Interbase Public License v1.0",
  30903. false,
  30904. false
  30905. ],
  30906. "IPA": [
  30907. "IPA Font License",
  30908. true,
  30909. false
  30910. ],
  30911. "IPL-1.0": [
  30912. "IBM Public License v1.0",
  30913. true,
  30914. false
  30915. ],
  30916. "ISC": [
  30917. "ISC License",
  30918. true,
  30919. false
  30920. ],
  30921. "JasPer-2.0": [
  30922. "JasPer License",
  30923. false,
  30924. false
  30925. ],
  30926. "JPNIC": [
  30927. "Japan Network Information Center License",
  30928. false,
  30929. false
  30930. ],
  30931. "JSON": [
  30932. "JSON License",
  30933. false,
  30934. false
  30935. ],
  30936. "LAL-1.2": [
  30937. "Licence Art Libre 1.2",
  30938. false,
  30939. false
  30940. ],
  30941. "LAL-1.3": [
  30942. "Licence Art Libre 1.3",
  30943. false,
  30944. false
  30945. ],
  30946. "Latex2e": [
  30947. "Latex2e License",
  30948. false,
  30949. false
  30950. ],
  30951. "Leptonica": [
  30952. "Leptonica License",
  30953. false,
  30954. false
  30955. ],
  30956. "LGPL-2.0": [
  30957. "GNU Library General Public License v2 only",
  30958. true,
  30959. true
  30960. ],
  30961. "LGPL-2.0+": [
  30962. "GNU Library General Public License v2 or later",
  30963. true,
  30964. true
  30965. ],
  30966. "LGPL-2.0-only": [
  30967. "GNU Library General Public License v2 only",
  30968. true,
  30969. false
  30970. ],
  30971. "LGPL-2.0-or-later": [
  30972. "GNU Library General Public License v2 or later",
  30973. true,
  30974. false
  30975. ],
  30976. "LGPL-2.1": [
  30977. "GNU Lesser General Public License v2.1 only",
  30978. true,
  30979. true
  30980. ],
  30981. "LGPL-2.1+": [
  30982. "GNU Library General Public License v2.1 or later",
  30983. true,
  30984. true
  30985. ],
  30986. "LGPL-2.1-only": [
  30987. "GNU Lesser General Public License v2.1 only",
  30988. true,
  30989. false
  30990. ],
  30991. "LGPL-2.1-or-later": [
  30992. "GNU Lesser General Public License v2.1 or later",
  30993. true,
  30994. false
  30995. ],
  30996. "LGPL-3.0": [
  30997. "GNU Lesser General Public License v3.0 only",
  30998. true,
  30999. true
  31000. ],
  31001. "LGPL-3.0+": [
  31002. "GNU Lesser General Public License v3.0 or later",
  31003. true,
  31004. true
  31005. ],
  31006. "LGPL-3.0-only": [
  31007. "GNU Lesser General Public License v3.0 only",
  31008. true,
  31009. false
  31010. ],
  31011. "LGPL-3.0-or-later": [
  31012. "GNU Lesser General Public License v3.0 or later",
  31013. true,
  31014. false
  31015. ],
  31016. "LGPLLR": [
  31017. "Lesser General Public License For Linguistic Resources",
  31018. false,
  31019. false
  31020. ],
  31021. "Libpng": [
  31022. "libpng License",
  31023. false,
  31024. false
  31025. ],
  31026. "libpng-2.0": [
  31027. "PNG Reference Library version 2",
  31028. false,
  31029. false
  31030. ],
  31031. "libtiff": [
  31032. "libtiff License",
  31033. false,
  31034. false
  31035. ],
  31036. "LiLiQ-P-1.1": [
  31037. "Licence Libre du Qu\u00e9bec \u2013 Permissive version 1.1",
  31038. true,
  31039. false
  31040. ],
  31041. "LiLiQ-R-1.1": [
  31042. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 version 1.1",
  31043. true,
  31044. false
  31045. ],
  31046. "LiLiQ-Rplus-1.1": [
  31047. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 forte version 1.1",
  31048. true,
  31049. false
  31050. ],
  31051. "Linux-OpenIB": [
  31052. "Linux Kernel Variant of OpenIB.org license",
  31053. false,
  31054. false
  31055. ],
  31056. "LPL-1.0": [
  31057. "Lucent Public License Version 1.0",
  31058. true,
  31059. false
  31060. ],
  31061. "LPL-1.02": [
  31062. "Lucent Public License v1.02",
  31063. true,
  31064. false
  31065. ],
  31066. "LPPL-1.0": [
  31067. "LaTeX Project Public License v1.0",
  31068. false,
  31069. false
  31070. ],
  31071. "LPPL-1.1": [
  31072. "LaTeX Project Public License v1.1",
  31073. false,
  31074. false
  31075. ],
  31076. "LPPL-1.2": [
  31077. "LaTeX Project Public License v1.2",
  31078. false,
  31079. false
  31080. ],
  31081. "LPPL-1.3a": [
  31082. "LaTeX Project Public License v1.3a",
  31083. false,
  31084. false
  31085. ],
  31086. "LPPL-1.3c": [
  31087. "LaTeX Project Public License v1.3c",
  31088. true,
  31089. false
  31090. ],
  31091. "MakeIndex": [
  31092. "MakeIndex License",
  31093. false,
  31094. false
  31095. ],
  31096. "MirOS": [
  31097. "MirOS License",
  31098. true,
  31099. false
  31100. ],
  31101. "MIT": [
  31102. "MIT License",
  31103. true,
  31104. false
  31105. ],
  31106. "MIT-0": [
  31107. "MIT No Attribution",
  31108. true,
  31109. false
  31110. ],
  31111. "MIT-advertising": [
  31112. "Enlightenment License (e16)",
  31113. false,
  31114. false
  31115. ],
  31116. "MIT-CMU": [
  31117. "CMU License",
  31118. false,
  31119. false
  31120. ],
  31121. "MIT-enna": [
  31122. "enna License",
  31123. false,
  31124. false
  31125. ],
  31126. "MIT-feh": [
  31127. "feh License",
  31128. false,
  31129. false
  31130. ],
  31131. "MITNFA": [
  31132. "MIT +no-false-attribs license",
  31133. false,
  31134. false
  31135. ],
  31136. "Motosoto": [
  31137. "Motosoto License",
  31138. true,
  31139. false
  31140. ],
  31141. "mpich2": [
  31142. "mpich2 License",
  31143. false,
  31144. false
  31145. ],
  31146. "MPL-1.0": [
  31147. "Mozilla Public License 1.0",
  31148. true,
  31149. false
  31150. ],
  31151. "MPL-1.1": [
  31152. "Mozilla Public License 1.1",
  31153. true,
  31154. false
  31155. ],
  31156. "MPL-2.0": [
  31157. "Mozilla Public License 2.0",
  31158. true,
  31159. false
  31160. ],
  31161. "MPL-2.0-no-copyleft-exception": [
  31162. "Mozilla Public License 2.0 (no copyleft exception)",
  31163. true,
  31164. false
  31165. ],
  31166. "MS-PL": [
  31167. "Microsoft Public License",
  31168. true,
  31169. false
  31170. ],
  31171. "MS-RL": [
  31172. "Microsoft Reciprocal License",
  31173. true,
  31174. false
  31175. ],
  31176. "MTLL": [
  31177. "Matrix Template Library License",
  31178. false,
  31179. false
  31180. ],
  31181. "Multics": [
  31182. "Multics License",
  31183. true,
  31184. false
  31185. ],
  31186. "Mup": [
  31187. "Mup License",
  31188. false,
  31189. false
  31190. ],
  31191. "NASA-1.3": [
  31192. "NASA Open Source Agreement 1.3",
  31193. true,
  31194. false
  31195. ],
  31196. "Naumen": [
  31197. "Naumen Public License",
  31198. true,
  31199. false
  31200. ],
  31201. "NBPL-1.0": [
  31202. "Net Boolean Public License v1",
  31203. false,
  31204. false
  31205. ],
  31206. "NCSA": [
  31207. "University of Illinois/NCSA Open Source License",
  31208. true,
  31209. false
  31210. ],
  31211. "Net-SNMP": [
  31212. "Net-SNMP License",
  31213. false,
  31214. false
  31215. ],
  31216. "NetCDF": [
  31217. "NetCDF license",
  31218. false,
  31219. false
  31220. ],
  31221. "Newsletr": [
  31222. "Newsletr License",
  31223. false,
  31224. false
  31225. ],
  31226. "NGPL": [
  31227. "Nethack General Public License",
  31228. true,
  31229. false
  31230. ],
  31231. "NLOD-1.0": [
  31232. "Norwegian Licence for Open Government Data",
  31233. false,
  31234. false
  31235. ],
  31236. "NLPL": [
  31237. "No Limit Public License",
  31238. false,
  31239. false
  31240. ],
  31241. "Nokia": [
  31242. "Nokia Open Source License",
  31243. true,
  31244. false
  31245. ],
  31246. "NOSL": [
  31247. "Netizen Open Source License",
  31248. false,
  31249. false
  31250. ],
  31251. "Noweb": [
  31252. "Noweb License",
  31253. false,
  31254. false
  31255. ],
  31256. "NPL-1.0": [
  31257. "Netscape Public License v1.0",
  31258. false,
  31259. false
  31260. ],
  31261. "NPL-1.1": [
  31262. "Netscape Public License v1.1",
  31263. false,
  31264. false
  31265. ],
  31266. "NPOSL-3.0": [
  31267. "Non-Profit Open Software License 3.0",
  31268. true,
  31269. false
  31270. ],
  31271. "NRL": [
  31272. "NRL License",
  31273. false,
  31274. false
  31275. ],
  31276. "NTP": [
  31277. "NTP License",
  31278. true,
  31279. false
  31280. ],
  31281. "Nunit": [
  31282. "Nunit License",
  31283. false,
  31284. true
  31285. ],
  31286. "OCCT-PL": [
  31287. "Open CASCADE Technology Public License",
  31288. false,
  31289. false
  31290. ],
  31291. "OCLC-2.0": [
  31292. "OCLC Research Public License 2.0",
  31293. true,
  31294. false
  31295. ],
  31296. "ODbL-1.0": [
  31297. "ODC Open Database License v1.0",
  31298. false,
  31299. false
  31300. ],
  31301. "ODC-By-1.0": [
  31302. "Open Data Commons Attribution License v1.0",
  31303. false,
  31304. false
  31305. ],
  31306. "OFL-1.0": [
  31307. "SIL Open Font License 1.0",
  31308. false,
  31309. false
  31310. ],
  31311. "OFL-1.1": [
  31312. "SIL Open Font License 1.1",
  31313. true,
  31314. false
  31315. ],
  31316. "OGL-UK-1.0": [
  31317. "Open Government Licence v1.0",
  31318. false,
  31319. false
  31320. ],
  31321. "OGL-UK-2.0": [
  31322. "Open Government Licence v2.0",
  31323. false,
  31324. false
  31325. ],
  31326. "OGL-UK-3.0": [
  31327. "Open Government Licence v3.0",
  31328. false,
  31329. false
  31330. ],
  31331. "OGTSL": [
  31332. "Open Group Test Suite License",
  31333. true,
  31334. false
  31335. ],
  31336. "OLDAP-1.1": [
  31337. "Open LDAP Public License v1.1",
  31338. false,
  31339. false
  31340. ],
  31341. "OLDAP-1.2": [
  31342. "Open LDAP Public License v1.2",
  31343. false,
  31344. false
  31345. ],
  31346. "OLDAP-1.3": [
  31347. "Open LDAP Public License v1.3",
  31348. false,
  31349. false
  31350. ],
  31351. "OLDAP-1.4": [
  31352. "Open LDAP Public License v1.4",
  31353. false,
  31354. false
  31355. ],
  31356. "OLDAP-2.0": [
  31357. "Open LDAP Public License v2.0 (or possibly 2.0A and 2.0B)",
  31358. false,
  31359. false
  31360. ],
  31361. "OLDAP-2.0.1": [
  31362. "Open LDAP Public License v2.0.1",
  31363. false,
  31364. false
  31365. ],
  31366. "OLDAP-2.1": [
  31367. "Open LDAP Public License v2.1",
  31368. false,
  31369. false
  31370. ],
  31371. "OLDAP-2.2": [
  31372. "Open LDAP Public License v2.2",
  31373. false,
  31374. false
  31375. ],
  31376. "OLDAP-2.2.1": [
  31377. "Open LDAP Public License v2.2.1",
  31378. false,
  31379. false
  31380. ],
  31381. "OLDAP-2.2.2": [
  31382. "Open LDAP Public License 2.2.2",
  31383. false,
  31384. false
  31385. ],
  31386. "OLDAP-2.3": [
  31387. "Open LDAP Public License v2.3",
  31388. false,
  31389. false
  31390. ],
  31391. "OLDAP-2.4": [
  31392. "Open LDAP Public License v2.4",
  31393. false,
  31394. false
  31395. ],
  31396. "OLDAP-2.5": [
  31397. "Open LDAP Public License v2.5",
  31398. false,
  31399. false
  31400. ],
  31401. "OLDAP-2.6": [
  31402. "Open LDAP Public License v2.6",
  31403. false,
  31404. false
  31405. ],
  31406. "OLDAP-2.7": [
  31407. "Open LDAP Public License v2.7",
  31408. false,
  31409. false
  31410. ],
  31411. "OLDAP-2.8": [
  31412. "Open LDAP Public License v2.8",
  31413. false,
  31414. false
  31415. ],
  31416. "OML": [
  31417. "Open Market License",
  31418. false,
  31419. false
  31420. ],
  31421. "OpenSSL": [
  31422. "OpenSSL License",
  31423. false,
  31424. false
  31425. ],
  31426. "OPL-1.0": [
  31427. "Open Public License v1.0",
  31428. false,
  31429. false
  31430. ],
  31431. "OSET-PL-2.1": [
  31432. "OSET Public License version 2.1",
  31433. true,
  31434. false
  31435. ],
  31436. "OSL-1.0": [
  31437. "Open Software License 1.0",
  31438. true,
  31439. false
  31440. ],
  31441. "OSL-1.1": [
  31442. "Open Software License 1.1",
  31443. false,
  31444. false
  31445. ],
  31446. "OSL-2.0": [
  31447. "Open Software License 2.0",
  31448. true,
  31449. false
  31450. ],
  31451. "OSL-2.1": [
  31452. "Open Software License 2.1",
  31453. true,
  31454. false
  31455. ],
  31456. "OSL-3.0": [
  31457. "Open Software License 3.0",
  31458. true,
  31459. false
  31460. ],
  31461. "Parity-6.0.0": [
  31462. "The Parity Public License 6.0.0",
  31463. false,
  31464. false
  31465. ],
  31466. "PDDL-1.0": [
  31467. "ODC Public Domain Dedication & License 1.0",
  31468. false,
  31469. false
  31470. ],
  31471. "PHP-3.0": [
  31472. "PHP License v3.0",
  31473. true,
  31474. false
  31475. ],
  31476. "PHP-3.01": [
  31477. "PHP License v3.01",
  31478. false,
  31479. false
  31480. ],
  31481. "Plexus": [
  31482. "Plexus Classworlds License",
  31483. false,
  31484. false
  31485. ],
  31486. "PostgreSQL": [
  31487. "PostgreSQL License",
  31488. true,
  31489. false
  31490. ],
  31491. "psfrag": [
  31492. "psfrag License",
  31493. false,
  31494. false
  31495. ],
  31496. "psutils": [
  31497. "psutils License",
  31498. false,
  31499. false
  31500. ],
  31501. "Python-2.0": [
  31502. "Python License 2.0",
  31503. true,
  31504. false
  31505. ],
  31506. "Qhull": [
  31507. "Qhull License",
  31508. false,
  31509. false
  31510. ],
  31511. "QPL-1.0": [
  31512. "Q Public License 1.0",
  31513. true,
  31514. false
  31515. ],
  31516. "Rdisc": [
  31517. "Rdisc License",
  31518. false,
  31519. false
  31520. ],
  31521. "RHeCos-1.1": [
  31522. "Red Hat eCos Public License v1.1",
  31523. false,
  31524. false
  31525. ],
  31526. "RPL-1.1": [
  31527. "Reciprocal Public License 1.1",
  31528. true,
  31529. false
  31530. ],
  31531. "RPL-1.5": [
  31532. "Reciprocal Public License 1.5",
  31533. true,
  31534. false
  31535. ],
  31536. "RPSL-1.0": [
  31537. "RealNetworks Public Source License v1.0",
  31538. true,
  31539. false
  31540. ],
  31541. "RSA-MD": [
  31542. "RSA Message-Digest License",
  31543. false,
  31544. false
  31545. ],
  31546. "RSCPL": [
  31547. "Ricoh Source Code Public License",
  31548. true,
  31549. false
  31550. ],
  31551. "Ruby": [
  31552. "Ruby License",
  31553. false,
  31554. false
  31555. ],
  31556. "SAX-PD": [
  31557. "Sax Public Domain Notice",
  31558. false,
  31559. false
  31560. ],
  31561. "Saxpath": [
  31562. "Saxpath License",
  31563. false,
  31564. false
  31565. ],
  31566. "SCEA": [
  31567. "SCEA Shared Source License",
  31568. false,
  31569. false
  31570. ],
  31571. "Sendmail": [
  31572. "Sendmail License",
  31573. false,
  31574. false
  31575. ],
  31576. "Sendmail-8.23": [
  31577. "Sendmail License 8.23",
  31578. false,
  31579. false
  31580. ],
  31581. "SGI-B-1.0": [
  31582. "SGI Free Software License B v1.0",
  31583. false,
  31584. false
  31585. ],
  31586. "SGI-B-1.1": [
  31587. "SGI Free Software License B v1.1",
  31588. false,
  31589. false
  31590. ],
  31591. "SGI-B-2.0": [
  31592. "SGI Free Software License B v2.0",
  31593. false,
  31594. false
  31595. ],
  31596. "SHL-0.5": [
  31597. "Solderpad Hardware License v0.5",
  31598. false,
  31599. false
  31600. ],
  31601. "SHL-0.51": [
  31602. "Solderpad Hardware License, Version 0.51",
  31603. false,
  31604. false
  31605. ],
  31606. "SimPL-2.0": [
  31607. "Simple Public License 2.0",
  31608. true,
  31609. false
  31610. ],
  31611. "SISSL": [
  31612. "Sun Industry Standards Source License v1.1",
  31613. true,
  31614. false
  31615. ],
  31616. "SISSL-1.2": [
  31617. "Sun Industry Standards Source License v1.2",
  31618. false,
  31619. false
  31620. ],
  31621. "Sleepycat": [
  31622. "Sleepycat License",
  31623. true,
  31624. false
  31625. ],
  31626. "SMLNJ": [
  31627. "Standard ML of New Jersey License",
  31628. false,
  31629. false
  31630. ],
  31631. "SMPPL": [
  31632. "Secure Messaging Protocol Public License",
  31633. false,
  31634. false
  31635. ],
  31636. "SNIA": [
  31637. "SNIA Public License 1.1",
  31638. false,
  31639. false
  31640. ],
  31641. "Spencer-86": [
  31642. "Spencer License 86",
  31643. false,
  31644. false
  31645. ],
  31646. "Spencer-94": [
  31647. "Spencer License 94",
  31648. false,
  31649. false
  31650. ],
  31651. "Spencer-99": [
  31652. "Spencer License 99",
  31653. false,
  31654. false
  31655. ],
  31656. "SPL-1.0": [
  31657. "Sun Public License v1.0",
  31658. true,
  31659. false
  31660. ],
  31661. "SSPL-1.0": [
  31662. "Server Side Public License, v 1",
  31663. false,
  31664. false
  31665. ],
  31666. "StandardML-NJ": [
  31667. "Standard ML of New Jersey License",
  31668. false,
  31669. true
  31670. ],
  31671. "SugarCRM-1.1.3": [
  31672. "SugarCRM Public License v1.1.3",
  31673. false,
  31674. false
  31675. ],
  31676. "SWL": [
  31677. "Scheme Widget Library (SWL) Software License Agreement",
  31678. false,
  31679. false
  31680. ],
  31681. "TAPR-OHL-1.0": [
  31682. "TAPR Open Hardware License v1.0",
  31683. false,
  31684. false
  31685. ],
  31686. "TCL": [
  31687. "TCL/TK License",
  31688. false,
  31689. false
  31690. ],
  31691. "TCP-wrappers": [
  31692. "TCP Wrappers License",
  31693. false,
  31694. false
  31695. ],
  31696. "TMate": [
  31697. "TMate Open Source License",
  31698. false,
  31699. false
  31700. ],
  31701. "TORQUE-1.1": [
  31702. "TORQUE v2.5+ Software License v1.1",
  31703. false,
  31704. false
  31705. ],
  31706. "TOSL": [
  31707. "Trusster Open Source License",
  31708. false,
  31709. false
  31710. ],
  31711. "TU-Berlin-1.0": [
  31712. "Technische Universitaet Berlin License 1.0",
  31713. false,
  31714. false
  31715. ],
  31716. "TU-Berlin-2.0": [
  31717. "Technische Universitaet Berlin License 2.0",
  31718. false,
  31719. false
  31720. ],
  31721. "Unicode-DFS-2015": [
  31722. "Unicode License Agreement - Data Files and Software (2015)",
  31723. false,
  31724. false
  31725. ],
  31726. "Unicode-DFS-2016": [
  31727. "Unicode License Agreement - Data Files and Software (2016)",
  31728. false,
  31729. false
  31730. ],
  31731. "Unicode-TOU": [
  31732. "Unicode Terms of Use",
  31733. false,
  31734. false
  31735. ],
  31736. "Unlicense": [
  31737. "The Unlicense",
  31738. false,
  31739. false
  31740. ],
  31741. "UPL-1.0": [
  31742. "Universal Permissive License v1.0",
  31743. true,
  31744. false
  31745. ],
  31746. "Vim": [
  31747. "Vim License",
  31748. false,
  31749. false
  31750. ],
  31751. "VOSTROM": [
  31752. "VOSTROM Public License for Open Source",
  31753. false,
  31754. false
  31755. ],
  31756. "VSL-1.0": [
  31757. "Vovida Software License v1.0",
  31758. true,
  31759. false
  31760. ],
  31761. "W3C": [
  31762. "W3C Software Notice and License (2002-12-31)",
  31763. true,
  31764. false
  31765. ],
  31766. "W3C-19980720": [
  31767. "W3C Software Notice and License (1998-07-20)",
  31768. false,
  31769. false
  31770. ],
  31771. "W3C-20150513": [
  31772. "W3C Software Notice and Document License (2015-05-13)",
  31773. false,
  31774. false
  31775. ],
  31776. "Watcom-1.0": [
  31777. "Sybase Open Watcom Public License 1.0",
  31778. true,
  31779. false
  31780. ],
  31781. "Wsuipa": [
  31782. "Wsuipa License",
  31783. false,
  31784. false
  31785. ],
  31786. "WTFPL": [
  31787. "Do What The F*ck You Want To Public License",
  31788. false,
  31789. false
  31790. ],
  31791. "wxWindows": [
  31792. "wxWindows Library License",
  31793. false,
  31794. true
  31795. ],
  31796. "X11": [
  31797. "X11 License",
  31798. false,
  31799. false
  31800. ],
  31801. "Xerox": [
  31802. "Xerox License",
  31803. false,
  31804. false
  31805. ],
  31806. "XFree86-1.1": [
  31807. "XFree86 License 1.1",
  31808. false,
  31809. false
  31810. ],
  31811. "xinetd": [
  31812. "xinetd License",
  31813. false,
  31814. false
  31815. ],
  31816. "Xnet": [
  31817. "X.Net License",
  31818. true,
  31819. false
  31820. ],
  31821. "xpp": [
  31822. "XPP License",
  31823. false,
  31824. false
  31825. ],
  31826. "XSkat": [
  31827. "XSkat License",
  31828. false,
  31829. false
  31830. ],
  31831. "YPL-1.0": [
  31832. "Yahoo! Public License v1.0",
  31833. false,
  31834. false
  31835. ],
  31836. "YPL-1.1": [
  31837. "Yahoo! Public License v1.1",
  31838. false,
  31839. false
  31840. ],
  31841. "Zed": [
  31842. "Zed License",
  31843. false,
  31844. false
  31845. ],
  31846. "Zend-2.0": [
  31847. "Zend License v2.0",
  31848. false,
  31849. false
  31850. ],
  31851. "Zimbra-1.3": [
  31852. "Zimbra Public License v1.3",
  31853. false,
  31854. false
  31855. ],
  31856. "Zimbra-1.4": [
  31857. "Zimbra Public License v1.4",
  31858. false,
  31859. false
  31860. ],
  31861. "Zlib": [
  31862. "zlib License",
  31863. true,
  31864. false
  31865. ],
  31866. "zlib-acknowledgement": [
  31867. "zlib/libpng License with Acknowledgement",
  31868. false,
  31869. false
  31870. ],
  31871. "ZPL-1.1": [
  31872. "Zope Public License 1.1",
  31873. false,
  31874. false
  31875. ],
  31876. "ZPL-2.0": [
  31877. "Zope Public License 2.0",
  31878. true,
  31879. false
  31880. ],
  31881. "ZPL-2.1": [
  31882. "Zope Public License 2.1",
  31883. false,
  31884. false
  31885. ]
  31886. }MZ��������ÿÿ��¸�������@�����������������������������������è���º�´ Í!¸LÍ!This program cannot be run in DOS mode.
  31887. $�������Æ,Í;§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ž��������PE��L�¬MoO��������à�  ��
  31888. ���������8������ ����@����������������������`�����?œ���@�����������������������������"��P����@�� �������������������P��p���!�����������������������������8!��@������������ ��Ø���������������������������.text��� ������
  31889. ����������������� ��`.rdata����� ���
  31890. �����������������@��@.data�������0��������������������@��À.rsrc��� ���@��������������������@��@.reloc��Ì���P������"��������������@��B��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������j$¸æ@�èx��jöÿ @�ƒ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
  31891. jè\��Yë;¡|3@�…Àu,‰5|3@�hð @�hä @�è§��YY…ÀtÇEüþÿÿÿ¸ÿ���éÝ���‰5<0@�¡|3@�;Æuhà @�hØ @�èl��YYÇ|3@����9]äuSWÿ8 @�9Œ3@�thŒ3@�èƒ��Y…Àt
  31892. 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@�èû��øMZ��f9��@�t3ÀëM¡<�@��€��@��8PE��ué·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¸MZ��f9t3À]ËA<Á�8PE��uï3Ò¹ ��f9H”‹Â]ÃÌÌÌÌÌÌÌÌÌÌÌ‹ÿU‹ì‹E‹H<È·ASV·q3ÒW�D…öv‹} ‹H ;ùr ‹XÙ;ûr
  31893. 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‡@�h�0@�èç���ƒÄ]ËÿVh���h���3ö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‹ÆÁà ð‰5�0@�÷Ö‰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@�Š@���������������������¬MoO�������l���€!��€��@0@�˜0@�bad allocation������H������������������������������������������������������������0@�ð!@����RSDSÑŒ³´�J¨!öÌëLZ����c:\users\seld\documents\visual studio 2010\Projects\hiddeninp\Release\hiddeninp.pdb�����e��æ������������������þÿÿÿ����Ðÿÿÿ����þÿÿÿ@�@�����þÿÿÿ����Ìÿÿÿ����þÿÿÿ����:@�����þÿÿÿ����Øÿÿÿ����þÿÿÿË@�ß@�ÿÿÿÿÝ@�"“���d"@������������������������à"����������ì#��� ��$#����������ô&��D ��H#����������(��h ����������������������¸#��Ê#��Ü#��ˆ)��r)��b)��H)��4)��)��ú(��æ(��Ò(��´(��¬(��–(��ž)������ú#��à$��%��Ê%��&��d&��®&��¤$������('��Ä'��Ö'��è'��þ'��(��((��6(��¦'��H(��Z(��t(��†(��'��'���'��–'��‚'��l'��^'��R'��F'��>'��>(��0'��¶'��¸)������•GetConsoleMode��·SetConsoleMode��;GetStdHandle��KERNEL32.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@A��J?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@@Z��MSVCP90.dll�_amsg_exit��Ÿ�__getmainargs�,_cexit��|_exit�f�_XcptFilter�Ìexit�� �__initenv�_initterm�_initterm_e�<_configthreadlocale�ã�__setusermatherr�� _adjust_fdiv��Ë�__p__commode��Ï�__p__fmode��j_encode_pointer�à�__set_app_type��K_crt_debugger_hook��C�?terminate@@YAXXZ�MSVCR90.dll�æ_unlock�–�__dllonexit�v_lock�_onexit�`_decode_pointer�s_except_handler4_common� _invoke_watson��?_controlfp_s��½InterlockedExchange�!Sleep�ºInterlockedCompareExchange��-TerminateProcess��©GetCurrentProcess�>UnhandledExceptionFilter��SetUnhandledExceptionFilter�ÑIsDebuggerPresent�TQueryPerformanceCounter�fGetTickCount��­GetCurrentThreadId��ªGetCurrentProcessId�OGetSystemTimeAsFileTime�s�__CxxFrameHandler3����������������������������������������������������Næ@»±¿Dÿÿÿÿÿÿÿÿþÿÿÿ���$!@���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� ��€���8��€�����������������P��€�����������������h��€�������������� ��€����������������� ������ @��(��ä������ÈC��V��ä������(4���V�S�_�V�E�R�S�I�O�N�_�I�N�F�O�����½ïþ������������������������������������������†���S�t�r�i�n�g�F�i�l�e�I�n�f�o���b���0�4�0�9�0�4�b�0���Ê�Q��F�i�l�e�D�e�s�c�r�i�p�t�i�o�n�����R�e�a�d�s� �f�r�o�m� �s�t�d�i�n� �w�i�t�h�o�u�t� �l�e�a�k�i�n�g� �i�n�f�o� �t�o� �t�h�e� �t�e�r�m�i�n�a�l� �a�n�d� �o�u�t�p�u�t�s� �b�a�c�k� �t�o� �s�t�d�o�u�t�����6� ��F�i�l�e�V�e�r�s�i�o�n�����1�,� �0�,� �0�,� �0�����8� ��I�n�t�e�r�n�a�l�N�a�m�e���h�i�d�d�e�n�i�n�p�u�t���P���L�e�g�a�l�C�o�p�y�r�i�g�h�t���J�o�r�d�i� �B�o�g�g�i�a�n�o� �-� �2�0�1�2���H���O�r�i�g�i�n�a�l�F�i�l�e�n�a�m�e���h�i�d�d�e�n�i�n�p�u�t�.�e�x�e���:� ��P�r�o�d�u�c�t�N�a�m�e�����H�i�d�d�e�n� �I�n�p�u�t�����:� ��P�r�o�d�u�c�t�V�e�r�s�i�o�n���1�,� �0�,� �0�,� �0�����D����V�a�r�F�i�l�e�I�n�f�o�����$����T�r�a�n�s�l�a�t�i�o�n����� °<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  31894. <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
  31895. <security>
  31896. <requestedPrivileges>
  31897. <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
  31898. </requestedPrivileges>
  31899. </security>
  31900. </trustInfo>
  31901. <dependency>
  31902. <dependentAssembly>
  31903. <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
  31904. </dependentAssembly>
  31905. </dependency>
  31906. </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—6�77 7*7w7|7Á7ä7ñ7ý78 88=8E8P8V8\8b8h8n8t8z8€8œ8â89��� ��$���Ü0è0ì01 1t1x12 2@2\2`2h2t2�0�� ���0��������������������������������������������������������������������������������������������������������������������������������������������������<?php
  31907. namespace Symfony\Component\Console;
  31908. use Symfony\Component\Console\Command\Command;
  31909. use Symfony\Component\Console\Command\HelpCommand;
  31910. use Symfony\Component\Console\Command\ListCommand;
  31911. use Symfony\Component\Console\Descriptor\TextDescriptor;
  31912. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  31913. use Symfony\Component\Console\Event\ConsoleCommandEvent;
  31914. use Symfony\Component\Console\Event\ConsoleExceptionEvent;
  31915. use Symfony\Component\Console\Event\ConsoleTerminateEvent;
  31916. use Symfony\Component\Console\Exception\CommandNotFoundException;
  31917. use Symfony\Component\Console\Exception\ExceptionInterface;
  31918. use Symfony\Component\Console\Exception\LogicException;
  31919. use Symfony\Component\Console\Formatter\OutputFormatter;
  31920. use Symfony\Component\Console\Helper\DebugFormatterHelper;
  31921. use Symfony\Component\Console\Helper\DialogHelper;
  31922. use Symfony\Component\Console\Helper\FormatterHelper;
  31923. use Symfony\Component\Console\Helper\Helper;
  31924. use Symfony\Component\Console\Helper\HelperSet;
  31925. use Symfony\Component\Console\Helper\ProcessHelper;
  31926. use Symfony\Component\Console\Helper\ProgressHelper;
  31927. use Symfony\Component\Console\Helper\QuestionHelper;
  31928. use Symfony\Component\Console\Helper\TableHelper;
  31929. use Symfony\Component\Console\Input\ArgvInput;
  31930. use Symfony\Component\Console\Input\ArrayInput;
  31931. use Symfony\Component\Console\Input\InputArgument;
  31932. use Symfony\Component\Console\Input\InputAwareInterface;
  31933. use Symfony\Component\Console\Input\InputDefinition;
  31934. use Symfony\Component\Console\Input\InputInterface;
  31935. use Symfony\Component\Console\Input\InputOption;
  31936. use Symfony\Component\Console\Output\BufferedOutput;
  31937. use Symfony\Component\Console\Output\ConsoleOutput;
  31938. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  31939. use Symfony\Component\Console\Output\OutputInterface;
  31940. use Symfony\Component\Debug\Exception\FatalThrowableError;
  31941. use Symfony\Component\EventDispatcher\EventDispatcherInterface;
  31942. class Application
  31943. {
  31944. private $commands = array();
  31945. private $wantHelps = false;
  31946. private $runningCommand;
  31947. private $name;
  31948. private $version;
  31949. private $catchExceptions = true;
  31950. private $autoExit = true;
  31951. private $definition;
  31952. private $helperSet;
  31953. private $dispatcher;
  31954. private $terminalDimensions;
  31955. private $defaultCommand;
  31956. private $initialized;
  31957. public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
  31958. {
  31959. $this->name = $name;
  31960. $this->version = $version;
  31961. $this->defaultCommand = 'list';
  31962. }
  31963. public function setDispatcher(EventDispatcherInterface $dispatcher)
  31964. {
  31965. $this->dispatcher = $dispatcher;
  31966. }
  31967. public function run(InputInterface $input = null, OutputInterface $output = null)
  31968. {
  31969. if (null === $input) {
  31970. $input = new ArgvInput();
  31971. }
  31972. if (null === $output) {
  31973. $output = new ConsoleOutput();
  31974. }
  31975. $this->configureIO($input, $output);
  31976. try {
  31977. $e = null;
  31978. $exitCode = $this->doRun($input, $output);
  31979. } catch (\Exception $e) {
  31980. }
  31981. if (null !== $e) {
  31982. if (!$this->catchExceptions) {
  31983. throw $e;
  31984. }
  31985. if ($output instanceof ConsoleOutputInterface) {
  31986. $this->renderException($e, $output->getErrorOutput());
  31987. } else {
  31988. $this->renderException($e, $output);
  31989. }
  31990. $exitCode = $this->getExitCodeForThrowable($e);
  31991. }
  31992. if ($this->autoExit) {
  31993. if ($exitCode > 255) {
  31994. $exitCode = 255;
  31995. }
  31996. exit($exitCode);
  31997. }
  31998. return $exitCode;
  31999. }
  32000. public function doRun(InputInterface $input, OutputInterface $output)
  32001. {
  32002. if (true === $input->hasParameterOption(array('--version', '-V'))) {
  32003. $output->writeln($this->getLongVersion());
  32004. return 0;
  32005. }
  32006. $name = $this->getCommandName($input);
  32007. if (true === $input->hasParameterOption(array('--help', '-h'))) {
  32008. if (!$name) {
  32009. $name = 'help';
  32010. $input = new ArrayInput(array('command' => 'help'));
  32011. } else {
  32012. $this->wantHelps = true;
  32013. }
  32014. }
  32015. if (!$name) {
  32016. $name = $this->defaultCommand;
  32017. $definition = $this->getDefinition();
  32018. $definition->setArguments(array_merge(
  32019. $definition->getArguments(),
  32020. array(
  32021. 'command' => new InputArgument('command', InputArgument::OPTIONAL, $definition->getArgument('command')->getDescription(), $name),
  32022. )
  32023. ));
  32024. }
  32025. $this->runningCommand = null;
  32026. $command = $this->find($name);
  32027. $this->runningCommand = $command;
  32028. $exitCode = $this->doRunCommand($command, $input, $output);
  32029. $this->runningCommand = null;
  32030. return $exitCode;
  32031. }
  32032. public function setHelperSet(HelperSet $helperSet)
  32033. {
  32034. $this->helperSet = $helperSet;
  32035. }
  32036. public function getHelperSet()
  32037. {
  32038. if (!$this->helperSet) {
  32039. $this->helperSet = $this->getDefaultHelperSet();
  32040. }
  32041. return $this->helperSet;
  32042. }
  32043. public function setDefinition(InputDefinition $definition)
  32044. {
  32045. $this->definition = $definition;
  32046. }
  32047. public function getDefinition()
  32048. {
  32049. if (!$this->definition) {
  32050. $this->definition = $this->getDefaultInputDefinition();
  32051. }
  32052. return $this->definition;
  32053. }
  32054. public function getHelp()
  32055. {
  32056. return $this->getLongVersion();
  32057. }
  32058. public function setCatchExceptions($boolean)
  32059. {
  32060. $this->catchExceptions = (bool) $boolean;
  32061. }
  32062. public function setAutoExit($boolean)
  32063. {
  32064. $this->autoExit = (bool) $boolean;
  32065. }
  32066. public function getName()
  32067. {
  32068. return $this->name;
  32069. }
  32070. public function setName($name)
  32071. {
  32072. $this->name = $name;
  32073. }
  32074. public function getVersion()
  32075. {
  32076. return $this->version;
  32077. }
  32078. public function setVersion($version)
  32079. {
  32080. $this->version = $version;
  32081. }
  32082. public function getLongVersion()
  32083. {
  32084. if ('UNKNOWN' !== $this->getName()) {
  32085. if ('UNKNOWN' !== $this->getVersion()) {
  32086. return sprintf('<info>%s</info> version <comment>%s</comment>', $this->getName(), $this->getVersion());
  32087. }
  32088. return sprintf('<info>%s</info>', $this->getName());
  32089. }
  32090. return '<info>Console Tool</info>';
  32091. }
  32092. public function register($name)
  32093. {
  32094. return $this->add(new Command($name));
  32095. }
  32096. public function addCommands(array $commands)
  32097. {
  32098. foreach ($commands as $command) {
  32099. $this->add($command);
  32100. }
  32101. }
  32102. public function add(Command $command)
  32103. {
  32104. $this->init();
  32105. $command->setApplication($this);
  32106. if (!$command->isEnabled()) {
  32107. $command->setApplication(null);
  32108. return;
  32109. }
  32110. if (null === $command->getDefinition()) {
  32111. throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', \get_class($command)));
  32112. }
  32113. $this->commands[$command->getName()] = $command;
  32114. foreach ($command->getAliases() as $alias) {
  32115. $this->commands[$alias] = $command;
  32116. }
  32117. return $command;
  32118. }
  32119. public function get($name)
  32120. {
  32121. $this->init();
  32122. if (!isset($this->commands[$name])) {
  32123. throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
  32124. }
  32125. $command = $this->commands[$name];
  32126. if ($this->wantHelps) {
  32127. $this->wantHelps = false;
  32128. $helpCommand = $this->get('help');
  32129. $helpCommand->setCommand($command);
  32130. return $helpCommand;
  32131. }
  32132. return $command;
  32133. }
  32134. public function has($name)
  32135. {
  32136. $this->init();
  32137. return isset($this->commands[$name]);
  32138. }
  32139. public function getNamespaces()
  32140. {
  32141. $namespaces = array();
  32142. foreach ($this->all() as $command) {
  32143. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName()));
  32144. foreach ($command->getAliases() as $alias) {
  32145. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($alias));
  32146. }
  32147. }
  32148. return array_values(array_unique(array_filter($namespaces)));
  32149. }
  32150. public function findNamespace($namespace)
  32151. {
  32152. $allNamespaces = $this->getNamespaces();
  32153. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $namespace);
  32154. $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces);
  32155. if (empty($namespaces)) {
  32156. $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);
  32157. if ($alternatives = $this->findAlternatives($namespace, $allNamespaces)) {
  32158. if (1 == \count($alternatives)) {
  32159. $message .= "\n\nDid you mean this?\n ";
  32160. } else {
  32161. $message .= "\n\nDid you mean one of these?\n ";
  32162. }
  32163. $message .= implode("\n ", $alternatives);
  32164. }
  32165. throw new CommandNotFoundException($message, $alternatives);
  32166. }
  32167. $exact = \in_array($namespace, $namespaces, true);
  32168. if (\count($namespaces) > 1 && !$exact) {
  32169. throw new CommandNotFoundException(sprintf('The namespace "%s" is ambiguous (%s).', $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces));
  32170. }
  32171. return $exact ? $namespace : reset($namespaces);
  32172. }
  32173. public function find($name)
  32174. {
  32175. $this->init();
  32176. $aliases = array();
  32177. $allCommands = array_keys($this->commands);
  32178. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $name);
  32179. $commands = preg_grep('{^'.$expr.'}', $allCommands);
  32180. if (empty($commands) || \count(preg_grep('{^'.$expr.'$}', $commands)) < 1) {
  32181. if (false !== $pos = strrpos($name, ':')) {
  32182. $this->findNamespace(substr($name, 0, $pos));
  32183. }
  32184. $message = sprintf('Command "%s" is not defined.', $name);
  32185. if ($alternatives = $this->findAlternatives($name, $allCommands)) {
  32186. if (1 == \count($alternatives)) {
  32187. $message .= "\n\nDid you mean this?\n ";
  32188. } else {
  32189. $message .= "\n\nDid you mean one of these?\n ";
  32190. }
  32191. $message .= implode("\n ", $alternatives);
  32192. }
  32193. throw new CommandNotFoundException($message, $alternatives);
  32194. }
  32195. if (\count($commands) > 1) {
  32196. $commandList = $this->commands;
  32197. $commands = array_filter($commands, function ($nameOrAlias) use ($commandList, $commands, &$aliases) {
  32198. $commandName = $commandList[$nameOrAlias]->getName();
  32199. $aliases[$nameOrAlias] = $commandName;
  32200. return $commandName === $nameOrAlias || !\in_array($commandName, $commands);
  32201. });
  32202. }
  32203. $exact = \in_array($name, $commands, true) || isset($aliases[$name]);
  32204. if (!$exact && \count($commands) > 1) {
  32205. $suggestions = $this->getAbbreviationSuggestions(array_values($commands));
  32206. throw new CommandNotFoundException(sprintf('Command "%s" is ambiguous (%s).', $name, $suggestions), array_values($commands));
  32207. }
  32208. return $this->get($exact ? $name : reset($commands));
  32209. }
  32210. public function all($namespace = null)
  32211. {
  32212. $this->init();
  32213. if (null === $namespace) {
  32214. return $this->commands;
  32215. }
  32216. $commands = array();
  32217. foreach ($this->commands as $name => $command) {
  32218. if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1)) {
  32219. $commands[$name] = $command;
  32220. }
  32221. }
  32222. return $commands;
  32223. }
  32224. public static function getAbbreviations($names)
  32225. {
  32226. $abbrevs = array();
  32227. foreach ($names as $name) {
  32228. for ($len = \strlen($name); $len > 0; --$len) {
  32229. $abbrev = substr($name, 0, $len);
  32230. $abbrevs[$abbrev][] = $name;
  32231. }
  32232. }
  32233. return $abbrevs;
  32234. }
  32235. public function asText($namespace = null, $raw = false)
  32236. {
  32237. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  32238. $descriptor = new TextDescriptor();
  32239. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, !$raw);
  32240. $descriptor->describe($output, $this, array('namespace' => $namespace, 'raw_output' => true));
  32241. return $output->fetch();
  32242. }
  32243. public function asXml($namespace = null, $asDom = false)
  32244. {
  32245. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  32246. $descriptor = new XmlDescriptor();
  32247. if ($asDom) {
  32248. return $descriptor->getApplicationDocument($this, $namespace);
  32249. }
  32250. $output = new BufferedOutput();
  32251. $descriptor->describe($output, $this, array('namespace' => $namespace));
  32252. return $output->fetch();
  32253. }
  32254. public function renderException($e, $output)
  32255. {
  32256. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  32257. do {
  32258. $title = sprintf(' [%s] ', \get_class($e));
  32259. $len = Helper::strlen($title);
  32260. $width = $this->getTerminalWidth() ? $this->getTerminalWidth() - 1 : PHP_INT_MAX;
  32261. if (\defined('HHVM_VERSION') && $width > 1 << 31) {
  32262. $width = 1 << 31;
  32263. }
  32264. $lines = array();
  32265. foreach (preg_split('/\r?\n/', trim($e->getMessage())) as $line) {
  32266. foreach ($this->splitStringByWidth($line, $width - 4) as $line) {
  32267. $lineLength = Helper::strlen($line) + 4;
  32268. $lines[] = array($line, $lineLength);
  32269. $len = max($lineLength, $len);
  32270. }
  32271. }
  32272. $messages = array();
  32273. $messages[] = $emptyLine = sprintf('<error>%s</error>', str_repeat(' ', $len));
  32274. $messages[] = sprintf('<error>%s%s</error>', $title, str_repeat(' ', max(0, $len - Helper::strlen($title))));
  32275. foreach ($lines as $line) {
  32276. $messages[] = sprintf('<error> %s %s</error>', OutputFormatter::escape($line[0]), str_repeat(' ', $len - $line[1]));
  32277. }
  32278. $messages[] = $emptyLine;
  32279. $messages[] = '';
  32280. $output->writeln($messages, OutputInterface::VERBOSITY_QUIET);
  32281. if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
  32282. $output->writeln('<comment>Exception trace:</comment>', OutputInterface::VERBOSITY_QUIET);
  32283. $trace = $e->getTrace();
  32284. array_unshift($trace, array(
  32285. 'function' => '',
  32286. 'file' => null !== $e->getFile() ? $e->getFile() : 'n/a',
  32287. 'line' => null !== $e->getLine() ? $e->getLine() : 'n/a',
  32288. 'args' => array(),
  32289. ));
  32290. for ($i = 0, $count = \count($trace); $i < $count; ++$i) {
  32291. $class = isset($trace[$i]['class']) ? $trace[$i]['class'] : '';
  32292. $type = isset($trace[$i]['type']) ? $trace[$i]['type'] : '';
  32293. $function = $trace[$i]['function'];
  32294. $file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a';
  32295. $line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a';
  32296. $output->writeln(sprintf(' %s%s%s() at <info>%s:%s</info>', $class, $type, $function, $file, $line), OutputInterface::VERBOSITY_QUIET);
  32297. }
  32298. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  32299. }
  32300. } while ($e = $e->getPrevious());
  32301. if (null !== $this->runningCommand) {
  32302. $output->writeln(sprintf('<info>%s</info>', sprintf($this->runningCommand->getSynopsis(), $this->getName())), OutputInterface::VERBOSITY_QUIET);
  32303. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  32304. }
  32305. }
  32306. protected function getTerminalWidth()
  32307. {
  32308. $dimensions = $this->getTerminalDimensions();
  32309. return $dimensions[0];
  32310. }
  32311. protected function getTerminalHeight()
  32312. {
  32313. $dimensions = $this->getTerminalDimensions();
  32314. return $dimensions[1];
  32315. }
  32316. public function getTerminalDimensions()
  32317. {
  32318. if ($this->terminalDimensions) {
  32319. return $this->terminalDimensions;
  32320. }
  32321. if ('\\' === \DIRECTORY_SEPARATOR) {
  32322. if (preg_match('/^(\d+)x\d+ \(\d+x(\d+)\)$/', trim(getenv('ANSICON')), $matches)) {
  32323. return array((int) $matches[1], (int) $matches[2]);
  32324. }
  32325. if (preg_match('/^(\d+)x(\d+)$/', $this->getConsoleMode(), $matches)) {
  32326. return array((int) $matches[1], (int) $matches[2]);
  32327. }
  32328. }
  32329. if ($sttyString = $this->getSttyColumns()) {
  32330. if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) {
  32331. return array((int) $matches[2], (int) $matches[1]);
  32332. }
  32333. if (preg_match('/;.(\d+).rows;.(\d+).columns/i', $sttyString, $matches)) {
  32334. return array((int) $matches[2], (int) $matches[1]);
  32335. }
  32336. }
  32337. return array(null, null);
  32338. }
  32339. public function setTerminalDimensions($width, $height)
  32340. {
  32341. $this->terminalDimensions = array($width, $height);
  32342. return $this;
  32343. }
  32344. protected function configureIO(InputInterface $input, OutputInterface $output)
  32345. {
  32346. if (true === $input->hasParameterOption(array('--ansi'))) {
  32347. $output->setDecorated(true);
  32348. } elseif (true === $input->hasParameterOption(array('--no-ansi'))) {
  32349. $output->setDecorated(false);
  32350. }
  32351. if (true === $input->hasParameterOption(array('--no-interaction', '-n'))) {
  32352. $input->setInteractive(false);
  32353. } elseif (\function_exists('posix_isatty') && $this->getHelperSet()->has('question')) {
  32354. $inputStream = $this->getHelperSet()->get('question')->getInputStream();
  32355. if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) {
  32356. $input->setInteractive(false);
  32357. }
  32358. }
  32359. if (true === $input->hasParameterOption(array('--quiet', '-q'))) {
  32360. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  32361. $input->setInteractive(false);
  32362. } else {
  32363. if ($input->hasParameterOption('-vvv') || $input->hasParameterOption('--verbose=3') || 3 === $input->getParameterOption('--verbose')) {
  32364. $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
  32365. } elseif ($input->hasParameterOption('-vv') || $input->hasParameterOption('--verbose=2') || 2 === $input->getParameterOption('--verbose')) {
  32366. $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
  32367. } elseif ($input->hasParameterOption('-v') || $input->hasParameterOption('--verbose=1') || $input->hasParameterOption('--verbose') || $input->getParameterOption('--verbose')) {
  32368. $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
  32369. }
  32370. }
  32371. }
  32372. protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
  32373. {
  32374. foreach ($command->getHelperSet() as $helper) {
  32375. if ($helper instanceof InputAwareInterface) {
  32376. $helper->setInput($input);
  32377. }
  32378. }
  32379. if (null === $this->dispatcher) {
  32380. return $command->run($input, $output);
  32381. }
  32382. try {
  32383. $command->mergeApplicationDefinition();
  32384. $input->bind($command->getDefinition());
  32385. } catch (ExceptionInterface $e) {
  32386. }
  32387. $event = new ConsoleCommandEvent($command, $input, $output);
  32388. $e = null;
  32389. try {
  32390. $this->dispatcher->dispatch(ConsoleEvents::COMMAND, $event);
  32391. if ($event->commandShouldRun()) {
  32392. $exitCode = $command->run($input, $output);
  32393. } else {
  32394. $exitCode = ConsoleCommandEvent::RETURN_CODE_DISABLED;
  32395. }
  32396. } catch (\Exception $e) {
  32397. } catch (\Throwable $e) {
  32398. }
  32399. if (null !== $e) {
  32400. $x = $e instanceof \Exception ? $e : new FatalThrowableError($e);
  32401. $event = new ConsoleExceptionEvent($command, $input, $output, $x, $x->getCode());
  32402. $this->dispatcher->dispatch(ConsoleEvents::EXCEPTION, $event);
  32403. if ($x !== $event->getException()) {
  32404. $e = $event->getException();
  32405. }
  32406. $exitCode = $this->getExitCodeForThrowable($e);
  32407. }
  32408. $event = new ConsoleTerminateEvent($command, $input, $output, $exitCode);
  32409. $this->dispatcher->dispatch(ConsoleEvents::TERMINATE, $event);
  32410. if (null !== $e) {
  32411. throw $e;
  32412. }
  32413. return $event->getExitCode();
  32414. }
  32415. protected function getCommandName(InputInterface $input)
  32416. {
  32417. return $input->getFirstArgument();
  32418. }
  32419. protected function getDefaultInputDefinition()
  32420. {
  32421. return new InputDefinition(array(
  32422. new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),
  32423. new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message'),
  32424. new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'),
  32425. 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'),
  32426. new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version'),
  32427. new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output'),
  32428. new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output'),
  32429. new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'),
  32430. ));
  32431. }
  32432. protected function getDefaultCommands()
  32433. {
  32434. return array(new HelpCommand(), new ListCommand());
  32435. }
  32436. protected function getDefaultHelperSet()
  32437. {
  32438. return new HelperSet(array(
  32439. new FormatterHelper(),
  32440. new DialogHelper(false),
  32441. new ProgressHelper(false),
  32442. new TableHelper(false),
  32443. new DebugFormatterHelper(),
  32444. new ProcessHelper(),
  32445. new QuestionHelper(),
  32446. ));
  32447. }
  32448. private function getSttyColumns()
  32449. {
  32450. if (!\function_exists('proc_open')) {
  32451. return;
  32452. }
  32453. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  32454. $process = proc_open('stty -a | grep columns', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  32455. if (\is_resource($process)) {
  32456. $info = stream_get_contents($pipes[1]);
  32457. fclose($pipes[1]);
  32458. fclose($pipes[2]);
  32459. proc_close($process);
  32460. return $info;
  32461. }
  32462. }
  32463. private function getConsoleMode()
  32464. {
  32465. if (!\function_exists('proc_open')) {
  32466. return;
  32467. }
  32468. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  32469. $process = proc_open('mode CON', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  32470. if (\is_resource($process)) {
  32471. $info = stream_get_contents($pipes[1]);
  32472. fclose($pipes[1]);
  32473. fclose($pipes[2]);
  32474. proc_close($process);
  32475. if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
  32476. return $matches[2].'x'.$matches[1];
  32477. }
  32478. }
  32479. }
  32480. private function getAbbreviationSuggestions($abbrevs)
  32481. {
  32482. return sprintf('%s, %s%s', $abbrevs[0], $abbrevs[1], \count($abbrevs) > 2 ? sprintf(' and %d more', \count($abbrevs) - 2) : '');
  32483. }
  32484. public function extractNamespace($name, $limit = null)
  32485. {
  32486. $parts = explode(':', $name);
  32487. array_pop($parts);
  32488. return implode(':', null === $limit ? $parts : \array_slice($parts, 0, $limit));
  32489. }
  32490. private function findAlternatives($name, $collection)
  32491. {
  32492. $threshold = 1e3;
  32493. $alternatives = array();
  32494. $collectionParts = array();
  32495. foreach ($collection as $item) {
  32496. $collectionParts[$item] = explode(':', $item);
  32497. }
  32498. foreach (explode(':', $name) as $i => $subname) {
  32499. foreach ($collectionParts as $collectionName => $parts) {
  32500. $exists = isset($alternatives[$collectionName]);
  32501. if (!isset($parts[$i]) && $exists) {
  32502. $alternatives[$collectionName] += $threshold;
  32503. continue;
  32504. } elseif (!isset($parts[$i])) {
  32505. continue;
  32506. }
  32507. $lev = levenshtein($subname, $parts[$i]);
  32508. if ($lev <= \strlen($subname) / 3 || '' !== $subname && false !== strpos($parts[$i], $subname)) {
  32509. $alternatives[$collectionName] = $exists ? $alternatives[$collectionName] + $lev : $lev;
  32510. } elseif ($exists) {
  32511. $alternatives[$collectionName] += $threshold;
  32512. }
  32513. }
  32514. }
  32515. foreach ($collection as $item) {
  32516. $lev = levenshtein($name, $item);
  32517. if ($lev <= \strlen($name) / 3 || false !== strpos($item, $name)) {
  32518. $alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev;
  32519. }
  32520. }
  32521. $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; });
  32522. asort($alternatives);
  32523. return array_keys($alternatives);
  32524. }
  32525. public function setDefaultCommand($commandName)
  32526. {
  32527. $this->defaultCommand = $commandName;
  32528. }
  32529. private function splitStringByWidth($string, $width)
  32530. {
  32531. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  32532. return str_split($string, $width);
  32533. }
  32534. $utf8String = mb_convert_encoding($string, 'utf8', $encoding);
  32535. $lines = array();
  32536. $line = '';
  32537. foreach (preg_split('//u', $utf8String) as $char) {
  32538. if (mb_strwidth($line.$char, 'utf8') <= $width) {
  32539. $line .= $char;
  32540. continue;
  32541. }
  32542. $lines[] = str_pad($line, $width);
  32543. $line = $char;
  32544. }
  32545. $lines[] = \count($lines) ? str_pad($line, $width) : $line;
  32546. mb_convert_variables($encoding, 'utf8', $lines);
  32547. return $lines;
  32548. }
  32549. private function extractAllNamespaces($name)
  32550. {
  32551. $parts = explode(':', $name, -1);
  32552. $namespaces = array();
  32553. foreach ($parts as $part) {
  32554. if (\count($namespaces)) {
  32555. $namespaces[] = end($namespaces).':'.$part;
  32556. } else {
  32557. $namespaces[] = $part;
  32558. }
  32559. }
  32560. return $namespaces;
  32561. }
  32562. private function init()
  32563. {
  32564. if ($this->initialized) {
  32565. return;
  32566. }
  32567. $this->initialized = true;
  32568. foreach ($this->getDefaultCommands() as $command) {
  32569. $this->add($command);
  32570. }
  32571. }
  32572. private function getExitCodeForThrowable($throwable)
  32573. {
  32574. $exitCode = $throwable->getCode();
  32575. if (is_numeric($exitCode)) {
  32576. $exitCode = (int) $exitCode;
  32577. if (0 === $exitCode) {
  32578. $exitCode = 1;
  32579. }
  32580. } else {
  32581. $exitCode = 1;
  32582. }
  32583. return $exitCode;
  32584. }
  32585. }
  32586. <?php
  32587. namespace Symfony\Component\Console\Command;
  32588. use Symfony\Component\Console\Application;
  32589. use Symfony\Component\Console\Descriptor\TextDescriptor;
  32590. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  32591. use Symfony\Component\Console\Exception\ExceptionInterface;
  32592. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32593. use Symfony\Component\Console\Exception\LogicException;
  32594. use Symfony\Component\Console\Helper\HelperSet;
  32595. use Symfony\Component\Console\Input\InputArgument;
  32596. use Symfony\Component\Console\Input\InputDefinition;
  32597. use Symfony\Component\Console\Input\InputInterface;
  32598. use Symfony\Component\Console\Input\InputOption;
  32599. use Symfony\Component\Console\Output\BufferedOutput;
  32600. use Symfony\Component\Console\Output\OutputInterface;
  32601. class Command
  32602. {
  32603. private $application;
  32604. private $name;
  32605. private $processTitle;
  32606. private $aliases = array();
  32607. private $definition;
  32608. private $help;
  32609. private $description;
  32610. private $ignoreValidationErrors = false;
  32611. private $applicationDefinitionMerged = false;
  32612. private $applicationDefinitionMergedWithArgs = false;
  32613. private $code;
  32614. private $synopsis = array();
  32615. private $usages = array();
  32616. private $helperSet;
  32617. public function __construct($name = null)
  32618. {
  32619. $this->definition = new InputDefinition();
  32620. if (null !== $name) {
  32621. $this->setName($name);
  32622. }
  32623. $this->configure();
  32624. if (!$this->name) {
  32625. throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', \get_class($this)));
  32626. }
  32627. }
  32628. public function ignoreValidationErrors()
  32629. {
  32630. $this->ignoreValidationErrors = true;
  32631. }
  32632. public function setApplication(Application $application = null)
  32633. {
  32634. $this->application = $application;
  32635. if ($application) {
  32636. $this->setHelperSet($application->getHelperSet());
  32637. } else {
  32638. $this->helperSet = null;
  32639. }
  32640. }
  32641. public function setHelperSet(HelperSet $helperSet)
  32642. {
  32643. $this->helperSet = $helperSet;
  32644. }
  32645. public function getHelperSet()
  32646. {
  32647. return $this->helperSet;
  32648. }
  32649. public function getApplication()
  32650. {
  32651. return $this->application;
  32652. }
  32653. public function isEnabled()
  32654. {
  32655. return true;
  32656. }
  32657. protected function configure()
  32658. {
  32659. }
  32660. protected function execute(InputInterface $input, OutputInterface $output)
  32661. {
  32662. throw new LogicException('You must override the execute() method in the concrete command class.');
  32663. }
  32664. protected function interact(InputInterface $input, OutputInterface $output)
  32665. {
  32666. }
  32667. protected function initialize(InputInterface $input, OutputInterface $output)
  32668. {
  32669. }
  32670. public function run(InputInterface $input, OutputInterface $output)
  32671. {
  32672. $this->getSynopsis(true);
  32673. $this->getSynopsis(false);
  32674. $this->mergeApplicationDefinition();
  32675. try {
  32676. $input->bind($this->definition);
  32677. } catch (ExceptionInterface $e) {
  32678. if (!$this->ignoreValidationErrors) {
  32679. throw $e;
  32680. }
  32681. }
  32682. $this->initialize($input, $output);
  32683. if (null !== $this->processTitle) {
  32684. if (\function_exists('cli_set_process_title')) {
  32685. if (!@cli_set_process_title($this->processTitle)) {
  32686. if ('Darwin' === PHP_OS) {
  32687. $output->writeln('<comment>Running "cli_set_process_title" as an unprivileged user is not supported on MacOS.</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
  32688. } else {
  32689. cli_set_process_title($this->processTitle);
  32690. }
  32691. }
  32692. } elseif (\function_exists('setproctitle')) {
  32693. setproctitle($this->processTitle);
  32694. } elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {
  32695. $output->writeln('<comment>Install the proctitle PECL to be able to change the process title.</comment>');
  32696. }
  32697. }
  32698. if ($input->isInteractive()) {
  32699. $this->interact($input, $output);
  32700. }
  32701. if ($input->hasArgument('command') && null === $input->getArgument('command')) {
  32702. $input->setArgument('command', $this->getName());
  32703. }
  32704. $input->validate();
  32705. if ($this->code) {
  32706. $statusCode = \call_user_func($this->code, $input, $output);
  32707. } else {
  32708. $statusCode = $this->execute($input, $output);
  32709. }
  32710. return is_numeric($statusCode) ? (int) $statusCode : 0;
  32711. }
  32712. public function setCode($code)
  32713. {
  32714. if (!\is_callable($code)) {
  32715. throw new InvalidArgumentException('Invalid callable provided to Command::setCode.');
  32716. }
  32717. if (\PHP_VERSION_ID >= 50400 && $code instanceof \Closure) {
  32718. $r = new \ReflectionFunction($code);
  32719. if (null === $r->getClosureThis()) {
  32720. if (\PHP_VERSION_ID < 70000) {
  32721. $code = @\Closure::bind($code, $this);
  32722. } else {
  32723. $code = \Closure::bind($code, $this);
  32724. }
  32725. }
  32726. }
  32727. $this->code = $code;
  32728. return $this;
  32729. }
  32730. public function mergeApplicationDefinition($mergeArgs = true)
  32731. {
  32732. if (null === $this->application || (true === $this->applicationDefinitionMerged && ($this->applicationDefinitionMergedWithArgs || !$mergeArgs))) {
  32733. return;
  32734. }
  32735. $this->definition->addOptions($this->application->getDefinition()->getOptions());
  32736. $this->applicationDefinitionMerged = true;
  32737. if ($mergeArgs) {
  32738. $currentArguments = $this->definition->getArguments();
  32739. $this->definition->setArguments($this->application->getDefinition()->getArguments());
  32740. $this->definition->addArguments($currentArguments);
  32741. $this->applicationDefinitionMergedWithArgs = true;
  32742. }
  32743. }
  32744. public function setDefinition($definition)
  32745. {
  32746. if ($definition instanceof InputDefinition) {
  32747. $this->definition = $definition;
  32748. } else {
  32749. $this->definition->setDefinition($definition);
  32750. }
  32751. $this->applicationDefinitionMerged = false;
  32752. return $this;
  32753. }
  32754. public function getDefinition()
  32755. {
  32756. return $this->definition;
  32757. }
  32758. public function getNativeDefinition()
  32759. {
  32760. return $this->getDefinition();
  32761. }
  32762. public function addArgument($name, $mode = null, $description = '', $default = null)
  32763. {
  32764. $this->definition->addArgument(new InputArgument($name, $mode, $description, $default));
  32765. return $this;
  32766. }
  32767. public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null)
  32768. {
  32769. $this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
  32770. return $this;
  32771. }
  32772. public function setName($name)
  32773. {
  32774. $this->validateName($name);
  32775. $this->name = $name;
  32776. return $this;
  32777. }
  32778. public function setProcessTitle($title)
  32779. {
  32780. $this->processTitle = $title;
  32781. return $this;
  32782. }
  32783. public function getName()
  32784. {
  32785. return $this->name;
  32786. }
  32787. public function setDescription($description)
  32788. {
  32789. $this->description = $description;
  32790. return $this;
  32791. }
  32792. public function getDescription()
  32793. {
  32794. return $this->description;
  32795. }
  32796. public function setHelp($help)
  32797. {
  32798. $this->help = $help;
  32799. return $this;
  32800. }
  32801. public function getHelp()
  32802. {
  32803. return $this->help;
  32804. }
  32805. public function getProcessedHelp()
  32806. {
  32807. $name = $this->name;
  32808. $placeholders = array(
  32809. '%command.name%',
  32810. '%command.full_name%',
  32811. );
  32812. $replacements = array(
  32813. $name,
  32814. $_SERVER['PHP_SELF'].' '.$name,
  32815. );
  32816. return str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription());
  32817. }
  32818. public function setAliases($aliases)
  32819. {
  32820. if (!\is_array($aliases) && !$aliases instanceof \Traversable) {
  32821. throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable');
  32822. }
  32823. foreach ($aliases as $alias) {
  32824. $this->validateName($alias);
  32825. }
  32826. $this->aliases = $aliases;
  32827. return $this;
  32828. }
  32829. public function getAliases()
  32830. {
  32831. return $this->aliases;
  32832. }
  32833. public function getSynopsis($short = false)
  32834. {
  32835. $key = $short ? 'short' : 'long';
  32836. if (!isset($this->synopsis[$key])) {
  32837. $this->synopsis[$key] = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis($short)));
  32838. }
  32839. return $this->synopsis[$key];
  32840. }
  32841. public function addUsage($usage)
  32842. {
  32843. if (0 !== strpos($usage, $this->name)) {
  32844. $usage = sprintf('%s %s', $this->name, $usage);
  32845. }
  32846. $this->usages[] = $usage;
  32847. return $this;
  32848. }
  32849. public function getUsages()
  32850. {
  32851. return $this->usages;
  32852. }
  32853. public function getHelper($name)
  32854. {
  32855. if (null === $this->helperSet) {
  32856. 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));
  32857. }
  32858. return $this->helperSet->get($name);
  32859. }
  32860. public function asText()
  32861. {
  32862. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  32863. $descriptor = new TextDescriptor();
  32864. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  32865. $descriptor->describe($output, $this, array('raw_output' => true));
  32866. return $output->fetch();
  32867. }
  32868. public function asXml($asDom = false)
  32869. {
  32870. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  32871. $descriptor = new XmlDescriptor();
  32872. if ($asDom) {
  32873. return $descriptor->getCommandDocument($this);
  32874. }
  32875. $output = new BufferedOutput();
  32876. $descriptor->describe($output, $this);
  32877. return $output->fetch();
  32878. }
  32879. private function validateName($name)
  32880. {
  32881. if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) {
  32882. throw new InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));
  32883. }
  32884. }
  32885. }
  32886. <?php
  32887. namespace Symfony\Component\Console\Command;
  32888. use Symfony\Component\Console\Helper\DescriptorHelper;
  32889. use Symfony\Component\Console\Input\InputArgument;
  32890. use Symfony\Component\Console\Input\InputInterface;
  32891. use Symfony\Component\Console\Input\InputOption;
  32892. use Symfony\Component\Console\Output\OutputInterface;
  32893. class HelpCommand extends Command
  32894. {
  32895. private $command;
  32896. protected function configure()
  32897. {
  32898. $this->ignoreValidationErrors();
  32899. $this
  32900. ->setName('help')
  32901. ->setDefinition(array(
  32902. new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'),
  32903. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output help as XML'),
  32904. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  32905. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
  32906. ))
  32907. ->setDescription('Displays help for a command')
  32908. ->setHelp(<<<'EOF'
  32909. The <info>%command.name%</info> command displays help for a given command:
  32910. <info>php %command.full_name% list</info>
  32911. You can also output the help in other formats by using the <comment>--format</comment> option:
  32912. <info>php %command.full_name% --format=xml list</info>
  32913. To display the list of available commands, please use the <info>list</info> command.
  32914. EOF
  32915. )
  32916. ;
  32917. }
  32918. public function setCommand(Command $command)
  32919. {
  32920. $this->command = $command;
  32921. }
  32922. protected function execute(InputInterface $input, OutputInterface $output)
  32923. {
  32924. if (null === $this->command) {
  32925. $this->command = $this->getApplication()->find($input->getArgument('command_name'));
  32926. }
  32927. if ($input->getOption('xml')) {
  32928. @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);
  32929. $input->setOption('format', 'xml');
  32930. }
  32931. $helper = new DescriptorHelper();
  32932. $helper->describe($output, $this->command, array(
  32933. 'format' => $input->getOption('format'),
  32934. 'raw_text' => $input->getOption('raw'),
  32935. ));
  32936. $this->command = null;
  32937. }
  32938. }
  32939. <?php
  32940. namespace Symfony\Component\Console\Command;
  32941. use Symfony\Component\Console\Helper\DescriptorHelper;
  32942. use Symfony\Component\Console\Input\InputArgument;
  32943. use Symfony\Component\Console\Input\InputDefinition;
  32944. use Symfony\Component\Console\Input\InputInterface;
  32945. use Symfony\Component\Console\Input\InputOption;
  32946. use Symfony\Component\Console\Output\OutputInterface;
  32947. class ListCommand extends Command
  32948. {
  32949. protected function configure()
  32950. {
  32951. $this
  32952. ->setName('list')
  32953. ->setDefinition($this->createDefinition())
  32954. ->setDescription('Lists commands')
  32955. ->setHelp(<<<'EOF'
  32956. The <info>%command.name%</info> command lists all commands:
  32957. <info>php %command.full_name%</info>
  32958. You can also display the commands for a specific namespace:
  32959. <info>php %command.full_name% test</info>
  32960. You can also output the information in other formats by using the <comment>--format</comment> option:
  32961. <info>php %command.full_name% --format=xml</info>
  32962. It's also possible to get raw list of commands (useful for embedding command runner):
  32963. <info>php %command.full_name% --raw</info>
  32964. EOF
  32965. )
  32966. ;
  32967. }
  32968. public function getNativeDefinition()
  32969. {
  32970. return $this->createDefinition();
  32971. }
  32972. protected function execute(InputInterface $input, OutputInterface $output)
  32973. {
  32974. if ($input->getOption('xml')) {
  32975. @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);
  32976. $input->setOption('format', 'xml');
  32977. }
  32978. $helper = new DescriptorHelper();
  32979. $helper->describe($output, $this->getApplication(), array(
  32980. 'format' => $input->getOption('format'),
  32981. 'raw_text' => $input->getOption('raw'),
  32982. 'namespace' => $input->getArgument('namespace'),
  32983. ));
  32984. }
  32985. private function createDefinition()
  32986. {
  32987. return new InputDefinition(array(
  32988. new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
  32989. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output list as XML'),
  32990. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'),
  32991. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  32992. ));
  32993. }
  32994. }
  32995. <?php
  32996. namespace Symfony\Component\Console;
  32997. final class ConsoleEvents
  32998. {
  32999. const COMMAND = 'console.command';
  33000. const TERMINATE = 'console.terminate';
  33001. const EXCEPTION = 'console.exception';
  33002. }
  33003. <?php
  33004. namespace Symfony\Component\Console\Descriptor;
  33005. use Symfony\Component\Console\Application;
  33006. use Symfony\Component\Console\Command\Command;
  33007. use Symfony\Component\Console\Exception\CommandNotFoundException;
  33008. class ApplicationDescription
  33009. {
  33010. const GLOBAL_NAMESPACE = '_global';
  33011. private $application;
  33012. private $namespace;
  33013. private $namespaces;
  33014. private $commands;
  33015. private $aliases;
  33016. public function __construct(Application $application, $namespace = null)
  33017. {
  33018. $this->application = $application;
  33019. $this->namespace = $namespace;
  33020. }
  33021. public function getNamespaces()
  33022. {
  33023. if (null === $this->namespaces) {
  33024. $this->inspectApplication();
  33025. }
  33026. return $this->namespaces;
  33027. }
  33028. public function getCommands()
  33029. {
  33030. if (null === $this->commands) {
  33031. $this->inspectApplication();
  33032. }
  33033. return $this->commands;
  33034. }
  33035. public function getCommand($name)
  33036. {
  33037. if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) {
  33038. throw new CommandNotFoundException(sprintf('Command %s does not exist.', $name));
  33039. }
  33040. return isset($this->commands[$name]) ? $this->commands[$name] : $this->aliases[$name];
  33041. }
  33042. private function inspectApplication()
  33043. {
  33044. $this->commands = array();
  33045. $this->namespaces = array();
  33046. $all = $this->application->all($this->namespace ? $this->application->findNamespace($this->namespace) : null);
  33047. foreach ($this->sortCommands($all) as $namespace => $commands) {
  33048. $names = array();
  33049. foreach ($commands as $name => $command) {
  33050. if (!$command->getName()) {
  33051. continue;
  33052. }
  33053. if ($command->getName() === $name) {
  33054. $this->commands[$name] = $command;
  33055. } else {
  33056. $this->aliases[$name] = $command;
  33057. }
  33058. $names[] = $name;
  33059. }
  33060. $this->namespaces[$namespace] = array('id' => $namespace, 'commands' => $names);
  33061. }
  33062. }
  33063. private function sortCommands(array $commands)
  33064. {
  33065. $namespacedCommands = array();
  33066. $globalCommands = array();
  33067. foreach ($commands as $name => $command) {
  33068. $key = $this->application->extractNamespace($name, 1);
  33069. if (!$key) {
  33070. $globalCommands['_global'][$name] = $command;
  33071. } else {
  33072. $namespacedCommands[$key][$name] = $command;
  33073. }
  33074. }
  33075. ksort($namespacedCommands);
  33076. $namespacedCommands = array_merge($globalCommands, $namespacedCommands);
  33077. foreach ($namespacedCommands as &$commandsSet) {
  33078. ksort($commandsSet);
  33079. }
  33080. unset($commandsSet);
  33081. return $namespacedCommands;
  33082. }
  33083. }
  33084. <?php
  33085. namespace Symfony\Component\Console\Descriptor;
  33086. use Symfony\Component\Console\Application;
  33087. use Symfony\Component\Console\Command\Command;
  33088. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33089. use Symfony\Component\Console\Input\InputArgument;
  33090. use Symfony\Component\Console\Input\InputDefinition;
  33091. use Symfony\Component\Console\Input\InputOption;
  33092. use Symfony\Component\Console\Output\OutputInterface;
  33093. abstract class Descriptor implements DescriptorInterface
  33094. {
  33095. private $output;
  33096. public function describe(OutputInterface $output, $object, array $options = array())
  33097. {
  33098. $this->output = $output;
  33099. switch (true) {
  33100. case $object instanceof InputArgument:
  33101. $this->describeInputArgument($object, $options);
  33102. break;
  33103. case $object instanceof InputOption:
  33104. $this->describeInputOption($object, $options);
  33105. break;
  33106. case $object instanceof InputDefinition:
  33107. $this->describeInputDefinition($object, $options);
  33108. break;
  33109. case $object instanceof Command:
  33110. $this->describeCommand($object, $options);
  33111. break;
  33112. case $object instanceof Application:
  33113. $this->describeApplication($object, $options);
  33114. break;
  33115. default:
  33116. throw new InvalidArgumentException(sprintf('Object of type "%s" is not describable.', \get_class($object)));
  33117. }
  33118. }
  33119. protected function write($content, $decorated = false)
  33120. {
  33121. $this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
  33122. }
  33123. abstract protected function describeInputArgument(InputArgument $argument, array $options = array());
  33124. abstract protected function describeInputOption(InputOption $option, array $options = array());
  33125. abstract protected function describeInputDefinition(InputDefinition $definition, array $options = array());
  33126. abstract protected function describeCommand(Command $command, array $options = array());
  33127. abstract protected function describeApplication(Application $application, array $options = array());
  33128. }
  33129. <?php
  33130. namespace Symfony\Component\Console\Descriptor;
  33131. use Symfony\Component\Console\Output\OutputInterface;
  33132. interface DescriptorInterface
  33133. {
  33134. public function describe(OutputInterface $output, $object, array $options = array());
  33135. }
  33136. <?php
  33137. namespace Symfony\Component\Console\Descriptor;
  33138. use Symfony\Component\Console\Application;
  33139. use Symfony\Component\Console\Command\Command;
  33140. use Symfony\Component\Console\Input\InputArgument;
  33141. use Symfony\Component\Console\Input\InputDefinition;
  33142. use Symfony\Component\Console\Input\InputOption;
  33143. class JsonDescriptor extends Descriptor
  33144. {
  33145. protected function describeInputArgument(InputArgument $argument, array $options = array())
  33146. {
  33147. $this->writeData($this->getInputArgumentData($argument), $options);
  33148. }
  33149. protected function describeInputOption(InputOption $option, array $options = array())
  33150. {
  33151. $this->writeData($this->getInputOptionData($option), $options);
  33152. }
  33153. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  33154. {
  33155. $this->writeData($this->getInputDefinitionData($definition), $options);
  33156. }
  33157. protected function describeCommand(Command $command, array $options = array())
  33158. {
  33159. $this->writeData($this->getCommandData($command), $options);
  33160. }
  33161. protected function describeApplication(Application $application, array $options = array())
  33162. {
  33163. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  33164. $description = new ApplicationDescription($application, $describedNamespace);
  33165. $commands = array();
  33166. foreach ($description->getCommands() as $command) {
  33167. $commands[] = $this->getCommandData($command);
  33168. }
  33169. $data = $describedNamespace
  33170. ? array('commands' => $commands, 'namespace' => $describedNamespace)
  33171. : array('commands' => $commands, 'namespaces' => array_values($description->getNamespaces()));
  33172. $this->writeData($data, $options);
  33173. }
  33174. private function writeData(array $data, array $options)
  33175. {
  33176. $this->write(json_encode($data, isset($options['json_encoding']) ? $options['json_encoding'] : 0));
  33177. }
  33178. private function getInputArgumentData(InputArgument $argument)
  33179. {
  33180. return array(
  33181. 'name' => $argument->getName(),
  33182. 'is_required' => $argument->isRequired(),
  33183. 'is_array' => $argument->isArray(),
  33184. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()),
  33185. 'default' => INF === $argument->getDefault() ? 'INF' : $argument->getDefault(),
  33186. );
  33187. }
  33188. private function getInputOptionData(InputOption $option)
  33189. {
  33190. return array(
  33191. 'name' => '--'.$option->getName(),
  33192. 'shortcut' => $option->getShortcut() ? '-'.str_replace('|', '|-', $option->getShortcut()) : '',
  33193. 'accept_value' => $option->acceptValue(),
  33194. 'is_value_required' => $option->isValueRequired(),
  33195. 'is_multiple' => $option->isArray(),
  33196. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
  33197. 'default' => INF === $option->getDefault() ? 'INF' : $option->getDefault(),
  33198. );
  33199. }
  33200. private function getInputDefinitionData(InputDefinition $definition)
  33201. {
  33202. $inputArguments = array();
  33203. foreach ($definition->getArguments() as $name => $argument) {
  33204. $inputArguments[$name] = $this->getInputArgumentData($argument);
  33205. }
  33206. $inputOptions = array();
  33207. foreach ($definition->getOptions() as $name => $option) {
  33208. $inputOptions[$name] = $this->getInputOptionData($option);
  33209. }
  33210. return array('arguments' => $inputArguments, 'options' => $inputOptions);
  33211. }
  33212. private function getCommandData(Command $command)
  33213. {
  33214. $command->getSynopsis();
  33215. $command->mergeApplicationDefinition(false);
  33216. return array(
  33217. 'name' => $command->getName(),
  33218. 'usage' => array_merge(array($command->getSynopsis()), $command->getUsages(), $command->getAliases()),
  33219. 'description' => $command->getDescription(),
  33220. 'help' => $command->getProcessedHelp(),
  33221. 'definition' => $this->getInputDefinitionData($command->getNativeDefinition()),
  33222. );
  33223. }
  33224. }
  33225. <?php
  33226. namespace Symfony\Component\Console\Descriptor;
  33227. use Symfony\Component\Console\Application;
  33228. use Symfony\Component\Console\Command\Command;
  33229. use Symfony\Component\Console\Helper\Helper;
  33230. use Symfony\Component\Console\Input\InputArgument;
  33231. use Symfony\Component\Console\Input\InputDefinition;
  33232. use Symfony\Component\Console\Input\InputOption;
  33233. class MarkdownDescriptor extends Descriptor
  33234. {
  33235. protected function describeInputArgument(InputArgument $argument, array $options = array())
  33236. {
  33237. $this->write(
  33238. '**'.$argument->getName().':**'."\n\n"
  33239. .'* Name: '.($argument->getName() ?: '<none>')."\n"
  33240. .'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n"
  33241. .'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n"
  33242. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $argument->getDescription() ?: '<none>')."\n"
  33243. .'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`'
  33244. );
  33245. }
  33246. protected function describeInputOption(InputOption $option, array $options = array())
  33247. {
  33248. $this->write(
  33249. '**'.$option->getName().':**'."\n\n"
  33250. .'* Name: `--'.$option->getName().'`'."\n"
  33251. .'* Shortcut: '.($option->getShortcut() ? '`-'.str_replace('|', '|-', $option->getShortcut()).'`' : '<none>')."\n"
  33252. .'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n"
  33253. .'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n"
  33254. .'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n"
  33255. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $option->getDescription() ?: '<none>')."\n"
  33256. .'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`'
  33257. );
  33258. }
  33259. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  33260. {
  33261. if ($showArguments = \count($definition->getArguments()) > 0) {
  33262. $this->write('### Arguments:');
  33263. foreach ($definition->getArguments() as $argument) {
  33264. $this->write("\n\n");
  33265. $this->write($this->describeInputArgument($argument));
  33266. }
  33267. }
  33268. if (\count($definition->getOptions()) > 0) {
  33269. if ($showArguments) {
  33270. $this->write("\n\n");
  33271. }
  33272. $this->write('### Options:');
  33273. foreach ($definition->getOptions() as $option) {
  33274. $this->write("\n\n");
  33275. $this->write($this->describeInputOption($option));
  33276. }
  33277. }
  33278. }
  33279. protected function describeCommand(Command $command, array $options = array())
  33280. {
  33281. $command->getSynopsis();
  33282. $command->mergeApplicationDefinition(false);
  33283. $this->write(
  33284. $command->getName()."\n"
  33285. .str_repeat('-', Helper::strlen($command->getName()))."\n\n"
  33286. .'* Description: '.($command->getDescription() ?: '<none>')."\n"
  33287. .'* Usage:'."\n\n"
  33288. .array_reduce(array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
  33289. return $carry.' * `'.$usage.'`'."\n";
  33290. })
  33291. );
  33292. if ($help = $command->getProcessedHelp()) {
  33293. $this->write("\n");
  33294. $this->write($help);
  33295. }
  33296. if ($command->getNativeDefinition()) {
  33297. $this->write("\n\n");
  33298. $this->describeInputDefinition($command->getNativeDefinition());
  33299. }
  33300. }
  33301. protected function describeApplication(Application $application, array $options = array())
  33302. {
  33303. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  33304. $description = new ApplicationDescription($application, $describedNamespace);
  33305. $this->write($application->getName()."\n".str_repeat('=', Helper::strlen($application->getName())));
  33306. foreach ($description->getNamespaces() as $namespace) {
  33307. if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  33308. $this->write("\n\n");
  33309. $this->write('**'.$namespace['id'].':**');
  33310. }
  33311. $this->write("\n\n");
  33312. $this->write(implode("\n", array_map(function ($commandName) {
  33313. return '* '.$commandName;
  33314. }, $namespace['commands'])));
  33315. }
  33316. foreach ($description->getCommands() as $command) {
  33317. $this->write("\n\n");
  33318. $this->write($this->describeCommand($command));
  33319. }
  33320. }
  33321. }
  33322. <?php
  33323. namespace Symfony\Component\Console\Descriptor;
  33324. use Symfony\Component\Console\Application;
  33325. use Symfony\Component\Console\Command\Command;
  33326. use Symfony\Component\Console\Formatter\OutputFormatter;
  33327. use Symfony\Component\Console\Helper\Helper;
  33328. use Symfony\Component\Console\Input\InputArgument;
  33329. use Symfony\Component\Console\Input\InputDefinition;
  33330. use Symfony\Component\Console\Input\InputOption;
  33331. class TextDescriptor extends Descriptor
  33332. {
  33333. protected function describeInputArgument(InputArgument $argument, array $options = array())
  33334. {
  33335. if (null !== $argument->getDefault() && (!\is_array($argument->getDefault()) || \count($argument->getDefault()))) {
  33336. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($argument->getDefault()));
  33337. } else {
  33338. $default = '';
  33339. }
  33340. $totalWidth = isset($options['total_width']) ? $options['total_width'] : Helper::strlen($argument->getName());
  33341. $spacingWidth = $totalWidth - \strlen($argument->getName());
  33342. $this->writeText(sprintf(' <info>%s</info> %s%s%s',
  33343. $argument->getName(),
  33344. str_repeat(' ', $spacingWidth),
  33345. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $argument->getDescription()),
  33346. $default
  33347. ), $options);
  33348. }
  33349. protected function describeInputOption(InputOption $option, array $options = array())
  33350. {
  33351. if ($option->acceptValue() && null !== $option->getDefault() && (!\is_array($option->getDefault()) || \count($option->getDefault()))) {
  33352. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($option->getDefault()));
  33353. } else {
  33354. $default = '';
  33355. }
  33356. $value = '';
  33357. if ($option->acceptValue()) {
  33358. $value = '='.strtoupper($option->getName());
  33359. if ($option->isValueOptional()) {
  33360. $value = '['.$value.']';
  33361. }
  33362. }
  33363. $totalWidth = isset($options['total_width']) ? $options['total_width'] : $this->calculateTotalWidthForOptions(array($option));
  33364. $synopsis = sprintf('%s%s',
  33365. $option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : ' ',
  33366. sprintf('--%s%s', $option->getName(), $value)
  33367. );
  33368. $spacingWidth = $totalWidth - Helper::strlen($synopsis);
  33369. $this->writeText(sprintf(' <info>%s</info> %s%s%s%s',
  33370. $synopsis,
  33371. str_repeat(' ', $spacingWidth),
  33372. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $option->getDescription()),
  33373. $default,
  33374. $option->isArray() ? '<comment> (multiple values allowed)</comment>' : ''
  33375. ), $options);
  33376. }
  33377. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  33378. {
  33379. $totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions());
  33380. foreach ($definition->getArguments() as $argument) {
  33381. $totalWidth = max($totalWidth, Helper::strlen($argument->getName()));
  33382. }
  33383. if ($definition->getArguments()) {
  33384. $this->writeText('<comment>Arguments:</comment>', $options);
  33385. $this->writeText("\n");
  33386. foreach ($definition->getArguments() as $argument) {
  33387. $this->describeInputArgument($argument, array_merge($options, array('total_width' => $totalWidth)));
  33388. $this->writeText("\n");
  33389. }
  33390. }
  33391. if ($definition->getArguments() && $definition->getOptions()) {
  33392. $this->writeText("\n");
  33393. }
  33394. if ($definition->getOptions()) {
  33395. $laterOptions = array();
  33396. $this->writeText('<comment>Options:</comment>', $options);
  33397. foreach ($definition->getOptions() as $option) {
  33398. if (\strlen($option->getShortcut()) > 1) {
  33399. $laterOptions[] = $option;
  33400. continue;
  33401. }
  33402. $this->writeText("\n");
  33403. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  33404. }
  33405. foreach ($laterOptions as $option) {
  33406. $this->writeText("\n");
  33407. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  33408. }
  33409. }
  33410. }
  33411. protected function describeCommand(Command $command, array $options = array())
  33412. {
  33413. $command->getSynopsis(true);
  33414. $command->getSynopsis(false);
  33415. $command->mergeApplicationDefinition(false);
  33416. $this->writeText('<comment>Usage:</comment>', $options);
  33417. foreach (array_merge(array($command->getSynopsis(true)), $command->getAliases(), $command->getUsages()) as $usage) {
  33418. $this->writeText("\n");
  33419. $this->writeText(' '.OutputFormatter::escape($usage), $options);
  33420. }
  33421. $this->writeText("\n");
  33422. $definition = $command->getNativeDefinition();
  33423. if ($definition->getOptions() || $definition->getArguments()) {
  33424. $this->writeText("\n");
  33425. $this->describeInputDefinition($definition, $options);
  33426. $this->writeText("\n");
  33427. }
  33428. if ($help = $command->getProcessedHelp()) {
  33429. $this->writeText("\n");
  33430. $this->writeText('<comment>Help:</comment>', $options);
  33431. $this->writeText("\n");
  33432. $this->writeText(' '.str_replace("\n", "\n ", $help), $options);
  33433. $this->writeText("\n");
  33434. }
  33435. }
  33436. protected function describeApplication(Application $application, array $options = array())
  33437. {
  33438. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  33439. $description = new ApplicationDescription($application, $describedNamespace);
  33440. if (isset($options['raw_text']) && $options['raw_text']) {
  33441. $width = $this->getColumnWidth($description->getCommands());
  33442. foreach ($description->getCommands() as $command) {
  33443. $this->writeText(sprintf("%-{$width}s %s", $command->getName(), $command->getDescription()), $options);
  33444. $this->writeText("\n");
  33445. }
  33446. } else {
  33447. if ('' != $help = $application->getHelp()) {
  33448. $this->writeText("$help\n\n", $options);
  33449. }
  33450. $this->writeText("<comment>Usage:</comment>\n", $options);
  33451. $this->writeText(" command [options] [arguments]\n\n", $options);
  33452. $this->describeInputDefinition(new InputDefinition($application->getDefinition()->getOptions()), $options);
  33453. $this->writeText("\n");
  33454. $this->writeText("\n");
  33455. $width = $this->getColumnWidth($description->getCommands());
  33456. if ($describedNamespace) {
  33457. $this->writeText(sprintf('<comment>Available commands for the "%s" namespace:</comment>', $describedNamespace), $options);
  33458. } else {
  33459. $this->writeText('<comment>Available commands:</comment>', $options);
  33460. }
  33461. foreach ($description->getNamespaces() as $namespace) {
  33462. if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  33463. $this->writeText("\n");
  33464. $this->writeText(' <comment>'.$namespace['id'].'</comment>', $options);
  33465. }
  33466. foreach ($namespace['commands'] as $name) {
  33467. $this->writeText("\n");
  33468. $spacingWidth = $width - Helper::strlen($name);
  33469. $this->writeText(sprintf(' <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $description->getCommand($name)->getDescription()), $options);
  33470. }
  33471. }
  33472. $this->writeText("\n");
  33473. }
  33474. }
  33475. private function writeText($content, array $options = array())
  33476. {
  33477. $this->write(
  33478. isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content,
  33479. isset($options['raw_output']) ? !$options['raw_output'] : true
  33480. );
  33481. }
  33482. private function formatDefaultValue($default)
  33483. {
  33484. if (INF === $default) {
  33485. return 'INF';
  33486. }
  33487. if (\is_string($default)) {
  33488. $default = OutputFormatter::escape($default);
  33489. } elseif (\is_array($default)) {
  33490. foreach ($default as $key => $value) {
  33491. if (\is_string($value)) {
  33492. $default[$key] = OutputFormatter::escape($value);
  33493. }
  33494. }
  33495. }
  33496. if (\PHP_VERSION_ID < 50400) {
  33497. return str_replace(array('\/', '\\\\'), array('/', '\\'), json_encode($default));
  33498. }
  33499. return str_replace('\\\\', '\\', json_encode($default, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
  33500. }
  33501. private function getColumnWidth(array $commands)
  33502. {
  33503. $widths = array();
  33504. foreach ($commands as $command) {
  33505. $widths[] = Helper::strlen($command->getName());
  33506. foreach ($command->getAliases() as $alias) {
  33507. $widths[] = Helper::strlen($alias);
  33508. }
  33509. }
  33510. return max($widths) + 2;
  33511. }
  33512. private function calculateTotalWidthForOptions(array $options)
  33513. {
  33514. $totalWidth = 0;
  33515. foreach ($options as $option) {
  33516. $nameLength = 1 + max(\strlen($option->getShortcut()), 1) + 4 + Helper::strlen($option->getName());
  33517. if ($option->acceptValue()) {
  33518. $valueLength = 1 + Helper::strlen($option->getName());
  33519. $valueLength += $option->isValueOptional() ? 2 : 0;
  33520. $nameLength += $valueLength;
  33521. }
  33522. $totalWidth = max($totalWidth, $nameLength);
  33523. }
  33524. return $totalWidth;
  33525. }
  33526. }
  33527. <?php
  33528. namespace Symfony\Component\Console\Descriptor;
  33529. use Symfony\Component\Console\Application;
  33530. use Symfony\Component\Console\Command\Command;
  33531. use Symfony\Component\Console\Input\InputArgument;
  33532. use Symfony\Component\Console\Input\InputDefinition;
  33533. use Symfony\Component\Console\Input\InputOption;
  33534. class XmlDescriptor extends Descriptor
  33535. {
  33536. public function getInputDefinitionDocument(InputDefinition $definition)
  33537. {
  33538. $dom = new \DOMDocument('1.0', 'UTF-8');
  33539. $dom->appendChild($definitionXML = $dom->createElement('definition'));
  33540. $definitionXML->appendChild($argumentsXML = $dom->createElement('arguments'));
  33541. foreach ($definition->getArguments() as $argument) {
  33542. $this->appendDocument($argumentsXML, $this->getInputArgumentDocument($argument));
  33543. }
  33544. $definitionXML->appendChild($optionsXML = $dom->createElement('options'));
  33545. foreach ($definition->getOptions() as $option) {
  33546. $this->appendDocument($optionsXML, $this->getInputOptionDocument($option));
  33547. }
  33548. return $dom;
  33549. }
  33550. public function getCommandDocument(Command $command)
  33551. {
  33552. $dom = new \DOMDocument('1.0', 'UTF-8');
  33553. $dom->appendChild($commandXML = $dom->createElement('command'));
  33554. $command->getSynopsis();
  33555. $command->mergeApplicationDefinition(false);
  33556. $commandXML->setAttribute('id', $command->getName());
  33557. $commandXML->setAttribute('name', $command->getName());
  33558. $commandXML->appendChild($usagesXML = $dom->createElement('usages'));
  33559. foreach (array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()) as $usage) {
  33560. $usagesXML->appendChild($dom->createElement('usage', $usage));
  33561. }
  33562. $commandXML->appendChild($descriptionXML = $dom->createElement('description'));
  33563. $descriptionXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getDescription())));
  33564. $commandXML->appendChild($helpXML = $dom->createElement('help'));
  33565. $helpXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getProcessedHelp())));
  33566. $definitionXML = $this->getInputDefinitionDocument($command->getNativeDefinition());
  33567. $this->appendDocument($commandXML, $definitionXML->getElementsByTagName('definition')->item(0));
  33568. return $dom;
  33569. }
  33570. public function getApplicationDocument(Application $application, $namespace = null)
  33571. {
  33572. $dom = new \DOMDocument('1.0', 'UTF-8');
  33573. $dom->appendChild($rootXml = $dom->createElement('symfony'));
  33574. if ('UNKNOWN' !== $application->getName()) {
  33575. $rootXml->setAttribute('name', $application->getName());
  33576. if ('UNKNOWN' !== $application->getVersion()) {
  33577. $rootXml->setAttribute('version', $application->getVersion());
  33578. }
  33579. }
  33580. $rootXml->appendChild($commandsXML = $dom->createElement('commands'));
  33581. $description = new ApplicationDescription($application, $namespace);
  33582. if ($namespace) {
  33583. $commandsXML->setAttribute('namespace', $namespace);
  33584. }
  33585. foreach ($description->getCommands() as $command) {
  33586. $this->appendDocument($commandsXML, $this->getCommandDocument($command));
  33587. }
  33588. if (!$namespace) {
  33589. $rootXml->appendChild($namespacesXML = $dom->createElement('namespaces'));
  33590. foreach ($description->getNamespaces() as $namespaceDescription) {
  33591. $namespacesXML->appendChild($namespaceArrayXML = $dom->createElement('namespace'));
  33592. $namespaceArrayXML->setAttribute('id', $namespaceDescription['id']);
  33593. foreach ($namespaceDescription['commands'] as $name) {
  33594. $namespaceArrayXML->appendChild($commandXML = $dom->createElement('command'));
  33595. $commandXML->appendChild($dom->createTextNode($name));
  33596. }
  33597. }
  33598. }
  33599. return $dom;
  33600. }
  33601. protected function describeInputArgument(InputArgument $argument, array $options = array())
  33602. {
  33603. $this->writeDocument($this->getInputArgumentDocument($argument));
  33604. }
  33605. protected function describeInputOption(InputOption $option, array $options = array())
  33606. {
  33607. $this->writeDocument($this->getInputOptionDocument($option));
  33608. }
  33609. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  33610. {
  33611. $this->writeDocument($this->getInputDefinitionDocument($definition));
  33612. }
  33613. protected function describeCommand(Command $command, array $options = array())
  33614. {
  33615. $this->writeDocument($this->getCommandDocument($command));
  33616. }
  33617. protected function describeApplication(Application $application, array $options = array())
  33618. {
  33619. $this->writeDocument($this->getApplicationDocument($application, isset($options['namespace']) ? $options['namespace'] : null));
  33620. }
  33621. private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent)
  33622. {
  33623. foreach ($importedParent->childNodes as $childNode) {
  33624. $parentNode->appendChild($parentNode->ownerDocument->importNode($childNode, true));
  33625. }
  33626. }
  33627. private function writeDocument(\DOMDocument $dom)
  33628. {
  33629. $dom->formatOutput = true;
  33630. $this->write($dom->saveXML());
  33631. }
  33632. private function getInputArgumentDocument(InputArgument $argument)
  33633. {
  33634. $dom = new \DOMDocument('1.0', 'UTF-8');
  33635. $dom->appendChild($objectXML = $dom->createElement('argument'));
  33636. $objectXML->setAttribute('name', $argument->getName());
  33637. $objectXML->setAttribute('is_required', $argument->isRequired() ? 1 : 0);
  33638. $objectXML->setAttribute('is_array', $argument->isArray() ? 1 : 0);
  33639. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  33640. $descriptionXML->appendChild($dom->createTextNode($argument->getDescription()));
  33641. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  33642. $defaults = \is_array($argument->getDefault()) ? $argument->getDefault() : (\is_bool($argument->getDefault()) ? array(var_export($argument->getDefault(), true)) : ($argument->getDefault() ? array($argument->getDefault()) : array()));
  33643. foreach ($defaults as $default) {
  33644. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  33645. $defaultXML->appendChild($dom->createTextNode($default));
  33646. }
  33647. return $dom;
  33648. }
  33649. private function getInputOptionDocument(InputOption $option)
  33650. {
  33651. $dom = new \DOMDocument('1.0', 'UTF-8');
  33652. $dom->appendChild($objectXML = $dom->createElement('option'));
  33653. $objectXML->setAttribute('name', '--'.$option->getName());
  33654. $pos = strpos($option->getShortcut(), '|');
  33655. if (false !== $pos) {
  33656. $objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos));
  33657. $objectXML->setAttribute('shortcuts', '-'.str_replace('|', '|-', $option->getShortcut()));
  33658. } else {
  33659. $objectXML->setAttribute('shortcut', $option->getShortcut() ? '-'.$option->getShortcut() : '');
  33660. }
  33661. $objectXML->setAttribute('accept_value', $option->acceptValue() ? 1 : 0);
  33662. $objectXML->setAttribute('is_value_required', $option->isValueRequired() ? 1 : 0);
  33663. $objectXML->setAttribute('is_multiple', $option->isArray() ? 1 : 0);
  33664. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  33665. $descriptionXML->appendChild($dom->createTextNode($option->getDescription()));
  33666. if ($option->acceptValue()) {
  33667. $defaults = \is_array($option->getDefault()) ? $option->getDefault() : (\is_bool($option->getDefault()) ? array(var_export($option->getDefault(), true)) : ($option->getDefault() ? array($option->getDefault()) : array()));
  33668. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  33669. if (!empty($defaults)) {
  33670. foreach ($defaults as $default) {
  33671. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  33672. $defaultXML->appendChild($dom->createTextNode($default));
  33673. }
  33674. }
  33675. }
  33676. return $dom;
  33677. }
  33678. }
  33679. <?php
  33680. namespace Symfony\Component\Console\Event;
  33681. class ConsoleCommandEvent extends ConsoleEvent
  33682. {
  33683. const RETURN_CODE_DISABLED = 113;
  33684. private $commandShouldRun = true;
  33685. public function disableCommand()
  33686. {
  33687. return $this->commandShouldRun = false;
  33688. }
  33689. public function enableCommand()
  33690. {
  33691. return $this->commandShouldRun = true;
  33692. }
  33693. public function commandShouldRun()
  33694. {
  33695. return $this->commandShouldRun;
  33696. }
  33697. }
  33698. <?php
  33699. namespace Symfony\Component\Console\Event;
  33700. use Symfony\Component\Console\Command\Command;
  33701. use Symfony\Component\Console\Input\InputInterface;
  33702. use Symfony\Component\Console\Output\OutputInterface;
  33703. use Symfony\Component\EventDispatcher\Event;
  33704. class ConsoleEvent extends Event
  33705. {
  33706. protected $command;
  33707. private $input;
  33708. private $output;
  33709. public function __construct(Command $command, InputInterface $input, OutputInterface $output)
  33710. {
  33711. $this->command = $command;
  33712. $this->input = $input;
  33713. $this->output = $output;
  33714. }
  33715. public function getCommand()
  33716. {
  33717. return $this->command;
  33718. }
  33719. public function getInput()
  33720. {
  33721. return $this->input;
  33722. }
  33723. public function getOutput()
  33724. {
  33725. return $this->output;
  33726. }
  33727. }
  33728. <?php
  33729. namespace Symfony\Component\Console\Event;
  33730. use Symfony\Component\Console\Command\Command;
  33731. use Symfony\Component\Console\Input\InputInterface;
  33732. use Symfony\Component\Console\Output\OutputInterface;
  33733. class ConsoleExceptionEvent extends ConsoleEvent
  33734. {
  33735. private $exception;
  33736. private $exitCode;
  33737. public function __construct(Command $command, InputInterface $input, OutputInterface $output, \Exception $exception, $exitCode)
  33738. {
  33739. parent::__construct($command, $input, $output);
  33740. $this->setException($exception);
  33741. $this->exitCode = (int) $exitCode;
  33742. }
  33743. public function getException()
  33744. {
  33745. return $this->exception;
  33746. }
  33747. public function setException(\Exception $exception)
  33748. {
  33749. $this->exception = $exception;
  33750. }
  33751. public function getExitCode()
  33752. {
  33753. return $this->exitCode;
  33754. }
  33755. }
  33756. <?php
  33757. namespace Symfony\Component\Console\Event;
  33758. use Symfony\Component\Console\Command\Command;
  33759. use Symfony\Component\Console\Input\InputInterface;
  33760. use Symfony\Component\Console\Output\OutputInterface;
  33761. class ConsoleTerminateEvent extends ConsoleEvent
  33762. {
  33763. private $exitCode;
  33764. public function __construct(Command $command, InputInterface $input, OutputInterface $output, $exitCode)
  33765. {
  33766. parent::__construct($command, $input, $output);
  33767. $this->setExitCode($exitCode);
  33768. }
  33769. public function setExitCode($exitCode)
  33770. {
  33771. $this->exitCode = (int) $exitCode;
  33772. }
  33773. public function getExitCode()
  33774. {
  33775. return $this->exitCode;
  33776. }
  33777. }
  33778. <?php
  33779. namespace Symfony\Component\Console\Exception;
  33780. class CommandNotFoundException extends \InvalidArgumentException implements ExceptionInterface
  33781. {
  33782. private $alternatives;
  33783. public function __construct($message, array $alternatives = array(), $code = 0, \Exception $previous = null)
  33784. {
  33785. parent::__construct($message, $code, $previous);
  33786. $this->alternatives = $alternatives;
  33787. }
  33788. public function getAlternatives()
  33789. {
  33790. return $this->alternatives;
  33791. }
  33792. }
  33793. <?php
  33794. namespace Symfony\Component\Console\Exception;
  33795. interface ExceptionInterface
  33796. {
  33797. }
  33798. <?php
  33799. namespace Symfony\Component\Console\Exception;
  33800. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  33801. {
  33802. }
  33803. <?php
  33804. namespace Symfony\Component\Console\Exception;
  33805. class InvalidOptionException extends \InvalidArgumentException implements ExceptionInterface
  33806. {
  33807. }
  33808. <?php
  33809. namespace Symfony\Component\Console\Exception;
  33810. class LogicException extends \LogicException implements ExceptionInterface
  33811. {
  33812. }
  33813. <?php
  33814. namespace Symfony\Component\Console\Exception;
  33815. class RuntimeException extends \RuntimeException implements ExceptionInterface
  33816. {
  33817. }
  33818. <?php
  33819. namespace Symfony\Component\Console\Formatter;
  33820. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33821. class OutputFormatter implements OutputFormatterInterface
  33822. {
  33823. private $decorated;
  33824. private $styles = array();
  33825. private $styleStack;
  33826. public static function escape($text)
  33827. {
  33828. $text = preg_replace('/([^\\\\]?)</', '$1\\<', $text);
  33829. return self::escapeTrailingBackslash($text);
  33830. }
  33831. public static function escapeTrailingBackslash($text)
  33832. {
  33833. if ('\\' === substr($text, -1)) {
  33834. $len = \strlen($text);
  33835. $text = rtrim($text, '\\');
  33836. $text = str_replace("\0", '', $text);
  33837. $text .= str_repeat("\0", $len - \strlen($text));
  33838. }
  33839. return $text;
  33840. }
  33841. public function __construct($decorated = false, array $styles = array())
  33842. {
  33843. $this->decorated = (bool) $decorated;
  33844. $this->setStyle('error', new OutputFormatterStyle('white', 'red'));
  33845. $this->setStyle('info', new OutputFormatterStyle('green'));
  33846. $this->setStyle('comment', new OutputFormatterStyle('yellow'));
  33847. $this->setStyle('question', new OutputFormatterStyle('black', 'cyan'));
  33848. foreach ($styles as $name => $style) {
  33849. $this->setStyle($name, $style);
  33850. }
  33851. $this->styleStack = new OutputFormatterStyleStack();
  33852. }
  33853. public function setDecorated($decorated)
  33854. {
  33855. $this->decorated = (bool) $decorated;
  33856. }
  33857. public function isDecorated()
  33858. {
  33859. return $this->decorated;
  33860. }
  33861. public function setStyle($name, OutputFormatterStyleInterface $style)
  33862. {
  33863. $this->styles[strtolower($name)] = $style;
  33864. }
  33865. public function hasStyle($name)
  33866. {
  33867. return isset($this->styles[strtolower($name)]);
  33868. }
  33869. public function getStyle($name)
  33870. {
  33871. if (!$this->hasStyle($name)) {
  33872. throw new InvalidArgumentException(sprintf('Undefined style: %s', $name));
  33873. }
  33874. return $this->styles[strtolower($name)];
  33875. }
  33876. public function format($message)
  33877. {
  33878. $message = (string) $message;
  33879. $offset = 0;
  33880. $output = '';
  33881. $tagRegex = '[a-z][a-z0-9_=;-]*+';
  33882. preg_match_all("#<(($tagRegex) | /($tagRegex)?)>#ix", $message, $matches, PREG_OFFSET_CAPTURE);
  33883. foreach ($matches[0] as $i => $match) {
  33884. $pos = $match[1];
  33885. $text = $match[0];
  33886. if (0 != $pos && '\\' == $message[$pos - 1]) {
  33887. continue;
  33888. }
  33889. $output .= $this->applyCurrentStyle(substr($message, $offset, $pos - $offset));
  33890. $offset = $pos + \strlen($text);
  33891. if ($open = '/' != $text[1]) {
  33892. $tag = $matches[1][$i][0];
  33893. } else {
  33894. $tag = isset($matches[3][$i][0]) ? $matches[3][$i][0] : '';
  33895. }
  33896. if (!$open && !$tag) {
  33897. $this->styleStack->pop();
  33898. } elseif (false === $style = $this->createStyleFromString(strtolower($tag))) {
  33899. $output .= $this->applyCurrentStyle($text);
  33900. } elseif ($open) {
  33901. $this->styleStack->push($style);
  33902. } else {
  33903. $this->styleStack->pop($style);
  33904. }
  33905. }
  33906. $output .= $this->applyCurrentStyle(substr($message, $offset));
  33907. if (false !== strpos($output, "\0")) {
  33908. return strtr($output, array("\0" => '\\', '\\<' => '<'));
  33909. }
  33910. return str_replace('\\<', '<', $output);
  33911. }
  33912. public function getStyleStack()
  33913. {
  33914. return $this->styleStack;
  33915. }
  33916. private function createStyleFromString($string)
  33917. {
  33918. if (isset($this->styles[$string])) {
  33919. return $this->styles[$string];
  33920. }
  33921. if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', strtolower($string), $matches, PREG_SET_ORDER)) {
  33922. return false;
  33923. }
  33924. $style = new OutputFormatterStyle();
  33925. foreach ($matches as $match) {
  33926. array_shift($match);
  33927. if ('fg' == $match[0]) {
  33928. $style->setForeground($match[1]);
  33929. } elseif ('bg' == $match[0]) {
  33930. $style->setBackground($match[1]);
  33931. } else {
  33932. try {
  33933. $style->setOption($match[1]);
  33934. } catch (\InvalidArgumentException $e) {
  33935. return false;
  33936. }
  33937. }
  33938. }
  33939. return $style;
  33940. }
  33941. private function applyCurrentStyle($text)
  33942. {
  33943. return $this->isDecorated() && \strlen($text) > 0 ? $this->styleStack->getCurrent()->apply($text) : $text;
  33944. }
  33945. }
  33946. <?php
  33947. namespace Symfony\Component\Console\Formatter;
  33948. interface OutputFormatterInterface
  33949. {
  33950. public function setDecorated($decorated);
  33951. public function isDecorated();
  33952. public function setStyle($name, OutputFormatterStyleInterface $style);
  33953. public function hasStyle($name);
  33954. public function getStyle($name);
  33955. public function format($message);
  33956. }
  33957. <?php
  33958. namespace Symfony\Component\Console\Formatter;
  33959. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33960. class OutputFormatterStyle implements OutputFormatterStyleInterface
  33961. {
  33962. private static $availableForegroundColors = array(
  33963. 'black' => array('set' => 30, 'unset' => 39),
  33964. 'red' => array('set' => 31, 'unset' => 39),
  33965. 'green' => array('set' => 32, 'unset' => 39),
  33966. 'yellow' => array('set' => 33, 'unset' => 39),
  33967. 'blue' => array('set' => 34, 'unset' => 39),
  33968. 'magenta' => array('set' => 35, 'unset' => 39),
  33969. 'cyan' => array('set' => 36, 'unset' => 39),
  33970. 'white' => array('set' => 37, 'unset' => 39),
  33971. 'default' => array('set' => 39, 'unset' => 39),
  33972. );
  33973. private static $availableBackgroundColors = array(
  33974. 'black' => array('set' => 40, 'unset' => 49),
  33975. 'red' => array('set' => 41, 'unset' => 49),
  33976. 'green' => array('set' => 42, 'unset' => 49),
  33977. 'yellow' => array('set' => 43, 'unset' => 49),
  33978. 'blue' => array('set' => 44, 'unset' => 49),
  33979. 'magenta' => array('set' => 45, 'unset' => 49),
  33980. 'cyan' => array('set' => 46, 'unset' => 49),
  33981. 'white' => array('set' => 47, 'unset' => 49),
  33982. 'default' => array('set' => 49, 'unset' => 49),
  33983. );
  33984. private static $availableOptions = array(
  33985. 'bold' => array('set' => 1, 'unset' => 22),
  33986. 'underscore' => array('set' => 4, 'unset' => 24),
  33987. 'blink' => array('set' => 5, 'unset' => 25),
  33988. 'reverse' => array('set' => 7, 'unset' => 27),
  33989. 'conceal' => array('set' => 8, 'unset' => 28),
  33990. );
  33991. private $foreground;
  33992. private $background;
  33993. private $options = array();
  33994. public function __construct($foreground = null, $background = null, array $options = array())
  33995. {
  33996. if (null !== $foreground) {
  33997. $this->setForeground($foreground);
  33998. }
  33999. if (null !== $background) {
  34000. $this->setBackground($background);
  34001. }
  34002. if (\count($options)) {
  34003. $this->setOptions($options);
  34004. }
  34005. }
  34006. public function setForeground($color = null)
  34007. {
  34008. if (null === $color) {
  34009. $this->foreground = null;
  34010. return;
  34011. }
  34012. if (!isset(static::$availableForegroundColors[$color])) {
  34013. throw new InvalidArgumentException(sprintf('Invalid foreground color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableForegroundColors))));
  34014. }
  34015. $this->foreground = static::$availableForegroundColors[$color];
  34016. }
  34017. public function setBackground($color = null)
  34018. {
  34019. if (null === $color) {
  34020. $this->background = null;
  34021. return;
  34022. }
  34023. if (!isset(static::$availableBackgroundColors[$color])) {
  34024. throw new InvalidArgumentException(sprintf('Invalid background color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableBackgroundColors))));
  34025. }
  34026. $this->background = static::$availableBackgroundColors[$color];
  34027. }
  34028. public function setOption($option)
  34029. {
  34030. if (!isset(static::$availableOptions[$option])) {
  34031. throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions))));
  34032. }
  34033. if (!\in_array(static::$availableOptions[$option], $this->options)) {
  34034. $this->options[] = static::$availableOptions[$option];
  34035. }
  34036. }
  34037. public function unsetOption($option)
  34038. {
  34039. if (!isset(static::$availableOptions[$option])) {
  34040. throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions))));
  34041. }
  34042. $pos = array_search(static::$availableOptions[$option], $this->options);
  34043. if (false !== $pos) {
  34044. unset($this->options[$pos]);
  34045. }
  34046. }
  34047. public function setOptions(array $options)
  34048. {
  34049. $this->options = array();
  34050. foreach ($options as $option) {
  34051. $this->setOption($option);
  34052. }
  34053. }
  34054. public function apply($text)
  34055. {
  34056. $setCodes = array();
  34057. $unsetCodes = array();
  34058. if (null !== $this->foreground) {
  34059. $setCodes[] = $this->foreground['set'];
  34060. $unsetCodes[] = $this->foreground['unset'];
  34061. }
  34062. if (null !== $this->background) {
  34063. $setCodes[] = $this->background['set'];
  34064. $unsetCodes[] = $this->background['unset'];
  34065. }
  34066. if (\count($this->options)) {
  34067. foreach ($this->options as $option) {
  34068. $setCodes[] = $option['set'];
  34069. $unsetCodes[] = $option['unset'];
  34070. }
  34071. }
  34072. if (0 === \count($setCodes)) {
  34073. return $text;
  34074. }
  34075. return sprintf("\033[%sm%s\033[%sm", implode(';', $setCodes), $text, implode(';', $unsetCodes));
  34076. }
  34077. }
  34078. <?php
  34079. namespace Symfony\Component\Console\Formatter;
  34080. interface OutputFormatterStyleInterface
  34081. {
  34082. public function setForeground($color = null);
  34083. public function setBackground($color = null);
  34084. public function setOption($option);
  34085. public function unsetOption($option);
  34086. public function setOptions(array $options);
  34087. public function apply($text);
  34088. }
  34089. <?php
  34090. namespace Symfony\Component\Console\Formatter;
  34091. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34092. class OutputFormatterStyleStack
  34093. {
  34094. private $styles;
  34095. private $emptyStyle;
  34096. public function __construct(OutputFormatterStyleInterface $emptyStyle = null)
  34097. {
  34098. $this->emptyStyle = $emptyStyle ?: new OutputFormatterStyle();
  34099. $this->reset();
  34100. }
  34101. public function reset()
  34102. {
  34103. $this->styles = array();
  34104. }
  34105. public function push(OutputFormatterStyleInterface $style)
  34106. {
  34107. $this->styles[] = $style;
  34108. }
  34109. public function pop(OutputFormatterStyleInterface $style = null)
  34110. {
  34111. if (empty($this->styles)) {
  34112. return $this->emptyStyle;
  34113. }
  34114. if (null === $style) {
  34115. return array_pop($this->styles);
  34116. }
  34117. foreach (array_reverse($this->styles, true) as $index => $stackedStyle) {
  34118. if ($style->apply('') === $stackedStyle->apply('')) {
  34119. $this->styles = \array_slice($this->styles, 0, $index);
  34120. return $stackedStyle;
  34121. }
  34122. }
  34123. throw new InvalidArgumentException('Incorrectly nested style tag found.');
  34124. }
  34125. public function getCurrent()
  34126. {
  34127. if (empty($this->styles)) {
  34128. return $this->emptyStyle;
  34129. }
  34130. return $this->styles[\count($this->styles) - 1];
  34131. }
  34132. public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle)
  34133. {
  34134. $this->emptyStyle = $emptyStyle;
  34135. return $this;
  34136. }
  34137. public function getEmptyStyle()
  34138. {
  34139. return $this->emptyStyle;
  34140. }
  34141. }
  34142. <?php
  34143. namespace Symfony\Component\Console\Helper;
  34144. class DebugFormatterHelper extends Helper
  34145. {
  34146. private $colors = array('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default');
  34147. private $started = array();
  34148. private $count = -1;
  34149. public function start($id, $message, $prefix = 'RUN')
  34150. {
  34151. $this->started[$id] = array('border' => ++$this->count % \count($this->colors));
  34152. return sprintf("%s<bg=blue;fg=white> %s </> <fg=blue>%s</>\n", $this->getBorder($id), $prefix, $message);
  34153. }
  34154. public function progress($id, $buffer, $error = false, $prefix = 'OUT', $errorPrefix = 'ERR')
  34155. {
  34156. $message = '';
  34157. if ($error) {
  34158. if (isset($this->started[$id]['out'])) {
  34159. $message .= "\n";
  34160. unset($this->started[$id]['out']);
  34161. }
  34162. if (!isset($this->started[$id]['err'])) {
  34163. $message .= sprintf('%s<bg=red;fg=white> %s </> ', $this->getBorder($id), $errorPrefix);
  34164. $this->started[$id]['err'] = true;
  34165. }
  34166. $message .= str_replace("\n", sprintf("\n%s<bg=red;fg=white> %s </> ", $this->getBorder($id), $errorPrefix), $buffer);
  34167. } else {
  34168. if (isset($this->started[$id]['err'])) {
  34169. $message .= "\n";
  34170. unset($this->started[$id]['err']);
  34171. }
  34172. if (!isset($this->started[$id]['out'])) {
  34173. $message .= sprintf('%s<bg=green;fg=white> %s </> ', $this->getBorder($id), $prefix);
  34174. $this->started[$id]['out'] = true;
  34175. }
  34176. $message .= str_replace("\n", sprintf("\n%s<bg=green;fg=white> %s </> ", $this->getBorder($id), $prefix), $buffer);
  34177. }
  34178. return $message;
  34179. }
  34180. public function stop($id, $message, $successful, $prefix = 'RES')
  34181. {
  34182. $trailingEOL = isset($this->started[$id]['out']) || isset($this->started[$id]['err']) ? "\n" : '';
  34183. if ($successful) {
  34184. return sprintf("%s%s<bg=green;fg=white> %s </> <fg=green>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  34185. }
  34186. $message = sprintf("%s%s<bg=red;fg=white> %s </> <fg=red>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  34187. unset($this->started[$id]['out'], $this->started[$id]['err']);
  34188. return $message;
  34189. }
  34190. private function getBorder($id)
  34191. {
  34192. return sprintf('<bg=%s> </>', $this->colors[$this->started[$id]['border']]);
  34193. }
  34194. public function getName()
  34195. {
  34196. return 'debug_formatter';
  34197. }
  34198. }
  34199. <?php
  34200. namespace Symfony\Component\Console\Helper;
  34201. use Symfony\Component\Console\Descriptor\DescriptorInterface;
  34202. use Symfony\Component\Console\Descriptor\JsonDescriptor;
  34203. use Symfony\Component\Console\Descriptor\MarkdownDescriptor;
  34204. use Symfony\Component\Console\Descriptor\TextDescriptor;
  34205. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  34206. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34207. use Symfony\Component\Console\Output\OutputInterface;
  34208. class DescriptorHelper extends Helper
  34209. {
  34210. private $descriptors = array();
  34211. public function __construct()
  34212. {
  34213. $this
  34214. ->register('txt', new TextDescriptor())
  34215. ->register('xml', new XmlDescriptor())
  34216. ->register('json', new JsonDescriptor())
  34217. ->register('md', new MarkdownDescriptor())
  34218. ;
  34219. }
  34220. public function describe(OutputInterface $output, $object, array $options = array())
  34221. {
  34222. $options = array_merge(array(
  34223. 'raw_text' => false,
  34224. 'format' => 'txt',
  34225. ), $options);
  34226. if (!isset($this->descriptors[$options['format']])) {
  34227. throw new InvalidArgumentException(sprintf('Unsupported format "%s".', $options['format']));
  34228. }
  34229. $descriptor = $this->descriptors[$options['format']];
  34230. $descriptor->describe($output, $object, $options);
  34231. }
  34232. public function register($format, DescriptorInterface $descriptor)
  34233. {
  34234. $this->descriptors[$format] = $descriptor;
  34235. return $this;
  34236. }
  34237. public function getName()
  34238. {
  34239. return 'descriptor';
  34240. }
  34241. }
  34242. <?php
  34243. namespace Symfony\Component\Console\Helper;
  34244. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34245. use Symfony\Component\Console\Exception\RuntimeException;
  34246. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  34247. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  34248. use Symfony\Component\Console\Output\OutputInterface;
  34249. class DialogHelper extends InputAwareHelper
  34250. {
  34251. private $inputStream;
  34252. private static $shell;
  34253. private static $stty;
  34254. public function __construct($triggerDeprecationError = true)
  34255. {
  34256. if ($triggerDeprecationError) {
  34257. @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);
  34258. }
  34259. }
  34260. public function select(OutputInterface $output, $question, $choices, $default = null, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  34261. {
  34262. if ($output instanceof ConsoleOutputInterface) {
  34263. $output = $output->getErrorOutput();
  34264. }
  34265. $width = max(array_map('strlen', array_keys($choices)));
  34266. $messages = (array) $question;
  34267. foreach ($choices as $key => $value) {
  34268. $messages[] = sprintf(" [<info>%-{$width}s</info>] %s", $key, $value);
  34269. }
  34270. $output->writeln($messages);
  34271. $result = $this->askAndValidate($output, '> ', function ($picked) use ($choices, $errorMessage, $multiselect) {
  34272. $selectedChoices = str_replace(' ', '', $picked);
  34273. if ($multiselect) {
  34274. if (!preg_match('/^[a-zA-Z0-9_-]+(?:,[a-zA-Z0-9_-]+)*$/', $selectedChoices, $matches)) {
  34275. throw new InvalidArgumentException(sprintf($errorMessage, $picked));
  34276. }
  34277. $selectedChoices = explode(',', $selectedChoices);
  34278. } else {
  34279. $selectedChoices = array($picked);
  34280. }
  34281. $multiselectChoices = array();
  34282. foreach ($selectedChoices as $value) {
  34283. if (empty($choices[$value])) {
  34284. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  34285. }
  34286. $multiselectChoices[] = $value;
  34287. }
  34288. if ($multiselect) {
  34289. return $multiselectChoices;
  34290. }
  34291. return $picked;
  34292. }, $attempts, $default);
  34293. return $result;
  34294. }
  34295. public function ask(OutputInterface $output, $question, $default = null, array $autocomplete = null)
  34296. {
  34297. if ($this->input && !$this->input->isInteractive()) {
  34298. return $default;
  34299. }
  34300. if ($output instanceof ConsoleOutputInterface) {
  34301. $output = $output->getErrorOutput();
  34302. }
  34303. $output->write($question);
  34304. $inputStream = $this->inputStream ?: STDIN;
  34305. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  34306. $ret = fgets($inputStream, 4096);
  34307. if (false === $ret) {
  34308. throw new RuntimeException('Aborted');
  34309. }
  34310. $ret = trim($ret);
  34311. } else {
  34312. $ret = '';
  34313. $i = 0;
  34314. $ofs = -1;
  34315. $matches = $autocomplete;
  34316. $numMatches = \count($matches);
  34317. $sttyMode = shell_exec('stty -g');
  34318. shell_exec('stty -icanon -echo');
  34319. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  34320. while (!feof($inputStream)) {
  34321. $c = fread($inputStream, 1);
  34322. if ("\177" === $c) {
  34323. if (0 === $numMatches && 0 !== $i) {
  34324. --$i;
  34325. $output->write("\033[1D");
  34326. }
  34327. if (0 === $i) {
  34328. $ofs = -1;
  34329. $matches = $autocomplete;
  34330. $numMatches = \count($matches);
  34331. } else {
  34332. $numMatches = 0;
  34333. }
  34334. $ret = substr($ret, 0, $i);
  34335. } elseif ("\033" === $c) {
  34336. $c .= fread($inputStream, 2);
  34337. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  34338. if ('A' === $c[2] && -1 === $ofs) {
  34339. $ofs = 0;
  34340. }
  34341. if (0 === $numMatches) {
  34342. continue;
  34343. }
  34344. $ofs += ('A' === $c[2]) ? -1 : 1;
  34345. $ofs = ($numMatches + $ofs) % $numMatches;
  34346. }
  34347. } elseif (\ord($c) < 32) {
  34348. if ("\t" === $c || "\n" === $c) {
  34349. if ($numMatches > 0 && -1 !== $ofs) {
  34350. $ret = $matches[$ofs];
  34351. $output->write(substr($ret, $i));
  34352. $i = \strlen($ret);
  34353. }
  34354. if ("\n" === $c) {
  34355. $output->write($c);
  34356. break;
  34357. }
  34358. $numMatches = 0;
  34359. }
  34360. continue;
  34361. } else {
  34362. $output->write($c);
  34363. $ret .= $c;
  34364. ++$i;
  34365. $numMatches = 0;
  34366. $ofs = 0;
  34367. foreach ($autocomplete as $value) {
  34368. if (0 === strpos($value, $ret) && $i !== \strlen($value)) {
  34369. $matches[$numMatches++] = $value;
  34370. }
  34371. }
  34372. }
  34373. $output->write("\033[K");
  34374. if ($numMatches > 0 && -1 !== $ofs) {
  34375. $output->write("\0337");
  34376. $output->write('<hl>'.substr($matches[$ofs], $i).'</hl>');
  34377. $output->write("\0338");
  34378. }
  34379. }
  34380. shell_exec(sprintf('stty %s', $sttyMode));
  34381. }
  34382. return \strlen($ret) > 0 ? $ret : $default;
  34383. }
  34384. public function askConfirmation(OutputInterface $output, $question, $default = true)
  34385. {
  34386. $answer = 'z';
  34387. while ($answer && !\in_array(strtolower($answer[0]), array('y', 'n'))) {
  34388. $answer = $this->ask($output, $question);
  34389. }
  34390. if (false === $default) {
  34391. return $answer && 'y' == strtolower($answer[0]);
  34392. }
  34393. return !$answer || 'y' == strtolower($answer[0]);
  34394. }
  34395. public function askHiddenResponse(OutputInterface $output, $question, $fallback = true)
  34396. {
  34397. if ($output instanceof ConsoleOutputInterface) {
  34398. $output = $output->getErrorOutput();
  34399. }
  34400. if ('\\' === \DIRECTORY_SEPARATOR) {
  34401. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  34402. if ('phar:' === substr(__FILE__, 0, 5)) {
  34403. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  34404. copy($exe, $tmpExe);
  34405. $exe = $tmpExe;
  34406. }
  34407. $output->write($question);
  34408. $value = rtrim(shell_exec($exe));
  34409. $output->writeln('');
  34410. if (isset($tmpExe)) {
  34411. unlink($tmpExe);
  34412. }
  34413. return $value;
  34414. }
  34415. if ($this->hasSttyAvailable()) {
  34416. $output->write($question);
  34417. $sttyMode = shell_exec('stty -g');
  34418. shell_exec('stty -echo');
  34419. $value = fgets($this->inputStream ?: STDIN, 4096);
  34420. shell_exec(sprintf('stty %s', $sttyMode));
  34421. if (false === $value) {
  34422. throw new RuntimeException('Aborted');
  34423. }
  34424. $value = trim($value);
  34425. $output->writeln('');
  34426. return $value;
  34427. }
  34428. if (false !== $shell = $this->getShell()) {
  34429. $output->write($question);
  34430. $readCmd = 'csh' === $shell ? 'set mypassword = $<' : 'read -r mypassword';
  34431. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  34432. $value = rtrim(shell_exec($command));
  34433. $output->writeln('');
  34434. return $value;
  34435. }
  34436. if ($fallback) {
  34437. return $this->ask($output, $question);
  34438. }
  34439. throw new RuntimeException('Unable to hide the response');
  34440. }
  34441. public function askAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $default = null, array $autocomplete = null)
  34442. {
  34443. $that = $this;
  34444. $interviewer = function () use ($output, $question, $default, $autocomplete, $that) {
  34445. return $that->ask($output, $question, $default, $autocomplete);
  34446. };
  34447. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  34448. }
  34449. public function askHiddenResponseAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $fallback = true)
  34450. {
  34451. $that = $this;
  34452. $interviewer = function () use ($output, $question, $fallback, $that) {
  34453. return $that->askHiddenResponse($output, $question, $fallback);
  34454. };
  34455. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  34456. }
  34457. public function setInputStream($stream)
  34458. {
  34459. $this->inputStream = $stream;
  34460. }
  34461. public function getInputStream()
  34462. {
  34463. return $this->inputStream;
  34464. }
  34465. public function getName()
  34466. {
  34467. return 'dialog';
  34468. }
  34469. private function getShell()
  34470. {
  34471. if (null !== self::$shell) {
  34472. return self::$shell;
  34473. }
  34474. self::$shell = false;
  34475. if (file_exists('/usr/bin/env')) {
  34476. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  34477. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  34478. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  34479. self::$shell = $sh;
  34480. break;
  34481. }
  34482. }
  34483. }
  34484. return self::$shell;
  34485. }
  34486. private function hasSttyAvailable()
  34487. {
  34488. if (null !== self::$stty) {
  34489. return self::$stty;
  34490. }
  34491. exec('stty 2>&1', $output, $exitcode);
  34492. return self::$stty = 0 === $exitcode;
  34493. }
  34494. private function validateAttempts($interviewer, OutputInterface $output, $validator, $attempts)
  34495. {
  34496. if ($output instanceof ConsoleOutputInterface) {
  34497. $output = $output->getErrorOutput();
  34498. }
  34499. $e = null;
  34500. while (false === $attempts || $attempts--) {
  34501. if (null !== $e) {
  34502. $output->writeln($this->getHelperSet()->get('formatter')->formatBlock($e->getMessage(), 'error'));
  34503. }
  34504. try {
  34505. return \call_user_func($validator, $interviewer());
  34506. } catch (\Exception $e) {
  34507. }
  34508. }
  34509. throw $e;
  34510. }
  34511. }
  34512. <?php
  34513. namespace Symfony\Component\Console\Helper;
  34514. use Symfony\Component\Console\Formatter\OutputFormatter;
  34515. class FormatterHelper extends Helper
  34516. {
  34517. public function formatSection($section, $message, $style = 'info')
  34518. {
  34519. return sprintf('<%s>[%s]</%s> %s', $style, $section, $style, $message);
  34520. }
  34521. public function formatBlock($messages, $style, $large = false)
  34522. {
  34523. if (!\is_array($messages)) {
  34524. $messages = array($messages);
  34525. }
  34526. $len = 0;
  34527. $lines = array();
  34528. foreach ($messages as $message) {
  34529. $message = OutputFormatter::escape($message);
  34530. $lines[] = sprintf($large ? ' %s ' : ' %s ', $message);
  34531. $len = max($this->strlen($message) + ($large ? 4 : 2), $len);
  34532. }
  34533. $messages = $large ? array(str_repeat(' ', $len)) : array();
  34534. for ($i = 0; isset($lines[$i]); ++$i) {
  34535. $messages[] = $lines[$i].str_repeat(' ', $len - $this->strlen($lines[$i]));
  34536. }
  34537. if ($large) {
  34538. $messages[] = str_repeat(' ', $len);
  34539. }
  34540. for ($i = 0; isset($messages[$i]); ++$i) {
  34541. $messages[$i] = sprintf('<%s>%s</%s>', $style, $messages[$i], $style);
  34542. }
  34543. return implode("\n", $messages);
  34544. }
  34545. public function getName()
  34546. {
  34547. return 'formatter';
  34548. }
  34549. }
  34550. <?php
  34551. namespace Symfony\Component\Console\Helper;
  34552. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  34553. abstract class Helper implements HelperInterface
  34554. {
  34555. protected $helperSet = null;
  34556. public function setHelperSet(HelperSet $helperSet = null)
  34557. {
  34558. $this->helperSet = $helperSet;
  34559. }
  34560. public function getHelperSet()
  34561. {
  34562. return $this->helperSet;
  34563. }
  34564. public static function strlen($string)
  34565. {
  34566. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  34567. return \strlen($string);
  34568. }
  34569. return mb_strwidth($string, $encoding);
  34570. }
  34571. public static function formatTime($secs)
  34572. {
  34573. static $timeFormats = array(
  34574. array(0, '< 1 sec'),
  34575. array(1, '1 sec'),
  34576. array(2, 'secs', 1),
  34577. array(60, '1 min'),
  34578. array(120, 'mins', 60),
  34579. array(3600, '1 hr'),
  34580. array(7200, 'hrs', 3600),
  34581. array(86400, '1 day'),
  34582. array(172800, 'days', 86400),
  34583. );
  34584. foreach ($timeFormats as $index => $format) {
  34585. if ($secs >= $format[0]) {
  34586. if ((isset($timeFormats[$index + 1]) && $secs < $timeFormats[$index + 1][0])
  34587. || $index == \count($timeFormats) - 1
  34588. ) {
  34589. if (2 == \count($format)) {
  34590. return $format[1];
  34591. }
  34592. return floor($secs / $format[2]).' '.$format[1];
  34593. }
  34594. }
  34595. }
  34596. }
  34597. public static function formatMemory($memory)
  34598. {
  34599. if ($memory >= 1024 * 1024 * 1024) {
  34600. return sprintf('%.1f GiB', $memory / 1024 / 1024 / 1024);
  34601. }
  34602. if ($memory >= 1024 * 1024) {
  34603. return sprintf('%.1f MiB', $memory / 1024 / 1024);
  34604. }
  34605. if ($memory >= 1024) {
  34606. return sprintf('%d KiB', $memory / 1024);
  34607. }
  34608. return sprintf('%d B', $memory);
  34609. }
  34610. public static function strlenWithoutDecoration(OutputFormatterInterface $formatter, $string)
  34611. {
  34612. return self::strlen(self::removeDecoration($formatter, $string));
  34613. }
  34614. public static function removeDecoration(OutputFormatterInterface $formatter, $string)
  34615. {
  34616. $isDecorated = $formatter->isDecorated();
  34617. $formatter->setDecorated(false);
  34618. $string = $formatter->format($string);
  34619. $string = preg_replace("/\033\[[^m]*m/", '', $string);
  34620. $formatter->setDecorated($isDecorated);
  34621. return $string;
  34622. }
  34623. }
  34624. <?php
  34625. namespace Symfony\Component\Console\Helper;
  34626. interface HelperInterface
  34627. {
  34628. public function setHelperSet(HelperSet $helperSet = null);
  34629. public function getHelperSet();
  34630. public function getName();
  34631. }
  34632. <?php
  34633. namespace Symfony\Component\Console\Helper;
  34634. use Symfony\Component\Console\Command\Command;
  34635. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34636. class HelperSet implements \IteratorAggregate
  34637. {
  34638. private $helpers = array();
  34639. private $command;
  34640. public function __construct(array $helpers = array())
  34641. {
  34642. foreach ($helpers as $alias => $helper) {
  34643. $this->set($helper, \is_int($alias) ? null : $alias);
  34644. }
  34645. }
  34646. public function set(HelperInterface $helper, $alias = null)
  34647. {
  34648. $this->helpers[$helper->getName()] = $helper;
  34649. if (null !== $alias) {
  34650. $this->helpers[$alias] = $helper;
  34651. }
  34652. $helper->setHelperSet($this);
  34653. }
  34654. public function has($name)
  34655. {
  34656. return isset($this->helpers[$name]);
  34657. }
  34658. public function get($name)
  34659. {
  34660. if (!$this->has($name)) {
  34661. throw new InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name));
  34662. }
  34663. if ('dialog' === $name && $this->helpers[$name] instanceof DialogHelper) {
  34664. @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);
  34665. } elseif ('progress' === $name && $this->helpers[$name] instanceof ProgressHelper) {
  34666. @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);
  34667. } elseif ('table' === $name && $this->helpers[$name] instanceof TableHelper) {
  34668. @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);
  34669. }
  34670. return $this->helpers[$name];
  34671. }
  34672. public function setCommand(Command $command = null)
  34673. {
  34674. $this->command = $command;
  34675. }
  34676. public function getCommand()
  34677. {
  34678. return $this->command;
  34679. }
  34680. public function getIterator()
  34681. {
  34682. return new \ArrayIterator($this->helpers);
  34683. }
  34684. }
  34685. <?php
  34686. namespace Symfony\Component\Console\Helper;
  34687. use Symfony\Component\Console\Input\InputAwareInterface;
  34688. use Symfony\Component\Console\Input\InputInterface;
  34689. abstract class InputAwareHelper extends Helper implements InputAwareInterface
  34690. {
  34691. protected $input;
  34692. public function setInput(InputInterface $input)
  34693. {
  34694. $this->input = $input;
  34695. }
  34696. }
  34697. <?php
  34698. namespace Symfony\Component\Console\Helper;
  34699. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  34700. use Symfony\Component\Console\Output\OutputInterface;
  34701. use Symfony\Component\Process\Exception\ProcessFailedException;
  34702. use Symfony\Component\Process\Process;
  34703. use Symfony\Component\Process\ProcessBuilder;
  34704. class ProcessHelper extends Helper
  34705. {
  34706. public function run(OutputInterface $output, $cmd, $error = null, $callback = null, $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE)
  34707. {
  34708. if ($output instanceof ConsoleOutputInterface) {
  34709. $output = $output->getErrorOutput();
  34710. }
  34711. $formatter = $this->getHelperSet()->get('debug_formatter');
  34712. if (\is_array($cmd)) {
  34713. $process = ProcessBuilder::create($cmd)->getProcess();
  34714. } elseif ($cmd instanceof Process) {
  34715. $process = $cmd;
  34716. } else {
  34717. $process = new Process($cmd);
  34718. }
  34719. if ($verbosity <= $output->getVerbosity()) {
  34720. $output->write($formatter->start(spl_object_hash($process), $this->escapeString($process->getCommandLine())));
  34721. }
  34722. if ($output->isDebug()) {
  34723. $callback = $this->wrapCallback($output, $process, $callback);
  34724. }
  34725. $process->run($callback);
  34726. if ($verbosity <= $output->getVerbosity()) {
  34727. $message = $process->isSuccessful() ? 'Command ran successfully' : sprintf('%s Command did not run successfully', $process->getExitCode());
  34728. $output->write($formatter->stop(spl_object_hash($process), $message, $process->isSuccessful()));
  34729. }
  34730. if (!$process->isSuccessful() && null !== $error) {
  34731. $output->writeln(sprintf('<error>%s</error>', $this->escapeString($error)));
  34732. }
  34733. return $process;
  34734. }
  34735. public function mustRun(OutputInterface $output, $cmd, $error = null, $callback = null)
  34736. {
  34737. $process = $this->run($output, $cmd, $error, $callback);
  34738. if (!$process->isSuccessful()) {
  34739. throw new ProcessFailedException($process);
  34740. }
  34741. return $process;
  34742. }
  34743. public function wrapCallback(OutputInterface $output, Process $process, $callback = null)
  34744. {
  34745. if ($output instanceof ConsoleOutputInterface) {
  34746. $output = $output->getErrorOutput();
  34747. }
  34748. $formatter = $this->getHelperSet()->get('debug_formatter');
  34749. $that = $this;
  34750. return function ($type, $buffer) use ($output, $process, $callback, $formatter, $that) {
  34751. $output->write($formatter->progress(spl_object_hash($process), $that->escapeString($buffer), Process::ERR === $type));
  34752. if (null !== $callback) {
  34753. \call_user_func($callback, $type, $buffer);
  34754. }
  34755. };
  34756. }
  34757. public function escapeString($str)
  34758. {
  34759. return str_replace('<', '\\<', $str);
  34760. }
  34761. public function getName()
  34762. {
  34763. return 'process';
  34764. }
  34765. }
  34766. <?php
  34767. namespace Symfony\Component\Console\Helper;
  34768. use Symfony\Component\Console\Exception\LogicException;
  34769. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  34770. use Symfony\Component\Console\Output\OutputInterface;
  34771. class ProgressBar
  34772. {
  34773. private $barWidth = 28;
  34774. private $barChar;
  34775. private $emptyBarChar = '-';
  34776. private $progressChar = '>';
  34777. private $format;
  34778. private $internalFormat;
  34779. private $redrawFreq = 1;
  34780. private $output;
  34781. private $step = 0;
  34782. private $max;
  34783. private $startTime;
  34784. private $stepWidth;
  34785. private $percent = 0.0;
  34786. private $formatLineCount;
  34787. private $messages = array();
  34788. private $overwrite = true;
  34789. private $firstRun = true;
  34790. private static $formatters;
  34791. private static $formats;
  34792. public function __construct(OutputInterface $output, $max = 0)
  34793. {
  34794. if ($output instanceof ConsoleOutputInterface) {
  34795. $output = $output->getErrorOutput();
  34796. }
  34797. $this->output = $output;
  34798. $this->setMaxSteps($max);
  34799. if (!$this->output->isDecorated()) {
  34800. $this->overwrite = false;
  34801. $this->setRedrawFrequency($max / 10);
  34802. }
  34803. $this->startTime = time();
  34804. }
  34805. public static function setPlaceholderFormatterDefinition($name, $callable)
  34806. {
  34807. if (!self::$formatters) {
  34808. self::$formatters = self::initPlaceholderFormatters();
  34809. }
  34810. self::$formatters[$name] = $callable;
  34811. }
  34812. public static function getPlaceholderFormatterDefinition($name)
  34813. {
  34814. if (!self::$formatters) {
  34815. self::$formatters = self::initPlaceholderFormatters();
  34816. }
  34817. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  34818. }
  34819. public static function setFormatDefinition($name, $format)
  34820. {
  34821. if (!self::$formats) {
  34822. self::$formats = self::initFormats();
  34823. }
  34824. self::$formats[$name] = $format;
  34825. }
  34826. public static function getFormatDefinition($name)
  34827. {
  34828. if (!self::$formats) {
  34829. self::$formats = self::initFormats();
  34830. }
  34831. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  34832. }
  34833. public function setMessage($message, $name = 'message')
  34834. {
  34835. $this->messages[$name] = $message;
  34836. }
  34837. public function getMessage($name = 'message')
  34838. {
  34839. return $this->messages[$name];
  34840. }
  34841. public function getStartTime()
  34842. {
  34843. return $this->startTime;
  34844. }
  34845. public function getMaxSteps()
  34846. {
  34847. return $this->max;
  34848. }
  34849. public function getStep()
  34850. {
  34851. @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);
  34852. return $this->getProgress();
  34853. }
  34854. public function getProgress()
  34855. {
  34856. return $this->step;
  34857. }
  34858. public function getStepWidth()
  34859. {
  34860. return $this->stepWidth;
  34861. }
  34862. public function getProgressPercent()
  34863. {
  34864. return $this->percent;
  34865. }
  34866. public function setBarWidth($size)
  34867. {
  34868. $this->barWidth = (int) $size;
  34869. }
  34870. public function getBarWidth()
  34871. {
  34872. return $this->barWidth;
  34873. }
  34874. public function setBarCharacter($char)
  34875. {
  34876. $this->barChar = $char;
  34877. }
  34878. public function getBarCharacter()
  34879. {
  34880. if (null === $this->barChar) {
  34881. return $this->max ? '=' : $this->emptyBarChar;
  34882. }
  34883. return $this->barChar;
  34884. }
  34885. public function setEmptyBarCharacter($char)
  34886. {
  34887. $this->emptyBarChar = $char;
  34888. }
  34889. public function getEmptyBarCharacter()
  34890. {
  34891. return $this->emptyBarChar;
  34892. }
  34893. public function setProgressCharacter($char)
  34894. {
  34895. $this->progressChar = $char;
  34896. }
  34897. public function getProgressCharacter()
  34898. {
  34899. return $this->progressChar;
  34900. }
  34901. public function setFormat($format)
  34902. {
  34903. $this->format = null;
  34904. $this->internalFormat = $format;
  34905. }
  34906. public function setRedrawFrequency($freq)
  34907. {
  34908. $this->redrawFreq = max((int) $freq, 1);
  34909. }
  34910. public function start($max = null)
  34911. {
  34912. $this->startTime = time();
  34913. $this->step = 0;
  34914. $this->percent = 0.0;
  34915. if (null !== $max) {
  34916. $this->setMaxSteps($max);
  34917. }
  34918. $this->display();
  34919. }
  34920. public function advance($step = 1)
  34921. {
  34922. $this->setProgress($this->step + $step);
  34923. }
  34924. public function setCurrent($step)
  34925. {
  34926. @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);
  34927. $this->setProgress($step);
  34928. }
  34929. public function setOverwrite($overwrite)
  34930. {
  34931. $this->overwrite = (bool) $overwrite;
  34932. }
  34933. public function setProgress($step)
  34934. {
  34935. $step = (int) $step;
  34936. if ($step < $this->step) {
  34937. throw new LogicException('You can\'t regress the progress bar.');
  34938. }
  34939. if ($this->max && $step > $this->max) {
  34940. $this->max = $step;
  34941. }
  34942. $prevPeriod = (int) ($this->step / $this->redrawFreq);
  34943. $currPeriod = (int) ($step / $this->redrawFreq);
  34944. $this->step = $step;
  34945. $this->percent = $this->max ? (float) $this->step / $this->max : 0;
  34946. if ($prevPeriod !== $currPeriod || $this->max === $step) {
  34947. $this->display();
  34948. }
  34949. }
  34950. public function finish()
  34951. {
  34952. if (!$this->max) {
  34953. $this->max = $this->step;
  34954. }
  34955. if ($this->step === $this->max && !$this->overwrite) {
  34956. return;
  34957. }
  34958. $this->setProgress($this->max);
  34959. }
  34960. public function display()
  34961. {
  34962. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  34963. return;
  34964. }
  34965. if (null === $this->format) {
  34966. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  34967. }
  34968. $self = $this;
  34969. $output = $this->output;
  34970. $messages = $this->messages;
  34971. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self, $output, $messages) {
  34972. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  34973. $text = \call_user_func($formatter, $self, $output);
  34974. } elseif (isset($messages[$matches[1]])) {
  34975. $text = $messages[$matches[1]];
  34976. } else {
  34977. return $matches[0];
  34978. }
  34979. if (isset($matches[2])) {
  34980. $text = sprintf('%'.$matches[2], $text);
  34981. }
  34982. return $text;
  34983. }, $this->format));
  34984. }
  34985. public function clear()
  34986. {
  34987. if (!$this->overwrite) {
  34988. return;
  34989. }
  34990. if (null === $this->format) {
  34991. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  34992. }
  34993. $this->overwrite('');
  34994. }
  34995. private function setRealFormat($format)
  34996. {
  34997. if (!$this->max && null !== self::getFormatDefinition($format.'_nomax')) {
  34998. $this->format = self::getFormatDefinition($format.'_nomax');
  34999. } elseif (null !== self::getFormatDefinition($format)) {
  35000. $this->format = self::getFormatDefinition($format);
  35001. } else {
  35002. $this->format = $format;
  35003. }
  35004. $this->formatLineCount = substr_count($this->format, "\n");
  35005. }
  35006. private function setMaxSteps($max)
  35007. {
  35008. $this->max = max(0, (int) $max);
  35009. $this->stepWidth = $this->max ? Helper::strlen($this->max) : 4;
  35010. }
  35011. private function overwrite($message)
  35012. {
  35013. if ($this->overwrite) {
  35014. if (!$this->firstRun) {
  35015. $this->output->write("\x0D");
  35016. $this->output->write("\x1B[2K");
  35017. if ($this->formatLineCount > 0) {
  35018. $this->output->write(str_repeat("\x1B[1A\x1B[2K", $this->formatLineCount));
  35019. }
  35020. }
  35021. } elseif ($this->step > 0) {
  35022. $this->output->writeln('');
  35023. }
  35024. $this->firstRun = false;
  35025. $this->output->write($message);
  35026. }
  35027. private function determineBestFormat()
  35028. {
  35029. switch ($this->output->getVerbosity()) {
  35030. case OutputInterface::VERBOSITY_VERBOSE:
  35031. return $this->max ? 'verbose' : 'verbose_nomax';
  35032. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  35033. return $this->max ? 'very_verbose' : 'very_verbose_nomax';
  35034. case OutputInterface::VERBOSITY_DEBUG:
  35035. return $this->max ? 'debug' : 'debug_nomax';
  35036. default:
  35037. return $this->max ? 'normal' : 'normal_nomax';
  35038. }
  35039. }
  35040. private static function initPlaceholderFormatters()
  35041. {
  35042. return array(
  35043. 'bar' => function (ProgressBar $bar, OutputInterface $output) {
  35044. $completeBars = floor($bar->getMaxSteps() > 0 ? $bar->getProgressPercent() * $bar->getBarWidth() : $bar->getProgress() % $bar->getBarWidth());
  35045. $display = str_repeat($bar->getBarCharacter(), $completeBars);
  35046. if ($completeBars < $bar->getBarWidth()) {
  35047. $emptyBars = $bar->getBarWidth() - $completeBars - Helper::strlenWithoutDecoration($output->getFormatter(), $bar->getProgressCharacter());
  35048. $display .= $bar->getProgressCharacter().str_repeat($bar->getEmptyBarCharacter(), $emptyBars);
  35049. }
  35050. return $display;
  35051. },
  35052. 'elapsed' => function (ProgressBar $bar) {
  35053. return Helper::formatTime(time() - $bar->getStartTime());
  35054. },
  35055. 'remaining' => function (ProgressBar $bar) {
  35056. if (!$bar->getMaxSteps()) {
  35057. throw new LogicException('Unable to display the remaining time if the maximum number of steps is not set.');
  35058. }
  35059. if (!$bar->getProgress()) {
  35060. $remaining = 0;
  35061. } else {
  35062. $remaining = round((time() - $bar->getStartTime()) / $bar->getProgress() * ($bar->getMaxSteps() - $bar->getProgress()));
  35063. }
  35064. return Helper::formatTime($remaining);
  35065. },
  35066. 'estimated' => function (ProgressBar $bar) {
  35067. if (!$bar->getMaxSteps()) {
  35068. throw new LogicException('Unable to display the estimated time if the maximum number of steps is not set.');
  35069. }
  35070. if (!$bar->getProgress()) {
  35071. $estimated = 0;
  35072. } else {
  35073. $estimated = round((time() - $bar->getStartTime()) / $bar->getProgress() * $bar->getMaxSteps());
  35074. }
  35075. return Helper::formatTime($estimated);
  35076. },
  35077. 'memory' => function (ProgressBar $bar) {
  35078. return Helper::formatMemory(memory_get_usage(true));
  35079. },
  35080. 'current' => function (ProgressBar $bar) {
  35081. return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', STR_PAD_LEFT);
  35082. },
  35083. 'max' => function (ProgressBar $bar) {
  35084. return $bar->getMaxSteps();
  35085. },
  35086. 'percent' => function (ProgressBar $bar) {
  35087. return floor($bar->getProgressPercent() * 100);
  35088. },
  35089. );
  35090. }
  35091. private static function initFormats()
  35092. {
  35093. return array(
  35094. 'normal' => ' %current%/%max% [%bar%] %percent:3s%%',
  35095. 'normal_nomax' => ' %current% [%bar%]',
  35096. 'verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%',
  35097. 'verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  35098. 'very_verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s%',
  35099. 'very_verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  35100. 'debug' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%',
  35101. 'debug_nomax' => ' %current% [%bar%] %elapsed:6s% %memory:6s%',
  35102. );
  35103. }
  35104. }
  35105. <?php
  35106. namespace Symfony\Component\Console\Helper;
  35107. use Symfony\Component\Console\Exception\LogicException;
  35108. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  35109. use Symfony\Component\Console\Output\NullOutput;
  35110. use Symfony\Component\Console\Output\OutputInterface;
  35111. class ProgressHelper extends Helper
  35112. {
  35113. const FORMAT_QUIET = ' %percent%%';
  35114. const FORMAT_NORMAL = ' %current%/%max% [%bar%] %percent%%';
  35115. const FORMAT_VERBOSE = ' %current%/%max% [%bar%] %percent%% Elapsed: %elapsed%';
  35116. const FORMAT_QUIET_NOMAX = ' %current%';
  35117. const FORMAT_NORMAL_NOMAX = ' %current% [%bar%]';
  35118. const FORMAT_VERBOSE_NOMAX = ' %current% [%bar%] Elapsed: %elapsed%';
  35119. private $barWidth = 28;
  35120. private $barChar = '=';
  35121. private $emptyBarChar = '-';
  35122. private $progressChar = '>';
  35123. private $format = null;
  35124. private $redrawFreq = 1;
  35125. private $lastMessagesLength;
  35126. private $barCharOriginal;
  35127. private $output;
  35128. private $current;
  35129. private $max;
  35130. private $startTime;
  35131. private $defaultFormatVars = array(
  35132. 'current',
  35133. 'max',
  35134. 'bar',
  35135. 'percent',
  35136. 'elapsed',
  35137. );
  35138. private $formatVars;
  35139. private $widths = array(
  35140. 'current' => 4,
  35141. 'max' => 4,
  35142. 'percent' => 3,
  35143. 'elapsed' => 6,
  35144. );
  35145. private $timeFormats = array(
  35146. array(0, '???'),
  35147. array(2, '1 sec'),
  35148. array(59, 'secs', 1),
  35149. array(60, '1 min'),
  35150. array(3600, 'mins', 60),
  35151. array(5400, '1 hr'),
  35152. array(86400, 'hrs', 3600),
  35153. array(129600, '1 day'),
  35154. array(604800, 'days', 86400),
  35155. );
  35156. public function __construct($triggerDeprecationError = true)
  35157. {
  35158. if ($triggerDeprecationError) {
  35159. @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);
  35160. }
  35161. }
  35162. public function setBarWidth($size)
  35163. {
  35164. $this->barWidth = (int) $size;
  35165. }
  35166. public function setBarCharacter($char)
  35167. {
  35168. $this->barChar = $char;
  35169. }
  35170. public function setEmptyBarCharacter($char)
  35171. {
  35172. $this->emptyBarChar = $char;
  35173. }
  35174. public function setProgressCharacter($char)
  35175. {
  35176. $this->progressChar = $char;
  35177. }
  35178. public function setFormat($format)
  35179. {
  35180. $this->format = $format;
  35181. }
  35182. public function setRedrawFrequency($freq)
  35183. {
  35184. $this->redrawFreq = (int) $freq;
  35185. }
  35186. public function start(OutputInterface $output, $max = null)
  35187. {
  35188. if ($output instanceof ConsoleOutputInterface) {
  35189. $output = $output->getErrorOutput();
  35190. }
  35191. $this->startTime = time();
  35192. $this->current = 0;
  35193. $this->max = (int) $max;
  35194. $this->output = $output->isDecorated() ? $output : new NullOutput();
  35195. $this->lastMessagesLength = 0;
  35196. $this->barCharOriginal = '';
  35197. if (null === $this->format) {
  35198. switch ($output->getVerbosity()) {
  35199. case OutputInterface::VERBOSITY_QUIET:
  35200. $this->format = self::FORMAT_QUIET_NOMAX;
  35201. if ($this->max > 0) {
  35202. $this->format = self::FORMAT_QUIET;
  35203. }
  35204. break;
  35205. case OutputInterface::VERBOSITY_VERBOSE:
  35206. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  35207. case OutputInterface::VERBOSITY_DEBUG:
  35208. $this->format = self::FORMAT_VERBOSE_NOMAX;
  35209. if ($this->max > 0) {
  35210. $this->format = self::FORMAT_VERBOSE;
  35211. }
  35212. break;
  35213. default:
  35214. $this->format = self::FORMAT_NORMAL_NOMAX;
  35215. if ($this->max > 0) {
  35216. $this->format = self::FORMAT_NORMAL;
  35217. }
  35218. break;
  35219. }
  35220. }
  35221. $this->initialize();
  35222. }
  35223. public function advance($step = 1, $redraw = false)
  35224. {
  35225. $this->setCurrent($this->current + $step, $redraw);
  35226. }
  35227. public function setCurrent($current, $redraw = false)
  35228. {
  35229. if (null === $this->startTime) {
  35230. throw new LogicException('You must start the progress bar before calling setCurrent().');
  35231. }
  35232. $current = (int) $current;
  35233. if ($current < $this->current) {
  35234. throw new LogicException('You can\'t regress the progress bar');
  35235. }
  35236. if (0 === $this->current) {
  35237. $redraw = true;
  35238. }
  35239. $prevPeriod = (int) ($this->current / $this->redrawFreq);
  35240. $this->current = $current;
  35241. $currPeriod = (int) ($this->current / $this->redrawFreq);
  35242. if ($redraw || $prevPeriod !== $currPeriod || $this->max === $this->current) {
  35243. $this->display();
  35244. }
  35245. }
  35246. public function display($finish = false)
  35247. {
  35248. if (null === $this->startTime) {
  35249. throw new LogicException('You must start the progress bar before calling display().');
  35250. }
  35251. $message = $this->format;
  35252. foreach ($this->generate($finish) as $name => $value) {
  35253. $message = str_replace("%{$name}%", $value, $message);
  35254. }
  35255. $this->overwrite($this->output, $message);
  35256. }
  35257. public function clear()
  35258. {
  35259. $this->overwrite($this->output, '');
  35260. }
  35261. public function finish()
  35262. {
  35263. if (null === $this->startTime) {
  35264. throw new LogicException('You must start the progress bar before calling finish().');
  35265. }
  35266. if (null !== $this->startTime) {
  35267. if (!$this->max) {
  35268. $this->barChar = $this->barCharOriginal;
  35269. $this->display(true);
  35270. }
  35271. $this->startTime = null;
  35272. $this->output->writeln('');
  35273. $this->output = null;
  35274. }
  35275. }
  35276. private function initialize()
  35277. {
  35278. $this->formatVars = array();
  35279. foreach ($this->defaultFormatVars as $var) {
  35280. if (false !== strpos($this->format, "%{$var}%")) {
  35281. $this->formatVars[$var] = true;
  35282. }
  35283. }
  35284. if ($this->max > 0) {
  35285. $this->widths['max'] = $this->strlen($this->max);
  35286. $this->widths['current'] = $this->widths['max'];
  35287. } else {
  35288. $this->barCharOriginal = $this->barChar;
  35289. $this->barChar = $this->emptyBarChar;
  35290. }
  35291. }
  35292. private function generate($finish = false)
  35293. {
  35294. $vars = array();
  35295. $percent = 0;
  35296. if ($this->max > 0) {
  35297. $percent = (float) $this->current / $this->max;
  35298. }
  35299. if (isset($this->formatVars['bar'])) {
  35300. if ($this->max > 0) {
  35301. $completeBars = floor($percent * $this->barWidth);
  35302. } else {
  35303. if (!$finish) {
  35304. $completeBars = floor($this->current % $this->barWidth);
  35305. } else {
  35306. $completeBars = $this->barWidth;
  35307. }
  35308. }
  35309. $emptyBars = $this->barWidth - $completeBars - $this->strlen($this->progressChar);
  35310. $bar = str_repeat($this->barChar, $completeBars);
  35311. if ($completeBars < $this->barWidth) {
  35312. $bar .= $this->progressChar;
  35313. $bar .= str_repeat($this->emptyBarChar, $emptyBars);
  35314. }
  35315. $vars['bar'] = $bar;
  35316. }
  35317. if (isset($this->formatVars['elapsed'])) {
  35318. $elapsed = time() - $this->startTime;
  35319. $vars['elapsed'] = str_pad($this->humaneTime($elapsed), $this->widths['elapsed'], ' ', STR_PAD_LEFT);
  35320. }
  35321. if (isset($this->formatVars['current'])) {
  35322. $vars['current'] = str_pad($this->current, $this->widths['current'], ' ', STR_PAD_LEFT);
  35323. }
  35324. if (isset($this->formatVars['max'])) {
  35325. $vars['max'] = $this->max;
  35326. }
  35327. if (isset($this->formatVars['percent'])) {
  35328. $vars['percent'] = str_pad(floor($percent * 100), $this->widths['percent'], ' ', STR_PAD_LEFT);
  35329. }
  35330. return $vars;
  35331. }
  35332. private function humaneTime($secs)
  35333. {
  35334. $text = '';
  35335. foreach ($this->timeFormats as $format) {
  35336. if ($secs < $format[0]) {
  35337. if (2 == \count($format)) {
  35338. $text = $format[1];
  35339. break;
  35340. } else {
  35341. $text = ceil($secs / $format[2]).' '.$format[1];
  35342. break;
  35343. }
  35344. }
  35345. }
  35346. return $text;
  35347. }
  35348. private function overwrite(OutputInterface $output, $message)
  35349. {
  35350. $length = $this->strlen($message);
  35351. if (null !== $this->lastMessagesLength && $this->lastMessagesLength > $length) {
  35352. $message = str_pad($message, $this->lastMessagesLength, "\x20", STR_PAD_RIGHT);
  35353. }
  35354. $output->write("\x0D");
  35355. $output->write($message);
  35356. $this->lastMessagesLength = $this->strlen($message);
  35357. }
  35358. public function getName()
  35359. {
  35360. return 'progress';
  35361. }
  35362. }
  35363. <?php
  35364. namespace Symfony\Component\Console\Helper;
  35365. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35366. use Symfony\Component\Console\Exception\LogicException;
  35367. use Symfony\Component\Console\Output\OutputInterface;
  35368. class ProgressIndicator
  35369. {
  35370. private $output;
  35371. private $startTime;
  35372. private $format;
  35373. private $message;
  35374. private $indicatorValues;
  35375. private $indicatorCurrent;
  35376. private $indicatorChangeInterval;
  35377. private $indicatorUpdateTime;
  35378. private $started = false;
  35379. private static $formatters;
  35380. private static $formats;
  35381. public function __construct(OutputInterface $output, $format = null, $indicatorChangeInterval = 100, $indicatorValues = null)
  35382. {
  35383. $this->output = $output;
  35384. if (null === $format) {
  35385. $format = $this->determineBestFormat();
  35386. }
  35387. if (null === $indicatorValues) {
  35388. $indicatorValues = array('-', '\\', '|', '/');
  35389. }
  35390. $indicatorValues = array_values($indicatorValues);
  35391. if (2 > \count($indicatorValues)) {
  35392. throw new InvalidArgumentException('Must have at least 2 indicator value characters.');
  35393. }
  35394. $this->format = self::getFormatDefinition($format);
  35395. $this->indicatorChangeInterval = $indicatorChangeInterval;
  35396. $this->indicatorValues = $indicatorValues;
  35397. $this->startTime = time();
  35398. }
  35399. public function setMessage($message)
  35400. {
  35401. $this->message = $message;
  35402. $this->display();
  35403. }
  35404. public function getMessage()
  35405. {
  35406. return $this->message;
  35407. }
  35408. public function getStartTime()
  35409. {
  35410. return $this->startTime;
  35411. }
  35412. public function getCurrentValue()
  35413. {
  35414. return $this->indicatorValues[$this->indicatorCurrent % \count($this->indicatorValues)];
  35415. }
  35416. public function start($message)
  35417. {
  35418. if ($this->started) {
  35419. throw new LogicException('Progress indicator already started.');
  35420. }
  35421. $this->message = $message;
  35422. $this->started = true;
  35423. $this->startTime = time();
  35424. $this->indicatorUpdateTime = $this->getCurrentTimeInMilliseconds() + $this->indicatorChangeInterval;
  35425. $this->indicatorCurrent = 0;
  35426. $this->display();
  35427. }
  35428. public function advance()
  35429. {
  35430. if (!$this->started) {
  35431. throw new LogicException('Progress indicator has not yet been started.');
  35432. }
  35433. if (!$this->output->isDecorated()) {
  35434. return;
  35435. }
  35436. $currentTime = $this->getCurrentTimeInMilliseconds();
  35437. if ($currentTime < $this->indicatorUpdateTime) {
  35438. return;
  35439. }
  35440. $this->indicatorUpdateTime = $currentTime + $this->indicatorChangeInterval;
  35441. ++$this->indicatorCurrent;
  35442. $this->display();
  35443. }
  35444. public function finish($message)
  35445. {
  35446. if (!$this->started) {
  35447. throw new LogicException('Progress indicator has not yet been started.');
  35448. }
  35449. $this->message = $message;
  35450. $this->display();
  35451. $this->output->writeln('');
  35452. $this->started = false;
  35453. }
  35454. public static function getFormatDefinition($name)
  35455. {
  35456. if (!self::$formats) {
  35457. self::$formats = self::initFormats();
  35458. }
  35459. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  35460. }
  35461. public static function setPlaceholderFormatterDefinition($name, $callable)
  35462. {
  35463. if (!self::$formatters) {
  35464. self::$formatters = self::initPlaceholderFormatters();
  35465. }
  35466. self::$formatters[$name] = $callable;
  35467. }
  35468. public static function getPlaceholderFormatterDefinition($name)
  35469. {
  35470. if (!self::$formatters) {
  35471. self::$formatters = self::initPlaceholderFormatters();
  35472. }
  35473. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  35474. }
  35475. private function display()
  35476. {
  35477. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  35478. return;
  35479. }
  35480. $self = $this;
  35481. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self) {
  35482. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  35483. return \call_user_func($formatter, $self);
  35484. }
  35485. return $matches[0];
  35486. }, $this->format));
  35487. }
  35488. private function determineBestFormat()
  35489. {
  35490. switch ($this->output->getVerbosity()) {
  35491. case OutputInterface::VERBOSITY_VERBOSE:
  35492. return $this->output->isDecorated() ? 'verbose' : 'verbose_no_ansi';
  35493. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  35494. case OutputInterface::VERBOSITY_DEBUG:
  35495. return $this->output->isDecorated() ? 'very_verbose' : 'very_verbose_no_ansi';
  35496. default:
  35497. return $this->output->isDecorated() ? 'normal' : 'normal_no_ansi';
  35498. }
  35499. }
  35500. private function overwrite($message)
  35501. {
  35502. if ($this->output->isDecorated()) {
  35503. $this->output->write("\x0D\x1B[2K");
  35504. $this->output->write($message);
  35505. } else {
  35506. $this->output->writeln($message);
  35507. }
  35508. }
  35509. private function getCurrentTimeInMilliseconds()
  35510. {
  35511. return round(microtime(true) * 1000);
  35512. }
  35513. private static function initPlaceholderFormatters()
  35514. {
  35515. return array(
  35516. 'indicator' => function (ProgressIndicator $indicator) {
  35517. return $indicator->getCurrentValue();
  35518. },
  35519. 'message' => function (ProgressIndicator $indicator) {
  35520. return $indicator->getMessage();
  35521. },
  35522. 'elapsed' => function (ProgressIndicator $indicator) {
  35523. return Helper::formatTime(time() - $indicator->getStartTime());
  35524. },
  35525. 'memory' => function () {
  35526. return Helper::formatMemory(memory_get_usage(true));
  35527. },
  35528. );
  35529. }
  35530. private static function initFormats()
  35531. {
  35532. return array(
  35533. 'normal' => ' %indicator% %message%',
  35534. 'normal_no_ansi' => ' %message%',
  35535. 'verbose' => ' %indicator% %message% (%elapsed:6s%)',
  35536. 'verbose_no_ansi' => ' %message% (%elapsed:6s%)',
  35537. 'very_verbose' => ' %indicator% %message% (%elapsed:6s%, %memory:6s%)',
  35538. 'very_verbose_no_ansi' => ' %message% (%elapsed:6s%, %memory:6s%)',
  35539. );
  35540. }
  35541. }
  35542. <?php
  35543. namespace Symfony\Component\Console\Helper;
  35544. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35545. use Symfony\Component\Console\Exception\RuntimeException;
  35546. use Symfony\Component\Console\Formatter\OutputFormatter;
  35547. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  35548. use Symfony\Component\Console\Input\InputInterface;
  35549. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  35550. use Symfony\Component\Console\Output\OutputInterface;
  35551. use Symfony\Component\Console\Question\ChoiceQuestion;
  35552. use Symfony\Component\Console\Question\Question;
  35553. class QuestionHelper extends Helper
  35554. {
  35555. private $inputStream;
  35556. private static $shell;
  35557. private static $stty;
  35558. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  35559. {
  35560. if ($output instanceof ConsoleOutputInterface) {
  35561. $output = $output->getErrorOutput();
  35562. }
  35563. if (!$input->isInteractive()) {
  35564. $default = $question->getDefault();
  35565. if (null !== $default && $question instanceof ChoiceQuestion) {
  35566. $choices = $question->getChoices();
  35567. if (!$question->isMultiselect()) {
  35568. return isset($choices[$default]) ? $choices[$default] : $default;
  35569. }
  35570. $default = explode(',', $default);
  35571. foreach ($default as $k => $v) {
  35572. $v = trim($v);
  35573. $default[$k] = isset($choices[$v]) ? $choices[$v] : $v;
  35574. }
  35575. }
  35576. return $default;
  35577. }
  35578. if (!$question->getValidator()) {
  35579. return $this->doAsk($output, $question);
  35580. }
  35581. $that = $this;
  35582. $interviewer = function () use ($output, $question, $that) {
  35583. return $that->doAsk($output, $question);
  35584. };
  35585. return $this->validateAttempts($interviewer, $output, $question);
  35586. }
  35587. public function setInputStream($stream)
  35588. {
  35589. if (!\is_resource($stream)) {
  35590. throw new InvalidArgumentException('Input stream must be a valid resource.');
  35591. }
  35592. $this->inputStream = $stream;
  35593. }
  35594. public function getInputStream()
  35595. {
  35596. return $this->inputStream;
  35597. }
  35598. public function getName()
  35599. {
  35600. return 'question';
  35601. }
  35602. public function doAsk(OutputInterface $output, Question $question)
  35603. {
  35604. $this->writePrompt($output, $question);
  35605. $inputStream = $this->inputStream ?: STDIN;
  35606. $autocomplete = $question->getAutocompleterValues();
  35607. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  35608. $ret = false;
  35609. if ($question->isHidden()) {
  35610. try {
  35611. $ret = trim($this->getHiddenResponse($output, $inputStream));
  35612. } catch (RuntimeException $e) {
  35613. if (!$question->isHiddenFallback()) {
  35614. throw $e;
  35615. }
  35616. }
  35617. }
  35618. if (false === $ret) {
  35619. $ret = fgets($inputStream, 4096);
  35620. if (false === $ret) {
  35621. throw new RuntimeException('Aborted');
  35622. }
  35623. $ret = trim($ret);
  35624. }
  35625. } else {
  35626. $ret = trim($this->autocomplete($output, $question, $inputStream, \is_array($autocomplete) ? $autocomplete : iterator_to_array($autocomplete, false)));
  35627. }
  35628. $ret = \strlen($ret) > 0 ? $ret : $question->getDefault();
  35629. if ($normalizer = $question->getNormalizer()) {
  35630. return $normalizer($ret);
  35631. }
  35632. return $ret;
  35633. }
  35634. protected function writePrompt(OutputInterface $output, Question $question)
  35635. {
  35636. $message = $question->getQuestion();
  35637. if ($question instanceof ChoiceQuestion) {
  35638. $maxWidth = max(array_map(array($this, 'strlen'), array_keys($question->getChoices())));
  35639. $messages = (array) $question->getQuestion();
  35640. foreach ($question->getChoices() as $key => $value) {
  35641. $width = $maxWidth - $this->strlen($key);
  35642. $messages[] = ' [<info>'.$key.str_repeat(' ', $width).'</info>] '.$value;
  35643. }
  35644. $output->writeln($messages);
  35645. $message = $question->getPrompt();
  35646. }
  35647. $output->write($message);
  35648. }
  35649. protected function writeError(OutputInterface $output, \Exception $error)
  35650. {
  35651. if (null !== $this->getHelperSet() && $this->getHelperSet()->has('formatter')) {
  35652. $message = $this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error');
  35653. } else {
  35654. $message = '<error>'.$error->getMessage().'</error>';
  35655. }
  35656. $output->writeln($message);
  35657. }
  35658. private function autocomplete(OutputInterface $output, Question $question, $inputStream, array $autocomplete)
  35659. {
  35660. $ret = '';
  35661. $i = 0;
  35662. $ofs = -1;
  35663. $matches = $autocomplete;
  35664. $numMatches = \count($matches);
  35665. $sttyMode = shell_exec('stty -g');
  35666. shell_exec('stty -icanon -echo');
  35667. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  35668. while (!feof($inputStream)) {
  35669. $c = fread($inputStream, 1);
  35670. if ("\177" === $c) {
  35671. if (0 === $numMatches && 0 !== $i) {
  35672. --$i;
  35673. $output->write("\033[1D");
  35674. }
  35675. if (0 === $i) {
  35676. $ofs = -1;
  35677. $matches = $autocomplete;
  35678. $numMatches = \count($matches);
  35679. } else {
  35680. $numMatches = 0;
  35681. }
  35682. $ret = substr($ret, 0, $i);
  35683. } elseif ("\033" === $c) {
  35684. $c .= fread($inputStream, 2);
  35685. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  35686. if ('A' === $c[2] && -1 === $ofs) {
  35687. $ofs = 0;
  35688. }
  35689. if (0 === $numMatches) {
  35690. continue;
  35691. }
  35692. $ofs += ('A' === $c[2]) ? -1 : 1;
  35693. $ofs = ($numMatches + $ofs) % $numMatches;
  35694. }
  35695. } elseif (\ord($c) < 32) {
  35696. if ("\t" === $c || "\n" === $c) {
  35697. if ($numMatches > 0 && -1 !== $ofs) {
  35698. $ret = $matches[$ofs];
  35699. $output->write(substr($ret, $i));
  35700. $i = \strlen($ret);
  35701. }
  35702. if ("\n" === $c) {
  35703. $output->write($c);
  35704. break;
  35705. }
  35706. $numMatches = 0;
  35707. }
  35708. continue;
  35709. } else {
  35710. $output->write($c);
  35711. $ret .= $c;
  35712. ++$i;
  35713. $numMatches = 0;
  35714. $ofs = 0;
  35715. foreach ($autocomplete as $value) {
  35716. if (0 === strpos($value, $ret)) {
  35717. $matches[$numMatches++] = $value;
  35718. }
  35719. }
  35720. }
  35721. $output->write("\033[K");
  35722. if ($numMatches > 0 && -1 !== $ofs) {
  35723. $output->write("\0337");
  35724. $output->write('<hl>'.OutputFormatter::escapeTrailingBackslash(substr($matches[$ofs], $i)).'</hl>');
  35725. $output->write("\0338");
  35726. }
  35727. }
  35728. shell_exec(sprintf('stty %s', $sttyMode));
  35729. return $ret;
  35730. }
  35731. private function getHiddenResponse(OutputInterface $output, $inputStream)
  35732. {
  35733. if ('\\' === \DIRECTORY_SEPARATOR) {
  35734. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  35735. if ('phar:' === substr(__FILE__, 0, 5)) {
  35736. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  35737. copy($exe, $tmpExe);
  35738. $exe = $tmpExe;
  35739. }
  35740. $value = rtrim(shell_exec($exe));
  35741. $output->writeln('');
  35742. if (isset($tmpExe)) {
  35743. unlink($tmpExe);
  35744. }
  35745. return $value;
  35746. }
  35747. if ($this->hasSttyAvailable()) {
  35748. $sttyMode = shell_exec('stty -g');
  35749. shell_exec('stty -echo');
  35750. $value = fgets($inputStream, 4096);
  35751. shell_exec(sprintf('stty %s', $sttyMode));
  35752. if (false === $value) {
  35753. throw new RuntimeException('Aborted');
  35754. }
  35755. $value = trim($value);
  35756. $output->writeln('');
  35757. return $value;
  35758. }
  35759. if (false !== $shell = $this->getShell()) {
  35760. $readCmd = 'csh' === $shell ? 'set mypassword = $<' : 'read -r mypassword';
  35761. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  35762. $value = rtrim(shell_exec($command));
  35763. $output->writeln('');
  35764. return $value;
  35765. }
  35766. throw new RuntimeException('Unable to hide the response.');
  35767. }
  35768. private function validateAttempts($interviewer, OutputInterface $output, Question $question)
  35769. {
  35770. $error = null;
  35771. $attempts = $question->getMaxAttempts();
  35772. while (null === $attempts || $attempts--) {
  35773. if (null !== $error) {
  35774. $this->writeError($output, $error);
  35775. }
  35776. try {
  35777. return \call_user_func($question->getValidator(), $interviewer());
  35778. } catch (RuntimeException $e) {
  35779. throw $e;
  35780. } catch (\Exception $error) {
  35781. }
  35782. }
  35783. throw $error;
  35784. }
  35785. private function getShell()
  35786. {
  35787. if (null !== self::$shell) {
  35788. return self::$shell;
  35789. }
  35790. self::$shell = false;
  35791. if (file_exists('/usr/bin/env')) {
  35792. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  35793. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  35794. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  35795. self::$shell = $sh;
  35796. break;
  35797. }
  35798. }
  35799. }
  35800. return self::$shell;
  35801. }
  35802. private function hasSttyAvailable()
  35803. {
  35804. if (null !== self::$stty) {
  35805. return self::$stty;
  35806. }
  35807. exec('stty 2>&1', $output, $exitcode);
  35808. return self::$stty = 0 === $exitcode;
  35809. }
  35810. }
  35811. <?php
  35812. namespace Symfony\Component\Console\Helper;
  35813. use Symfony\Component\Console\Exception\LogicException;
  35814. use Symfony\Component\Console\Formatter\OutputFormatter;
  35815. use Symfony\Component\Console\Input\InputInterface;
  35816. use Symfony\Component\Console\Output\OutputInterface;
  35817. use Symfony\Component\Console\Question\ChoiceQuestion;
  35818. use Symfony\Component\Console\Question\ConfirmationQuestion;
  35819. use Symfony\Component\Console\Question\Question;
  35820. use Symfony\Component\Console\Style\SymfonyStyle;
  35821. class SymfonyQuestionHelper extends QuestionHelper
  35822. {
  35823. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  35824. {
  35825. $validator = $question->getValidator();
  35826. $question->setValidator(function ($value) use ($validator) {
  35827. if (null !== $validator) {
  35828. $value = $validator($value);
  35829. } else {
  35830. if (!\is_array($value) && !\is_bool($value) && 0 === \strlen($value)) {
  35831. throw new LogicException('A value is required.');
  35832. }
  35833. }
  35834. return $value;
  35835. });
  35836. return parent::ask($input, $output, $question);
  35837. }
  35838. protected function writePrompt(OutputInterface $output, Question $question)
  35839. {
  35840. $text = OutputFormatter::escapeTrailingBackslash($question->getQuestion());
  35841. $default = $question->getDefault();
  35842. switch (true) {
  35843. case null === $default:
  35844. $text = sprintf(' <info>%s</info>:', $text);
  35845. break;
  35846. case $question instanceof ConfirmationQuestion:
  35847. $text = sprintf(' <info>%s (yes/no)</info> [<comment>%s</comment>]:', $text, $default ? 'yes' : 'no');
  35848. break;
  35849. case $question instanceof ChoiceQuestion && $question->isMultiselect():
  35850. $choices = $question->getChoices();
  35851. $default = explode(',', $default);
  35852. foreach ($default as $key => $value) {
  35853. $default[$key] = $choices[trim($value)];
  35854. }
  35855. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(implode(', ', $default)));
  35856. break;
  35857. case $question instanceof ChoiceQuestion:
  35858. $choices = $question->getChoices();
  35859. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(isset($choices[$default]) ? $choices[$default] : $default));
  35860. break;
  35861. default:
  35862. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($default));
  35863. }
  35864. $output->writeln($text);
  35865. if ($question instanceof ChoiceQuestion) {
  35866. $width = max(array_map('strlen', array_keys($question->getChoices())));
  35867. foreach ($question->getChoices() as $key => $value) {
  35868. $output->writeln(sprintf(" [<comment>%-${width}s</comment>] %s", $key, $value));
  35869. }
  35870. }
  35871. $output->write(' > ');
  35872. }
  35873. protected function writeError(OutputInterface $output, \Exception $error)
  35874. {
  35875. if ($output instanceof SymfonyStyle) {
  35876. $output->newLine();
  35877. $output->error($error->getMessage());
  35878. return;
  35879. }
  35880. parent::writeError($output, $error);
  35881. }
  35882. }
  35883. <?php
  35884. namespace Symfony\Component\Console\Helper;
  35885. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35886. use Symfony\Component\Console\Output\OutputInterface;
  35887. class Table
  35888. {
  35889. private $headers = array();
  35890. private $rows = array();
  35891. private $columnWidths = array();
  35892. private $numberOfColumns;
  35893. private $output;
  35894. private $style;
  35895. private $columnStyles = array();
  35896. private static $styles;
  35897. public function __construct(OutputInterface $output)
  35898. {
  35899. $this->output = $output;
  35900. if (!self::$styles) {
  35901. self::$styles = self::initStyles();
  35902. }
  35903. $this->setStyle('default');
  35904. }
  35905. public static function setStyleDefinition($name, TableStyle $style)
  35906. {
  35907. if (!self::$styles) {
  35908. self::$styles = self::initStyles();
  35909. }
  35910. self::$styles[$name] = $style;
  35911. }
  35912. public static function getStyleDefinition($name)
  35913. {
  35914. if (!self::$styles) {
  35915. self::$styles = self::initStyles();
  35916. }
  35917. if (isset(self::$styles[$name])) {
  35918. return self::$styles[$name];
  35919. }
  35920. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  35921. }
  35922. public function setStyle($name)
  35923. {
  35924. $this->style = $this->resolveStyle($name);
  35925. return $this;
  35926. }
  35927. public function getStyle()
  35928. {
  35929. return $this->style;
  35930. }
  35931. public function setColumnStyle($columnIndex, $name)
  35932. {
  35933. $columnIndex = (int) $columnIndex;
  35934. $this->columnStyles[$columnIndex] = $this->resolveStyle($name);
  35935. return $this;
  35936. }
  35937. public function getColumnStyle($columnIndex)
  35938. {
  35939. if (isset($this->columnStyles[$columnIndex])) {
  35940. return $this->columnStyles[$columnIndex];
  35941. }
  35942. return $this->getStyle();
  35943. }
  35944. public function setHeaders(array $headers)
  35945. {
  35946. $headers = array_values($headers);
  35947. if (!empty($headers) && !\is_array($headers[0])) {
  35948. $headers = array($headers);
  35949. }
  35950. $this->headers = $headers;
  35951. return $this;
  35952. }
  35953. public function setRows(array $rows)
  35954. {
  35955. $this->rows = array();
  35956. return $this->addRows($rows);
  35957. }
  35958. public function addRows(array $rows)
  35959. {
  35960. foreach ($rows as $row) {
  35961. $this->addRow($row);
  35962. }
  35963. return $this;
  35964. }
  35965. public function addRow($row)
  35966. {
  35967. if ($row instanceof TableSeparator) {
  35968. $this->rows[] = $row;
  35969. return $this;
  35970. }
  35971. if (!\is_array($row)) {
  35972. throw new InvalidArgumentException('A row must be an array or a TableSeparator instance.');
  35973. }
  35974. $this->rows[] = array_values($row);
  35975. return $this;
  35976. }
  35977. public function setRow($column, array $row)
  35978. {
  35979. $this->rows[$column] = $row;
  35980. return $this;
  35981. }
  35982. public function render()
  35983. {
  35984. $this->calculateNumberOfColumns();
  35985. $rows = $this->buildTableRows($this->rows);
  35986. $headers = $this->buildTableRows($this->headers);
  35987. $this->calculateColumnsWidth(array_merge($headers, $rows));
  35988. $this->renderRowSeparator();
  35989. if (!empty($headers)) {
  35990. foreach ($headers as $header) {
  35991. $this->renderRow($header, $this->style->getCellHeaderFormat());
  35992. $this->renderRowSeparator();
  35993. }
  35994. }
  35995. foreach ($rows as $row) {
  35996. if ($row instanceof TableSeparator) {
  35997. $this->renderRowSeparator();
  35998. } else {
  35999. $this->renderRow($row, $this->style->getCellRowFormat());
  36000. }
  36001. }
  36002. if (!empty($rows)) {
  36003. $this->renderRowSeparator();
  36004. }
  36005. $this->cleanup();
  36006. }
  36007. private function renderRowSeparator()
  36008. {
  36009. if (0 === $count = $this->numberOfColumns) {
  36010. return;
  36011. }
  36012. if (!$this->style->getHorizontalBorderChar() && !$this->style->getCrossingChar()) {
  36013. return;
  36014. }
  36015. $markup = $this->style->getCrossingChar();
  36016. for ($column = 0; $column < $count; ++$column) {
  36017. $markup .= str_repeat($this->style->getHorizontalBorderChar(), $this->columnWidths[$column]).$this->style->getCrossingChar();
  36018. }
  36019. $this->output->writeln(sprintf($this->style->getBorderFormat(), $markup));
  36020. }
  36021. private function renderColumnSeparator()
  36022. {
  36023. return sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar());
  36024. }
  36025. private function renderRow(array $row, $cellFormat)
  36026. {
  36027. if (empty($row)) {
  36028. return;
  36029. }
  36030. $rowContent = $this->renderColumnSeparator();
  36031. foreach ($this->getRowColumns($row) as $column) {
  36032. $rowContent .= $this->renderCell($row, $column, $cellFormat);
  36033. $rowContent .= $this->renderColumnSeparator();
  36034. }
  36035. $this->output->writeln($rowContent);
  36036. }
  36037. private function renderCell(array $row, $column, $cellFormat)
  36038. {
  36039. $cell = isset($row[$column]) ? $row[$column] : '';
  36040. $width = $this->columnWidths[$column];
  36041. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  36042. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $nextColumn) {
  36043. $width += $this->getColumnSeparatorWidth() + $this->columnWidths[$nextColumn];
  36044. }
  36045. }
  36046. if (false !== $encoding = mb_detect_encoding($cell, null, true)) {
  36047. $width += \strlen($cell) - mb_strwidth($cell, $encoding);
  36048. }
  36049. $style = $this->getColumnStyle($column);
  36050. if ($cell instanceof TableSeparator) {
  36051. return sprintf($style->getBorderFormat(), str_repeat($style->getHorizontalBorderChar(), $width));
  36052. }
  36053. $width += Helper::strlen($cell) - Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  36054. $content = sprintf($style->getCellRowContentFormat(), $cell);
  36055. return sprintf($cellFormat, str_pad($content, $width, $style->getPaddingChar(), $style->getPadType()));
  36056. }
  36057. private function calculateNumberOfColumns()
  36058. {
  36059. if (null !== $this->numberOfColumns) {
  36060. return;
  36061. }
  36062. $columns = array(0);
  36063. foreach (array_merge($this->headers, $this->rows) as $row) {
  36064. if ($row instanceof TableSeparator) {
  36065. continue;
  36066. }
  36067. $columns[] = $this->getNumberOfColumns($row);
  36068. }
  36069. $this->numberOfColumns = max($columns);
  36070. }
  36071. private function buildTableRows($rows)
  36072. {
  36073. $unmergedRows = array();
  36074. for ($rowKey = 0; $rowKey < \count($rows); ++$rowKey) {
  36075. $rows = $this->fillNextRows($rows, $rowKey);
  36076. foreach ($rows[$rowKey] as $column => $cell) {
  36077. if (!strstr($cell, "\n")) {
  36078. continue;
  36079. }
  36080. $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
  36081. foreach ($lines as $lineKey => $line) {
  36082. if ($cell instanceof TableCell) {
  36083. $line = new TableCell($line, array('colspan' => $cell->getColspan()));
  36084. }
  36085. if (0 === $lineKey) {
  36086. $rows[$rowKey][$column] = $line;
  36087. } else {
  36088. $unmergedRows[$rowKey][$lineKey][$column] = $line;
  36089. }
  36090. }
  36091. }
  36092. }
  36093. $tableRows = array();
  36094. foreach ($rows as $rowKey => $row) {
  36095. $tableRows[] = $this->fillCells($row);
  36096. if (isset($unmergedRows[$rowKey])) {
  36097. $tableRows = array_merge($tableRows, $unmergedRows[$rowKey]);
  36098. }
  36099. }
  36100. return $tableRows;
  36101. }
  36102. private function fillNextRows(array $rows, $line)
  36103. {
  36104. $unmergedRows = array();
  36105. foreach ($rows[$line] as $column => $cell) {
  36106. if ($cell instanceof TableCell && $cell->getRowspan() > 1) {
  36107. $nbLines = $cell->getRowspan() - 1;
  36108. $lines = array($cell);
  36109. if (strstr($cell, "\n")) {
  36110. $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
  36111. $nbLines = \count($lines) > $nbLines ? substr_count($cell, "\n") : $nbLines;
  36112. $rows[$line][$column] = new TableCell($lines[0], array('colspan' => $cell->getColspan()));
  36113. unset($lines[0]);
  36114. }
  36115. $unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, array()), $unmergedRows);
  36116. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  36117. $value = isset($lines[$unmergedRowKey - $line]) ? $lines[$unmergedRowKey - $line] : '';
  36118. $unmergedRows[$unmergedRowKey][$column] = new TableCell($value, array('colspan' => $cell->getColspan()));
  36119. if ($nbLines === $unmergedRowKey - $line) {
  36120. break;
  36121. }
  36122. }
  36123. }
  36124. }
  36125. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  36126. if (isset($rows[$unmergedRowKey]) && \is_array($rows[$unmergedRowKey]) && ($this->getNumberOfColumns($rows[$unmergedRowKey]) + $this->getNumberOfColumns($unmergedRows[$unmergedRowKey]) <= $this->numberOfColumns)) {
  36127. foreach ($unmergedRow as $cellKey => $cell) {
  36128. array_splice($rows[$unmergedRowKey], $cellKey, 0, array($cell));
  36129. }
  36130. } else {
  36131. $row = $this->copyRow($rows, $unmergedRowKey - 1);
  36132. foreach ($unmergedRow as $column => $cell) {
  36133. if (!empty($cell)) {
  36134. $row[$column] = $unmergedRow[$column];
  36135. }
  36136. }
  36137. array_splice($rows, $unmergedRowKey, 0, array($row));
  36138. }
  36139. }
  36140. return $rows;
  36141. }
  36142. private function fillCells($row)
  36143. {
  36144. $newRow = array();
  36145. foreach ($row as $column => $cell) {
  36146. $newRow[] = $cell;
  36147. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  36148. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $position) {
  36149. $newRow[] = '';
  36150. }
  36151. }
  36152. }
  36153. return $newRow ?: $row;
  36154. }
  36155. private function copyRow(array $rows, $line)
  36156. {
  36157. $row = $rows[$line];
  36158. foreach ($row as $cellKey => $cellValue) {
  36159. $row[$cellKey] = '';
  36160. if ($cellValue instanceof TableCell) {
  36161. $row[$cellKey] = new TableCell('', array('colspan' => $cellValue->getColspan()));
  36162. }
  36163. }
  36164. return $row;
  36165. }
  36166. private function getNumberOfColumns(array $row)
  36167. {
  36168. $columns = \count($row);
  36169. foreach ($row as $column) {
  36170. $columns += $column instanceof TableCell ? ($column->getColspan() - 1) : 0;
  36171. }
  36172. return $columns;
  36173. }
  36174. private function getRowColumns(array $row)
  36175. {
  36176. $columns = range(0, $this->numberOfColumns - 1);
  36177. foreach ($row as $cellKey => $cell) {
  36178. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  36179. $columns = array_diff($columns, range($cellKey + 1, $cellKey + $cell->getColspan() - 1));
  36180. }
  36181. }
  36182. return $columns;
  36183. }
  36184. private function calculateColumnsWidth($rows)
  36185. {
  36186. for ($column = 0; $column < $this->numberOfColumns; ++$column) {
  36187. $lengths = array();
  36188. foreach ($rows as $row) {
  36189. if ($row instanceof TableSeparator) {
  36190. continue;
  36191. }
  36192. foreach ($row as $i => $cell) {
  36193. if ($cell instanceof TableCell) {
  36194. $textContent = Helper::removeDecoration($this->output->getFormatter(), $cell);
  36195. $textLength = Helper::strlen($textContent);
  36196. if ($textLength > 0) {
  36197. $contentColumns = str_split($textContent, ceil($textLength / $cell->getColspan()));
  36198. foreach ($contentColumns as $position => $content) {
  36199. $row[$i + $position] = $content;
  36200. }
  36201. }
  36202. }
  36203. }
  36204. $lengths[] = $this->getCellWidth($row, $column);
  36205. }
  36206. $this->columnWidths[$column] = max($lengths) + Helper::strlen($this->style->getCellRowContentFormat()) - 2;
  36207. }
  36208. }
  36209. private function getColumnSeparatorWidth()
  36210. {
  36211. return Helper::strlen(sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar()));
  36212. }
  36213. private function getCellWidth(array $row, $column)
  36214. {
  36215. if (isset($row[$column])) {
  36216. $cell = $row[$column];
  36217. $cellWidth = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  36218. return $cellWidth;
  36219. }
  36220. return 0;
  36221. }
  36222. private function cleanup()
  36223. {
  36224. $this->columnWidths = array();
  36225. $this->numberOfColumns = null;
  36226. }
  36227. private static function initStyles()
  36228. {
  36229. $borderless = new TableStyle();
  36230. $borderless
  36231. ->setHorizontalBorderChar('=')
  36232. ->setVerticalBorderChar(' ')
  36233. ->setCrossingChar(' ')
  36234. ;
  36235. $compact = new TableStyle();
  36236. $compact
  36237. ->setHorizontalBorderChar('')
  36238. ->setVerticalBorderChar(' ')
  36239. ->setCrossingChar('')
  36240. ->setCellRowContentFormat('%s')
  36241. ;
  36242. $styleGuide = new TableStyle();
  36243. $styleGuide
  36244. ->setHorizontalBorderChar('-')
  36245. ->setVerticalBorderChar(' ')
  36246. ->setCrossingChar(' ')
  36247. ->setCellHeaderFormat('%s')
  36248. ;
  36249. return array(
  36250. 'default' => new TableStyle(),
  36251. 'borderless' => $borderless,
  36252. 'compact' => $compact,
  36253. 'symfony-style-guide' => $styleGuide,
  36254. );
  36255. }
  36256. private function resolveStyle($name)
  36257. {
  36258. if ($name instanceof TableStyle) {
  36259. return $name;
  36260. }
  36261. if (isset(self::$styles[$name])) {
  36262. return self::$styles[$name];
  36263. }
  36264. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  36265. }
  36266. }
  36267. <?php
  36268. namespace Symfony\Component\Console\Helper;
  36269. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36270. class TableCell
  36271. {
  36272. private $value;
  36273. private $options = array(
  36274. 'rowspan' => 1,
  36275. 'colspan' => 1,
  36276. );
  36277. public function __construct($value = '', array $options = array())
  36278. {
  36279. if (is_numeric($value) && !\is_string($value)) {
  36280. $value = (string) $value;
  36281. }
  36282. $this->value = $value;
  36283. if ($diff = array_diff(array_keys($options), array_keys($this->options))) {
  36284. throw new InvalidArgumentException(sprintf('The TableCell does not support the following options: \'%s\'.', implode('\', \'', $diff)));
  36285. }
  36286. $this->options = array_merge($this->options, $options);
  36287. }
  36288. public function __toString()
  36289. {
  36290. return $this->value;
  36291. }
  36292. public function getColspan()
  36293. {
  36294. return (int) $this->options['colspan'];
  36295. }
  36296. public function getRowspan()
  36297. {
  36298. return (int) $this->options['rowspan'];
  36299. }
  36300. }
  36301. <?php
  36302. namespace Symfony\Component\Console\Helper;
  36303. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36304. use Symfony\Component\Console\Output\NullOutput;
  36305. use Symfony\Component\Console\Output\OutputInterface;
  36306. class TableHelper extends Helper
  36307. {
  36308. const LAYOUT_DEFAULT = 0;
  36309. const LAYOUT_BORDERLESS = 1;
  36310. const LAYOUT_COMPACT = 2;
  36311. private $table;
  36312. public function __construct($triggerDeprecationError = true)
  36313. {
  36314. if ($triggerDeprecationError) {
  36315. @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);
  36316. }
  36317. $this->table = new Table(new NullOutput());
  36318. }
  36319. public function setLayout($layout)
  36320. {
  36321. switch ($layout) {
  36322. case self::LAYOUT_BORDERLESS:
  36323. $this->table->setStyle('borderless');
  36324. break;
  36325. case self::LAYOUT_COMPACT:
  36326. $this->table->setStyle('compact');
  36327. break;
  36328. case self::LAYOUT_DEFAULT:
  36329. $this->table->setStyle('default');
  36330. break;
  36331. default:
  36332. throw new InvalidArgumentException(sprintf('Invalid table layout "%s".', $layout));
  36333. }
  36334. return $this;
  36335. }
  36336. public function setHeaders(array $headers)
  36337. {
  36338. $this->table->setHeaders($headers);
  36339. return $this;
  36340. }
  36341. public function setRows(array $rows)
  36342. {
  36343. $this->table->setRows($rows);
  36344. return $this;
  36345. }
  36346. public function addRows(array $rows)
  36347. {
  36348. $this->table->addRows($rows);
  36349. return $this;
  36350. }
  36351. public function addRow(array $row)
  36352. {
  36353. $this->table->addRow($row);
  36354. return $this;
  36355. }
  36356. public function setRow($column, array $row)
  36357. {
  36358. $this->table->setRow($column, $row);
  36359. return $this;
  36360. }
  36361. public function setPaddingChar($paddingChar)
  36362. {
  36363. $this->table->getStyle()->setPaddingChar($paddingChar);
  36364. return $this;
  36365. }
  36366. public function setHorizontalBorderChar($horizontalBorderChar)
  36367. {
  36368. $this->table->getStyle()->setHorizontalBorderChar($horizontalBorderChar);
  36369. return $this;
  36370. }
  36371. public function setVerticalBorderChar($verticalBorderChar)
  36372. {
  36373. $this->table->getStyle()->setVerticalBorderChar($verticalBorderChar);
  36374. return $this;
  36375. }
  36376. public function setCrossingChar($crossingChar)
  36377. {
  36378. $this->table->getStyle()->setCrossingChar($crossingChar);
  36379. return $this;
  36380. }
  36381. public function setCellHeaderFormat($cellHeaderFormat)
  36382. {
  36383. $this->table->getStyle()->setCellHeaderFormat($cellHeaderFormat);
  36384. return $this;
  36385. }
  36386. public function setCellRowFormat($cellRowFormat)
  36387. {
  36388. $this->table->getStyle()->setCellHeaderFormat($cellRowFormat);
  36389. return $this;
  36390. }
  36391. public function setCellRowContentFormat($cellRowContentFormat)
  36392. {
  36393. $this->table->getStyle()->setCellRowContentFormat($cellRowContentFormat);
  36394. return $this;
  36395. }
  36396. public function setBorderFormat($borderFormat)
  36397. {
  36398. $this->table->getStyle()->setBorderFormat($borderFormat);
  36399. return $this;
  36400. }
  36401. public function setPadType($padType)
  36402. {
  36403. $this->table->getStyle()->setPadType($padType);
  36404. return $this;
  36405. }
  36406. public function render(OutputInterface $output)
  36407. {
  36408. $p = new \ReflectionProperty($this->table, 'output');
  36409. $p->setAccessible(true);
  36410. $p->setValue($this->table, $output);
  36411. $this->table->render();
  36412. }
  36413. public function getName()
  36414. {
  36415. return 'table';
  36416. }
  36417. }
  36418. <?php
  36419. namespace Symfony\Component\Console\Helper;
  36420. class TableSeparator extends TableCell
  36421. {
  36422. public function __construct(array $options = array())
  36423. {
  36424. parent::__construct('', $options);
  36425. }
  36426. }
  36427. <?php
  36428. namespace Symfony\Component\Console\Helper;
  36429. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36430. use Symfony\Component\Console\Exception\LogicException;
  36431. class TableStyle
  36432. {
  36433. private $paddingChar = ' ';
  36434. private $horizontalBorderChar = '-';
  36435. private $verticalBorderChar = '|';
  36436. private $crossingChar = '+';
  36437. private $cellHeaderFormat = '<info>%s</info>';
  36438. private $cellRowFormat = '%s';
  36439. private $cellRowContentFormat = ' %s ';
  36440. private $borderFormat = '%s';
  36441. private $padType = STR_PAD_RIGHT;
  36442. public function setPaddingChar($paddingChar)
  36443. {
  36444. if (!$paddingChar) {
  36445. throw new LogicException('The padding char must not be empty');
  36446. }
  36447. $this->paddingChar = $paddingChar;
  36448. return $this;
  36449. }
  36450. public function getPaddingChar()
  36451. {
  36452. return $this->paddingChar;
  36453. }
  36454. public function setHorizontalBorderChar($horizontalBorderChar)
  36455. {
  36456. $this->horizontalBorderChar = $horizontalBorderChar;
  36457. return $this;
  36458. }
  36459. public function getHorizontalBorderChar()
  36460. {
  36461. return $this->horizontalBorderChar;
  36462. }
  36463. public function setVerticalBorderChar($verticalBorderChar)
  36464. {
  36465. $this->verticalBorderChar = $verticalBorderChar;
  36466. return $this;
  36467. }
  36468. public function getVerticalBorderChar()
  36469. {
  36470. return $this->verticalBorderChar;
  36471. }
  36472. public function setCrossingChar($crossingChar)
  36473. {
  36474. $this->crossingChar = $crossingChar;
  36475. return $this;
  36476. }
  36477. public function getCrossingChar()
  36478. {
  36479. return $this->crossingChar;
  36480. }
  36481. public function setCellHeaderFormat($cellHeaderFormat)
  36482. {
  36483. $this->cellHeaderFormat = $cellHeaderFormat;
  36484. return $this;
  36485. }
  36486. public function getCellHeaderFormat()
  36487. {
  36488. return $this->cellHeaderFormat;
  36489. }
  36490. public function setCellRowFormat($cellRowFormat)
  36491. {
  36492. $this->cellRowFormat = $cellRowFormat;
  36493. return $this;
  36494. }
  36495. public function getCellRowFormat()
  36496. {
  36497. return $this->cellRowFormat;
  36498. }
  36499. public function setCellRowContentFormat($cellRowContentFormat)
  36500. {
  36501. $this->cellRowContentFormat = $cellRowContentFormat;
  36502. return $this;
  36503. }
  36504. public function getCellRowContentFormat()
  36505. {
  36506. return $this->cellRowContentFormat;
  36507. }
  36508. public function setBorderFormat($borderFormat)
  36509. {
  36510. $this->borderFormat = $borderFormat;
  36511. return $this;
  36512. }
  36513. public function getBorderFormat()
  36514. {
  36515. return $this->borderFormat;
  36516. }
  36517. public function setPadType($padType)
  36518. {
  36519. if (!\in_array($padType, array(STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH), true)) {
  36520. throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).');
  36521. }
  36522. $this->padType = $padType;
  36523. return $this;
  36524. }
  36525. public function getPadType()
  36526. {
  36527. return $this->padType;
  36528. }
  36529. }
  36530. <?php
  36531. namespace Symfony\Component\Console\Input;
  36532. use Symfony\Component\Console\Exception\RuntimeException;
  36533. class ArgvInput extends Input
  36534. {
  36535. private $tokens;
  36536. private $parsed;
  36537. public function __construct(array $argv = null, InputDefinition $definition = null)
  36538. {
  36539. if (null === $argv) {
  36540. $argv = $_SERVER['argv'];
  36541. }
  36542. array_shift($argv);
  36543. $this->tokens = $argv;
  36544. parent::__construct($definition);
  36545. }
  36546. protected function setTokens(array $tokens)
  36547. {
  36548. $this->tokens = $tokens;
  36549. }
  36550. protected function parse()
  36551. {
  36552. $parseOptions = true;
  36553. $this->parsed = $this->tokens;
  36554. while (null !== $token = array_shift($this->parsed)) {
  36555. if ($parseOptions && '' == $token) {
  36556. $this->parseArgument($token);
  36557. } elseif ($parseOptions && '--' == $token) {
  36558. $parseOptions = false;
  36559. } elseif ($parseOptions && 0 === strpos($token, '--')) {
  36560. $this->parseLongOption($token);
  36561. } elseif ($parseOptions && '-' === $token[0] && '-' !== $token) {
  36562. $this->parseShortOption($token);
  36563. } else {
  36564. $this->parseArgument($token);
  36565. }
  36566. }
  36567. }
  36568. private function parseShortOption($token)
  36569. {
  36570. $name = substr($token, 1);
  36571. if (\strlen($name) > 1) {
  36572. if ($this->definition->hasShortcut($name[0]) && $this->definition->getOptionForShortcut($name[0])->acceptValue()) {
  36573. $this->addShortOption($name[0], substr($name, 1));
  36574. } else {
  36575. $this->parseShortOptionSet($name);
  36576. }
  36577. } else {
  36578. $this->addShortOption($name, null);
  36579. }
  36580. }
  36581. private function parseShortOptionSet($name)
  36582. {
  36583. $len = \strlen($name);
  36584. for ($i = 0; $i < $len; ++$i) {
  36585. if (!$this->definition->hasShortcut($name[$i])) {
  36586. $encoding = mb_detect_encoding($name, null, true);
  36587. throw new RuntimeException(sprintf('The "-%s" option does not exist.', false === $encoding ? $name[$i] : mb_substr($name, $i, 1, $encoding)));
  36588. }
  36589. $option = $this->definition->getOptionForShortcut($name[$i]);
  36590. if ($option->acceptValue()) {
  36591. $this->addLongOption($option->getName(), $i === $len - 1 ? null : substr($name, $i + 1));
  36592. break;
  36593. } else {
  36594. $this->addLongOption($option->getName(), null);
  36595. }
  36596. }
  36597. }
  36598. private function parseLongOption($token)
  36599. {
  36600. $name = substr($token, 2);
  36601. if (false !== $pos = strpos($name, '=')) {
  36602. if (0 === \strlen($value = substr($name, $pos + 1))) {
  36603. array_unshift($this->parsed, null);
  36604. }
  36605. $this->addLongOption(substr($name, 0, $pos), $value);
  36606. } else {
  36607. $this->addLongOption($name, null);
  36608. }
  36609. }
  36610. private function parseArgument($token)
  36611. {
  36612. $c = \count($this->arguments);
  36613. if ($this->definition->hasArgument($c)) {
  36614. $arg = $this->definition->getArgument($c);
  36615. $this->arguments[$arg->getName()] = $arg->isArray() ? array($token) : $token;
  36616. } elseif ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) {
  36617. $arg = $this->definition->getArgument($c - 1);
  36618. $this->arguments[$arg->getName()][] = $token;
  36619. } else {
  36620. $all = $this->definition->getArguments();
  36621. if (\count($all)) {
  36622. throw new RuntimeException(sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all))));
  36623. }
  36624. throw new RuntimeException(sprintf('No arguments expected, got "%s".', $token));
  36625. }
  36626. }
  36627. private function addShortOption($shortcut, $value)
  36628. {
  36629. if (!$this->definition->hasShortcut($shortcut)) {
  36630. throw new RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut));
  36631. }
  36632. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  36633. }
  36634. private function addLongOption($name, $value)
  36635. {
  36636. if (!$this->definition->hasOption($name)) {
  36637. throw new RuntimeException(sprintf('The "--%s" option does not exist.', $name));
  36638. }
  36639. $option = $this->definition->getOption($name);
  36640. if (!isset($value[0])) {
  36641. $value = null;
  36642. }
  36643. if (null !== $value && !$option->acceptValue()) {
  36644. throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
  36645. }
  36646. if (null === $value && $option->acceptValue() && \count($this->parsed)) {
  36647. $next = array_shift($this->parsed);
  36648. if (isset($next[0]) && '-' !== $next[0]) {
  36649. $value = $next;
  36650. } elseif (empty($next)) {
  36651. $value = null;
  36652. } else {
  36653. array_unshift($this->parsed, $next);
  36654. }
  36655. }
  36656. if (null === $value) {
  36657. if ($option->isValueRequired()) {
  36658. throw new RuntimeException(sprintf('The "--%s" option requires a value.', $name));
  36659. }
  36660. if (!$option->isArray()) {
  36661. $value = $option->isValueOptional() ? $option->getDefault() : true;
  36662. }
  36663. }
  36664. if ($option->isArray()) {
  36665. $this->options[$name][] = $value;
  36666. } else {
  36667. $this->options[$name] = $value;
  36668. }
  36669. }
  36670. public function getFirstArgument()
  36671. {
  36672. foreach ($this->tokens as $token) {
  36673. if ($token && '-' === $token[0]) {
  36674. continue;
  36675. }
  36676. return $token;
  36677. }
  36678. }
  36679. public function hasParameterOption($values)
  36680. {
  36681. $values = (array) $values;
  36682. foreach ($this->tokens as $token) {
  36683. foreach ($values as $value) {
  36684. $leading = 0 === strpos($value, '--') ? $value.'=' : $value;
  36685. if ($token === $value || '' !== $leading && 0 === strpos($token, $leading)) {
  36686. return true;
  36687. }
  36688. }
  36689. }
  36690. return false;
  36691. }
  36692. public function getParameterOption($values, $default = false)
  36693. {
  36694. $values = (array) $values;
  36695. $tokens = $this->tokens;
  36696. while (0 < \count($tokens)) {
  36697. $token = array_shift($tokens);
  36698. foreach ($values as $value) {
  36699. if ($token === $value) {
  36700. return array_shift($tokens);
  36701. }
  36702. $leading = 0 === strpos($value, '--') ? $value.'=' : $value;
  36703. if ('' !== $leading && 0 === strpos($token, $leading)) {
  36704. return substr($token, \strlen($leading));
  36705. }
  36706. }
  36707. }
  36708. return $default;
  36709. }
  36710. public function __toString()
  36711. {
  36712. $self = $this;
  36713. $tokens = array_map(function ($token) use ($self) {
  36714. if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) {
  36715. return $match[1].$self->escapeToken($match[2]);
  36716. }
  36717. if ($token && '-' !== $token[0]) {
  36718. return $self->escapeToken($token);
  36719. }
  36720. return $token;
  36721. }, $this->tokens);
  36722. return implode(' ', $tokens);
  36723. }
  36724. }
  36725. <?php
  36726. namespace Symfony\Component\Console\Input;
  36727. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36728. use Symfony\Component\Console\Exception\InvalidOptionException;
  36729. class ArrayInput extends Input
  36730. {
  36731. private $parameters;
  36732. public function __construct(array $parameters, InputDefinition $definition = null)
  36733. {
  36734. $this->parameters = $parameters;
  36735. parent::__construct($definition);
  36736. }
  36737. public function getFirstArgument()
  36738. {
  36739. foreach ($this->parameters as $key => $value) {
  36740. if ($key && '-' === $key[0]) {
  36741. continue;
  36742. }
  36743. return $value;
  36744. }
  36745. }
  36746. public function hasParameterOption($values)
  36747. {
  36748. $values = (array) $values;
  36749. foreach ($this->parameters as $k => $v) {
  36750. if (!\is_int($k)) {
  36751. $v = $k;
  36752. }
  36753. if (\in_array($v, $values)) {
  36754. return true;
  36755. }
  36756. }
  36757. return false;
  36758. }
  36759. public function getParameterOption($values, $default = false)
  36760. {
  36761. $values = (array) $values;
  36762. foreach ($this->parameters as $k => $v) {
  36763. if (\is_int($k)) {
  36764. if (\in_array($v, $values)) {
  36765. return true;
  36766. }
  36767. } elseif (\in_array($k, $values)) {
  36768. return $v;
  36769. }
  36770. }
  36771. return $default;
  36772. }
  36773. public function __toString()
  36774. {
  36775. $params = array();
  36776. foreach ($this->parameters as $param => $val) {
  36777. if ($param && '-' === $param[0]) {
  36778. if (\is_array($val)) {
  36779. foreach ($val as $v) {
  36780. $params[] = $param.('' != $v ? '='.$this->escapeToken($v) : '');
  36781. }
  36782. } else {
  36783. $params[] = $param.('' != $val ? '='.$this->escapeToken($val) : '');
  36784. }
  36785. } else {
  36786. $params[] = \is_array($val) ? implode(' ', array_map(array($this, 'escapeToken'), $val)) : $this->escapeToken($val);
  36787. }
  36788. }
  36789. return implode(' ', $params);
  36790. }
  36791. protected function parse()
  36792. {
  36793. foreach ($this->parameters as $key => $value) {
  36794. if (0 === strpos($key, '--')) {
  36795. $this->addLongOption(substr($key, 2), $value);
  36796. } elseif ('-' === $key[0]) {
  36797. $this->addShortOption(substr($key, 1), $value);
  36798. } else {
  36799. $this->addArgument($key, $value);
  36800. }
  36801. }
  36802. }
  36803. private function addShortOption($shortcut, $value)
  36804. {
  36805. if (!$this->definition->hasShortcut($shortcut)) {
  36806. throw new InvalidOptionException(sprintf('The "-%s" option does not exist.', $shortcut));
  36807. }
  36808. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  36809. }
  36810. private function addLongOption($name, $value)
  36811. {
  36812. if (!$this->definition->hasOption($name)) {
  36813. throw new InvalidOptionException(sprintf('The "--%s" option does not exist.', $name));
  36814. }
  36815. $option = $this->definition->getOption($name);
  36816. if (null === $value) {
  36817. if ($option->isValueRequired()) {
  36818. throw new InvalidOptionException(sprintf('The "--%s" option requires a value.', $name));
  36819. }
  36820. $value = $option->isValueOptional() ? $option->getDefault() : true;
  36821. }
  36822. $this->options[$name] = $value;
  36823. }
  36824. private function addArgument($name, $value)
  36825. {
  36826. if (!$this->definition->hasArgument($name)) {
  36827. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  36828. }
  36829. $this->arguments[$name] = $value;
  36830. }
  36831. }
  36832. <?php
  36833. namespace Symfony\Component\Console\Input;
  36834. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36835. use Symfony\Component\Console\Exception\RuntimeException;
  36836. abstract class Input implements InputInterface
  36837. {
  36838. protected $definition;
  36839. protected $options = array();
  36840. protected $arguments = array();
  36841. protected $interactive = true;
  36842. public function __construct(InputDefinition $definition = null)
  36843. {
  36844. if (null === $definition) {
  36845. $this->definition = new InputDefinition();
  36846. } else {
  36847. $this->bind($definition);
  36848. $this->validate();
  36849. }
  36850. }
  36851. public function bind(InputDefinition $definition)
  36852. {
  36853. $this->arguments = array();
  36854. $this->options = array();
  36855. $this->definition = $definition;
  36856. $this->parse();
  36857. }
  36858. abstract protected function parse();
  36859. public function validate()
  36860. {
  36861. $definition = $this->definition;
  36862. $givenArguments = $this->arguments;
  36863. $missingArguments = array_filter(array_keys($definition->getArguments()), function ($argument) use ($definition, $givenArguments) {
  36864. return !array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired();
  36865. });
  36866. if (\count($missingArguments) > 0) {
  36867. throw new RuntimeException(sprintf('Not enough arguments (missing: "%s").', implode(', ', $missingArguments)));
  36868. }
  36869. }
  36870. public function isInteractive()
  36871. {
  36872. return $this->interactive;
  36873. }
  36874. public function setInteractive($interactive)
  36875. {
  36876. $this->interactive = (bool) $interactive;
  36877. }
  36878. public function getArguments()
  36879. {
  36880. return array_merge($this->definition->getArgumentDefaults(), $this->arguments);
  36881. }
  36882. public function getArgument($name)
  36883. {
  36884. if (!$this->definition->hasArgument($name)) {
  36885. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  36886. }
  36887. return isset($this->arguments[$name]) ? $this->arguments[$name] : $this->definition->getArgument($name)->getDefault();
  36888. }
  36889. public function setArgument($name, $value)
  36890. {
  36891. if (!$this->definition->hasArgument($name)) {
  36892. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  36893. }
  36894. $this->arguments[$name] = $value;
  36895. }
  36896. public function hasArgument($name)
  36897. {
  36898. return $this->definition->hasArgument($name);
  36899. }
  36900. public function getOptions()
  36901. {
  36902. return array_merge($this->definition->getOptionDefaults(), $this->options);
  36903. }
  36904. public function getOption($name)
  36905. {
  36906. if (!$this->definition->hasOption($name)) {
  36907. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  36908. }
  36909. return isset($this->options[$name]) ? $this->options[$name] : $this->definition->getOption($name)->getDefault();
  36910. }
  36911. public function setOption($name, $value)
  36912. {
  36913. if (!$this->definition->hasOption($name)) {
  36914. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  36915. }
  36916. $this->options[$name] = $value;
  36917. }
  36918. public function hasOption($name)
  36919. {
  36920. return $this->definition->hasOption($name);
  36921. }
  36922. public function escapeToken($token)
  36923. {
  36924. return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token);
  36925. }
  36926. }
  36927. <?php
  36928. namespace Symfony\Component\Console\Input;
  36929. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36930. use Symfony\Component\Console\Exception\LogicException;
  36931. class InputArgument
  36932. {
  36933. const REQUIRED = 1;
  36934. const OPTIONAL = 2;
  36935. const IS_ARRAY = 4;
  36936. private $name;
  36937. private $mode;
  36938. private $default;
  36939. private $description;
  36940. public function __construct($name, $mode = null, $description = '', $default = null)
  36941. {
  36942. if (null === $mode) {
  36943. $mode = self::OPTIONAL;
  36944. } elseif (!\is_int($mode) || $mode > 7 || $mode < 1) {
  36945. throw new InvalidArgumentException(sprintf('Argument mode "%s" is not valid.', $mode));
  36946. }
  36947. $this->name = $name;
  36948. $this->mode = $mode;
  36949. $this->description = $description;
  36950. $this->setDefault($default);
  36951. }
  36952. public function getName()
  36953. {
  36954. return $this->name;
  36955. }
  36956. public function isRequired()
  36957. {
  36958. return self::REQUIRED === (self::REQUIRED & $this->mode);
  36959. }
  36960. public function isArray()
  36961. {
  36962. return self::IS_ARRAY === (self::IS_ARRAY & $this->mode);
  36963. }
  36964. public function setDefault($default = null)
  36965. {
  36966. if (self::REQUIRED === $this->mode && null !== $default) {
  36967. throw new LogicException('Cannot set a default value except for InputArgument::OPTIONAL mode.');
  36968. }
  36969. if ($this->isArray()) {
  36970. if (null === $default) {
  36971. $default = array();
  36972. } elseif (!\is_array($default)) {
  36973. throw new LogicException('A default value for an array argument must be an array.');
  36974. }
  36975. }
  36976. $this->default = $default;
  36977. }
  36978. public function getDefault()
  36979. {
  36980. return $this->default;
  36981. }
  36982. public function getDescription()
  36983. {
  36984. return $this->description;
  36985. }
  36986. }
  36987. <?php
  36988. namespace Symfony\Component\Console\Input;
  36989. interface InputAwareInterface
  36990. {
  36991. public function setInput(InputInterface $input);
  36992. }
  36993. <?php
  36994. namespace Symfony\Component\Console\Input;
  36995. use Symfony\Component\Console\Descriptor\TextDescriptor;
  36996. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  36997. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36998. use Symfony\Component\Console\Exception\LogicException;
  36999. use Symfony\Component\Console\Output\BufferedOutput;
  37000. class InputDefinition
  37001. {
  37002. private $arguments;
  37003. private $requiredCount;
  37004. private $hasAnArrayArgument = false;
  37005. private $hasOptional;
  37006. private $options;
  37007. private $shortcuts;
  37008. public function __construct(array $definition = array())
  37009. {
  37010. $this->setDefinition($definition);
  37011. }
  37012. public function setDefinition(array $definition)
  37013. {
  37014. $arguments = array();
  37015. $options = array();
  37016. foreach ($definition as $item) {
  37017. if ($item instanceof InputOption) {
  37018. $options[] = $item;
  37019. } else {
  37020. $arguments[] = $item;
  37021. }
  37022. }
  37023. $this->setArguments($arguments);
  37024. $this->setOptions($options);
  37025. }
  37026. public function setArguments($arguments = array())
  37027. {
  37028. $this->arguments = array();
  37029. $this->requiredCount = 0;
  37030. $this->hasOptional = false;
  37031. $this->hasAnArrayArgument = false;
  37032. $this->addArguments($arguments);
  37033. }
  37034. public function addArguments($arguments = array())
  37035. {
  37036. if (null !== $arguments) {
  37037. foreach ($arguments as $argument) {
  37038. $this->addArgument($argument);
  37039. }
  37040. }
  37041. }
  37042. public function addArgument(InputArgument $argument)
  37043. {
  37044. if (isset($this->arguments[$argument->getName()])) {
  37045. throw new LogicException(sprintf('An argument with name "%s" already exists.', $argument->getName()));
  37046. }
  37047. if ($this->hasAnArrayArgument) {
  37048. throw new LogicException('Cannot add an argument after an array argument.');
  37049. }
  37050. if ($argument->isRequired() && $this->hasOptional) {
  37051. throw new LogicException('Cannot add a required argument after an optional one.');
  37052. }
  37053. if ($argument->isArray()) {
  37054. $this->hasAnArrayArgument = true;
  37055. }
  37056. if ($argument->isRequired()) {
  37057. ++$this->requiredCount;
  37058. } else {
  37059. $this->hasOptional = true;
  37060. }
  37061. $this->arguments[$argument->getName()] = $argument;
  37062. }
  37063. public function getArgument($name)
  37064. {
  37065. if (!$this->hasArgument($name)) {
  37066. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  37067. }
  37068. $arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments;
  37069. return $arguments[$name];
  37070. }
  37071. public function hasArgument($name)
  37072. {
  37073. $arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments;
  37074. return isset($arguments[$name]);
  37075. }
  37076. public function getArguments()
  37077. {
  37078. return $this->arguments;
  37079. }
  37080. public function getArgumentCount()
  37081. {
  37082. return $this->hasAnArrayArgument ? PHP_INT_MAX : \count($this->arguments);
  37083. }
  37084. public function getArgumentRequiredCount()
  37085. {
  37086. return $this->requiredCount;
  37087. }
  37088. public function getArgumentDefaults()
  37089. {
  37090. $values = array();
  37091. foreach ($this->arguments as $argument) {
  37092. $values[$argument->getName()] = $argument->getDefault();
  37093. }
  37094. return $values;
  37095. }
  37096. public function setOptions($options = array())
  37097. {
  37098. $this->options = array();
  37099. $this->shortcuts = array();
  37100. $this->addOptions($options);
  37101. }
  37102. public function addOptions($options = array())
  37103. {
  37104. foreach ($options as $option) {
  37105. $this->addOption($option);
  37106. }
  37107. }
  37108. public function addOption(InputOption $option)
  37109. {
  37110. if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) {
  37111. throw new LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
  37112. }
  37113. if ($option->getShortcut()) {
  37114. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  37115. if (isset($this->shortcuts[$shortcut]) && !$option->equals($this->options[$this->shortcuts[$shortcut]])) {
  37116. throw new LogicException(sprintf('An option with shortcut "%s" already exists.', $shortcut));
  37117. }
  37118. }
  37119. }
  37120. $this->options[$option->getName()] = $option;
  37121. if ($option->getShortcut()) {
  37122. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  37123. $this->shortcuts[$shortcut] = $option->getName();
  37124. }
  37125. }
  37126. }
  37127. public function getOption($name)
  37128. {
  37129. if (!$this->hasOption($name)) {
  37130. throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $name));
  37131. }
  37132. return $this->options[$name];
  37133. }
  37134. public function hasOption($name)
  37135. {
  37136. return isset($this->options[$name]);
  37137. }
  37138. public function getOptions()
  37139. {
  37140. return $this->options;
  37141. }
  37142. public function hasShortcut($name)
  37143. {
  37144. return isset($this->shortcuts[$name]);
  37145. }
  37146. public function getOptionForShortcut($shortcut)
  37147. {
  37148. return $this->getOption($this->shortcutToName($shortcut));
  37149. }
  37150. public function getOptionDefaults()
  37151. {
  37152. $values = array();
  37153. foreach ($this->options as $option) {
  37154. $values[$option->getName()] = $option->getDefault();
  37155. }
  37156. return $values;
  37157. }
  37158. private function shortcutToName($shortcut)
  37159. {
  37160. if (!isset($this->shortcuts[$shortcut])) {
  37161. throw new InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut));
  37162. }
  37163. return $this->shortcuts[$shortcut];
  37164. }
  37165. public function getSynopsis($short = false)
  37166. {
  37167. $elements = array();
  37168. if ($short && $this->getOptions()) {
  37169. $elements[] = '[options]';
  37170. } elseif (!$short) {
  37171. foreach ($this->getOptions() as $option) {
  37172. $value = '';
  37173. if ($option->acceptValue()) {
  37174. $value = sprintf(
  37175. ' %s%s%s',
  37176. $option->isValueOptional() ? '[' : '',
  37177. strtoupper($option->getName()),
  37178. $option->isValueOptional() ? ']' : ''
  37179. );
  37180. }
  37181. $shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : '';
  37182. $elements[] = sprintf('[%s--%s%s]', $shortcut, $option->getName(), $value);
  37183. }
  37184. }
  37185. if (\count($elements) && $this->getArguments()) {
  37186. $elements[] = '[--]';
  37187. }
  37188. foreach ($this->getArguments() as $argument) {
  37189. $element = '<'.$argument->getName().'>';
  37190. if (!$argument->isRequired()) {
  37191. $element = '['.$element.']';
  37192. } elseif ($argument->isArray()) {
  37193. $element .= ' ('.$element.')';
  37194. }
  37195. if ($argument->isArray()) {
  37196. $element .= '...';
  37197. }
  37198. $elements[] = $element;
  37199. }
  37200. return implode(' ', $elements);
  37201. }
  37202. public function asText()
  37203. {
  37204. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  37205. $descriptor = new TextDescriptor();
  37206. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  37207. $descriptor->describe($output, $this, array('raw_output' => true));
  37208. return $output->fetch();
  37209. }
  37210. public function asXml($asDom = false)
  37211. {
  37212. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  37213. $descriptor = new XmlDescriptor();
  37214. if ($asDom) {
  37215. return $descriptor->getInputDefinitionDocument($this);
  37216. }
  37217. $output = new BufferedOutput();
  37218. $descriptor->describe($output, $this);
  37219. return $output->fetch();
  37220. }
  37221. }
  37222. <?php
  37223. namespace Symfony\Component\Console\Input;
  37224. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37225. use Symfony\Component\Console\Exception\RuntimeException;
  37226. interface InputInterface
  37227. {
  37228. public function getFirstArgument();
  37229. public function hasParameterOption($values);
  37230. public function getParameterOption($values, $default = false);
  37231. public function bind(InputDefinition $definition);
  37232. public function validate();
  37233. public function getArguments();
  37234. public function getArgument($name);
  37235. public function setArgument($name, $value);
  37236. public function hasArgument($name);
  37237. public function getOptions();
  37238. public function getOption($name);
  37239. public function setOption($name, $value);
  37240. public function hasOption($name);
  37241. public function isInteractive();
  37242. public function setInteractive($interactive);
  37243. }
  37244. <?php
  37245. namespace Symfony\Component\Console\Input;
  37246. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37247. use Symfony\Component\Console\Exception\LogicException;
  37248. class InputOption
  37249. {
  37250. const VALUE_NONE = 1;
  37251. const VALUE_REQUIRED = 2;
  37252. const VALUE_OPTIONAL = 4;
  37253. const VALUE_IS_ARRAY = 8;
  37254. private $name;
  37255. private $shortcut;
  37256. private $mode;
  37257. private $default;
  37258. private $description;
  37259. public function __construct($name, $shortcut = null, $mode = null, $description = '', $default = null)
  37260. {
  37261. if (0 === strpos($name, '--')) {
  37262. $name = substr($name, 2);
  37263. }
  37264. if (empty($name)) {
  37265. throw new InvalidArgumentException('An option name cannot be empty.');
  37266. }
  37267. if (empty($shortcut)) {
  37268. $shortcut = null;
  37269. }
  37270. if (null !== $shortcut) {
  37271. if (\is_array($shortcut)) {
  37272. $shortcut = implode('|', $shortcut);
  37273. }
  37274. $shortcuts = preg_split('{(\|)-?}', ltrim($shortcut, '-'));
  37275. $shortcuts = array_filter($shortcuts);
  37276. $shortcut = implode('|', $shortcuts);
  37277. if (empty($shortcut)) {
  37278. throw new InvalidArgumentException('An option shortcut cannot be empty.');
  37279. }
  37280. }
  37281. if (null === $mode) {
  37282. $mode = self::VALUE_NONE;
  37283. } elseif (!\is_int($mode) || $mode > 15 || $mode < 1) {
  37284. throw new InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode));
  37285. }
  37286. $this->name = $name;
  37287. $this->shortcut = $shortcut;
  37288. $this->mode = $mode;
  37289. $this->description = $description;
  37290. if ($this->isArray() && !$this->acceptValue()) {
  37291. throw new InvalidArgumentException('Impossible to have an option mode VALUE_IS_ARRAY if the option does not accept a value.');
  37292. }
  37293. $this->setDefault($default);
  37294. }
  37295. public function getShortcut()
  37296. {
  37297. return $this->shortcut;
  37298. }
  37299. public function getName()
  37300. {
  37301. return $this->name;
  37302. }
  37303. public function acceptValue()
  37304. {
  37305. return $this->isValueRequired() || $this->isValueOptional();
  37306. }
  37307. public function isValueRequired()
  37308. {
  37309. return self::VALUE_REQUIRED === (self::VALUE_REQUIRED & $this->mode);
  37310. }
  37311. public function isValueOptional()
  37312. {
  37313. return self::VALUE_OPTIONAL === (self::VALUE_OPTIONAL & $this->mode);
  37314. }
  37315. public function isArray()
  37316. {
  37317. return self::VALUE_IS_ARRAY === (self::VALUE_IS_ARRAY & $this->mode);
  37318. }
  37319. public function setDefault($default = null)
  37320. {
  37321. if (self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default) {
  37322. throw new LogicException('Cannot set a default value when using InputOption::VALUE_NONE mode.');
  37323. }
  37324. if ($this->isArray()) {
  37325. if (null === $default) {
  37326. $default = array();
  37327. } elseif (!\is_array($default)) {
  37328. throw new LogicException('A default value for an array option must be an array.');
  37329. }
  37330. }
  37331. $this->default = $this->acceptValue() ? $default : false;
  37332. }
  37333. public function getDefault()
  37334. {
  37335. return $this->default;
  37336. }
  37337. public function getDescription()
  37338. {
  37339. return $this->description;
  37340. }
  37341. public function equals(self $option)
  37342. {
  37343. return $option->getName() === $this->getName()
  37344. && $option->getShortcut() === $this->getShortcut()
  37345. && $option->getDefault() === $this->getDefault()
  37346. && $option->isArray() === $this->isArray()
  37347. && $option->isValueRequired() === $this->isValueRequired()
  37348. && $option->isValueOptional() === $this->isValueOptional()
  37349. ;
  37350. }
  37351. }
  37352. <?php
  37353. namespace Symfony\Component\Console\Input;
  37354. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37355. class StringInput extends ArgvInput
  37356. {
  37357. const REGEX_STRING = '([^\s]+?)(?:\s|(?<!\\\\)"|(?<!\\\\)\'|$)';
  37358. const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';
  37359. public function __construct($input, InputDefinition $definition = null)
  37360. {
  37361. if ($definition) {
  37362. @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);
  37363. }
  37364. parent::__construct(array(), null);
  37365. $this->setTokens($this->tokenize($input));
  37366. if (null !== $definition) {
  37367. $this->bind($definition);
  37368. }
  37369. }
  37370. private function tokenize($input)
  37371. {
  37372. $tokens = array();
  37373. $length = \strlen($input);
  37374. $cursor = 0;
  37375. while ($cursor < $length) {
  37376. if (preg_match('/\s+/A', $input, $match, null, $cursor)) {
  37377. } elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, null, $cursor)) {
  37378. $tokens[] = $match[1].$match[2].stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, \strlen($match[3]) - 2)));
  37379. } elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, null, $cursor)) {
  37380. $tokens[] = stripcslashes(substr($match[0], 1, \strlen($match[0]) - 2));
  37381. } elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, null, $cursor)) {
  37382. $tokens[] = stripcslashes($match[1]);
  37383. } else {
  37384. throw new InvalidArgumentException(sprintf('Unable to parse input near "... %s ..."', substr($input, $cursor, 10)));
  37385. }
  37386. $cursor += \strlen($match[0]);
  37387. }
  37388. return $tokens;
  37389. }
  37390. }
  37391. Copyright (c) 2004-2018 Fabien Potencier
  37392. Permission is hereby granted, free of charge, to any person obtaining a copy
  37393. of this software and associated documentation files (the "Software"), to deal
  37394. in the Software without restriction, including without limitation the rights
  37395. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  37396. copies of the Software, and to permit persons to whom the Software is furnished
  37397. to do so, subject to the following conditions:
  37398. The above copyright notice and this permission notice shall be included in all
  37399. copies or substantial portions of the Software.
  37400. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  37401. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  37402. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  37403. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  37404. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  37405. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  37406. THE SOFTWARE.
  37407. <?php
  37408. namespace Symfony\Component\Console\Logger;
  37409. use Psr\Log\AbstractLogger;
  37410. use Psr\Log\InvalidArgumentException;
  37411. use Psr\Log\LogLevel;
  37412. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  37413. use Symfony\Component\Console\Output\OutputInterface;
  37414. class ConsoleLogger extends AbstractLogger
  37415. {
  37416. const INFO = 'info';
  37417. const ERROR = 'error';
  37418. private $output;
  37419. private $verbosityLevelMap = array(
  37420. LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL,
  37421. LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL,
  37422. LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL,
  37423. LogLevel::ERROR => OutputInterface::VERBOSITY_NORMAL,
  37424. LogLevel::WARNING => OutputInterface::VERBOSITY_NORMAL,
  37425. LogLevel::NOTICE => OutputInterface::VERBOSITY_VERBOSE,
  37426. LogLevel::INFO => OutputInterface::VERBOSITY_VERY_VERBOSE,
  37427. LogLevel::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  37428. );
  37429. private $formatLevelMap = array(
  37430. LogLevel::EMERGENCY => self::ERROR,
  37431. LogLevel::ALERT => self::ERROR,
  37432. LogLevel::CRITICAL => self::ERROR,
  37433. LogLevel::ERROR => self::ERROR,
  37434. LogLevel::WARNING => self::INFO,
  37435. LogLevel::NOTICE => self::INFO,
  37436. LogLevel::INFO => self::INFO,
  37437. LogLevel::DEBUG => self::INFO,
  37438. );
  37439. public function __construct(OutputInterface $output, array $verbosityLevelMap = array(), array $formatLevelMap = array())
  37440. {
  37441. $this->output = $output;
  37442. $this->verbosityLevelMap = $verbosityLevelMap + $this->verbosityLevelMap;
  37443. $this->formatLevelMap = $formatLevelMap + $this->formatLevelMap;
  37444. }
  37445. public function log($level, $message, array $context = array())
  37446. {
  37447. if (!isset($this->verbosityLevelMap[$level])) {
  37448. throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level));
  37449. }
  37450. if (self::ERROR === $this->formatLevelMap[$level] && $this->output instanceof ConsoleOutputInterface) {
  37451. $output = $this->output->getErrorOutput();
  37452. } else {
  37453. $output = $this->output;
  37454. }
  37455. if ($output->getVerbosity() >= $this->verbosityLevelMap[$level]) {
  37456. $output->writeln(sprintf('<%1$s>[%2$s] %3$s</%1$s>', $this->formatLevelMap[$level], $level, $this->interpolate($message, $context)));
  37457. }
  37458. }
  37459. private function interpolate($message, array $context)
  37460. {
  37461. $replace = array();
  37462. foreach ($context as $key => $val) {
  37463. if (!\is_array($val) && (!\is_object($val) || method_exists($val, '__toString'))) {
  37464. $replace[sprintf('{%s}', $key)] = $val;
  37465. }
  37466. }
  37467. return strtr($message, $replace);
  37468. }
  37469. }
  37470. <?php
  37471. namespace Symfony\Component\Console\Output;
  37472. class BufferedOutput extends Output
  37473. {
  37474. private $buffer = '';
  37475. public function fetch()
  37476. {
  37477. $content = $this->buffer;
  37478. $this->buffer = '';
  37479. return $content;
  37480. }
  37481. protected function doWrite($message, $newline)
  37482. {
  37483. $this->buffer .= $message;
  37484. if ($newline) {
  37485. $this->buffer .= PHP_EOL;
  37486. }
  37487. }
  37488. }
  37489. <?php
  37490. namespace Symfony\Component\Console\Output;
  37491. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  37492. class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
  37493. {
  37494. private $stderr;
  37495. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  37496. {
  37497. parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter);
  37498. $actualDecorated = $this->isDecorated();
  37499. $this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated, $this->getFormatter());
  37500. if (null === $decorated) {
  37501. $this->setDecorated($actualDecorated && $this->stderr->isDecorated());
  37502. }
  37503. }
  37504. public function setDecorated($decorated)
  37505. {
  37506. parent::setDecorated($decorated);
  37507. $this->stderr->setDecorated($decorated);
  37508. }
  37509. public function setFormatter(OutputFormatterInterface $formatter)
  37510. {
  37511. parent::setFormatter($formatter);
  37512. $this->stderr->setFormatter($formatter);
  37513. }
  37514. public function setVerbosity($level)
  37515. {
  37516. parent::setVerbosity($level);
  37517. $this->stderr->setVerbosity($level);
  37518. }
  37519. public function getErrorOutput()
  37520. {
  37521. return $this->stderr;
  37522. }
  37523. public function setErrorOutput(OutputInterface $error)
  37524. {
  37525. $this->stderr = $error;
  37526. }
  37527. protected function hasStdoutSupport()
  37528. {
  37529. return false === $this->isRunningOS400();
  37530. }
  37531. protected function hasStderrSupport()
  37532. {
  37533. return false === $this->isRunningOS400();
  37534. }
  37535. private function isRunningOS400()
  37536. {
  37537. $checks = array(
  37538. \function_exists('php_uname') ? php_uname('s') : '',
  37539. getenv('OSTYPE'),
  37540. PHP_OS,
  37541. );
  37542. return false !== stripos(implode(';', $checks), 'OS400');
  37543. }
  37544. private function openOutputStream()
  37545. {
  37546. $outputStream = $this->hasStdoutSupport() ? 'php://stdout' : 'php://output';
  37547. return @fopen($outputStream, 'w') ?: fopen('php://output', 'w');
  37548. }
  37549. private function openErrorStream()
  37550. {
  37551. $errorStream = $this->hasStderrSupport() ? 'php://stderr' : 'php://output';
  37552. return fopen($errorStream, 'w');
  37553. }
  37554. }
  37555. <?php
  37556. namespace Symfony\Component\Console\Output;
  37557. interface ConsoleOutputInterface extends OutputInterface
  37558. {
  37559. public function getErrorOutput();
  37560. public function setErrorOutput(OutputInterface $error);
  37561. }
  37562. <?php
  37563. namespace Symfony\Component\Console\Output;
  37564. use Symfony\Component\Console\Formatter\OutputFormatter;
  37565. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  37566. class NullOutput implements OutputInterface
  37567. {
  37568. public function setFormatter(OutputFormatterInterface $formatter)
  37569. {
  37570. }
  37571. public function getFormatter()
  37572. {
  37573. return new OutputFormatter();
  37574. }
  37575. public function setDecorated($decorated)
  37576. {
  37577. }
  37578. public function isDecorated()
  37579. {
  37580. return false;
  37581. }
  37582. public function setVerbosity($level)
  37583. {
  37584. }
  37585. public function getVerbosity()
  37586. {
  37587. return self::VERBOSITY_QUIET;
  37588. }
  37589. public function isQuiet()
  37590. {
  37591. return true;
  37592. }
  37593. public function isVerbose()
  37594. {
  37595. return false;
  37596. }
  37597. public function isVeryVerbose()
  37598. {
  37599. return false;
  37600. }
  37601. public function isDebug()
  37602. {
  37603. return false;
  37604. }
  37605. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  37606. {
  37607. }
  37608. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  37609. {
  37610. }
  37611. }
  37612. <?php
  37613. namespace Symfony\Component\Console\Output;
  37614. use Symfony\Component\Console\Formatter\OutputFormatter;
  37615. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  37616. abstract class Output implements OutputInterface
  37617. {
  37618. private $verbosity;
  37619. private $formatter;
  37620. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = false, OutputFormatterInterface $formatter = null)
  37621. {
  37622. $this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity;
  37623. $this->formatter = $formatter ?: new OutputFormatter();
  37624. $this->formatter->setDecorated($decorated);
  37625. }
  37626. public function setFormatter(OutputFormatterInterface $formatter)
  37627. {
  37628. $this->formatter = $formatter;
  37629. }
  37630. public function getFormatter()
  37631. {
  37632. return $this->formatter;
  37633. }
  37634. public function setDecorated($decorated)
  37635. {
  37636. $this->formatter->setDecorated($decorated);
  37637. }
  37638. public function isDecorated()
  37639. {
  37640. return $this->formatter->isDecorated();
  37641. }
  37642. public function setVerbosity($level)
  37643. {
  37644. $this->verbosity = (int) $level;
  37645. }
  37646. public function getVerbosity()
  37647. {
  37648. return $this->verbosity;
  37649. }
  37650. public function isQuiet()
  37651. {
  37652. return self::VERBOSITY_QUIET === $this->verbosity;
  37653. }
  37654. public function isVerbose()
  37655. {
  37656. return self::VERBOSITY_VERBOSE <= $this->verbosity;
  37657. }
  37658. public function isVeryVerbose()
  37659. {
  37660. return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity;
  37661. }
  37662. public function isDebug()
  37663. {
  37664. return self::VERBOSITY_DEBUG <= $this->verbosity;
  37665. }
  37666. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  37667. {
  37668. $this->write($messages, true, $options);
  37669. }
  37670. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  37671. {
  37672. $messages = (array) $messages;
  37673. $types = self::OUTPUT_NORMAL | self::OUTPUT_RAW | self::OUTPUT_PLAIN;
  37674. $type = $types & $options ?: self::OUTPUT_NORMAL;
  37675. $verbosities = self::VERBOSITY_QUIET | self::VERBOSITY_NORMAL | self::VERBOSITY_VERBOSE | self::VERBOSITY_VERY_VERBOSE | self::VERBOSITY_DEBUG;
  37676. $verbosity = $verbosities & $options ?: self::VERBOSITY_NORMAL;
  37677. if ($verbosity > $this->getVerbosity()) {
  37678. return;
  37679. }
  37680. foreach ($messages as $message) {
  37681. switch ($type) {
  37682. case OutputInterface::OUTPUT_NORMAL:
  37683. $message = $this->formatter->format($message);
  37684. break;
  37685. case OutputInterface::OUTPUT_RAW:
  37686. break;
  37687. case OutputInterface::OUTPUT_PLAIN:
  37688. $message = strip_tags($this->formatter->format($message));
  37689. break;
  37690. }
  37691. $this->doWrite($message, $newline);
  37692. }
  37693. }
  37694. abstract protected function doWrite($message, $newline);
  37695. }
  37696. <?php
  37697. namespace Symfony\Component\Console\Output;
  37698. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  37699. interface OutputInterface
  37700. {
  37701. const VERBOSITY_QUIET = 16;
  37702. const VERBOSITY_NORMAL = 32;
  37703. const VERBOSITY_VERBOSE = 64;
  37704. const VERBOSITY_VERY_VERBOSE = 128;
  37705. const VERBOSITY_DEBUG = 256;
  37706. const OUTPUT_NORMAL = 1;
  37707. const OUTPUT_RAW = 2;
  37708. const OUTPUT_PLAIN = 4;
  37709. public function write($messages, $newline = false, $options = 0);
  37710. public function writeln($messages, $options = 0);
  37711. public function setVerbosity($level);
  37712. public function getVerbosity();
  37713. public function setDecorated($decorated);
  37714. public function isDecorated();
  37715. public function setFormatter(OutputFormatterInterface $formatter);
  37716. public function getFormatter();
  37717. }
  37718. <?php
  37719. namespace Symfony\Component\Console\Output;
  37720. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37721. use Symfony\Component\Console\Exception\RuntimeException;
  37722. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  37723. class StreamOutput extends Output
  37724. {
  37725. private $stream;
  37726. public function __construct($stream, $verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  37727. {
  37728. if (!\is_resource($stream) || 'stream' !== get_resource_type($stream)) {
  37729. throw new InvalidArgumentException('The StreamOutput class needs a stream as its first argument.');
  37730. }
  37731. $this->stream = $stream;
  37732. if (null === $decorated) {
  37733. $decorated = $this->hasColorSupport();
  37734. }
  37735. parent::__construct($verbosity, $decorated, $formatter);
  37736. }
  37737. public function getStream()
  37738. {
  37739. return $this->stream;
  37740. }
  37741. protected function doWrite($message, $newline)
  37742. {
  37743. if ($newline) {
  37744. $message .= PHP_EOL;
  37745. }
  37746. if (false === @fwrite($this->stream, $message)) {
  37747. throw new RuntimeException('Unable to write output.');
  37748. }
  37749. fflush($this->stream);
  37750. }
  37751. protected function hasColorSupport()
  37752. {
  37753. if ('Hyper' === getenv('TERM_PROGRAM')) {
  37754. return true;
  37755. }
  37756. if (\DIRECTORY_SEPARATOR === '\\') {
  37757. return (\function_exists('sapi_windows_vt100_support')
  37758. && @sapi_windows_vt100_support($this->stream))
  37759. || false !== getenv('ANSICON')
  37760. || 'ON' === getenv('ConEmuANSI')
  37761. || 'xterm' === getenv('TERM');
  37762. }
  37763. if (\function_exists('stream_isatty')) {
  37764. return @stream_isatty($this->stream);
  37765. }
  37766. if (\function_exists('posix_isatty')) {
  37767. return @posix_isatty($this->stream);
  37768. }
  37769. $stat = @fstat($this->stream);
  37770. return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
  37771. }
  37772. }
  37773. <?php
  37774. namespace Symfony\Component\Console\Question;
  37775. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37776. class ChoiceQuestion extends Question
  37777. {
  37778. private $choices;
  37779. private $multiselect = false;
  37780. private $prompt = ' > ';
  37781. private $errorMessage = 'Value "%s" is invalid';
  37782. public function __construct($question, array $choices, $default = null)
  37783. {
  37784. if (!$choices) {
  37785. throw new \LogicException('Choice question must have at least 1 choice available.');
  37786. }
  37787. parent::__construct($question, $default);
  37788. $this->choices = $choices;
  37789. $this->setValidator($this->getDefaultValidator());
  37790. $this->setAutocompleterValues($choices);
  37791. }
  37792. public function getChoices()
  37793. {
  37794. return $this->choices;
  37795. }
  37796. public function setMultiselect($multiselect)
  37797. {
  37798. $this->multiselect = $multiselect;
  37799. $this->setValidator($this->getDefaultValidator());
  37800. return $this;
  37801. }
  37802. public function isMultiselect()
  37803. {
  37804. return $this->multiselect;
  37805. }
  37806. public function getPrompt()
  37807. {
  37808. return $this->prompt;
  37809. }
  37810. public function setPrompt($prompt)
  37811. {
  37812. $this->prompt = $prompt;
  37813. return $this;
  37814. }
  37815. public function setErrorMessage($errorMessage)
  37816. {
  37817. $this->errorMessage = $errorMessage;
  37818. $this->setValidator($this->getDefaultValidator());
  37819. return $this;
  37820. }
  37821. private function getDefaultValidator()
  37822. {
  37823. $choices = $this->choices;
  37824. $errorMessage = $this->errorMessage;
  37825. $multiselect = $this->multiselect;
  37826. $isAssoc = $this->isAssoc($choices);
  37827. return function ($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) {
  37828. $selectedChoices = str_replace(' ', '', $selected);
  37829. if ($multiselect) {
  37830. if (!preg_match('/^[^,]+(?:,[^,]+)*$/', $selectedChoices, $matches)) {
  37831. throw new InvalidArgumentException(sprintf($errorMessage, $selected));
  37832. }
  37833. $selectedChoices = explode(',', $selectedChoices);
  37834. } else {
  37835. $selectedChoices = array($selected);
  37836. }
  37837. $multiselectChoices = array();
  37838. foreach ($selectedChoices as $value) {
  37839. $results = array();
  37840. foreach ($choices as $key => $choice) {
  37841. if ($choice === $value) {
  37842. $results[] = $key;
  37843. }
  37844. }
  37845. if (\count($results) > 1) {
  37846. throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of %s.', implode(' or ', $results)));
  37847. }
  37848. $result = array_search($value, $choices);
  37849. if (!$isAssoc) {
  37850. if (false !== $result) {
  37851. $result = $choices[$result];
  37852. } elseif (isset($choices[$value])) {
  37853. $result = $choices[$value];
  37854. }
  37855. } elseif (false === $result && isset($choices[$value])) {
  37856. $result = $value;
  37857. }
  37858. if (false === $result) {
  37859. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  37860. }
  37861. $multiselectChoices[] = (string) $result;
  37862. }
  37863. if ($multiselect) {
  37864. return $multiselectChoices;
  37865. }
  37866. return current($multiselectChoices);
  37867. };
  37868. }
  37869. }
  37870. <?php
  37871. namespace Symfony\Component\Console\Question;
  37872. class ConfirmationQuestion extends Question
  37873. {
  37874. private $trueAnswerRegex;
  37875. public function __construct($question, $default = true, $trueAnswerRegex = '/^y/i')
  37876. {
  37877. parent::__construct($question, (bool) $default);
  37878. $this->trueAnswerRegex = $trueAnswerRegex;
  37879. $this->setNormalizer($this->getDefaultNormalizer());
  37880. }
  37881. private function getDefaultNormalizer()
  37882. {
  37883. $default = $this->getDefault();
  37884. $regex = $this->trueAnswerRegex;
  37885. return function ($answer) use ($default, $regex) {
  37886. if (\is_bool($answer)) {
  37887. return $answer;
  37888. }
  37889. $answerIsTrue = (bool) preg_match($regex, $answer);
  37890. if (false === $default) {
  37891. return $answer && $answerIsTrue;
  37892. }
  37893. return !$answer || $answerIsTrue;
  37894. };
  37895. }
  37896. }
  37897. <?php
  37898. namespace Symfony\Component\Console\Question;
  37899. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37900. use Symfony\Component\Console\Exception\LogicException;
  37901. class Question
  37902. {
  37903. private $question;
  37904. private $attempts;
  37905. private $hidden = false;
  37906. private $hiddenFallback = true;
  37907. private $autocompleterValues;
  37908. private $validator;
  37909. private $default;
  37910. private $normalizer;
  37911. public function __construct($question, $default = null)
  37912. {
  37913. $this->question = $question;
  37914. $this->default = $default;
  37915. }
  37916. public function getQuestion()
  37917. {
  37918. return $this->question;
  37919. }
  37920. public function getDefault()
  37921. {
  37922. return $this->default;
  37923. }
  37924. public function isHidden()
  37925. {
  37926. return $this->hidden;
  37927. }
  37928. public function setHidden($hidden)
  37929. {
  37930. if ($this->autocompleterValues) {
  37931. throw new LogicException('A hidden question cannot use the autocompleter.');
  37932. }
  37933. $this->hidden = (bool) $hidden;
  37934. return $this;
  37935. }
  37936. public function isHiddenFallback()
  37937. {
  37938. return $this->hiddenFallback;
  37939. }
  37940. public function setHiddenFallback($fallback)
  37941. {
  37942. $this->hiddenFallback = (bool) $fallback;
  37943. return $this;
  37944. }
  37945. public function getAutocompleterValues()
  37946. {
  37947. return $this->autocompleterValues;
  37948. }
  37949. public function setAutocompleterValues($values)
  37950. {
  37951. if (\is_array($values)) {
  37952. $values = $this->isAssoc($values) ? array_merge(array_keys($values), array_values($values)) : array_values($values);
  37953. }
  37954. if (null !== $values && !\is_array($values) && !$values instanceof \Traversable) {
  37955. throw new InvalidArgumentException('Autocompleter values can be either an array, `null` or a `Traversable` object.');
  37956. }
  37957. if ($this->hidden) {
  37958. throw new LogicException('A hidden question cannot use the autocompleter.');
  37959. }
  37960. $this->autocompleterValues = $values;
  37961. return $this;
  37962. }
  37963. public function setValidator($validator)
  37964. {
  37965. $this->validator = $validator;
  37966. return $this;
  37967. }
  37968. public function getValidator()
  37969. {
  37970. return $this->validator;
  37971. }
  37972. public function setMaxAttempts($attempts)
  37973. {
  37974. if (null !== $attempts && $attempts < 1) {
  37975. throw new InvalidArgumentException('Maximum number of attempts must be a positive value.');
  37976. }
  37977. $this->attempts = $attempts;
  37978. return $this;
  37979. }
  37980. public function getMaxAttempts()
  37981. {
  37982. return $this->attempts;
  37983. }
  37984. public function setNormalizer($normalizer)
  37985. {
  37986. $this->normalizer = $normalizer;
  37987. return $this;
  37988. }
  37989. public function getNormalizer()
  37990. {
  37991. return $this->normalizer;
  37992. }
  37993. protected function isAssoc($array)
  37994. {
  37995. return (bool) \count(array_filter(array_keys($array), 'is_string'));
  37996. }
  37997. }
  37998. <?php
  37999. namespace Symfony\Component\Console;
  38000. use Symfony\Component\Console\Exception\RuntimeException;
  38001. use Symfony\Component\Console\Input\StringInput;
  38002. use Symfony\Component\Console\Output\ConsoleOutput;
  38003. use Symfony\Component\Process\PhpExecutableFinder;
  38004. use Symfony\Component\Process\ProcessBuilder;
  38005. class Shell
  38006. {
  38007. private $application;
  38008. private $history;
  38009. private $output;
  38010. private $hasReadline;
  38011. private $processIsolation = false;
  38012. public function __construct(Application $application)
  38013. {
  38014. @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  38015. $this->hasReadline = \function_exists('readline');
  38016. $this->application = $application;
  38017. $this->history = getenv('HOME').'/.history_'.$application->getName();
  38018. $this->output = new ConsoleOutput();
  38019. }
  38020. public function run()
  38021. {
  38022. $this->application->setAutoExit(false);
  38023. $this->application->setCatchExceptions(true);
  38024. if ($this->hasReadline) {
  38025. readline_read_history($this->history);
  38026. readline_completion_function(array($this, 'autocompleter'));
  38027. }
  38028. $this->output->writeln($this->getHeader());
  38029. $php = null;
  38030. if ($this->processIsolation) {
  38031. $finder = new PhpExecutableFinder();
  38032. $php = $finder->find();
  38033. $this->output->writeln(<<<'EOF'
  38034. <info>Running with process isolation, you should consider this:</info>
  38035. * each command is executed as separate process,
  38036. * commands don't support interactivity, all params must be passed explicitly,
  38037. * commands output is not colorized.
  38038. EOF
  38039. );
  38040. }
  38041. while (true) {
  38042. $command = $this->readline();
  38043. if (false === $command) {
  38044. $this->output->writeln("\n");
  38045. break;
  38046. }
  38047. if ($this->hasReadline) {
  38048. readline_add_history($command);
  38049. readline_write_history($this->history);
  38050. }
  38051. if ($this->processIsolation) {
  38052. $pb = new ProcessBuilder();
  38053. $process = $pb
  38054. ->add($php)
  38055. ->add($_SERVER['argv'][0])
  38056. ->add($command)
  38057. ->inheritEnvironmentVariables(true)
  38058. ->getProcess()
  38059. ;
  38060. $output = $this->output;
  38061. $process->run(function ($type, $data) use ($output) {
  38062. $output->writeln($data);
  38063. });
  38064. $ret = $process->getExitCode();
  38065. } else {
  38066. $ret = $this->application->run(new StringInput($command), $this->output);
  38067. }
  38068. if (0 !== $ret) {
  38069. $this->output->writeln(sprintf('<error>The command terminated with an error status (%s)</error>', $ret));
  38070. }
  38071. }
  38072. }
  38073. protected function getHeader()
  38074. {
  38075. return <<<EOF
  38076. Welcome to the <info>{$this->application->getName()}</info> shell (<comment>{$this->application->getVersion()}</comment>).
  38077. At the prompt, type <comment>help</comment> for some help,
  38078. or <comment>list</comment> to get a list of available commands.
  38079. To exit the shell, type <comment>^D</comment>.
  38080. EOF;
  38081. }
  38082. protected function getPrompt()
  38083. {
  38084. return $this->output->getFormatter()->format($this->application->getName().' > ');
  38085. }
  38086. protected function getOutput()
  38087. {
  38088. return $this->output;
  38089. }
  38090. protected function getApplication()
  38091. {
  38092. return $this->application;
  38093. }
  38094. private function autocompleter($text)
  38095. {
  38096. $info = readline_info();
  38097. $text = substr($info['line_buffer'], 0, $info['end']);
  38098. if ($info['point'] !== $info['end']) {
  38099. return true;
  38100. }
  38101. if (false === strpos($text, ' ') || !$text) {
  38102. return array_keys($this->application->all());
  38103. }
  38104. try {
  38105. $command = $this->application->find(substr($text, 0, strpos($text, ' ')));
  38106. } catch (\Exception $e) {
  38107. return true;
  38108. }
  38109. $list = array('--help');
  38110. foreach ($command->getDefinition()->getOptions() as $option) {
  38111. $list[] = '--'.$option->getName();
  38112. }
  38113. return $list;
  38114. }
  38115. private function readline()
  38116. {
  38117. if ($this->hasReadline) {
  38118. $line = readline($this->getPrompt());
  38119. } else {
  38120. $this->output->write($this->getPrompt());
  38121. $line = fgets(STDIN, 1024);
  38122. $line = (false === $line || '' === $line) ? false : rtrim($line);
  38123. }
  38124. return $line;
  38125. }
  38126. public function getProcessIsolation()
  38127. {
  38128. return $this->processIsolation;
  38129. }
  38130. public function setProcessIsolation($processIsolation)
  38131. {
  38132. $this->processIsolation = (bool) $processIsolation;
  38133. if ($this->processIsolation && !class_exists('Symfony\\Component\\Process\\Process')) {
  38134. throw new RuntimeException('Unable to isolate processes as the Symfony Process Component is not installed.');
  38135. }
  38136. }
  38137. }
  38138. <?php
  38139. namespace Symfony\Component\Console\Style;
  38140. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  38141. use Symfony\Component\Console\Helper\ProgressBar;
  38142. use Symfony\Component\Console\Output\OutputInterface;
  38143. abstract class OutputStyle implements OutputInterface, StyleInterface
  38144. {
  38145. private $output;
  38146. public function __construct(OutputInterface $output)
  38147. {
  38148. $this->output = $output;
  38149. }
  38150. public function newLine($count = 1)
  38151. {
  38152. $this->output->write(str_repeat(PHP_EOL, $count));
  38153. }
  38154. public function createProgressBar($max = 0)
  38155. {
  38156. return new ProgressBar($this->output, $max);
  38157. }
  38158. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  38159. {
  38160. $this->output->write($messages, $newline, $type);
  38161. }
  38162. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  38163. {
  38164. $this->output->writeln($messages, $type);
  38165. }
  38166. public function setVerbosity($level)
  38167. {
  38168. $this->output->setVerbosity($level);
  38169. }
  38170. public function getVerbosity()
  38171. {
  38172. return $this->output->getVerbosity();
  38173. }
  38174. public function setDecorated($decorated)
  38175. {
  38176. $this->output->setDecorated($decorated);
  38177. }
  38178. public function isDecorated()
  38179. {
  38180. return $this->output->isDecorated();
  38181. }
  38182. public function setFormatter(OutputFormatterInterface $formatter)
  38183. {
  38184. $this->output->setFormatter($formatter);
  38185. }
  38186. public function getFormatter()
  38187. {
  38188. return $this->output->getFormatter();
  38189. }
  38190. }
  38191. <?php
  38192. namespace Symfony\Component\Console\Style;
  38193. interface StyleInterface
  38194. {
  38195. public function title($message);
  38196. public function section($message);
  38197. public function listing(array $elements);
  38198. public function text($message);
  38199. public function success($message);
  38200. public function error($message);
  38201. public function warning($message);
  38202. public function note($message);
  38203. public function caution($message);
  38204. public function table(array $headers, array $rows);
  38205. public function ask($question, $default = null, $validator = null);
  38206. public function askHidden($question, $validator = null);
  38207. public function confirm($question, $default = true);
  38208. public function choice($question, array $choices, $default = null);
  38209. public function newLine($count = 1);
  38210. public function progressStart($max = 0);
  38211. public function progressAdvance($step = 1);
  38212. public function progressFinish();
  38213. }
  38214. <?php
  38215. namespace Symfony\Component\Console\Style;
  38216. use Symfony\Component\Console\Application;
  38217. use Symfony\Component\Console\Exception\RuntimeException;
  38218. use Symfony\Component\Console\Formatter\OutputFormatter;
  38219. use Symfony\Component\Console\Helper\Helper;
  38220. use Symfony\Component\Console\Helper\ProgressBar;
  38221. use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
  38222. use Symfony\Component\Console\Helper\Table;
  38223. use Symfony\Component\Console\Input\InputInterface;
  38224. use Symfony\Component\Console\Output\BufferedOutput;
  38225. use Symfony\Component\Console\Output\OutputInterface;
  38226. use Symfony\Component\Console\Question\ChoiceQuestion;
  38227. use Symfony\Component\Console\Question\ConfirmationQuestion;
  38228. use Symfony\Component\Console\Question\Question;
  38229. class SymfonyStyle extends OutputStyle
  38230. {
  38231. const MAX_LINE_LENGTH = 120;
  38232. private $input;
  38233. private $questionHelper;
  38234. private $progressBar;
  38235. private $lineLength;
  38236. private $bufferedOutput;
  38237. public function __construct(InputInterface $input, OutputInterface $output)
  38238. {
  38239. $this->input = $input;
  38240. $this->bufferedOutput = new BufferedOutput($output->getVerbosity(), false, clone $output->getFormatter());
  38241. $this->lineLength = min($this->getTerminalWidth() - (int) (\DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH);
  38242. parent::__construct($output);
  38243. }
  38244. public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false)
  38245. {
  38246. $messages = \is_array($messages) ? array_values($messages) : array($messages);
  38247. $this->autoPrependBlock();
  38248. $this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, true));
  38249. $this->newLine();
  38250. }
  38251. public function title($message)
  38252. {
  38253. $this->autoPrependBlock();
  38254. $this->writeln(array(
  38255. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  38256. sprintf('<comment>%s</>', str_repeat('=', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  38257. ));
  38258. $this->newLine();
  38259. }
  38260. public function section($message)
  38261. {
  38262. $this->autoPrependBlock();
  38263. $this->writeln(array(
  38264. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  38265. sprintf('<comment>%s</>', str_repeat('-', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  38266. ));
  38267. $this->newLine();
  38268. }
  38269. public function listing(array $elements)
  38270. {
  38271. $this->autoPrependText();
  38272. $elements = array_map(function ($element) {
  38273. return sprintf(' * %s', $element);
  38274. }, $elements);
  38275. $this->writeln($elements);
  38276. $this->newLine();
  38277. }
  38278. public function text($message)
  38279. {
  38280. $this->autoPrependText();
  38281. $messages = \is_array($message) ? array_values($message) : array($message);
  38282. foreach ($messages as $message) {
  38283. $this->writeln(sprintf(' %s', $message));
  38284. }
  38285. }
  38286. public function comment($message)
  38287. {
  38288. $messages = \is_array($message) ? array_values($message) : array($message);
  38289. $this->autoPrependBlock();
  38290. $this->writeln($this->createBlock($messages, null, null, '<fg=default;bg=default> // </>'));
  38291. $this->newLine();
  38292. }
  38293. public function success($message)
  38294. {
  38295. $this->block($message, 'OK', 'fg=black;bg=green', ' ', true);
  38296. }
  38297. public function error($message)
  38298. {
  38299. $this->block($message, 'ERROR', 'fg=white;bg=red', ' ', true);
  38300. }
  38301. public function warning($message)
  38302. {
  38303. $this->block($message, 'WARNING', 'fg=white;bg=red', ' ', true);
  38304. }
  38305. public function note($message)
  38306. {
  38307. $this->block($message, 'NOTE', 'fg=yellow', ' ! ');
  38308. }
  38309. public function caution($message)
  38310. {
  38311. $this->block($message, 'CAUTION', 'fg=white;bg=red', ' ! ', true);
  38312. }
  38313. public function table(array $headers, array $rows)
  38314. {
  38315. $style = clone Table::getStyleDefinition('symfony-style-guide');
  38316. $style->setCellHeaderFormat('<info>%s</info>');
  38317. $table = new Table($this);
  38318. $table->setHeaders($headers);
  38319. $table->setRows($rows);
  38320. $table->setStyle($style);
  38321. $table->render();
  38322. $this->newLine();
  38323. }
  38324. public function ask($question, $default = null, $validator = null)
  38325. {
  38326. $question = new Question($question, $default);
  38327. $question->setValidator($validator);
  38328. return $this->askQuestion($question);
  38329. }
  38330. public function askHidden($question, $validator = null)
  38331. {
  38332. $question = new Question($question);
  38333. $question->setHidden(true);
  38334. $question->setValidator($validator);
  38335. return $this->askQuestion($question);
  38336. }
  38337. public function confirm($question, $default = true)
  38338. {
  38339. return $this->askQuestion(new ConfirmationQuestion($question, $default));
  38340. }
  38341. public function choice($question, array $choices, $default = null)
  38342. {
  38343. if (null !== $default) {
  38344. $values = array_flip($choices);
  38345. $default = $values[$default];
  38346. }
  38347. return $this->askQuestion(new ChoiceQuestion($question, $choices, $default));
  38348. }
  38349. public function progressStart($max = 0)
  38350. {
  38351. $this->progressBar = $this->createProgressBar($max);
  38352. $this->progressBar->start();
  38353. }
  38354. public function progressAdvance($step = 1)
  38355. {
  38356. $this->getProgressBar()->advance($step);
  38357. }
  38358. public function progressFinish()
  38359. {
  38360. $this->getProgressBar()->finish();
  38361. $this->newLine(2);
  38362. $this->progressBar = null;
  38363. }
  38364. public function createProgressBar($max = 0)
  38365. {
  38366. $progressBar = parent::createProgressBar($max);
  38367. if ('\\' !== \DIRECTORY_SEPARATOR || 'Hyper' === getenv('TERM_PROGRAM')) {
  38368. $progressBar->setEmptyBarCharacter('â–‘');
  38369. $progressBar->setProgressCharacter('');
  38370. $progressBar->setBarCharacter('â–“');
  38371. }
  38372. return $progressBar;
  38373. }
  38374. public function askQuestion(Question $question)
  38375. {
  38376. if ($this->input->isInteractive()) {
  38377. $this->autoPrependBlock();
  38378. }
  38379. if (!$this->questionHelper) {
  38380. $this->questionHelper = new SymfonyQuestionHelper();
  38381. }
  38382. $answer = $this->questionHelper->ask($this->input, $this, $question);
  38383. if ($this->input->isInteractive()) {
  38384. $this->newLine();
  38385. $this->bufferedOutput->write("\n");
  38386. }
  38387. return $answer;
  38388. }
  38389. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  38390. {
  38391. parent::writeln($messages, $type);
  38392. $this->bufferedOutput->writeln($this->reduceBuffer($messages), $type);
  38393. }
  38394. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  38395. {
  38396. parent::write($messages, $newline, $type);
  38397. $this->bufferedOutput->write($this->reduceBuffer($messages), $newline, $type);
  38398. }
  38399. public function newLine($count = 1)
  38400. {
  38401. parent::newLine($count);
  38402. $this->bufferedOutput->write(str_repeat("\n", $count));
  38403. }
  38404. private function getProgressBar()
  38405. {
  38406. if (!$this->progressBar) {
  38407. throw new RuntimeException('The ProgressBar is not started.');
  38408. }
  38409. return $this->progressBar;
  38410. }
  38411. private function getTerminalWidth()
  38412. {
  38413. $application = new Application();
  38414. $dimensions = $application->getTerminalDimensions();
  38415. return $dimensions[0] ?: self::MAX_LINE_LENGTH;
  38416. }
  38417. private function autoPrependBlock()
  38418. {
  38419. $chars = substr(str_replace(PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
  38420. if (!isset($chars[0])) {
  38421. return $this->newLine();
  38422. }
  38423. $this->newLine(2 - substr_count($chars, "\n"));
  38424. }
  38425. private function autoPrependText()
  38426. {
  38427. $fetched = $this->bufferedOutput->fetch();
  38428. if ("\n" !== substr($fetched, -1)) {
  38429. $this->newLine();
  38430. }
  38431. }
  38432. private function reduceBuffer($messages)
  38433. {
  38434. return array_map(function ($value) {
  38435. return substr($value, -4);
  38436. }, array_merge(array($this->bufferedOutput->fetch()), (array) $messages));
  38437. }
  38438. private function createBlock($messages, $type = null, $style = null, $prefix = ' ', $padding = false, $escape = false)
  38439. {
  38440. $indentLength = 0;
  38441. $prefixLength = Helper::strlenWithoutDecoration($this->getFormatter(), $prefix);
  38442. $lines = array();
  38443. if (null !== $type) {
  38444. $type = sprintf('[%s] ', $type);
  38445. $indentLength = \strlen($type);
  38446. $lineIndentation = str_repeat(' ', $indentLength);
  38447. }
  38448. foreach ($messages as $key => $message) {
  38449. if ($escape) {
  38450. $message = OutputFormatter::escape($message);
  38451. }
  38452. $lines = array_merge($lines, explode(PHP_EOL, wordwrap($message, $this->lineLength - $prefixLength - $indentLength, PHP_EOL, true)));
  38453. if (\count($messages) > 1 && $key < \count($messages) - 1) {
  38454. $lines[] = '';
  38455. }
  38456. }
  38457. $firstLineIndex = 0;
  38458. if ($padding && $this->isDecorated()) {
  38459. $firstLineIndex = 1;
  38460. array_unshift($lines, '');
  38461. $lines[] = '';
  38462. }
  38463. foreach ($lines as $i => &$line) {
  38464. if (null !== $type) {
  38465. $line = $firstLineIndex === $i ? $type.$line : $lineIndentation.$line;
  38466. }
  38467. $line = $prefix.$line;
  38468. $line .= str_repeat(' ', $this->lineLength - Helper::strlenWithoutDecoration($this->getFormatter(), $line));
  38469. if ($style) {
  38470. $line = sprintf('<%s>%s</>', $style, $line);
  38471. }
  38472. }
  38473. return $lines;
  38474. }
  38475. }
  38476. <?php
  38477. namespace Symfony\Component\Console\Tester;
  38478. use Symfony\Component\Console\Application;
  38479. use Symfony\Component\Console\Input\ArrayInput;
  38480. use Symfony\Component\Console\Input\InputInterface;
  38481. use Symfony\Component\Console\Output\OutputInterface;
  38482. use Symfony\Component\Console\Output\StreamOutput;
  38483. class ApplicationTester
  38484. {
  38485. private $application;
  38486. private $input;
  38487. private $output;
  38488. private $statusCode;
  38489. public function __construct(Application $application)
  38490. {
  38491. $this->application = $application;
  38492. }
  38493. public function run(array $input, $options = array())
  38494. {
  38495. $this->input = new ArrayInput($input);
  38496. if (isset($options['interactive'])) {
  38497. $this->input->setInteractive($options['interactive']);
  38498. }
  38499. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  38500. if (isset($options['decorated'])) {
  38501. $this->output->setDecorated($options['decorated']);
  38502. }
  38503. if (isset($options['verbosity'])) {
  38504. $this->output->setVerbosity($options['verbosity']);
  38505. }
  38506. return $this->statusCode = $this->application->run($this->input, $this->output);
  38507. }
  38508. public function getDisplay($normalize = false)
  38509. {
  38510. rewind($this->output->getStream());
  38511. $display = stream_get_contents($this->output->getStream());
  38512. if ($normalize) {
  38513. $display = str_replace(PHP_EOL, "\n", $display);
  38514. }
  38515. return $display;
  38516. }
  38517. public function getInput()
  38518. {
  38519. return $this->input;
  38520. }
  38521. public function getOutput()
  38522. {
  38523. return $this->output;
  38524. }
  38525. public function getStatusCode()
  38526. {
  38527. return $this->statusCode;
  38528. }
  38529. }
  38530. <?php
  38531. namespace Symfony\Component\Console\Tester;
  38532. use Symfony\Component\Console\Command\Command;
  38533. use Symfony\Component\Console\Input\ArrayInput;
  38534. use Symfony\Component\Console\Input\InputInterface;
  38535. use Symfony\Component\Console\Output\OutputInterface;
  38536. use Symfony\Component\Console\Output\StreamOutput;
  38537. class CommandTester
  38538. {
  38539. private $command;
  38540. private $input;
  38541. private $output;
  38542. private $statusCode;
  38543. public function __construct(Command $command)
  38544. {
  38545. $this->command = $command;
  38546. }
  38547. public function execute(array $input, array $options = array())
  38548. {
  38549. if (!isset($input['command'])
  38550. && (null !== $application = $this->command->getApplication())
  38551. && $application->getDefinition()->hasArgument('command')
  38552. ) {
  38553. $input = array_merge(array('command' => $this->command->getName()), $input);
  38554. }
  38555. $this->input = new ArrayInput($input);
  38556. if (isset($options['interactive'])) {
  38557. $this->input->setInteractive($options['interactive']);
  38558. }
  38559. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  38560. $this->output->setDecorated(isset($options['decorated']) ? $options['decorated'] : false);
  38561. if (isset($options['verbosity'])) {
  38562. $this->output->setVerbosity($options['verbosity']);
  38563. }
  38564. return $this->statusCode = $this->command->run($this->input, $this->output);
  38565. }
  38566. public function getDisplay($normalize = false)
  38567. {
  38568. rewind($this->output->getStream());
  38569. $display = stream_get_contents($this->output->getStream());
  38570. if ($normalize) {
  38571. $display = str_replace(PHP_EOL, "\n", $display);
  38572. }
  38573. return $display;
  38574. }
  38575. public function getInput()
  38576. {
  38577. return $this->input;
  38578. }
  38579. public function getOutput()
  38580. {
  38581. return $this->output;
  38582. }
  38583. public function getStatusCode()
  38584. {
  38585. return $this->statusCode;
  38586. }
  38587. }
  38588. <?php
  38589. namespace Symfony\Component\Debug;
  38590. use Psr\Log\AbstractLogger;
  38591. class BufferingLogger extends AbstractLogger
  38592. {
  38593. private $logs = array();
  38594. public function log($level, $message, array $context = array())
  38595. {
  38596. $this->logs[] = array($level, $message, $context);
  38597. }
  38598. public function cleanLogs()
  38599. {
  38600. $logs = $this->logs;
  38601. $this->logs = array();
  38602. return $logs;
  38603. }
  38604. }
  38605. <?php
  38606. namespace Symfony\Component\Debug;
  38607. class Debug
  38608. {
  38609. private static $enabled = false;
  38610. public static function enable($errorReportingLevel = null, $displayErrors = true)
  38611. {
  38612. if (static::$enabled) {
  38613. return;
  38614. }
  38615. static::$enabled = true;
  38616. if (null !== $errorReportingLevel) {
  38617. error_reporting($errorReportingLevel);
  38618. } else {
  38619. error_reporting(-1);
  38620. }
  38621. if (!\in_array(\PHP_SAPI, array('cli', 'phpdbg'), true)) {
  38622. ini_set('display_errors', 0);
  38623. ExceptionHandler::register();
  38624. } elseif ($displayErrors && (!filter_var(ini_get('log_errors'), FILTER_VALIDATE_BOOLEAN) || ini_get('error_log'))) {
  38625. ini_set('display_errors', 1);
  38626. }
  38627. if ($displayErrors) {
  38628. ErrorHandler::register(new ErrorHandler(new BufferingLogger()));
  38629. } else {
  38630. ErrorHandler::register()->throwAt(0, true);
  38631. }
  38632. DebugClassLoader::enable();
  38633. }
  38634. }
  38635. <?php
  38636. namespace Symfony\Component\Debug;
  38637. class DebugClassLoader
  38638. {
  38639. private $classLoader;
  38640. private $isFinder;
  38641. private $loaded = array();
  38642. private $wasFinder;
  38643. private static $caseCheck;
  38644. private static $deprecated = array();
  38645. private static $php7Reserved = array('int', 'float', 'bool', 'string', 'true', 'false', 'null');
  38646. private static $darwinCache = array('/' => array('/', array()));
  38647. public function __construct($classLoader)
  38648. {
  38649. $this->wasFinder = \is_object($classLoader) && method_exists($classLoader, 'findFile');
  38650. if ($this->wasFinder) {
  38651. @trigger_error('The '.__METHOD__.' method will no longer support receiving an object into its $classLoader argument in 3.0.', E_USER_DEPRECATED);
  38652. $this->classLoader = array($classLoader, 'loadClass');
  38653. $this->isFinder = true;
  38654. } else {
  38655. $this->classLoader = $classLoader;
  38656. $this->isFinder = \is_array($classLoader) && method_exists($classLoader[0], 'findFile');
  38657. }
  38658. if (!isset(self::$caseCheck)) {
  38659. $file = file_exists(__FILE__) ? __FILE__ : rtrim(realpath('.'), \DIRECTORY_SEPARATOR);
  38660. $i = strrpos($file, \DIRECTORY_SEPARATOR);
  38661. $dir = substr($file, 0, 1 + $i);
  38662. $file = substr($file, 1 + $i);
  38663. $test = strtoupper($file) === $file ? strtolower($file) : strtoupper($file);
  38664. $test = realpath($dir.$test);
  38665. if (false === $test || false === $i) {
  38666. self::$caseCheck = 0;
  38667. } elseif (substr($test, -\strlen($file)) === $file) {
  38668. self::$caseCheck = 1;
  38669. } elseif (false !== stripos(PHP_OS, 'darwin')) {
  38670. self::$caseCheck = 2;
  38671. } else {
  38672. self::$caseCheck = 0;
  38673. }
  38674. }
  38675. }
  38676. public function getClassLoader()
  38677. {
  38678. return $this->wasFinder ? $this->classLoader[0] : $this->classLoader;
  38679. }
  38680. public static function enable()
  38681. {
  38682. class_exists('Symfony\Component\Debug\ErrorHandler');
  38683. class_exists('Psr\Log\LogLevel');
  38684. if (!\is_array($functions = spl_autoload_functions())) {
  38685. return;
  38686. }
  38687. foreach ($functions as $function) {
  38688. spl_autoload_unregister($function);
  38689. }
  38690. foreach ($functions as $function) {
  38691. if (!\is_array($function) || !$function[0] instanceof self) {
  38692. $function = array(new static($function), 'loadClass');
  38693. }
  38694. spl_autoload_register($function);
  38695. }
  38696. }
  38697. public static function disable()
  38698. {
  38699. if (!\is_array($functions = spl_autoload_functions())) {
  38700. return;
  38701. }
  38702. foreach ($functions as $function) {
  38703. spl_autoload_unregister($function);
  38704. }
  38705. foreach ($functions as $function) {
  38706. if (\is_array($function) && $function[0] instanceof self) {
  38707. $function = $function[0]->getClassLoader();
  38708. }
  38709. spl_autoload_register($function);
  38710. }
  38711. }
  38712. public function findFile($class)
  38713. {
  38714. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  38715. if ($this->wasFinder) {
  38716. return $this->classLoader[0]->findFile($class);
  38717. }
  38718. }
  38719. public function loadClass($class)
  38720. {
  38721. ErrorHandler::stackErrors();
  38722. try {
  38723. if ($this->isFinder && !isset($this->loaded[$class])) {
  38724. $this->loaded[$class] = true;
  38725. if ($file = $this->classLoader[0]->findFile($class)) {
  38726. require $file;
  38727. }
  38728. } else {
  38729. \call_user_func($this->classLoader, $class);
  38730. $file = false;
  38731. }
  38732. } catch (\Exception $e) {
  38733. ErrorHandler::unstackErrors();
  38734. throw $e;
  38735. } catch (\Throwable $e) {
  38736. ErrorHandler::unstackErrors();
  38737. throw $e;
  38738. }
  38739. ErrorHandler::unstackErrors();
  38740. $exists = class_exists($class, false) || interface_exists($class, false) || (\function_exists('trait_exists') && trait_exists($class, false));
  38741. if ($class && '\\' === $class[0]) {
  38742. $class = substr($class, 1);
  38743. }
  38744. if ($exists) {
  38745. $refl = new \ReflectionClass($class);
  38746. $name = $refl->getName();
  38747. if ($name !== $class && 0 === strcasecmp($name, $class)) {
  38748. throw new \RuntimeException(sprintf('Case mismatch between loaded and declared class names: %s vs %s', $class, $name));
  38749. }
  38750. if (\in_array(strtolower($refl->getShortName()), self::$php7Reserved)) {
  38751. @trigger_error(sprintf('%s uses a reserved class name (%s) that will break on PHP 7 and higher', $name, $refl->getShortName()), E_USER_DEPRECATED);
  38752. } elseif (preg_match('#\n \* @deprecated (.*?)\r?\n \*(?: @|/$)#s', $refl->getDocComment(), $notice)) {
  38753. self::$deprecated[$name] = preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]);
  38754. } else {
  38755. if (2 > $len = 1 + (strpos($name, '\\') ?: strpos($name, '_'))) {
  38756. $len = 0;
  38757. $ns = '';
  38758. } else {
  38759. $ns = substr($name, 0, $len);
  38760. }
  38761. $parent = get_parent_class($class);
  38762. if (!$parent || strncmp($ns, $parent, $len)) {
  38763. if ($parent && isset(self::$deprecated[$parent]) && strncmp($ns, $parent, $len)) {
  38764. @trigger_error(sprintf('The %s class extends %s that is deprecated %s', $name, $parent, self::$deprecated[$parent]), E_USER_DEPRECATED);
  38765. }
  38766. $parentInterfaces = array();
  38767. $deprecatedInterfaces = array();
  38768. if ($parent) {
  38769. foreach (class_implements($parent) as $interface) {
  38770. $parentInterfaces[$interface] = 1;
  38771. }
  38772. }
  38773. foreach ($refl->getInterfaceNames() as $interface) {
  38774. if (isset(self::$deprecated[$interface]) && strncmp($ns, $interface, $len)) {
  38775. $deprecatedInterfaces[] = $interface;
  38776. }
  38777. foreach (class_implements($interface) as $interface) {
  38778. $parentInterfaces[$interface] = 1;
  38779. }
  38780. }
  38781. foreach ($deprecatedInterfaces as $interface) {
  38782. if (!isset($parentInterfaces[$interface])) {
  38783. @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);
  38784. }
  38785. }
  38786. }
  38787. }
  38788. }
  38789. if ($file) {
  38790. if (!$exists) {
  38791. if (false !== strpos($class, '/')) {
  38792. 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));
  38793. }
  38794. 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));
  38795. }
  38796. if (self::$caseCheck) {
  38797. $real = explode('\\', $class.strrchr($file, '.'));
  38798. $tail = explode(\DIRECTORY_SEPARATOR, str_replace('/', \DIRECTORY_SEPARATOR, $file));
  38799. $i = \count($tail) - 1;
  38800. $j = \count($real) - 1;
  38801. while (isset($tail[$i], $real[$j]) && $tail[$i] === $real[$j]) {
  38802. --$i;
  38803. --$j;
  38804. }
  38805. array_splice($tail, 0, $i + 1);
  38806. }
  38807. if (self::$caseCheck && $tail) {
  38808. $tail = \DIRECTORY_SEPARATOR.implode(\DIRECTORY_SEPARATOR, $tail);
  38809. $tailLen = \strlen($tail);
  38810. $real = $refl->getFileName();
  38811. if (2 === self::$caseCheck) {
  38812. $i = 1 + strrpos($real, '/');
  38813. $file = substr($real, $i);
  38814. $real = substr($real, 0, $i);
  38815. if (isset(self::$darwinCache[$real])) {
  38816. $kDir = $real;
  38817. } else {
  38818. $kDir = strtolower($real);
  38819. if (isset(self::$darwinCache[$kDir])) {
  38820. $real = self::$darwinCache[$kDir][0];
  38821. } else {
  38822. $dir = getcwd();
  38823. chdir($real);
  38824. $real = getcwd().'/';
  38825. chdir($dir);
  38826. $dir = $real;
  38827. $k = $kDir;
  38828. $i = \strlen($dir) - 1;
  38829. while (!isset(self::$darwinCache[$k])) {
  38830. self::$darwinCache[$k] = array($dir, array());
  38831. self::$darwinCache[$dir] = &self::$darwinCache[$k];
  38832. while ('/' !== $dir[--$i]) {
  38833. }
  38834. $k = substr($k, 0, ++$i);
  38835. $dir = substr($dir, 0, $i--);
  38836. }
  38837. }
  38838. }
  38839. $dirFiles = self::$darwinCache[$kDir][1];
  38840. if (isset($dirFiles[$file])) {
  38841. $kFile = $file;
  38842. } else {
  38843. $kFile = strtolower($file);
  38844. if (!isset($dirFiles[$kFile])) {
  38845. foreach (scandir($real, 2) as $f) {
  38846. if ('.' !== $f[0]) {
  38847. $dirFiles[$f] = $f;
  38848. if ($f === $file) {
  38849. $kFile = $k = $file;
  38850. } elseif ($f !== $k = strtolower($f)) {
  38851. $dirFiles[$k] = $f;
  38852. }
  38853. }
  38854. }
  38855. self::$darwinCache[$kDir][1] = $dirFiles;
  38856. }
  38857. }
  38858. $real .= $dirFiles[$kFile];
  38859. }
  38860. if (0 === substr_compare($real, $tail, -$tailLen, $tailLen, true)
  38861. && 0 !== substr_compare($real, $tail, -$tailLen, $tailLen, false)
  38862. ) {
  38863. 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)));
  38864. }
  38865. }
  38866. return true;
  38867. }
  38868. }
  38869. }
  38870. <?php
  38871. namespace Symfony\Component\Debug;
  38872. use Psr\Log\LoggerInterface;
  38873. use Psr\Log\LogLevel;
  38874. use Symfony\Component\Debug\Exception\ContextErrorException;
  38875. use Symfony\Component\Debug\Exception\FatalErrorException;
  38876. use Symfony\Component\Debug\Exception\FatalThrowableError;
  38877. use Symfony\Component\Debug\Exception\OutOfMemoryException;
  38878. use Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler;
  38879. use Symfony\Component\Debug\FatalErrorHandler\FatalErrorHandlerInterface;
  38880. use Symfony\Component\Debug\FatalErrorHandler\UndefinedFunctionFatalErrorHandler;
  38881. use Symfony\Component\Debug\FatalErrorHandler\UndefinedMethodFatalErrorHandler;
  38882. class ErrorHandler
  38883. {
  38884. const TYPE_DEPRECATION = -100;
  38885. private $levels = array(
  38886. E_DEPRECATED => 'Deprecated',
  38887. E_USER_DEPRECATED => 'User Deprecated',
  38888. E_NOTICE => 'Notice',
  38889. E_USER_NOTICE => 'User Notice',
  38890. E_STRICT => 'Runtime Notice',
  38891. E_WARNING => 'Warning',
  38892. E_USER_WARNING => 'User Warning',
  38893. E_COMPILE_WARNING => 'Compile Warning',
  38894. E_CORE_WARNING => 'Core Warning',
  38895. E_USER_ERROR => 'User Error',
  38896. E_RECOVERABLE_ERROR => 'Catchable Fatal Error',
  38897. E_COMPILE_ERROR => 'Compile Error',
  38898. E_PARSE => 'Parse Error',
  38899. E_ERROR => 'Error',
  38900. E_CORE_ERROR => 'Core Error',
  38901. );
  38902. private $loggers = array(
  38903. E_DEPRECATED => array(null, LogLevel::INFO),
  38904. E_USER_DEPRECATED => array(null, LogLevel::INFO),
  38905. E_NOTICE => array(null, LogLevel::WARNING),
  38906. E_USER_NOTICE => array(null, LogLevel::WARNING),
  38907. E_STRICT => array(null, LogLevel::WARNING),
  38908. E_WARNING => array(null, LogLevel::WARNING),
  38909. E_USER_WARNING => array(null, LogLevel::WARNING),
  38910. E_COMPILE_WARNING => array(null, LogLevel::WARNING),
  38911. E_CORE_WARNING => array(null, LogLevel::WARNING),
  38912. E_USER_ERROR => array(null, LogLevel::CRITICAL),
  38913. E_RECOVERABLE_ERROR => array(null, LogLevel::CRITICAL),
  38914. E_COMPILE_ERROR => array(null, LogLevel::CRITICAL),
  38915. E_PARSE => array(null, LogLevel::CRITICAL),
  38916. E_ERROR => array(null, LogLevel::CRITICAL),
  38917. E_CORE_ERROR => array(null, LogLevel::CRITICAL),
  38918. );
  38919. private $thrownErrors = 0x1FFF;
  38920. private $scopedErrors = 0x1FFF;
  38921. private $tracedErrors = 0x77FB;
  38922. private $screamedErrors = 0x55;
  38923. private $loggedErrors = 0;
  38924. private $loggedTraces = array();
  38925. private $isRecursive = 0;
  38926. private $isRoot = false;
  38927. private $exceptionHandler;
  38928. private $bootstrappingLogger;
  38929. private static $reservedMemory;
  38930. private static $stackedErrors = array();
  38931. private static $stackedErrorLevels = array();
  38932. private static $toStringException = null;
  38933. private static $exitCode = 0;
  38934. private $displayErrors = 0x1FFF;
  38935. public static function register($handler = null, $replace = true)
  38936. {
  38937. if (null === self::$reservedMemory) {
  38938. self::$reservedMemory = str_repeat('x', 10240);
  38939. register_shutdown_function(__CLASS__.'::handleFatalError');
  38940. }
  38941. $levels = -1;
  38942. if ($handlerIsNew = !$handler instanceof self) {
  38943. if (null !== $handler) {
  38944. $levels = $replace ? $handler : 0;
  38945. $replace = true;
  38946. }
  38947. $handler = new static();
  38948. }
  38949. if (null === $prev = set_error_handler(array($handler, 'handleError'))) {
  38950. restore_error_handler();
  38951. set_error_handler(array($handler, 'handleError'), $handler->thrownErrors | $handler->loggedErrors);
  38952. $handler->isRoot = true;
  38953. }
  38954. if ($handlerIsNew && \is_array($prev) && $prev[0] instanceof self) {
  38955. $handler = $prev[0];
  38956. $replace = false;
  38957. }
  38958. if (!$replace && $prev) {
  38959. restore_error_handler();
  38960. $handlerIsRegistered = \is_array($prev) && $handler === $prev[0];
  38961. } else {
  38962. $handlerIsRegistered = true;
  38963. }
  38964. if (\is_array($prev = set_exception_handler(array($handler, 'handleException'))) && $prev[0] instanceof self) {
  38965. restore_exception_handler();
  38966. if (!$handlerIsRegistered) {
  38967. $handler = $prev[0];
  38968. } elseif ($handler !== $prev[0] && $replace) {
  38969. set_exception_handler(array($handler, 'handleException'));
  38970. $p = $prev[0]->setExceptionHandler(null);
  38971. $handler->setExceptionHandler($p);
  38972. $prev[0]->setExceptionHandler($p);
  38973. }
  38974. } else {
  38975. $handler->setExceptionHandler($prev);
  38976. }
  38977. $handler->throwAt($levels & $handler->thrownErrors, true);
  38978. return $handler;
  38979. }
  38980. public function __construct(BufferingLogger $bootstrappingLogger = null)
  38981. {
  38982. if ($bootstrappingLogger) {
  38983. $this->bootstrappingLogger = $bootstrappingLogger;
  38984. $this->setDefaultLogger($bootstrappingLogger);
  38985. }
  38986. }
  38987. public function setDefaultLogger(LoggerInterface $logger, $levels = null, $replace = false)
  38988. {
  38989. $loggers = array();
  38990. if (\is_array($levels)) {
  38991. foreach ($levels as $type => $logLevel) {
  38992. if (empty($this->loggers[$type][0]) || $replace || $this->loggers[$type][0] === $this->bootstrappingLogger) {
  38993. $loggers[$type] = array($logger, $logLevel);
  38994. }
  38995. }
  38996. } else {
  38997. if (null === $levels) {
  38998. $levels = E_ALL | E_STRICT;
  38999. }
  39000. foreach ($this->loggers as $type => $log) {
  39001. if (($type & $levels) && (empty($log[0]) || $replace || $log[0] === $this->bootstrappingLogger)) {
  39002. $log[0] = $logger;
  39003. $loggers[$type] = $log;
  39004. }
  39005. }
  39006. }
  39007. $this->setLoggers($loggers);
  39008. }
  39009. public function setLoggers(array $loggers)
  39010. {
  39011. $prevLogged = $this->loggedErrors;
  39012. $prev = $this->loggers;
  39013. $flush = array();
  39014. foreach ($loggers as $type => $log) {
  39015. if (!isset($prev[$type])) {
  39016. throw new \InvalidArgumentException('Unknown error type: '.$type);
  39017. }
  39018. if (!\is_array($log)) {
  39019. $log = array($log);
  39020. } elseif (!array_key_exists(0, $log)) {
  39021. throw new \InvalidArgumentException('No logger provided');
  39022. }
  39023. if (null === $log[0]) {
  39024. $this->loggedErrors &= ~$type;
  39025. } elseif ($log[0] instanceof LoggerInterface) {
  39026. $this->loggedErrors |= $type;
  39027. } else {
  39028. throw new \InvalidArgumentException('Invalid logger provided');
  39029. }
  39030. $this->loggers[$type] = $log + $prev[$type];
  39031. if ($this->bootstrappingLogger && $prev[$type][0] === $this->bootstrappingLogger) {
  39032. $flush[$type] = $type;
  39033. }
  39034. }
  39035. $this->reRegister($prevLogged | $this->thrownErrors);
  39036. if ($flush) {
  39037. foreach ($this->bootstrappingLogger->cleanLogs() as $log) {
  39038. $type = $log[2]['type'];
  39039. if (!isset($flush[$type])) {
  39040. $this->bootstrappingLogger->log($log[0], $log[1], $log[2]);
  39041. } elseif ($this->loggers[$type][0]) {
  39042. $this->loggers[$type][0]->log($this->loggers[$type][1], $log[1], $log[2]);
  39043. }
  39044. }
  39045. }
  39046. return $prev;
  39047. }
  39048. public function setExceptionHandler($handler)
  39049. {
  39050. if (null !== $handler && !\is_callable($handler)) {
  39051. throw new \LogicException('The exception handler must be a valid PHP callable.');
  39052. }
  39053. $prev = $this->exceptionHandler;
  39054. $this->exceptionHandler = $handler;
  39055. return $prev;
  39056. }
  39057. public function throwAt($levels, $replace = false)
  39058. {
  39059. $prev = $this->thrownErrors;
  39060. $this->thrownErrors = ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED;
  39061. if (!$replace) {
  39062. $this->thrownErrors |= $prev;
  39063. }
  39064. $this->reRegister($prev | $this->loggedErrors);
  39065. $this->displayErrors = $this->thrownErrors;
  39066. return $prev;
  39067. }
  39068. public function scopeAt($levels, $replace = false)
  39069. {
  39070. $prev = $this->scopedErrors;
  39071. $this->scopedErrors = (int) $levels;
  39072. if (!$replace) {
  39073. $this->scopedErrors |= $prev;
  39074. }
  39075. return $prev;
  39076. }
  39077. public function traceAt($levels, $replace = false)
  39078. {
  39079. $prev = $this->tracedErrors;
  39080. $this->tracedErrors = (int) $levels;
  39081. if (!$replace) {
  39082. $this->tracedErrors |= $prev;
  39083. }
  39084. return $prev;
  39085. }
  39086. public function screamAt($levels, $replace = false)
  39087. {
  39088. $prev = $this->screamedErrors;
  39089. $this->screamedErrors = (int) $levels;
  39090. if (!$replace) {
  39091. $this->screamedErrors |= $prev;
  39092. }
  39093. return $prev;
  39094. }
  39095. private function reRegister($prev)
  39096. {
  39097. if ($prev !== $this->thrownErrors | $this->loggedErrors) {
  39098. $handler = set_error_handler('var_dump');
  39099. $handler = \is_array($handler) ? $handler[0] : null;
  39100. restore_error_handler();
  39101. if ($handler === $this) {
  39102. restore_error_handler();
  39103. if ($this->isRoot) {
  39104. set_error_handler(array($this, 'handleError'), $this->thrownErrors | $this->loggedErrors);
  39105. } else {
  39106. set_error_handler(array($this, 'handleError'));
  39107. }
  39108. }
  39109. }
  39110. }
  39111. public function handleError($type, $message, $file, $line)
  39112. {
  39113. $level = error_reporting();
  39114. $silenced = 0 === ($level & $type);
  39115. $level |= E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED;
  39116. $log = $this->loggedErrors & $type;
  39117. $throw = $this->thrownErrors & $type & $level;
  39118. $type &= $level | $this->screamedErrors;
  39119. if (!$type || (!$log && !$throw)) {
  39120. return !$silenced && $type && $log;
  39121. }
  39122. $scope = $this->scopedErrors & $type;
  39123. if (4 < $numArgs = \func_num_args()) {
  39124. $context = $scope ? (func_get_arg(4) ?: array()) : array();
  39125. $backtrace = 5 < $numArgs ? func_get_arg(5) : null;
  39126. } else {
  39127. $context = array();
  39128. $backtrace = null;
  39129. }
  39130. if (isset($context['GLOBALS']) && $scope) {
  39131. $e = $context;
  39132. unset($e['GLOBALS'], $context);
  39133. $context = $e;
  39134. }
  39135. if (null !== $backtrace && $type & E_ERROR) {
  39136. $this->handleFatalError(compact('type', 'message', 'file', 'line', 'backtrace'));
  39137. return true;
  39138. }
  39139. if ($throw) {
  39140. if (null !== self::$toStringException) {
  39141. $throw = self::$toStringException;
  39142. self::$toStringException = null;
  39143. } elseif ($scope && class_exists('Symfony\Component\Debug\Exception\ContextErrorException')) {
  39144. $throw = new ContextErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line, $context);
  39145. } else {
  39146. $throw = new \ErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line);
  39147. }
  39148. if (\PHP_VERSION_ID <= 50407 && (\PHP_VERSION_ID >= 50400 || \PHP_VERSION_ID <= 50317)) {
  39149. $throw->errorHandlerCanary = new ErrorHandlerCanary();
  39150. }
  39151. if (E_USER_ERROR & $type) {
  39152. $backtrace = $backtrace ?: $throw->getTrace();
  39153. for ($i = 1; isset($backtrace[$i]); ++$i) {
  39154. if (isset($backtrace[$i]['function'], $backtrace[$i]['type'], $backtrace[$i - 1]['function'])
  39155. && '__toString' === $backtrace[$i]['function']
  39156. && '->' === $backtrace[$i]['type']
  39157. && !isset($backtrace[$i - 1]['class'])
  39158. && ('trigger_error' === $backtrace[$i - 1]['function'] || 'user_error' === $backtrace[$i - 1]['function'])
  39159. ) {
  39160. foreach ($context as $e) {
  39161. if (($e instanceof \Exception || $e instanceof \Throwable) && $e->__toString() === $message) {
  39162. if (1 === $i) {
  39163. $throw = $e;
  39164. break;
  39165. }
  39166. self::$toStringException = $e;
  39167. return true;
  39168. }
  39169. }
  39170. if (1 < $i) {
  39171. $this->handleException($throw);
  39172. return false;
  39173. }
  39174. }
  39175. }
  39176. }
  39177. throw $throw;
  39178. }
  39179. $e = md5("{$type}/{$line}/{$file}\x00{$message}", true);
  39180. $trace = true;
  39181. if (!($this->tracedErrors & $type) || isset($this->loggedTraces[$e])) {
  39182. $trace = false;
  39183. } else {
  39184. $this->loggedTraces[$e] = 1;
  39185. }
  39186. $e = compact('type', 'file', 'line', 'level');
  39187. if ($type & $level) {
  39188. if ($scope) {
  39189. $e['scope_vars'] = $context;
  39190. if ($trace) {
  39191. $e['stack'] = $backtrace ?: debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT);
  39192. }
  39193. } elseif ($trace) {
  39194. if (null === $backtrace) {
  39195. $e['stack'] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
  39196. } else {
  39197. foreach ($backtrace as &$frame) {
  39198. unset($frame['args'], $frame);
  39199. }
  39200. $e['stack'] = $backtrace;
  39201. }
  39202. }
  39203. }
  39204. if ($this->isRecursive) {
  39205. $log = 0;
  39206. } elseif (self::$stackedErrorLevels) {
  39207. self::$stackedErrors[] = array($this->loggers[$type][0], ($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
  39208. } else {
  39209. try {
  39210. $this->isRecursive = true;
  39211. $this->loggers[$type][0]->log(($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
  39212. $this->isRecursive = false;
  39213. } catch (\Exception $e) {
  39214. $this->isRecursive = false;
  39215. throw $e;
  39216. } catch (\Throwable $e) {
  39217. $this->isRecursive = false;
  39218. throw $e;
  39219. }
  39220. }
  39221. return !$silenced && $type && $log;
  39222. }
  39223. public function handleException($exception, array $error = null)
  39224. {
  39225. if (null === $error) {
  39226. self::$exitCode = 255;
  39227. }
  39228. if (!$exception instanceof \Exception) {
  39229. $exception = new FatalThrowableError($exception);
  39230. }
  39231. $type = $exception instanceof FatalErrorException ? $exception->getSeverity() : E_ERROR;
  39232. $handlerException = null;
  39233. if (($this->loggedErrors & $type) || $exception instanceof FatalThrowableError) {
  39234. $e = array(
  39235. 'type' => $type,
  39236. 'file' => $exception->getFile(),
  39237. 'line' => $exception->getLine(),
  39238. 'level' => error_reporting(),
  39239. 'stack' => $exception->getTrace(),
  39240. );
  39241. if ($exception instanceof FatalErrorException) {
  39242. if ($exception instanceof FatalThrowableError) {
  39243. $error = array(
  39244. 'type' => $type,
  39245. 'message' => $message = $exception->getMessage(),
  39246. 'file' => $e['file'],
  39247. 'line' => $e['line'],
  39248. );
  39249. } else {
  39250. $message = 'Fatal '.$exception->getMessage();
  39251. }
  39252. } elseif ($exception instanceof \ErrorException) {
  39253. $message = 'Uncaught '.$exception->getMessage();
  39254. if ($exception instanceof ContextErrorException) {
  39255. $e['context'] = $exception->getContext();
  39256. }
  39257. } else {
  39258. $message = 'Uncaught Exception: '.$exception->getMessage();
  39259. }
  39260. }
  39261. if ($this->loggedErrors & $type) {
  39262. try {
  39263. $this->loggers[$type][0]->log($this->loggers[$type][1], $message, $e);
  39264. } catch (\Exception $handlerException) {
  39265. } catch (\Throwable $handlerException) {
  39266. }
  39267. }
  39268. if ($exception instanceof FatalErrorException && !$exception instanceof OutOfMemoryException && $error) {
  39269. foreach ($this->getFatalErrorHandlers() as $handler) {
  39270. if ($e = $handler->handleError($error, $exception)) {
  39271. $exception = $e;
  39272. break;
  39273. }
  39274. }
  39275. }
  39276. $exceptionHandler = $this->exceptionHandler;
  39277. $this->exceptionHandler = null;
  39278. try {
  39279. if (null !== $exceptionHandler) {
  39280. return \call_user_func($exceptionHandler, $exception);
  39281. }
  39282. $handlerException = $handlerException ?: $exception;
  39283. } catch (\Exception $handlerException) {
  39284. } catch (\Throwable $handlerException) {
  39285. }
  39286. if ($exception === $handlerException) {
  39287. self::$reservedMemory = null;
  39288. throw $exception;
  39289. }
  39290. $this->handleException($handlerException);
  39291. }
  39292. public static function handleFatalError(array $error = null)
  39293. {
  39294. if (null === self::$reservedMemory) {
  39295. return;
  39296. }
  39297. $handler = self::$reservedMemory = null;
  39298. $handlers = array();
  39299. $previousHandler = null;
  39300. $sameHandlerLimit = 10;
  39301. while (!\is_array($handler) || !$handler[0] instanceof self) {
  39302. $handler = set_exception_handler('var_dump');
  39303. restore_exception_handler();
  39304. if (!$handler) {
  39305. break;
  39306. }
  39307. restore_exception_handler();
  39308. if ($handler !== $previousHandler) {
  39309. array_unshift($handlers, $handler);
  39310. $previousHandler = $handler;
  39311. } elseif (0 === --$sameHandlerLimit) {
  39312. $handler = null;
  39313. break;
  39314. }
  39315. }
  39316. foreach ($handlers as $h) {
  39317. set_exception_handler($h);
  39318. }
  39319. if (!$handler) {
  39320. return;
  39321. }
  39322. if ($handler !== $h) {
  39323. $handler[0]->setExceptionHandler($h);
  39324. }
  39325. $handler = $handler[0];
  39326. $handlers = array();
  39327. if ($exit = null === $error) {
  39328. $error = error_get_last();
  39329. }
  39330. try {
  39331. while (self::$stackedErrorLevels) {
  39332. static::unstackErrors();
  39333. }
  39334. } catch (\Exception $exception) {
  39335. } catch (\Throwable $exception) {
  39336. }
  39337. if ($error && $error['type'] &= E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR) {
  39338. $handler->throwAt(0, true);
  39339. $trace = isset($error['backtrace']) ? $error['backtrace'] : null;
  39340. if (0 === strpos($error['message'], 'Allowed memory') || 0 === strpos($error['message'], 'Out of memory')) {
  39341. $exception = new OutOfMemoryException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, false, $trace);
  39342. } else {
  39343. $exception = new FatalErrorException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, true, $trace);
  39344. }
  39345. }
  39346. try {
  39347. if (isset($exception)) {
  39348. self::$exitCode = 255;
  39349. $handler->handleException($exception, $error);
  39350. }
  39351. } catch (FatalErrorException $e) {
  39352. }
  39353. if ($exit && self::$exitCode) {
  39354. $exitCode = self::$exitCode;
  39355. register_shutdown_function('register_shutdown_function', function () use ($exitCode) { exit($exitCode); });
  39356. }
  39357. }
  39358. public static function stackErrors()
  39359. {
  39360. self::$stackedErrorLevels[] = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
  39361. }
  39362. public static function unstackErrors()
  39363. {
  39364. $level = array_pop(self::$stackedErrorLevels);
  39365. if (null !== $level) {
  39366. $e = error_reporting($level);
  39367. if ($e !== ($level | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR)) {
  39368. error_reporting($e);
  39369. }
  39370. }
  39371. if (empty(self::$stackedErrorLevels)) {
  39372. $errors = self::$stackedErrors;
  39373. self::$stackedErrors = array();
  39374. foreach ($errors as $e) {
  39375. $e[0]->log($e[1], $e[2], $e[3]);
  39376. }
  39377. }
  39378. }
  39379. protected function getFatalErrorHandlers()
  39380. {
  39381. return array(
  39382. new UndefinedFunctionFatalErrorHandler(),
  39383. new UndefinedMethodFatalErrorHandler(),
  39384. new ClassNotFoundFatalErrorHandler(),
  39385. );
  39386. }
  39387. public function setLevel($level)
  39388. {
  39389. @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);
  39390. $level = null === $level ? error_reporting() : $level;
  39391. $this->throwAt($level, true);
  39392. }
  39393. public function setDisplayErrors($displayErrors)
  39394. {
  39395. @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);
  39396. if ($displayErrors) {
  39397. $this->throwAt($this->displayErrors, true);
  39398. } else {
  39399. $displayErrors = $this->displayErrors;
  39400. $this->throwAt(0, true);
  39401. $this->displayErrors = $displayErrors;
  39402. }
  39403. }
  39404. public static function setLogger(LoggerInterface $logger, $channel = 'deprecation')
  39405. {
  39406. @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);
  39407. $handler = set_error_handler('var_dump');
  39408. $handler = \is_array($handler) ? $handler[0] : null;
  39409. restore_error_handler();
  39410. if (!$handler instanceof self) {
  39411. return;
  39412. }
  39413. if ('deprecation' === $channel) {
  39414. $handler->setDefaultLogger($logger, E_DEPRECATED | E_USER_DEPRECATED, true);
  39415. $handler->screamAt(E_DEPRECATED | E_USER_DEPRECATED);
  39416. } elseif ('scream' === $channel) {
  39417. $handler->setDefaultLogger($logger, E_ALL | E_STRICT, false);
  39418. $handler->screamAt(E_ALL | E_STRICT);
  39419. } elseif ('emergency' === $channel) {
  39420. $handler->setDefaultLogger($logger, E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR, true);
  39421. $handler->screamAt(E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
  39422. }
  39423. }
  39424. public function handle($level, $message, $file = 'unknown', $line = 0, $context = array())
  39425. {
  39426. $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());
  39427. return $this->handleError($level, $message, $file, $line, (array) $context);
  39428. }
  39429. public function handleFatal()
  39430. {
  39431. @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);
  39432. static::handleFatalError();
  39433. }
  39434. }
  39435. class ErrorHandlerCanary
  39436. {
  39437. private static $displayErrors = null;
  39438. public function __construct()
  39439. {
  39440. if (null === self::$displayErrors) {
  39441. self::$displayErrors = ini_set('display_errors', 1);
  39442. }
  39443. }
  39444. public function __destruct()
  39445. {
  39446. if (null !== self::$displayErrors) {
  39447. ini_set('display_errors', self::$displayErrors);
  39448. self::$displayErrors = null;
  39449. }
  39450. }
  39451. }
  39452. <?php
  39453. namespace Symfony\Component\Debug\Exception;
  39454. class ClassNotFoundException extends FatalErrorException
  39455. {
  39456. public function __construct($message, \ErrorException $previous)
  39457. {
  39458. parent::__construct(
  39459. $message,
  39460. $previous->getCode(),
  39461. $previous->getSeverity(),
  39462. $previous->getFile(),
  39463. $previous->getLine(),
  39464. null,
  39465. true,
  39466. null,
  39467. $previous->getPrevious()
  39468. );
  39469. $this->setTrace($previous->getTrace());
  39470. }
  39471. }
  39472. <?php
  39473. namespace Symfony\Component\Debug\Exception;
  39474. class ContextErrorException extends \ErrorException
  39475. {
  39476. private $context = array();
  39477. public function __construct($message, $code, $severity, $filename, $lineno, $context = array())
  39478. {
  39479. parent::__construct($message, $code, $severity, $filename, $lineno);
  39480. $this->context = $context;
  39481. }
  39482. public function getContext()
  39483. {
  39484. return $this->context;
  39485. }
  39486. }
  39487. <?php
  39488. namespace Symfony\Component\Debug\Exception;
  39489. @trigger_error('The '.__NAMESPACE__.'\DummyException class is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  39490. class DummyException extends \ErrorException
  39491. {
  39492. }
  39493. <?php
  39494. namespace Symfony\Component\HttpKernel\Exception;
  39495. class FatalErrorException extends \ErrorException
  39496. {
  39497. }
  39498. namespace Symfony\Component\Debug\Exception;
  39499. use Symfony\Component\HttpKernel\Exception\FatalErrorException as LegacyFatalErrorException;
  39500. class FatalErrorException extends LegacyFatalErrorException
  39501. {
  39502. public function __construct($message, $code, $severity, $filename, $lineno, $traceOffset = null, $traceArgs = true, array $trace = null, $previous = null)
  39503. {
  39504. parent::__construct($message, $code, $severity, $filename, $lineno, $previous);
  39505. if (null !== $trace) {
  39506. if (!$traceArgs) {
  39507. foreach ($trace as &$frame) {
  39508. unset($frame['args'], $frame['this'], $frame);
  39509. }
  39510. }
  39511. $this->setTrace($trace);
  39512. } elseif (null !== $traceOffset) {
  39513. if (\function_exists('xdebug_get_function_stack')) {
  39514. $trace = xdebug_get_function_stack();
  39515. if (0 < $traceOffset) {
  39516. array_splice($trace, -$traceOffset);
  39517. }
  39518. foreach ($trace as &$frame) {
  39519. if (!isset($frame['type'])) {
  39520. if (isset($frame['class'])) {
  39521. $frame['type'] = '::';
  39522. }
  39523. } elseif ('dynamic' === $frame['type']) {
  39524. $frame['type'] = '->';
  39525. } elseif ('static' === $frame['type']) {
  39526. $frame['type'] = '::';
  39527. }
  39528. if (!$traceArgs) {
  39529. unset($frame['params'], $frame['args']);
  39530. } elseif (isset($frame['params']) && !isset($frame['args'])) {
  39531. $frame['args'] = $frame['params'];
  39532. unset($frame['params']);
  39533. }
  39534. }
  39535. unset($frame);
  39536. $trace = array_reverse($trace);
  39537. } elseif (\function_exists('symfony_debug_backtrace')) {
  39538. $trace = symfony_debug_backtrace();
  39539. if (0 < $traceOffset) {
  39540. array_splice($trace, 0, $traceOffset);
  39541. }
  39542. } else {
  39543. $trace = array();
  39544. }
  39545. $this->setTrace($trace);
  39546. }
  39547. }
  39548. protected function setTrace($trace)
  39549. {
  39550. $traceReflector = new \ReflectionProperty('Exception', 'trace');
  39551. $traceReflector->setAccessible(true);
  39552. $traceReflector->setValue($this, $trace);
  39553. }
  39554. }
  39555. <?php
  39556. namespace Symfony\Component\Debug\Exception;
  39557. class FatalThrowableError extends FatalErrorException
  39558. {
  39559. public function __construct(\Throwable $e)
  39560. {
  39561. if ($e instanceof \ParseError) {
  39562. $message = 'Parse error: '.$e->getMessage();
  39563. $severity = E_PARSE;
  39564. } elseif ($e instanceof \TypeError) {
  39565. $message = 'Type error: '.$e->getMessage();
  39566. $severity = E_RECOVERABLE_ERROR;
  39567. } else {
  39568. $message = $e->getMessage();
  39569. $severity = E_ERROR;
  39570. }
  39571. \ErrorException::__construct(
  39572. $message,
  39573. $e->getCode(),
  39574. $severity,
  39575. $e->getFile(),
  39576. $e->getLine(),
  39577. $e->getPrevious()
  39578. );
  39579. $this->setTrace($e->getTrace());
  39580. }
  39581. }
  39582. <?php
  39583. namespace Symfony\Component\HttpKernel\Exception;
  39584. use Symfony\Component\Debug\Exception\FlattenException as DebugFlattenException;
  39585. class FlattenException
  39586. {
  39587. private $handler;
  39588. public static function __callStatic($method, $args)
  39589. {
  39590. if (!method_exists('Symfony\Component\Debug\Exception\FlattenException', $method)) {
  39591. throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', \get_called_class(), $method));
  39592. }
  39593. return \call_user_func_array(array('Symfony\Component\Debug\Exception\FlattenException', $method), $args);
  39594. }
  39595. public function __call($method, $args)
  39596. {
  39597. if (!isset($this->handler)) {
  39598. $this->handler = new DebugFlattenException();
  39599. }
  39600. if (!method_exists($this->handler, $method)) {
  39601. throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', \get_class($this), $method));
  39602. }
  39603. return \call_user_func_array(array($this->handler, $method), $args);
  39604. }
  39605. }
  39606. namespace Symfony\Component\Debug\Exception;
  39607. use Symfony\Component\HttpKernel\Exception\FlattenException as LegacyFlattenException;
  39608. use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
  39609. class FlattenException extends LegacyFlattenException
  39610. {
  39611. private $message;
  39612. private $code;
  39613. private $previous;
  39614. private $trace;
  39615. private $class;
  39616. private $statusCode;
  39617. private $headers;
  39618. private $file;
  39619. private $line;
  39620. public static function create(\Exception $exception, $statusCode = null, array $headers = array())
  39621. {
  39622. $e = new static();
  39623. $e->setMessage($exception->getMessage());
  39624. $e->setCode($exception->getCode());
  39625. if ($exception instanceof HttpExceptionInterface) {
  39626. $statusCode = $exception->getStatusCode();
  39627. $headers = array_merge($headers, $exception->getHeaders());
  39628. }
  39629. if (null === $statusCode) {
  39630. $statusCode = 500;
  39631. }
  39632. $e->setStatusCode($statusCode);
  39633. $e->setHeaders($headers);
  39634. $e->setTraceFromException($exception);
  39635. $e->setClass(\get_class($exception));
  39636. $e->setFile($exception->getFile());
  39637. $e->setLine($exception->getLine());
  39638. $previous = $exception->getPrevious();
  39639. if ($previous instanceof \Exception) {
  39640. $e->setPrevious(static::create($previous));
  39641. } elseif ($previous instanceof \Throwable) {
  39642. $e->setPrevious(static::create(new FatalThrowableError($previous)));
  39643. }
  39644. return $e;
  39645. }
  39646. public function toArray()
  39647. {
  39648. $exceptions = array();
  39649. foreach (array_merge(array($this), $this->getAllPrevious()) as $exception) {
  39650. $exceptions[] = array(
  39651. 'message' => $exception->getMessage(),
  39652. 'class' => $exception->getClass(),
  39653. 'trace' => $exception->getTrace(),
  39654. );
  39655. }
  39656. return $exceptions;
  39657. }
  39658. public function getStatusCode()
  39659. {
  39660. return $this->statusCode;
  39661. }
  39662. public function setStatusCode($code)
  39663. {
  39664. $this->statusCode = $code;
  39665. }
  39666. public function getHeaders()
  39667. {
  39668. return $this->headers;
  39669. }
  39670. public function setHeaders(array $headers)
  39671. {
  39672. $this->headers = $headers;
  39673. }
  39674. public function getClass()
  39675. {
  39676. return $this->class;
  39677. }
  39678. public function setClass($class)
  39679. {
  39680. $this->class = $class;
  39681. }
  39682. public function getFile()
  39683. {
  39684. return $this->file;
  39685. }
  39686. public function setFile($file)
  39687. {
  39688. $this->file = $file;
  39689. }
  39690. public function getLine()
  39691. {
  39692. return $this->line;
  39693. }
  39694. public function setLine($line)
  39695. {
  39696. $this->line = $line;
  39697. }
  39698. public function getMessage()
  39699. {
  39700. return $this->message;
  39701. }
  39702. public function setMessage($message)
  39703. {
  39704. $this->message = $message;
  39705. }
  39706. public function getCode()
  39707. {
  39708. return $this->code;
  39709. }
  39710. public function setCode($code)
  39711. {
  39712. $this->code = $code;
  39713. }
  39714. public function getPrevious()
  39715. {
  39716. return $this->previous;
  39717. }
  39718. public function setPrevious(FlattenException $previous)
  39719. {
  39720. $this->previous = $previous;
  39721. }
  39722. public function getAllPrevious()
  39723. {
  39724. $exceptions = array();
  39725. $e = $this;
  39726. while ($e = $e->getPrevious()) {
  39727. $exceptions[] = $e;
  39728. }
  39729. return $exceptions;
  39730. }
  39731. public function getTrace()
  39732. {
  39733. return $this->trace;
  39734. }
  39735. public function setTraceFromException(\Exception $exception)
  39736. {
  39737. $this->setTrace($exception->getTrace(), $exception->getFile(), $exception->getLine());
  39738. }
  39739. public function setTrace($trace, $file, $line)
  39740. {
  39741. $this->trace = array();
  39742. $this->trace[] = array(
  39743. 'namespace' => '',
  39744. 'short_class' => '',
  39745. 'class' => '',
  39746. 'type' => '',
  39747. 'function' => '',
  39748. 'file' => $file,
  39749. 'line' => $line,
  39750. 'args' => array(),
  39751. );
  39752. foreach ($trace as $entry) {
  39753. $class = '';
  39754. $namespace = '';
  39755. if (isset($entry['class'])) {
  39756. $parts = explode('\\', $entry['class']);
  39757. $class = array_pop($parts);
  39758. $namespace = implode('\\', $parts);
  39759. }
  39760. $this->trace[] = array(
  39761. 'namespace' => $namespace,
  39762. 'short_class' => $class,
  39763. 'class' => isset($entry['class']) ? $entry['class'] : '',
  39764. 'type' => isset($entry['type']) ? $entry['type'] : '',
  39765. 'function' => isset($entry['function']) ? $entry['function'] : null,
  39766. 'file' => isset($entry['file']) ? $entry['file'] : null,
  39767. 'line' => isset($entry['line']) ? $entry['line'] : null,
  39768. 'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : array(),
  39769. );
  39770. }
  39771. }
  39772. private function flattenArgs($args, $level = 0, &$count = 0)
  39773. {
  39774. $result = array();
  39775. foreach ($args as $key => $value) {
  39776. if (++$count > 1e4) {
  39777. return array('array', '*SKIPPED over 10000 entries*');
  39778. }
  39779. if ($value instanceof \__PHP_Incomplete_Class) {
  39780. $result[$key] = array('incomplete-object', $this->getClassNameFromIncomplete($value));
  39781. } elseif (\is_object($value)) {
  39782. $result[$key] = array('object', \get_class($value));
  39783. } elseif (\is_array($value)) {
  39784. if ($level > 10) {
  39785. $result[$key] = array('array', '*DEEP NESTED ARRAY*');
  39786. } else {
  39787. $result[$key] = array('array', $this->flattenArgs($value, $level + 1, $count));
  39788. }
  39789. } elseif (null === $value) {
  39790. $result[$key] = array('null', null);
  39791. } elseif (\is_bool($value)) {
  39792. $result[$key] = array('boolean', $value);
  39793. } elseif (\is_resource($value)) {
  39794. $result[$key] = array('resource', get_resource_type($value));
  39795. } else {
  39796. $result[$key] = array('string', (string) $value);
  39797. }
  39798. }
  39799. return $result;
  39800. }
  39801. private function getClassNameFromIncomplete(\__PHP_Incomplete_Class $value)
  39802. {
  39803. $array = new \ArrayObject($value);
  39804. return $array['__PHP_Incomplete_Class_Name'];
  39805. }
  39806. }
  39807. <?php
  39808. namespace Symfony\Component\Debug\Exception;
  39809. class OutOfMemoryException extends FatalErrorException
  39810. {
  39811. }
  39812. <?php
  39813. namespace Symfony\Component\Debug\Exception;
  39814. class UndefinedFunctionException extends FatalErrorException
  39815. {
  39816. public function __construct($message, \ErrorException $previous)
  39817. {
  39818. parent::__construct(
  39819. $message,
  39820. $previous->getCode(),
  39821. $previous->getSeverity(),
  39822. $previous->getFile(),
  39823. $previous->getLine(),
  39824. null,
  39825. true,
  39826. null,
  39827. $previous->getPrevious()
  39828. );
  39829. $this->setTrace($previous->getTrace());
  39830. }
  39831. }
  39832. <?php
  39833. namespace Symfony\Component\Debug\Exception;
  39834. class UndefinedMethodException extends FatalErrorException
  39835. {
  39836. public function __construct($message, \ErrorException $previous)
  39837. {
  39838. parent::__construct(
  39839. $message,
  39840. $previous->getCode(),
  39841. $previous->getSeverity(),
  39842. $previous->getFile(),
  39843. $previous->getLine(),
  39844. null,
  39845. true,
  39846. null,
  39847. $previous->getPrevious()
  39848. );
  39849. $this->setTrace($previous->getTrace());
  39850. }
  39851. }
  39852. <?php
  39853. namespace Symfony\Component\Debug;
  39854. use Symfony\Component\Debug\Exception\FlattenException;
  39855. use Symfony\Component\Debug\Exception\OutOfMemoryException;
  39856. use Symfony\Component\HttpFoundation\Response;
  39857. class ExceptionHandler
  39858. {
  39859. private $debug;
  39860. private $charset;
  39861. private $handler;
  39862. private $caughtBuffer;
  39863. private $caughtLength;
  39864. private $fileLinkFormat;
  39865. public function __construct($debug = true, $charset = null, $fileLinkFormat = null)
  39866. {
  39867. if (false !== strpos($charset, '%')) {
  39868. @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);
  39869. $pivot = $fileLinkFormat;
  39870. $fileLinkFormat = $charset;
  39871. $charset = $pivot;
  39872. }
  39873. $this->debug = $debug;
  39874. $this->charset = $charset ?: ini_get('default_charset') ?: 'UTF-8';
  39875. $this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
  39876. }
  39877. public static function register($debug = true, $charset = null, $fileLinkFormat = null)
  39878. {
  39879. $handler = new static($debug, $charset, $fileLinkFormat);
  39880. $prev = set_exception_handler(array($handler, 'handle'));
  39881. if (\is_array($prev) && $prev[0] instanceof ErrorHandler) {
  39882. restore_exception_handler();
  39883. $prev[0]->setExceptionHandler(array($handler, 'handle'));
  39884. }
  39885. return $handler;
  39886. }
  39887. public function setHandler($handler)
  39888. {
  39889. if (null !== $handler && !\is_callable($handler)) {
  39890. throw new \LogicException('The exception handler must be a valid PHP callable.');
  39891. }
  39892. $old = $this->handler;
  39893. $this->handler = $handler;
  39894. return $old;
  39895. }
  39896. public function setFileLinkFormat($format)
  39897. {
  39898. $old = $this->fileLinkFormat;
  39899. $this->fileLinkFormat = $format;
  39900. return $old;
  39901. }
  39902. public function handle(\Exception $exception)
  39903. {
  39904. if (null === $this->handler || $exception instanceof OutOfMemoryException) {
  39905. $this->failSafeHandle($exception);
  39906. return;
  39907. }
  39908. $caughtLength = $this->caughtLength = 0;
  39909. ob_start(array($this, 'catchOutput'));
  39910. $this->failSafeHandle($exception);
  39911. while (null === $this->caughtBuffer && ob_end_flush()) {
  39912. }
  39913. if (isset($this->caughtBuffer[0])) {
  39914. ob_start(array($this, 'cleanOutput'));
  39915. echo $this->caughtBuffer;
  39916. $caughtLength = ob_get_length();
  39917. }
  39918. $this->caughtBuffer = null;
  39919. try {
  39920. \call_user_func($this->handler, $exception);
  39921. $this->caughtLength = $caughtLength;
  39922. } catch (\Exception $e) {
  39923. if (!$caughtLength) {
  39924. throw $exception;
  39925. }
  39926. }
  39927. }
  39928. private function failSafeHandle(\Exception $exception)
  39929. {
  39930. if (class_exists('Symfony\Component\HttpFoundation\Response', false)
  39931. && __CLASS__ !== \get_class($this)
  39932. && ($reflector = new \ReflectionMethod($this, 'createResponse'))
  39933. && __CLASS__ !== $reflector->class
  39934. ) {
  39935. $response = $this->createResponse($exception);
  39936. $response->sendHeaders();
  39937. $response->sendContent();
  39938. @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);
  39939. return;
  39940. }
  39941. $this->sendPhpResponse($exception);
  39942. }
  39943. public function sendPhpResponse($exception)
  39944. {
  39945. if (!$exception instanceof FlattenException) {
  39946. $exception = FlattenException::create($exception);
  39947. }
  39948. if (!headers_sent()) {
  39949. header(sprintf('HTTP/1.0 %s', $exception->getStatusCode()));
  39950. foreach ($exception->getHeaders() as $name => $value) {
  39951. header($name.': '.$value, false);
  39952. }
  39953. header('Content-Type: text/html; charset='.$this->charset);
  39954. }
  39955. echo $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
  39956. }
  39957. public function createResponse($exception)
  39958. {
  39959. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  39960. if (!$exception instanceof FlattenException) {
  39961. $exception = FlattenException::create($exception);
  39962. }
  39963. return Response::create($this->getHtml($exception), $exception->getStatusCode(), $exception->getHeaders())->setCharset($this->charset);
  39964. }
  39965. public function getHtml($exception)
  39966. {
  39967. if (!$exception instanceof FlattenException) {
  39968. $exception = FlattenException::create($exception);
  39969. }
  39970. return $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
  39971. }
  39972. public function getContent(FlattenException $exception)
  39973. {
  39974. switch ($exception->getStatusCode()) {
  39975. case 404:
  39976. $title = 'Sorry, the page you are looking for could not be found.';
  39977. break;
  39978. default:
  39979. $title = 'Whoops, looks like something went wrong.';
  39980. }
  39981. $content = '';
  39982. if ($this->debug) {
  39983. try {
  39984. $count = \count($exception->getAllPrevious());
  39985. $total = $count + 1;
  39986. foreach ($exception->toArray() as $position => $e) {
  39987. $ind = $count - $position + 1;
  39988. $class = $this->formatClass($e['class']);
  39989. $message = nl2br($this->escapeHtml($e['message']));
  39990. $content .= sprintf(<<<'EOF'
  39991. <h2 class="block_exception clear_fix">
  39992. <span class="exception_counter">%d/%d</span>
  39993. <span class="exception_title">%s%s:</span>
  39994. <span class="exception_message">%s</span>
  39995. </h2>
  39996. <div class="block">
  39997. <ol class="traces list_exception">
  39998. EOF
  39999. , $ind, $total, $class, $this->formatPath($e['trace'][0]['file'], $e['trace'][0]['line']), $message);
  40000. foreach ($e['trace'] as $trace) {
  40001. $content .= ' <li>';
  40002. if ($trace['function']) {
  40003. $content .= sprintf('at %s%s%s(%s)', $this->formatClass($trace['class']), $trace['type'], $trace['function'], $this->formatArgs($trace['args']));
  40004. }
  40005. if (isset($trace['file']) && isset($trace['line'])) {
  40006. $content .= $this->formatPath($trace['file'], $trace['line']);
  40007. }
  40008. $content .= "</li>\n";
  40009. }
  40010. $content .= " </ol>\n</div>\n";
  40011. }
  40012. } catch (\Exception $e) {
  40013. if ($this->debug) {
  40014. $title = sprintf('Exception thrown when handling an exception (%s: %s)', \get_class($e), $this->escapeHtml($e->getMessage()));
  40015. } else {
  40016. $title = 'Whoops, looks like something went wrong.';
  40017. }
  40018. }
  40019. }
  40020. return <<<EOF
  40021. <div id="sf-resetcontent" class="sf-reset">
  40022. <h1>$title</h1>
  40023. $content
  40024. </div>
  40025. EOF;
  40026. }
  40027. public function getStylesheet(FlattenException $exception)
  40028. {
  40029. return <<<'EOF'
  40030. .sf-reset { font: 11px Verdana, Arial, sans-serif; color: #333 }
  40031. .sf-reset .clear { clear:both; height:0; font-size:0; line-height:0; }
  40032. .sf-reset .clear_fix:after { display:block; height:0; clear:both; visibility:hidden; }
  40033. .sf-reset .clear_fix { display:inline-block; }
  40034. .sf-reset * html .clear_fix { height:1%; }
  40035. .sf-reset .clear_fix { display:block; }
  40036. .sf-reset, .sf-reset .block { margin: auto }
  40037. .sf-reset abbr { border-bottom: 1px dotted #000; cursor: help; }
  40038. .sf-reset p { font-size:14px; line-height:20px; color:#868686; padding-bottom:20px }
  40039. .sf-reset strong { font-weight:bold; }
  40040. .sf-reset a { color:#6c6159; cursor: default; }
  40041. .sf-reset a img { border:none; }
  40042. .sf-reset a:hover { text-decoration:underline; }
  40043. .sf-reset em { font-style:italic; }
  40044. .sf-reset h1, .sf-reset h2 { font: 20px Georgia, "Times New Roman", Times, serif }
  40045. .sf-reset .exception_counter { background-color: #fff; color: #333; padding: 6px; float: left; margin-right: 10px; float: left; display: block; }
  40046. .sf-reset .exception_title { margin-left: 3em; margin-bottom: 0.7em; display: block; }
  40047. .sf-reset .exception_message { margin-left: 3em; display: block; }
  40048. .sf-reset .traces li { font-size:12px; padding: 2px 4px; list-style-type:decimal; margin-left:20px; }
  40049. .sf-reset .block { background-color:#FFFFFF; padding:10px 28px; margin-bottom:20px;
  40050. -webkit-border-bottom-right-radius: 16px;
  40051. -webkit-border-bottom-left-radius: 16px;
  40052. -moz-border-radius-bottomright: 16px;
  40053. -moz-border-radius-bottomleft: 16px;
  40054. border-bottom-right-radius: 16px;
  40055. border-bottom-left-radius: 16px;
  40056. border-bottom:1px solid #ccc;
  40057. border-right:1px solid #ccc;
  40058. border-left:1px solid #ccc;
  40059. word-wrap: break-word;
  40060. }
  40061. .sf-reset .block_exception { background-color:#ddd; color: #333; padding:20px;
  40062. -webkit-border-top-left-radius: 16px;
  40063. -webkit-border-top-right-radius: 16px;
  40064. -moz-border-radius-topleft: 16px;
  40065. -moz-border-radius-topright: 16px;
  40066. border-top-left-radius: 16px;
  40067. border-top-right-radius: 16px;
  40068. border-top:1px solid #ccc;
  40069. border-right:1px solid #ccc;
  40070. border-left:1px solid #ccc;
  40071. overflow: hidden;
  40072. word-wrap: break-word;
  40073. }
  40074. .sf-reset a { background:none; color:#868686; text-decoration:none; }
  40075. .sf-reset a:hover { background:none; color:#313131; text-decoration:underline; }
  40076. .sf-reset ol { padding: 10px 0; }
  40077. .sf-reset h1 { background-color:#FFFFFF; padding: 15px 28px; margin-bottom: 20px;
  40078. -webkit-border-radius: 10px;
  40079. -moz-border-radius: 10px;
  40080. border-radius: 10px;
  40081. border: 1px solid #ccc;
  40082. }
  40083. EOF;
  40084. }
  40085. private function decorate($content, $css)
  40086. {
  40087. return <<<EOF
  40088. <!DOCTYPE html>
  40089. <html>
  40090. <head>
  40091. <meta charset="{$this->charset}" />
  40092. <meta name="robots" content="noindex,nofollow" />
  40093. <style>
  40094. /* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html */
  40095. 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;}
  40096. html { background: #eee; padding: 10px }
  40097. img { border: 0; }
  40098. #sf-resetcontent { width:970px; margin:0 auto; }
  40099. $css
  40100. </style>
  40101. </head>
  40102. <body>
  40103. $content
  40104. </body>
  40105. </html>
  40106. EOF;
  40107. }
  40108. private function formatClass($class)
  40109. {
  40110. $parts = explode('\\', $class);
  40111. return sprintf('<abbr title="%s">%s</abbr>', $class, array_pop($parts));
  40112. }
  40113. private function formatPath($path, $line)
  40114. {
  40115. $path = $this->escapeHtml($path);
  40116. $file = preg_match('#[^/\\\\]*$#', $path, $file) ? $file[0] : $path;
  40117. if ($linkFormat = $this->fileLinkFormat) {
  40118. $link = strtr($this->escapeHtml($linkFormat), array('%f' => $path, '%l' => (int) $line));
  40119. return sprintf(' in <a href="%s" title="Go to source">%s line %d</a>', $link, $file, $line);
  40120. }
  40121. 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);
  40122. }
  40123. private function formatArgs(array $args)
  40124. {
  40125. $result = array();
  40126. foreach ($args as $key => $item) {
  40127. if ('object' === $item[0]) {
  40128. $formattedValue = sprintf('<em>object</em>(%s)', $this->formatClass($item[1]));
  40129. } elseif ('array' === $item[0]) {
  40130. $formattedValue = sprintf('<em>array</em>(%s)', \is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
  40131. } elseif ('string' === $item[0]) {
  40132. $formattedValue = sprintf("'%s'", $this->escapeHtml($item[1]));
  40133. } elseif ('null' === $item[0]) {
  40134. $formattedValue = '<em>null</em>';
  40135. } elseif ('boolean' === $item[0]) {
  40136. $formattedValue = '<em>'.strtolower(var_export($item[1], true)).'</em>';
  40137. } elseif ('resource' === $item[0]) {
  40138. $formattedValue = '<em>resource</em>';
  40139. } else {
  40140. $formattedValue = str_replace("\n", '', var_export($this->escapeHtml((string) $item[1]), true));
  40141. }
  40142. $result[] = \is_int($key) ? $formattedValue : sprintf("'%s' => %s", $this->escapeHtml($key), $formattedValue);
  40143. }
  40144. return implode(', ', $result);
  40145. }
  40146. protected static function utf8Htmlize($str)
  40147. {
  40148. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
  40149. return htmlspecialchars($str, ENT_QUOTES | (\PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), 'UTF-8');
  40150. }
  40151. private function escapeHtml($str)
  40152. {
  40153. return htmlspecialchars($str, ENT_QUOTES | (\PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), $this->charset);
  40154. }
  40155. public function catchOutput($buffer)
  40156. {
  40157. $this->caughtBuffer = $buffer;
  40158. return '';
  40159. }
  40160. public function cleanOutput($buffer)
  40161. {
  40162. if ($this->caughtLength) {
  40163. $cleanBuffer = substr_replace($buffer, '', 0, $this->caughtLength);
  40164. if (isset($cleanBuffer[0])) {
  40165. $buffer = $cleanBuffer;
  40166. }
  40167. }
  40168. return $buffer;
  40169. }
  40170. }
  40171. <?php
  40172. namespace Symfony\Component\Debug\FatalErrorHandler;
  40173. use Composer\Autoload\ClassLoader as ComposerClassLoader;
  40174. use Symfony\Component\ClassLoader\ClassLoader as SymfonyClassLoader;
  40175. use Symfony\Component\ClassLoader\UniversalClassLoader as SymfonyUniversalClassLoader;
  40176. use Symfony\Component\Debug\DebugClassLoader;
  40177. use Symfony\Component\Debug\Exception\ClassNotFoundException;
  40178. use Symfony\Component\Debug\Exception\FatalErrorException;
  40179. class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface
  40180. {
  40181. public function handleError(array $error, FatalErrorException $exception)
  40182. {
  40183. $messageLen = \strlen($error['message']);
  40184. $notFoundSuffix = '\' not found';
  40185. $notFoundSuffixLen = \strlen($notFoundSuffix);
  40186. if ($notFoundSuffixLen > $messageLen) {
  40187. return;
  40188. }
  40189. if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) {
  40190. return;
  40191. }
  40192. foreach (array('class', 'interface', 'trait') as $typeName) {
  40193. $prefix = ucfirst($typeName).' \'';
  40194. $prefixLen = \strlen($prefix);
  40195. if (0 !== strpos($error['message'], $prefix)) {
  40196. continue;
  40197. }
  40198. $fullyQualifiedClassName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);
  40199. if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedClassName, '\\')) {
  40200. $className = substr($fullyQualifiedClassName, $namespaceSeparatorIndex + 1);
  40201. $namespacePrefix = substr($fullyQualifiedClassName, 0, $namespaceSeparatorIndex);
  40202. $message = sprintf('Attempted to load %s "%s" from namespace "%s".', $typeName, $className, $namespacePrefix);
  40203. $tail = ' for another namespace?';
  40204. } else {
  40205. $className = $fullyQualifiedClassName;
  40206. $message = sprintf('Attempted to load %s "%s" from the global namespace.', $typeName, $className);
  40207. $tail = '?';
  40208. }
  40209. if ($candidates = $this->getClassCandidates($className)) {
  40210. $tail = array_pop($candidates).'"?';
  40211. if ($candidates) {
  40212. $tail = ' for e.g. "'.implode('", "', $candidates).'" or "'.$tail;
  40213. } else {
  40214. $tail = ' for "'.$tail;
  40215. }
  40216. }
  40217. $message .= "\nDid you forget a \"use\" statement".$tail;
  40218. return new ClassNotFoundException($message, $exception);
  40219. }
  40220. }
  40221. private function getClassCandidates($class)
  40222. {
  40223. if (!\is_array($functions = spl_autoload_functions())) {
  40224. return array();
  40225. }
  40226. $classes = array();
  40227. foreach ($functions as $function) {
  40228. if (!\is_array($function)) {
  40229. continue;
  40230. }
  40231. if ($function[0] instanceof DebugClassLoader) {
  40232. $function = $function[0]->getClassLoader();
  40233. if (\is_object($function)) {
  40234. $function = array($function);
  40235. }
  40236. if (!\is_array($function)) {
  40237. continue;
  40238. }
  40239. }
  40240. if ($function[0] instanceof ComposerClassLoader || $function[0] instanceof SymfonyClassLoader || $function[0] instanceof SymfonyUniversalClassLoader) {
  40241. foreach ($function[0]->getPrefixes() as $prefix => $paths) {
  40242. foreach ($paths as $path) {
  40243. $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
  40244. }
  40245. }
  40246. }
  40247. if ($function[0] instanceof ComposerClassLoader) {
  40248. foreach ($function[0]->getPrefixesPsr4() as $prefix => $paths) {
  40249. foreach ($paths as $path) {
  40250. $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
  40251. }
  40252. }
  40253. }
  40254. }
  40255. return array_unique($classes);
  40256. }
  40257. private function findClassInPath($path, $class, $prefix)
  40258. {
  40259. if (!$path = realpath($path.'/'.strtr($prefix, '\\_', '//')) ?: realpath($path.'/'.\dirname(strtr($prefix, '\\_', '//'))) ?: realpath($path)) {
  40260. return array();
  40261. }
  40262. $classes = array();
  40263. $filename = $class.'.php';
  40264. foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
  40265. if ($filename == $file->getFileName() && $class = $this->convertFileToClass($path, $file->getPathName(), $prefix)) {
  40266. $classes[] = $class;
  40267. }
  40268. }
  40269. return $classes;
  40270. }
  40271. private function convertFileToClass($path, $file, $prefix)
  40272. {
  40273. $candidates = array(
  40274. $namespacedClass = str_replace(array($path.\DIRECTORY_SEPARATOR, '.php', '/'), array('', '', '\\'), $file),
  40275. $prefix.$namespacedClass,
  40276. $prefix.'\\'.$namespacedClass,
  40277. str_replace('\\', '_', $namespacedClass),
  40278. str_replace('\\', '_', $prefix.$namespacedClass),
  40279. str_replace('\\', '_', $prefix.'\\'.$namespacedClass),
  40280. );
  40281. if ($prefix) {
  40282. $candidates = array_filter($candidates, function ($candidate) use ($prefix) { return 0 === strpos($candidate, $prefix); });
  40283. }
  40284. foreach ($candidates as $candidate) {
  40285. if ($this->classExists($candidate)) {
  40286. return $candidate;
  40287. }
  40288. }
  40289. require_once $file;
  40290. foreach ($candidates as $candidate) {
  40291. if ($this->classExists($candidate)) {
  40292. return $candidate;
  40293. }
  40294. }
  40295. }
  40296. private function classExists($class)
  40297. {
  40298. return class_exists($class, false) || interface_exists($class, false) || (\function_exists('trait_exists') && trait_exists($class, false));
  40299. }
  40300. }
  40301. <?php
  40302. namespace Symfony\Component\Debug\FatalErrorHandler;
  40303. use Symfony\Component\Debug\Exception\FatalErrorException;
  40304. interface FatalErrorHandlerInterface
  40305. {
  40306. public function handleError(array $error, FatalErrorException $exception);
  40307. }
  40308. <?php
  40309. namespace Symfony\Component\Debug\FatalErrorHandler;
  40310. use Symfony\Component\Debug\Exception\FatalErrorException;
  40311. use Symfony\Component\Debug\Exception\UndefinedFunctionException;
  40312. class UndefinedFunctionFatalErrorHandler implements FatalErrorHandlerInterface
  40313. {
  40314. public function handleError(array $error, FatalErrorException $exception)
  40315. {
  40316. $messageLen = \strlen($error['message']);
  40317. $notFoundSuffix = '()';
  40318. $notFoundSuffixLen = \strlen($notFoundSuffix);
  40319. if ($notFoundSuffixLen > $messageLen) {
  40320. return;
  40321. }
  40322. if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) {
  40323. return;
  40324. }
  40325. $prefix = 'Call to undefined function ';
  40326. $prefixLen = \strlen($prefix);
  40327. if (0 !== strpos($error['message'], $prefix)) {
  40328. return;
  40329. }
  40330. $fullyQualifiedFunctionName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);
  40331. if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedFunctionName, '\\')) {
  40332. $functionName = substr($fullyQualifiedFunctionName, $namespaceSeparatorIndex + 1);
  40333. $namespacePrefix = substr($fullyQualifiedFunctionName, 0, $namespaceSeparatorIndex);
  40334. $message = sprintf('Attempted to call function "%s" from namespace "%s".', $functionName, $namespacePrefix);
  40335. } else {
  40336. $functionName = $fullyQualifiedFunctionName;
  40337. $message = sprintf('Attempted to call function "%s" from the global namespace.', $functionName);
  40338. }
  40339. $candidates = array();
  40340. foreach (get_defined_functions() as $type => $definedFunctionNames) {
  40341. foreach ($definedFunctionNames as $definedFunctionName) {
  40342. if (false !== $namespaceSeparatorIndex = strrpos($definedFunctionName, '\\')) {
  40343. $definedFunctionNameBasename = substr($definedFunctionName, $namespaceSeparatorIndex + 1);
  40344. } else {
  40345. $definedFunctionNameBasename = $definedFunctionName;
  40346. }
  40347. if ($definedFunctionNameBasename === $functionName) {
  40348. $candidates[] = '\\'.$definedFunctionName;
  40349. }
  40350. }
  40351. }
  40352. if ($candidates) {
  40353. sort($candidates);
  40354. $last = array_pop($candidates).'"?';
  40355. if ($candidates) {
  40356. $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
  40357. } else {
  40358. $candidates = '"'.$last;
  40359. }
  40360. $message .= "\nDid you mean to call ".$candidates;
  40361. }
  40362. return new UndefinedFunctionException($message, $exception);
  40363. }
  40364. }
  40365. <?php
  40366. namespace Symfony\Component\Debug\FatalErrorHandler;
  40367. use Symfony\Component\Debug\Exception\FatalErrorException;
  40368. use Symfony\Component\Debug\Exception\UndefinedMethodException;
  40369. class UndefinedMethodFatalErrorHandler implements FatalErrorHandlerInterface
  40370. {
  40371. public function handleError(array $error, FatalErrorException $exception)
  40372. {
  40373. preg_match('/^Call to undefined method (.*)::(.*)\(\)$/', $error['message'], $matches);
  40374. if (!$matches) {
  40375. return;
  40376. }
  40377. $className = $matches[1];
  40378. $methodName = $matches[2];
  40379. $message = sprintf('Attempted to call an undefined method named "%s" of class "%s".', $methodName, $className);
  40380. if (!class_exists($className) || null === $methods = get_class_methods($className)) {
  40381. return new UndefinedMethodException($message, $exception);
  40382. }
  40383. $candidates = array();
  40384. foreach ($methods as $definedMethodName) {
  40385. $lev = levenshtein($methodName, $definedMethodName);
  40386. if ($lev <= \strlen($methodName) / 3 || false !== strpos($definedMethodName, $methodName)) {
  40387. $candidates[] = $definedMethodName;
  40388. }
  40389. }
  40390. if ($candidates) {
  40391. sort($candidates);
  40392. $last = array_pop($candidates).'"?';
  40393. if ($candidates) {
  40394. $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
  40395. } else {
  40396. $candidates = '"'.$last;
  40397. }
  40398. $message .= "\nDid you mean to call ".$candidates;
  40399. }
  40400. return new UndefinedMethodException($message, $exception);
  40401. }
  40402. }
  40403. Copyright (c) 2004-2018 Fabien Potencier
  40404. Permission is hereby granted, free of charge, to any person obtaining a copy
  40405. of this software and associated documentation files (the "Software"), to deal
  40406. in the Software without restriction, including without limitation the rights
  40407. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  40408. copies of the Software, and to permit persons to whom the Software is furnished
  40409. to do so, subject to the following conditions:
  40410. The above copyright notice and this permission notice shall be included in all
  40411. copies or substantial portions of the Software.
  40412. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  40413. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  40414. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  40415. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  40416. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  40417. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  40418. THE SOFTWARE.
  40419. <?php
  40420. namespace Symfony\Component\Filesystem\Exception;
  40421. interface ExceptionInterface
  40422. {
  40423. }
  40424. <?php
  40425. namespace Symfony\Component\Filesystem\Exception;
  40426. class FileNotFoundException extends IOException
  40427. {
  40428. public function __construct($message = null, $code = 0, \Exception $previous = null, $path = null)
  40429. {
  40430. if (null === $message) {
  40431. if (null === $path) {
  40432. $message = 'File could not be found.';
  40433. } else {
  40434. $message = sprintf('File "%s" could not be found.', $path);
  40435. }
  40436. }
  40437. parent::__construct($message, $code, $previous, $path);
  40438. }
  40439. }
  40440. <?php
  40441. namespace Symfony\Component\Filesystem\Exception;
  40442. class IOException extends \RuntimeException implements IOExceptionInterface
  40443. {
  40444. private $path;
  40445. public function __construct($message, $code = 0, \Exception $previous = null, $path = null)
  40446. {
  40447. $this->path = $path;
  40448. parent::__construct($message, $code, $previous);
  40449. }
  40450. public function getPath()
  40451. {
  40452. return $this->path;
  40453. }
  40454. }
  40455. <?php
  40456. namespace Symfony\Component\Filesystem\Exception;
  40457. interface IOExceptionInterface extends ExceptionInterface
  40458. {
  40459. public function getPath();
  40460. }
  40461. <?php
  40462. namespace Symfony\Component\Filesystem;
  40463. use Symfony\Component\Filesystem\Exception\FileNotFoundException;
  40464. use Symfony\Component\Filesystem\Exception\IOException;
  40465. class Filesystem
  40466. {
  40467. private static $lastError;
  40468. public function copy($originFile, $targetFile, $overwriteNewerFiles = false)
  40469. {
  40470. $originIsLocal = stream_is_local($originFile) || 0 === stripos($originFile, 'file://');
  40471. if ($originIsLocal && !is_file($originFile)) {
  40472. throw new FileNotFoundException(sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile);
  40473. }
  40474. $this->mkdir(\dirname($targetFile));
  40475. $doCopy = true;
  40476. if (!$overwriteNewerFiles && null === parse_url($originFile, PHP_URL_HOST) && is_file($targetFile)) {
  40477. $doCopy = filemtime($originFile) > filemtime($targetFile);
  40478. }
  40479. if ($doCopy) {
  40480. if (false === $source = @fopen($originFile, 'r')) {
  40481. throw new IOException(sprintf('Failed to copy "%s" to "%s" because source file could not be opened for reading.', $originFile, $targetFile), 0, null, $originFile);
  40482. }
  40483. if (false === $target = @fopen($targetFile, 'w', null, stream_context_create(array('ftp' => array('overwrite' => true))))) {
  40484. throw new IOException(sprintf('Failed to copy "%s" to "%s" because target file could not be opened for writing.', $originFile, $targetFile), 0, null, $originFile);
  40485. }
  40486. $bytesCopied = stream_copy_to_stream($source, $target);
  40487. fclose($source);
  40488. fclose($target);
  40489. unset($source, $target);
  40490. if (!is_file($targetFile)) {
  40491. throw new IOException(sprintf('Failed to copy "%s" to "%s".', $originFile, $targetFile), 0, null, $originFile);
  40492. }
  40493. if ($originIsLocal) {
  40494. @chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111));
  40495. if ($bytesCopied !== $bytesOrigin = filesize($originFile)) {
  40496. 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);
  40497. }
  40498. }
  40499. }
  40500. }
  40501. public function mkdir($dirs, $mode = 0777)
  40502. {
  40503. foreach ($this->toIterator($dirs) as $dir) {
  40504. if (is_dir($dir)) {
  40505. continue;
  40506. }
  40507. if (!self::box('mkdir', $dir, $mode, true)) {
  40508. if (!is_dir($dir)) {
  40509. if (self::$lastError) {
  40510. throw new IOException(sprintf('Failed to create "%s": %s.', $dir, self::$lastError), 0, null, $dir);
  40511. }
  40512. throw new IOException(sprintf('Failed to create "%s"', $dir), 0, null, $dir);
  40513. }
  40514. }
  40515. }
  40516. }
  40517. public function exists($files)
  40518. {
  40519. $maxPathLength = PHP_MAXPATHLEN - 2;
  40520. foreach ($this->toIterator($files) as $file) {
  40521. if (\strlen($file) > $maxPathLength) {
  40522. throw new IOException(sprintf('Could not check if file exist because path length exceeds %d characters.', $maxPathLength), 0, null, $file);
  40523. }
  40524. if (!file_exists($file)) {
  40525. return false;
  40526. }
  40527. }
  40528. return true;
  40529. }
  40530. public function touch($files, $time = null, $atime = null)
  40531. {
  40532. foreach ($this->toIterator($files) as $file) {
  40533. $touch = $time ? @touch($file, $time, $atime) : @touch($file);
  40534. if (true !== $touch) {
  40535. throw new IOException(sprintf('Failed to touch "%s".', $file), 0, null, $file);
  40536. }
  40537. }
  40538. }
  40539. public function remove($files)
  40540. {
  40541. if ($files instanceof \Traversable) {
  40542. $files = iterator_to_array($files, false);
  40543. } elseif (!\is_array($files)) {
  40544. $files = array($files);
  40545. }
  40546. $files = array_reverse($files);
  40547. foreach ($files as $file) {
  40548. if (is_link($file)) {
  40549. if (!(self::box('unlink', $file) || '\\' !== \DIRECTORY_SEPARATOR || self::box('rmdir', $file)) && file_exists($file)) {
  40550. throw new IOException(sprintf('Failed to remove symlink "%s": %s.', $file, self::$lastError));
  40551. }
  40552. } elseif (is_dir($file)) {
  40553. $this->remove(new \FilesystemIterator($file, \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS));
  40554. if (!self::box('rmdir', $file) && file_exists($file)) {
  40555. throw new IOException(sprintf('Failed to remove directory "%s": %s.', $file, self::$lastError));
  40556. }
  40557. } elseif (!self::box('unlink', $file) && file_exists($file)) {
  40558. throw new IOException(sprintf('Failed to remove file "%s": %s.', $file, self::$lastError));
  40559. }
  40560. }
  40561. }
  40562. public function chmod($files, $mode, $umask = 0000, $recursive = false)
  40563. {
  40564. foreach ($this->toIterator($files) as $file) {
  40565. if (true !== @chmod($file, $mode & ~$umask)) {
  40566. throw new IOException(sprintf('Failed to chmod file "%s".', $file), 0, null, $file);
  40567. }
  40568. if ($recursive && is_dir($file) && !is_link($file)) {
  40569. $this->chmod(new \FilesystemIterator($file), $mode, $umask, true);
  40570. }
  40571. }
  40572. }
  40573. public function chown($files, $user, $recursive = false)
  40574. {
  40575. foreach ($this->toIterator($files) as $file) {
  40576. if ($recursive && is_dir($file) && !is_link($file)) {
  40577. $this->chown(new \FilesystemIterator($file), $user, true);
  40578. }
  40579. if (is_link($file) && \function_exists('lchown')) {
  40580. if (true !== @lchown($file, $user)) {
  40581. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  40582. }
  40583. } else {
  40584. if (true !== @chown($file, $user)) {
  40585. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  40586. }
  40587. }
  40588. }
  40589. }
  40590. public function chgrp($files, $group, $recursive = false)
  40591. {
  40592. foreach ($this->toIterator($files) as $file) {
  40593. if ($recursive && is_dir($file) && !is_link($file)) {
  40594. $this->chgrp(new \FilesystemIterator($file), $group, true);
  40595. }
  40596. if (is_link($file) && \function_exists('lchgrp')) {
  40597. if (true !== @lchgrp($file, $group) || (\defined('HHVM_VERSION') && !posix_getgrnam($group))) {
  40598. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  40599. }
  40600. } else {
  40601. if (true !== @chgrp($file, $group)) {
  40602. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  40603. }
  40604. }
  40605. }
  40606. }
  40607. public function rename($origin, $target, $overwrite = false)
  40608. {
  40609. if (!$overwrite && $this->isReadable($target)) {
  40610. throw new IOException(sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target);
  40611. }
  40612. if (true !== @rename($origin, $target)) {
  40613. if (is_dir($origin)) {
  40614. $this->mirror($origin, $target, null, array('override' => $overwrite, 'delete' => $overwrite));
  40615. $this->remove($origin);
  40616. return;
  40617. }
  40618. throw new IOException(sprintf('Cannot rename "%s" to "%s".', $origin, $target), 0, null, $target);
  40619. }
  40620. }
  40621. private function isReadable($filename)
  40622. {
  40623. $maxPathLength = PHP_MAXPATHLEN - 2;
  40624. if (\strlen($filename) > $maxPathLength) {
  40625. throw new IOException(sprintf('Could not check if file is readable because path length exceeds %d characters.', $maxPathLength), 0, null, $filename);
  40626. }
  40627. return is_readable($filename);
  40628. }
  40629. public function symlink($originDir, $targetDir, $copyOnWindows = false)
  40630. {
  40631. if ('\\' === \DIRECTORY_SEPARATOR) {
  40632. $originDir = strtr($originDir, '/', '\\');
  40633. $targetDir = strtr($targetDir, '/', '\\');
  40634. if ($copyOnWindows) {
  40635. $this->mirror($originDir, $targetDir);
  40636. return;
  40637. }
  40638. }
  40639. $this->mkdir(\dirname($targetDir));
  40640. if (is_link($targetDir)) {
  40641. if (readlink($targetDir) === $originDir) {
  40642. return;
  40643. }
  40644. $this->remove($targetDir);
  40645. }
  40646. if (!self::box('symlink', $originDir, $targetDir)) {
  40647. if (null !== self::$lastError) {
  40648. if ('\\' === \DIRECTORY_SEPARATOR && false !== strpos(self::$lastError, 'error code(1314)')) {
  40649. 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);
  40650. }
  40651. }
  40652. throw new IOException(sprintf('Failed to create symbolic link from "%s" to "%s".', $originDir, $targetDir), 0, null, $targetDir);
  40653. }
  40654. }
  40655. public function makePathRelative($endPath, $startPath)
  40656. {
  40657. if ('\\' === \DIRECTORY_SEPARATOR) {
  40658. $endPath = str_replace('\\', '/', $endPath);
  40659. $startPath = str_replace('\\', '/', $startPath);
  40660. }
  40661. $stripDriveLetter = function ($path) {
  40662. if (\strlen($path) > 2 && ':' === $path[1] && '/' === $path[2] && ctype_alpha($path[0])) {
  40663. return substr($path, 2);
  40664. }
  40665. return $path;
  40666. };
  40667. $endPath = $stripDriveLetter($endPath);
  40668. $startPath = $stripDriveLetter($startPath);
  40669. $startPathArr = explode('/', trim($startPath, '/'));
  40670. $endPathArr = explode('/', trim($endPath, '/'));
  40671. $normalizePathArray = function ($pathSegments, $absolute) {
  40672. $result = array();
  40673. foreach ($pathSegments as $segment) {
  40674. if ('..' === $segment && ($absolute || \count($result))) {
  40675. array_pop($result);
  40676. } elseif ('.' !== $segment) {
  40677. $result[] = $segment;
  40678. }
  40679. }
  40680. return $result;
  40681. };
  40682. $startPathArr = $normalizePathArray($startPathArr, static::isAbsolutePath($startPath));
  40683. $endPathArr = $normalizePathArray($endPathArr, static::isAbsolutePath($endPath));
  40684. $index = 0;
  40685. while (isset($startPathArr[$index]) && isset($endPathArr[$index]) && $startPathArr[$index] === $endPathArr[$index]) {
  40686. ++$index;
  40687. }
  40688. if (1 === \count($startPathArr) && '' === $startPathArr[0]) {
  40689. $depth = 0;
  40690. } else {
  40691. $depth = \count($startPathArr) - $index;
  40692. }
  40693. $traverser = str_repeat('../', $depth);
  40694. $endPathRemainder = implode('/', \array_slice($endPathArr, $index));
  40695. $relativePath = $traverser.('' !== $endPathRemainder ? $endPathRemainder.'/' : '');
  40696. return '' === $relativePath ? './' : $relativePath;
  40697. }
  40698. public function mirror($originDir, $targetDir, \Traversable $iterator = null, $options = array())
  40699. {
  40700. $targetDir = rtrim($targetDir, '/\\');
  40701. $originDir = rtrim($originDir, '/\\');
  40702. $originDirLen = \strlen($originDir);
  40703. if ($this->exists($targetDir) && isset($options['delete']) && $options['delete']) {
  40704. $deleteIterator = $iterator;
  40705. if (null === $deleteIterator) {
  40706. $flags = \FilesystemIterator::SKIP_DOTS;
  40707. $deleteIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($targetDir, $flags), \RecursiveIteratorIterator::CHILD_FIRST);
  40708. }
  40709. $targetDirLen = \strlen($targetDir);
  40710. foreach ($deleteIterator as $file) {
  40711. $origin = $originDir.substr($file->getPathname(), $targetDirLen);
  40712. if (!$this->exists($origin)) {
  40713. $this->remove($file);
  40714. }
  40715. }
  40716. }
  40717. $copyOnWindows = false;
  40718. if (isset($options['copy_on_windows'])) {
  40719. $copyOnWindows = $options['copy_on_windows'];
  40720. }
  40721. if (null === $iterator) {
  40722. $flags = $copyOnWindows ? \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS : \FilesystemIterator::SKIP_DOTS;
  40723. $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($originDir, $flags), \RecursiveIteratorIterator::SELF_FIRST);
  40724. }
  40725. if ($this->exists($originDir)) {
  40726. $this->mkdir($targetDir);
  40727. }
  40728. foreach ($iterator as $file) {
  40729. $target = $targetDir.substr($file->getPathname(), $originDirLen);
  40730. if ($copyOnWindows) {
  40731. if (is_file($file)) {
  40732. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  40733. } elseif (is_dir($file)) {
  40734. $this->mkdir($target);
  40735. } else {
  40736. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  40737. }
  40738. } else {
  40739. if (is_link($file)) {
  40740. $this->symlink($file->getLinkTarget(), $target);
  40741. } elseif (is_dir($file)) {
  40742. $this->mkdir($target);
  40743. } elseif (is_file($file)) {
  40744. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  40745. } else {
  40746. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  40747. }
  40748. }
  40749. }
  40750. }
  40751. public function isAbsolutePath($file)
  40752. {
  40753. return strspn($file, '/\\', 0, 1)
  40754. || (\strlen($file) > 3 && ctype_alpha($file[0])
  40755. && ':' === substr($file, 1, 1)
  40756. && strspn($file, '/\\', 2, 1)
  40757. )
  40758. || null !== parse_url($file, PHP_URL_SCHEME)
  40759. ;
  40760. }
  40761. public function tempnam($dir, $prefix)
  40762. {
  40763. list($scheme, $hierarchy) = $this->getSchemeAndHierarchy($dir);
  40764. if (null === $scheme || 'file' === $scheme || 'gs' === $scheme) {
  40765. $tmpFile = @tempnam($hierarchy, $prefix);
  40766. if (false !== $tmpFile) {
  40767. if (null !== $scheme && 'gs' !== $scheme) {
  40768. return $scheme.'://'.$tmpFile;
  40769. }
  40770. return $tmpFile;
  40771. }
  40772. throw new IOException('A temporary file could not be created.');
  40773. }
  40774. for ($i = 0; $i < 10; ++$i) {
  40775. $tmpFile = $dir.'/'.$prefix.uniqid(mt_rand(), true);
  40776. $handle = @fopen($tmpFile, 'x+');
  40777. if (false === $handle) {
  40778. continue;
  40779. }
  40780. @fclose($handle);
  40781. return $tmpFile;
  40782. }
  40783. throw new IOException('A temporary file could not be created.');
  40784. }
  40785. public function dumpFile($filename, $content, $mode = 0666)
  40786. {
  40787. $dir = \dirname($filename);
  40788. if (!is_dir($dir)) {
  40789. $this->mkdir($dir);
  40790. }
  40791. if (!is_writable($dir)) {
  40792. throw new IOException(sprintf('Unable to write to the "%s" directory.', $dir), 0, null, $dir);
  40793. }
  40794. $tmpFile = $this->tempnam($dir, basename($filename));
  40795. if (false === @file_put_contents($tmpFile, $content)) {
  40796. throw new IOException(sprintf('Failed to write file "%s".', $filename), 0, null, $filename);
  40797. }
  40798. if (null !== $mode) {
  40799. if (\func_num_args() > 2) {
  40800. @trigger_error('Support for modifying file permissions is deprecated since Symfony 2.3.12 and will be removed in 3.0.', E_USER_DEPRECATED);
  40801. }
  40802. $this->chmod($tmpFile, $mode);
  40803. } elseif (file_exists($filename)) {
  40804. @chmod($tmpFile, fileperms($filename));
  40805. }
  40806. $this->rename($tmpFile, $filename, true);
  40807. }
  40808. private function toIterator($files)
  40809. {
  40810. if (!$files instanceof \Traversable) {
  40811. $files = new \ArrayObject(\is_array($files) ? $files : array($files));
  40812. }
  40813. return $files;
  40814. }
  40815. private function getSchemeAndHierarchy($filename)
  40816. {
  40817. $components = explode('://', $filename, 2);
  40818. return 2 === \count($components) ? array($components[0], $components[1]) : array(null, $components[0]);
  40819. }
  40820. private static function box($func)
  40821. {
  40822. self::$lastError = null;
  40823. \set_error_handler(__CLASS__.'::handleError');
  40824. try {
  40825. $result = \call_user_func_array($func, \array_slice(\func_get_args(), 1));
  40826. \restore_error_handler();
  40827. return $result;
  40828. } catch (\Throwable $e) {
  40829. } catch (\Exception $e) {
  40830. }
  40831. \restore_error_handler();
  40832. throw $e;
  40833. }
  40834. public static function handleError($type, $msg)
  40835. {
  40836. self::$lastError = $msg;
  40837. }
  40838. }
  40839. Copyright (c) 2004-2018 Fabien Potencier
  40840. Permission is hereby granted, free of charge, to any person obtaining a copy
  40841. of this software and associated documentation files (the "Software"), to deal
  40842. in the Software without restriction, including without limitation the rights
  40843. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  40844. copies of the Software, and to permit persons to whom the Software is furnished
  40845. to do so, subject to the following conditions:
  40846. The above copyright notice and this permission notice shall be included in all
  40847. copies or substantial portions of the Software.
  40848. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  40849. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  40850. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  40851. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  40852. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  40853. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  40854. THE SOFTWARE.
  40855. <?php
  40856. namespace Symfony\Component\Filesystem;
  40857. use Symfony\Component\Filesystem\Exception\IOException;
  40858. class LockHandler
  40859. {
  40860. private $file;
  40861. private $handle;
  40862. public function __construct($name, $lockPath = null)
  40863. {
  40864. $lockPath = $lockPath ?: sys_get_temp_dir();
  40865. if (!is_dir($lockPath)) {
  40866. $fs = new Filesystem();
  40867. $fs->mkdir($lockPath);
  40868. }
  40869. if (!is_writable($lockPath)) {
  40870. throw new IOException(sprintf('The directory "%s" is not writable.', $lockPath), 0, null, $lockPath);
  40871. }
  40872. $this->file = sprintf('%s/sf.%s.%s.lock', $lockPath, preg_replace('/[^a-z0-9\._-]+/i', '-', $name), hash('sha256', $name));
  40873. }
  40874. public function lock($blocking = false)
  40875. {
  40876. if ($this->handle) {
  40877. return true;
  40878. }
  40879. $error = null;
  40880. set_error_handler(function ($errno, $msg) use (&$error) {
  40881. $error = $msg;
  40882. });
  40883. if (!$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r')) {
  40884. if ($this->handle = fopen($this->file, 'x')) {
  40885. chmod($this->file, 0666);
  40886. } elseif (!$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r')) {
  40887. usleep(100);
  40888. $this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r');
  40889. }
  40890. }
  40891. restore_error_handler();
  40892. if (!$this->handle) {
  40893. throw new IOException($error, 0, null, $this->file);
  40894. }
  40895. if (!flock($this->handle, LOCK_EX | ($blocking ? 0 : LOCK_NB))) {
  40896. fclose($this->handle);
  40897. $this->handle = null;
  40898. return false;
  40899. }
  40900. return true;
  40901. }
  40902. public function release()
  40903. {
  40904. if ($this->handle) {
  40905. flock($this->handle, LOCK_UN | LOCK_NB);
  40906. fclose($this->handle);
  40907. $this->handle = null;
  40908. }
  40909. }
  40910. }
  40911. <?php
  40912. namespace Symfony\Component\Finder\Adapter;
  40913. @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);
  40914. abstract class AbstractAdapter implements AdapterInterface
  40915. {
  40916. protected $followLinks = false;
  40917. protected $mode = 0;
  40918. protected $minDepth = 0;
  40919. protected $maxDepth = PHP_INT_MAX;
  40920. protected $exclude = array();
  40921. protected $names = array();
  40922. protected $notNames = array();
  40923. protected $contains = array();
  40924. protected $notContains = array();
  40925. protected $sizes = array();
  40926. protected $dates = array();
  40927. protected $filters = array();
  40928. protected $sort = false;
  40929. protected $paths = array();
  40930. protected $notPaths = array();
  40931. protected $ignoreUnreadableDirs = false;
  40932. private static $areSupported = array();
  40933. public function isSupported()
  40934. {
  40935. $name = $this->getName();
  40936. if (!array_key_exists($name, self::$areSupported)) {
  40937. self::$areSupported[$name] = $this->canBeUsed();
  40938. }
  40939. return self::$areSupported[$name];
  40940. }
  40941. public function setFollowLinks($followLinks)
  40942. {
  40943. $this->followLinks = $followLinks;
  40944. return $this;
  40945. }
  40946. public function setMode($mode)
  40947. {
  40948. $this->mode = $mode;
  40949. return $this;
  40950. }
  40951. public function setDepths(array $depths)
  40952. {
  40953. $this->minDepth = 0;
  40954. $this->maxDepth = PHP_INT_MAX;
  40955. foreach ($depths as $comparator) {
  40956. switch ($comparator->getOperator()) {
  40957. case '>':
  40958. $this->minDepth = $comparator->getTarget() + 1;
  40959. break;
  40960. case '>=':
  40961. $this->minDepth = $comparator->getTarget();
  40962. break;
  40963. case '<':
  40964. $this->maxDepth = $comparator->getTarget() - 1;
  40965. break;
  40966. case '<=':
  40967. $this->maxDepth = $comparator->getTarget();
  40968. break;
  40969. default:
  40970. $this->minDepth = $this->maxDepth = $comparator->getTarget();
  40971. }
  40972. }
  40973. return $this;
  40974. }
  40975. public function setExclude(array $exclude)
  40976. {
  40977. $this->exclude = $exclude;
  40978. return $this;
  40979. }
  40980. public function setNames(array $names)
  40981. {
  40982. $this->names = $names;
  40983. return $this;
  40984. }
  40985. public function setNotNames(array $notNames)
  40986. {
  40987. $this->notNames = $notNames;
  40988. return $this;
  40989. }
  40990. public function setContains(array $contains)
  40991. {
  40992. $this->contains = $contains;
  40993. return $this;
  40994. }
  40995. public function setNotContains(array $notContains)
  40996. {
  40997. $this->notContains = $notContains;
  40998. return $this;
  40999. }
  41000. public function setSizes(array $sizes)
  41001. {
  41002. $this->sizes = $sizes;
  41003. return $this;
  41004. }
  41005. public function setDates(array $dates)
  41006. {
  41007. $this->dates = $dates;
  41008. return $this;
  41009. }
  41010. public function setFilters(array $filters)
  41011. {
  41012. $this->filters = $filters;
  41013. return $this;
  41014. }
  41015. public function setSort($sort)
  41016. {
  41017. $this->sort = $sort;
  41018. return $this;
  41019. }
  41020. public function setPath(array $paths)
  41021. {
  41022. $this->paths = $paths;
  41023. return $this;
  41024. }
  41025. public function setNotPath(array $notPaths)
  41026. {
  41027. $this->notPaths = $notPaths;
  41028. return $this;
  41029. }
  41030. public function ignoreUnreadableDirs($ignore = true)
  41031. {
  41032. $this->ignoreUnreadableDirs = (bool) $ignore;
  41033. return $this;
  41034. }
  41035. abstract protected function canBeUsed();
  41036. }
  41037. <?php
  41038. namespace Symfony\Component\Finder\Adapter;
  41039. @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);
  41040. use Symfony\Component\Finder\Comparator\DateComparator;
  41041. use Symfony\Component\Finder\Comparator\NumberComparator;
  41042. use Symfony\Component\Finder\Exception\AccessDeniedException;
  41043. use Symfony\Component\Finder\Expression\Expression;
  41044. use Symfony\Component\Finder\Iterator;
  41045. use Symfony\Component\Finder\Shell\Command;
  41046. use Symfony\Component\Finder\Shell\Shell;
  41047. abstract class AbstractFindAdapter extends AbstractAdapter
  41048. {
  41049. protected $shell;
  41050. public function __construct()
  41051. {
  41052. $this->shell = new Shell();
  41053. }
  41054. public function searchInDirectory($dir)
  41055. {
  41056. $dir = realpath($dir);
  41057. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode && ($this->contains || $this->notContains)) {
  41058. return new Iterator\FilePathsIterator(array(), $dir);
  41059. }
  41060. $command = Command::create();
  41061. $find = $this->buildFindCommand($command, $dir);
  41062. if ($this->followLinks) {
  41063. $find->add('-follow');
  41064. }
  41065. $find->add('-mindepth')->add($this->minDepth + 1);
  41066. if (PHP_INT_MAX !== $this->maxDepth) {
  41067. $find->add('-maxdepth')->add($this->maxDepth + 1);
  41068. }
  41069. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode) {
  41070. $find->add('-type d');
  41071. } elseif (Iterator\FileTypeFilterIterator::ONLY_FILES === $this->mode) {
  41072. $find->add('-type f');
  41073. }
  41074. $this->buildNamesFiltering($find, $this->names);
  41075. $this->buildNamesFiltering($find, $this->notNames, true);
  41076. $this->buildPathsFiltering($find, $dir, $this->paths);
  41077. $this->buildPathsFiltering($find, $dir, $this->notPaths, true);
  41078. $this->buildSizesFiltering($find, $this->sizes);
  41079. $this->buildDatesFiltering($find, $this->dates);
  41080. $useGrep = $this->shell->testCommand('grep') && $this->shell->testCommand('xargs');
  41081. $useSort = \is_int($this->sort) && $this->shell->testCommand('sort') && $this->shell->testCommand('cut');
  41082. if ($useGrep && ($this->contains || $this->notContains)) {
  41083. $grep = $command->ins('grep');
  41084. $this->buildContentFiltering($grep, $this->contains);
  41085. $this->buildContentFiltering($grep, $this->notContains, true);
  41086. }
  41087. if ($useSort) {
  41088. $this->buildSorting($command, $this->sort);
  41089. }
  41090. $command->setErrorHandler(
  41091. $this->ignoreUnreadableDirs
  41092. ? function ($stderr) { }
  41093. : function ($stderr) { throw new AccessDeniedException($stderr); }
  41094. );
  41095. $paths = $this->shell->testCommand('uniq') ? $command->add('| uniq')->execute() : array_unique($command->execute());
  41096. $iterator = new Iterator\FilePathsIterator($paths, $dir);
  41097. if ($this->exclude) {
  41098. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  41099. }
  41100. if (!$useGrep && ($this->contains || $this->notContains)) {
  41101. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  41102. }
  41103. if ($this->filters) {
  41104. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  41105. }
  41106. if (!$useSort && $this->sort) {
  41107. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  41108. $iterator = $iteratorAggregate->getIterator();
  41109. }
  41110. return $iterator;
  41111. }
  41112. protected function canBeUsed()
  41113. {
  41114. return $this->shell->testCommand('find');
  41115. }
  41116. protected function buildFindCommand(Command $command, $dir)
  41117. {
  41118. return $command
  41119. ->ins('find')
  41120. ->add('find ')
  41121. ->arg($dir)
  41122. ->add('-noleaf');
  41123. }
  41124. private function buildNamesFiltering(Command $command, array $names, $not = false)
  41125. {
  41126. if (0 === \count($names)) {
  41127. return;
  41128. }
  41129. $command->add($not ? '-not' : null)->cmd('(');
  41130. foreach ($names as $i => $name) {
  41131. $expr = Expression::create($name);
  41132. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  41133. $expr = Expression::create($expr->getGlob()->toRegex(false));
  41134. }
  41135. if ($expr->isRegex()) {
  41136. $regex = $expr->getRegex();
  41137. $regex->prepend($regex->hasStartFlag() ? '/' : '/[^/]*')
  41138. ->setStartFlag(false)
  41139. ->setStartJoker(true)
  41140. ->replaceJokers('[^/]');
  41141. if (!$regex->hasEndFlag() || $regex->hasEndJoker()) {
  41142. $regex->setEndJoker(false)->append('[^/]*');
  41143. }
  41144. }
  41145. $command
  41146. ->add($i > 0 ? '-or' : null)
  41147. ->add($expr->isRegex()
  41148. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  41149. : ($expr->isCaseSensitive() ? '-name' : '-iname')
  41150. )
  41151. ->arg($expr->renderPattern());
  41152. }
  41153. $command->cmd(')');
  41154. }
  41155. private function buildPathsFiltering(Command $command, $dir, array $paths, $not = false)
  41156. {
  41157. if (0 === \count($paths)) {
  41158. return;
  41159. }
  41160. $command->add($not ? '-not' : null)->cmd('(');
  41161. foreach ($paths as $i => $path) {
  41162. $expr = Expression::create($path);
  41163. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  41164. $expr = Expression::create($expr->getGlob()->toRegex(false));
  41165. }
  41166. if ($expr->isRegex()) {
  41167. $regex = $expr->getRegex();
  41168. $regex->prepend($regex->hasStartFlag() ? preg_quote($dir).\DIRECTORY_SEPARATOR : '.*')->setEndJoker(!$regex->hasEndFlag());
  41169. } else {
  41170. $expr->prepend('*')->append('*');
  41171. }
  41172. $command
  41173. ->add($i > 0 ? '-or' : null)
  41174. ->add($expr->isRegex()
  41175. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  41176. : ($expr->isCaseSensitive() ? '-path' : '-ipath')
  41177. )
  41178. ->arg($expr->renderPattern());
  41179. }
  41180. $command->cmd(')');
  41181. }
  41182. private function buildSizesFiltering(Command $command, array $sizes)
  41183. {
  41184. foreach ($sizes as $i => $size) {
  41185. $command->add($i > 0 ? '-and' : null);
  41186. switch ($size->getOperator()) {
  41187. case '<=':
  41188. $command->add('-size -'.($size->getTarget() + 1).'c');
  41189. break;
  41190. case '>=':
  41191. $command->add('-size +'.($size->getTarget() - 1).'c');
  41192. break;
  41193. case '>':
  41194. $command->add('-size +'.$size->getTarget().'c');
  41195. break;
  41196. case '!=':
  41197. $command->add('-size -'.$size->getTarget().'c');
  41198. $command->add('-size +'.$size->getTarget().'c');
  41199. break;
  41200. case '<':
  41201. default:
  41202. $command->add('-size -'.$size->getTarget().'c');
  41203. }
  41204. }
  41205. }
  41206. private function buildDatesFiltering(Command $command, array $dates)
  41207. {
  41208. foreach ($dates as $i => $date) {
  41209. $command->add($i > 0 ? '-and' : null);
  41210. $mins = (int) round((time() - $date->getTarget()) / 60);
  41211. if (0 > $mins) {
  41212. $command->add(' -mmin -0');
  41213. return;
  41214. }
  41215. switch ($date->getOperator()) {
  41216. case '<=':
  41217. $command->add('-mmin +'.($mins - 1));
  41218. break;
  41219. case '>=':
  41220. $command->add('-mmin -'.($mins + 1));
  41221. break;
  41222. case '>':
  41223. $command->add('-mmin -'.$mins);
  41224. break;
  41225. case '!=':
  41226. $command->add('-mmin +'.$mins.' -or -mmin -'.$mins);
  41227. break;
  41228. case '<':
  41229. default:
  41230. $command->add('-mmin +'.$mins);
  41231. }
  41232. }
  41233. }
  41234. private function buildSorting(Command $command, $sort)
  41235. {
  41236. $this->buildFormatSorting($command, $sort);
  41237. }
  41238. abstract protected function buildFormatSorting(Command $command, $sort);
  41239. abstract protected function buildContentFiltering(Command $command, array $contains, $not = false);
  41240. }
  41241. <?php
  41242. namespace Symfony\Component\Finder\Adapter;
  41243. interface AdapterInterface
  41244. {
  41245. public function setFollowLinks($followLinks);
  41246. public function setMode($mode);
  41247. public function setExclude(array $exclude);
  41248. public function setDepths(array $depths);
  41249. public function setNames(array $names);
  41250. public function setNotNames(array $notNames);
  41251. public function setContains(array $contains);
  41252. public function setNotContains(array $notContains);
  41253. public function setSizes(array $sizes);
  41254. public function setDates(array $dates);
  41255. public function setFilters(array $filters);
  41256. public function setSort($sort);
  41257. public function setPath(array $paths);
  41258. public function setNotPath(array $notPaths);
  41259. public function ignoreUnreadableDirs($ignore = true);
  41260. public function searchInDirectory($dir);
  41261. public function isSupported();
  41262. public function getName();
  41263. }
  41264. <?php
  41265. namespace Symfony\Component\Finder\Adapter;
  41266. @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);
  41267. use Symfony\Component\Finder\Expression\Expression;
  41268. use Symfony\Component\Finder\Iterator\SortableIterator;
  41269. use Symfony\Component\Finder\Shell\Command;
  41270. use Symfony\Component\Finder\Shell\Shell;
  41271. class BsdFindAdapter extends AbstractFindAdapter
  41272. {
  41273. public function getName()
  41274. {
  41275. return 'bsd_find';
  41276. }
  41277. protected function canBeUsed()
  41278. {
  41279. return \in_array($this->shell->getType(), array(Shell::TYPE_BSD, Shell::TYPE_DARWIN)) && parent::canBeUsed();
  41280. }
  41281. protected function buildFormatSorting(Command $command, $sort)
  41282. {
  41283. switch ($sort) {
  41284. case SortableIterator::SORT_BY_NAME:
  41285. $command->ins('sort')->add('| sort');
  41286. return;
  41287. case SortableIterator::SORT_BY_TYPE:
  41288. $format = '%HT';
  41289. break;
  41290. case SortableIterator::SORT_BY_ACCESSED_TIME:
  41291. $format = '%a';
  41292. break;
  41293. case SortableIterator::SORT_BY_CHANGED_TIME:
  41294. $format = '%c';
  41295. break;
  41296. case SortableIterator::SORT_BY_MODIFIED_TIME:
  41297. $format = '%m';
  41298. break;
  41299. default:
  41300. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  41301. }
  41302. $command
  41303. ->add('-print0 | xargs -0 stat -f')
  41304. ->arg($format.'%t%N')
  41305. ->add('| sort | cut -f 2');
  41306. }
  41307. protected function buildFindCommand(Command $command, $dir)
  41308. {
  41309. parent::buildFindCommand($command, $dir)->addAtIndex('-E', 1);
  41310. return $command;
  41311. }
  41312. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  41313. {
  41314. foreach ($contains as $contain) {
  41315. $expr = Expression::create($contain);
  41316. $command
  41317. ->add('| grep -v \'^$\'')
  41318. ->add('| xargs -I{} grep -I')
  41319. ->add($expr->isCaseSensitive() ? null : '-i')
  41320. ->add($not ? '-L' : '-l')
  41321. ->add('-Ee')->arg($expr->renderPattern())
  41322. ->add('{}')
  41323. ;
  41324. }
  41325. }
  41326. }
  41327. <?php
  41328. namespace Symfony\Component\Finder\Adapter;
  41329. @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);
  41330. use Symfony\Component\Finder\Expression\Expression;
  41331. use Symfony\Component\Finder\Iterator\SortableIterator;
  41332. use Symfony\Component\Finder\Shell\Command;
  41333. use Symfony\Component\Finder\Shell\Shell;
  41334. class GnuFindAdapter extends AbstractFindAdapter
  41335. {
  41336. public function getName()
  41337. {
  41338. return 'gnu_find';
  41339. }
  41340. protected function buildFormatSorting(Command $command, $sort)
  41341. {
  41342. switch ($sort) {
  41343. case SortableIterator::SORT_BY_NAME:
  41344. $command->ins('sort')->add('| sort');
  41345. return;
  41346. case SortableIterator::SORT_BY_TYPE:
  41347. $format = '%y';
  41348. break;
  41349. case SortableIterator::SORT_BY_ACCESSED_TIME:
  41350. $format = '%A@';
  41351. break;
  41352. case SortableIterator::SORT_BY_CHANGED_TIME:
  41353. $format = '%C@';
  41354. break;
  41355. case SortableIterator::SORT_BY_MODIFIED_TIME:
  41356. $format = '%T@';
  41357. break;
  41358. default:
  41359. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  41360. }
  41361. $command
  41362. ->get('find')
  41363. ->add('-printf')
  41364. ->arg($format.' %h/%f\\n')
  41365. ->add('| sort | cut')
  41366. ->arg('-d ')
  41367. ->arg('-f2-')
  41368. ;
  41369. }
  41370. protected function canBeUsed()
  41371. {
  41372. return Shell::TYPE_UNIX === $this->shell->getType() && parent::canBeUsed();
  41373. }
  41374. protected function buildFindCommand(Command $command, $dir)
  41375. {
  41376. return parent::buildFindCommand($command, $dir)->add('-regextype posix-extended');
  41377. }
  41378. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  41379. {
  41380. foreach ($contains as $contain) {
  41381. $expr = Expression::create($contain);
  41382. $command
  41383. ->add('| xargs -I{} -r grep -I')
  41384. ->add($expr->isCaseSensitive() ? null : '-i')
  41385. ->add($not ? '-L' : '-l')
  41386. ->add('-Ee')->arg($expr->renderPattern())
  41387. ->add('{}')
  41388. ;
  41389. }
  41390. }
  41391. }
  41392. <?php
  41393. namespace Symfony\Component\Finder\Adapter;
  41394. @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);
  41395. use Symfony\Component\Finder\Iterator;
  41396. class PhpAdapter extends AbstractAdapter
  41397. {
  41398. public function searchInDirectory($dir)
  41399. {
  41400. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  41401. if ($this->followLinks) {
  41402. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  41403. }
  41404. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  41405. if ($this->exclude) {
  41406. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  41407. }
  41408. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  41409. if ($this->minDepth > 0 || $this->maxDepth < PHP_INT_MAX) {
  41410. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $this->minDepth, $this->maxDepth);
  41411. }
  41412. if ($this->mode) {
  41413. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  41414. }
  41415. if ($this->names || $this->notNames) {
  41416. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  41417. }
  41418. if ($this->contains || $this->notContains) {
  41419. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  41420. }
  41421. if ($this->sizes) {
  41422. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  41423. }
  41424. if ($this->dates) {
  41425. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  41426. }
  41427. if ($this->filters) {
  41428. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  41429. }
  41430. if ($this->paths || $this->notPaths) {
  41431. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  41432. }
  41433. if ($this->sort) {
  41434. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  41435. $iterator = $iteratorAggregate->getIterator();
  41436. }
  41437. return $iterator;
  41438. }
  41439. public function getName()
  41440. {
  41441. return 'php';
  41442. }
  41443. protected function canBeUsed()
  41444. {
  41445. return true;
  41446. }
  41447. }
  41448. <?php
  41449. namespace Symfony\Component\Finder\Comparator;
  41450. class Comparator
  41451. {
  41452. private $target;
  41453. private $operator = '==';
  41454. public function getTarget()
  41455. {
  41456. return $this->target;
  41457. }
  41458. public function setTarget($target)
  41459. {
  41460. $this->target = $target;
  41461. }
  41462. public function getOperator()
  41463. {
  41464. return $this->operator;
  41465. }
  41466. public function setOperator($operator)
  41467. {
  41468. if (!$operator) {
  41469. $operator = '==';
  41470. }
  41471. if (!\in_array($operator, array('>', '<', '>=', '<=', '==', '!='))) {
  41472. throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
  41473. }
  41474. $this->operator = $operator;
  41475. }
  41476. public function test($test)
  41477. {
  41478. switch ($this->operator) {
  41479. case '>':
  41480. return $test > $this->target;
  41481. case '>=':
  41482. return $test >= $this->target;
  41483. case '<':
  41484. return $test < $this->target;
  41485. case '<=':
  41486. return $test <= $this->target;
  41487. case '!=':
  41488. return $test != $this->target;
  41489. }
  41490. return $test == $this->target;
  41491. }
  41492. }
  41493. <?php
  41494. namespace Symfony\Component\Finder\Comparator;
  41495. class DateComparator extends Comparator
  41496. {
  41497. public function __construct($test)
  41498. {
  41499. if (!preg_match('#^\s*(==|!=|[<>]=?|after|since|before|until)?\s*(.+?)\s*$#i', $test, $matches)) {
  41500. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a date test.', $test));
  41501. }
  41502. try {
  41503. $date = new \DateTime($matches[2]);
  41504. $target = $date->format('U');
  41505. } catch (\Exception $e) {
  41506. throw new \InvalidArgumentException(sprintf('"%s" is not a valid date.', $matches[2]));
  41507. }
  41508. $operator = isset($matches[1]) ? $matches[1] : '==';
  41509. if ('since' === $operator || 'after' === $operator) {
  41510. $operator = '>';
  41511. }
  41512. if ('until' === $operator || 'before' === $operator) {
  41513. $operator = '<';
  41514. }
  41515. $this->setOperator($operator);
  41516. $this->setTarget($target);
  41517. }
  41518. }
  41519. <?php
  41520. namespace Symfony\Component\Finder\Comparator;
  41521. class NumberComparator extends Comparator
  41522. {
  41523. public function __construct($test)
  41524. {
  41525. if (!preg_match('#^\s*(==|!=|[<>]=?)?\s*([0-9\.]+)\s*([kmg]i?)?\s*$#i', $test, $matches)) {
  41526. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a number test.', $test));
  41527. }
  41528. $target = $matches[2];
  41529. if (!is_numeric($target)) {
  41530. throw new \InvalidArgumentException(sprintf('Invalid number "%s".', $target));
  41531. }
  41532. if (isset($matches[3])) {
  41533. switch (strtolower($matches[3])) {
  41534. case 'k':
  41535. $target *= 1000;
  41536. break;
  41537. case 'ki':
  41538. $target *= 1024;
  41539. break;
  41540. case 'm':
  41541. $target *= 1000000;
  41542. break;
  41543. case 'mi':
  41544. $target *= 1024 * 1024;
  41545. break;
  41546. case 'g':
  41547. $target *= 1000000000;
  41548. break;
  41549. case 'gi':
  41550. $target *= 1024 * 1024 * 1024;
  41551. break;
  41552. }
  41553. }
  41554. $this->setTarget($target);
  41555. $this->setOperator(isset($matches[1]) ? $matches[1] : '==');
  41556. }
  41557. }
  41558. <?php
  41559. namespace Symfony\Component\Finder\Exception;
  41560. class AccessDeniedException extends \UnexpectedValueException
  41561. {
  41562. }
  41563. <?php
  41564. namespace Symfony\Component\Finder\Exception;
  41565. @trigger_error('The '.__NAMESPACE__.'\AdapterFailureException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41566. use Symfony\Component\Finder\Adapter\AdapterInterface;
  41567. class AdapterFailureException extends \RuntimeException implements ExceptionInterface
  41568. {
  41569. private $adapter;
  41570. public function __construct(AdapterInterface $adapter, $message = null, \Exception $previous = null)
  41571. {
  41572. $this->adapter = $adapter;
  41573. parent::__construct($message ?: 'Search failed with "'.$adapter->getName().'" adapter.', $previous);
  41574. }
  41575. public function getAdapter()
  41576. {
  41577. return $this->adapter;
  41578. }
  41579. }
  41580. <?php
  41581. namespace Symfony\Component\Finder\Exception;
  41582. interface ExceptionInterface
  41583. {
  41584. public function getAdapter();
  41585. }
  41586. <?php
  41587. namespace Symfony\Component\Finder\Exception;
  41588. @trigger_error('The '.__NAMESPACE__.'\OperationNotPermitedException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41589. class OperationNotPermitedException extends AdapterFailureException
  41590. {
  41591. }
  41592. <?php
  41593. namespace Symfony\Component\Finder\Exception;
  41594. @trigger_error('The '.__NAMESPACE__.'\ShellCommandFailureException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41595. use Symfony\Component\Finder\Adapter\AdapterInterface;
  41596. use Symfony\Component\Finder\Shell\Command;
  41597. class ShellCommandFailureException extends AdapterFailureException
  41598. {
  41599. private $command;
  41600. public function __construct(AdapterInterface $adapter, Command $command, \Exception $previous = null)
  41601. {
  41602. $this->command = $command;
  41603. parent::__construct($adapter, 'Shell command failed: "'.$command->join().'".', $previous);
  41604. }
  41605. public function getCommand()
  41606. {
  41607. return $this->command;
  41608. }
  41609. }
  41610. <?php
  41611. namespace Symfony\Component\Finder\Expression;
  41612. @trigger_error('The '.__NAMESPACE__.'\Expression class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41613. class Expression implements ValueInterface
  41614. {
  41615. const TYPE_REGEX = 1;
  41616. const TYPE_GLOB = 2;
  41617. private $value;
  41618. public static function create($expr)
  41619. {
  41620. return new self($expr);
  41621. }
  41622. public function __construct($expr)
  41623. {
  41624. try {
  41625. $this->value = Regex::create($expr);
  41626. } catch (\InvalidArgumentException $e) {
  41627. $this->value = new Glob($expr);
  41628. }
  41629. }
  41630. public function __toString()
  41631. {
  41632. return $this->render();
  41633. }
  41634. public function render()
  41635. {
  41636. return $this->value->render();
  41637. }
  41638. public function renderPattern()
  41639. {
  41640. return $this->value->renderPattern();
  41641. }
  41642. public function isCaseSensitive()
  41643. {
  41644. return $this->value->isCaseSensitive();
  41645. }
  41646. public function getType()
  41647. {
  41648. return $this->value->getType();
  41649. }
  41650. public function prepend($expr)
  41651. {
  41652. $this->value->prepend($expr);
  41653. return $this;
  41654. }
  41655. public function append($expr)
  41656. {
  41657. $this->value->append($expr);
  41658. return $this;
  41659. }
  41660. public function isRegex()
  41661. {
  41662. return self::TYPE_REGEX === $this->value->getType();
  41663. }
  41664. public function isGlob()
  41665. {
  41666. return self::TYPE_GLOB === $this->value->getType();
  41667. }
  41668. public function getGlob()
  41669. {
  41670. if (self::TYPE_GLOB !== $this->value->getType()) {
  41671. throw new \LogicException('Regex can\'t be transformed to glob.');
  41672. }
  41673. return $this->value;
  41674. }
  41675. public function getRegex()
  41676. {
  41677. return self::TYPE_REGEX === $this->value->getType() ? $this->value : $this->value->toRegex();
  41678. }
  41679. }
  41680. <?php
  41681. namespace Symfony\Component\Finder\Expression;
  41682. @trigger_error('The '.__NAMESPACE__.'\Glob class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41683. use Symfony\Component\Finder\Glob as FinderGlob;
  41684. class Glob implements ValueInterface
  41685. {
  41686. private $pattern;
  41687. public function __construct($pattern)
  41688. {
  41689. $this->pattern = $pattern;
  41690. }
  41691. public function render()
  41692. {
  41693. return $this->pattern;
  41694. }
  41695. public function renderPattern()
  41696. {
  41697. return $this->pattern;
  41698. }
  41699. public function getType()
  41700. {
  41701. return Expression::TYPE_GLOB;
  41702. }
  41703. public function isCaseSensitive()
  41704. {
  41705. return true;
  41706. }
  41707. public function prepend($expr)
  41708. {
  41709. $this->pattern = $expr.$this->pattern;
  41710. return $this;
  41711. }
  41712. public function append($expr)
  41713. {
  41714. $this->pattern .= $expr;
  41715. return $this;
  41716. }
  41717. public function isExpandable()
  41718. {
  41719. return false !== strpos($this->pattern, '{')
  41720. && false !== strpos($this->pattern, '}');
  41721. }
  41722. public function toRegex($strictLeadingDot = true, $strictWildcardSlash = true)
  41723. {
  41724. $regex = FinderGlob::toRegex($this->pattern, $strictLeadingDot, $strictWildcardSlash, '');
  41725. return new Regex($regex);
  41726. }
  41727. }
  41728. <?php
  41729. namespace Symfony\Component\Finder\Expression;
  41730. @trigger_error('The '.__NAMESPACE__.'\Regex class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41731. class Regex implements ValueInterface
  41732. {
  41733. const START_FLAG = '^';
  41734. const END_FLAG = '$';
  41735. const BOUNDARY = '~';
  41736. const JOKER = '.*';
  41737. const ESCAPING = '\\';
  41738. private $pattern;
  41739. private $options;
  41740. private $startFlag;
  41741. private $endFlag;
  41742. private $startJoker;
  41743. private $endJoker;
  41744. public static function create($expr)
  41745. {
  41746. if (preg_match('/^(.{3,}?)([imsxuADU]*)$/', $expr, $m)) {
  41747. $start = substr($m[1], 0, 1);
  41748. $end = substr($m[1], -1);
  41749. if (
  41750. ($start === $end && !preg_match('/[*?[:alnum:] \\\\]/', $start))
  41751. || ('{' === $start && '}' === $end)
  41752. || ('(' === $start && ')' === $end)
  41753. ) {
  41754. return new self(substr($m[1], 1, -1), $m[2], $end);
  41755. }
  41756. }
  41757. throw new \InvalidArgumentException('Given expression is not a regex.');
  41758. }
  41759. public function __construct($pattern, $options = '', $delimiter = null)
  41760. {
  41761. if (null !== $delimiter) {
  41762. $pattern = str_replace('\\'.$delimiter, $delimiter, $pattern);
  41763. }
  41764. $this->parsePattern($pattern);
  41765. $this->options = $options;
  41766. }
  41767. public function __toString()
  41768. {
  41769. return $this->render();
  41770. }
  41771. public function render()
  41772. {
  41773. return self::BOUNDARY
  41774. .$this->renderPattern()
  41775. .self::BOUNDARY
  41776. .$this->options;
  41777. }
  41778. public function renderPattern()
  41779. {
  41780. return ($this->startFlag ? self::START_FLAG : '')
  41781. .($this->startJoker ? self::JOKER : '')
  41782. .str_replace(self::BOUNDARY, '\\'.self::BOUNDARY, $this->pattern)
  41783. .($this->endJoker ? self::JOKER : '')
  41784. .($this->endFlag ? self::END_FLAG : '');
  41785. }
  41786. public function isCaseSensitive()
  41787. {
  41788. return !$this->hasOption('i');
  41789. }
  41790. public function getType()
  41791. {
  41792. return Expression::TYPE_REGEX;
  41793. }
  41794. public function prepend($expr)
  41795. {
  41796. $this->pattern = $expr.$this->pattern;
  41797. return $this;
  41798. }
  41799. public function append($expr)
  41800. {
  41801. $this->pattern .= $expr;
  41802. return $this;
  41803. }
  41804. public function hasOption($option)
  41805. {
  41806. return false !== strpos($this->options, $option);
  41807. }
  41808. public function addOption($option)
  41809. {
  41810. if (!$this->hasOption($option)) {
  41811. $this->options .= $option;
  41812. }
  41813. return $this;
  41814. }
  41815. public function removeOption($option)
  41816. {
  41817. $this->options = str_replace($option, '', $this->options);
  41818. return $this;
  41819. }
  41820. public function setStartFlag($startFlag)
  41821. {
  41822. $this->startFlag = $startFlag;
  41823. return $this;
  41824. }
  41825. public function hasStartFlag()
  41826. {
  41827. return $this->startFlag;
  41828. }
  41829. public function setEndFlag($endFlag)
  41830. {
  41831. $this->endFlag = (bool) $endFlag;
  41832. return $this;
  41833. }
  41834. public function hasEndFlag()
  41835. {
  41836. return $this->endFlag;
  41837. }
  41838. public function setStartJoker($startJoker)
  41839. {
  41840. $this->startJoker = $startJoker;
  41841. return $this;
  41842. }
  41843. public function hasStartJoker()
  41844. {
  41845. return $this->startJoker;
  41846. }
  41847. public function setEndJoker($endJoker)
  41848. {
  41849. $this->endJoker = (bool) $endJoker;
  41850. return $this;
  41851. }
  41852. public function hasEndJoker()
  41853. {
  41854. return $this->endJoker;
  41855. }
  41856. public function replaceJokers($replacement)
  41857. {
  41858. $replace = function ($subject) use ($replacement) {
  41859. $subject = $subject[0];
  41860. $replace = 0 === substr_count($subject, '\\') % 2;
  41861. return $replace ? str_replace('.', $replacement, $subject) : $subject;
  41862. };
  41863. $this->pattern = preg_replace_callback('~[\\\\]*\\.~', $replace, $this->pattern);
  41864. return $this;
  41865. }
  41866. private function parsePattern($pattern)
  41867. {
  41868. if ($this->startFlag = self::START_FLAG === substr($pattern, 0, 1)) {
  41869. $pattern = substr($pattern, 1);
  41870. }
  41871. if ($this->startJoker = self::JOKER === substr($pattern, 0, 2)) {
  41872. $pattern = substr($pattern, 2);
  41873. }
  41874. if ($this->endFlag = (self::END_FLAG === substr($pattern, -1) && self::ESCAPING !== substr($pattern, -2, -1))) {
  41875. $pattern = substr($pattern, 0, -1);
  41876. }
  41877. if ($this->endJoker = (self::JOKER === substr($pattern, -2) && self::ESCAPING !== substr($pattern, -3, -2))) {
  41878. $pattern = substr($pattern, 0, -2);
  41879. }
  41880. $this->pattern = $pattern;
  41881. }
  41882. }
  41883. <?php
  41884. namespace Symfony\Component\Finder\Expression;
  41885. @trigger_error('The '.__NAMESPACE__.'\ValueInterface interface is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41886. interface ValueInterface
  41887. {
  41888. public function render();
  41889. public function renderPattern();
  41890. public function isCaseSensitive();
  41891. public function getType();
  41892. public function prepend($expr);
  41893. public function append($expr);
  41894. }
  41895. <?php
  41896. namespace Symfony\Component\Finder;
  41897. use Symfony\Component\Finder\Adapter\AdapterInterface;
  41898. use Symfony\Component\Finder\Adapter\BsdFindAdapter;
  41899. use Symfony\Component\Finder\Adapter\GnuFindAdapter;
  41900. use Symfony\Component\Finder\Adapter\PhpAdapter;
  41901. use Symfony\Component\Finder\Comparator\DateComparator;
  41902. use Symfony\Component\Finder\Comparator\NumberComparator;
  41903. use Symfony\Component\Finder\Exception\ExceptionInterface;
  41904. use Symfony\Component\Finder\Iterator\CustomFilterIterator;
  41905. use Symfony\Component\Finder\Iterator\DateRangeFilterIterator;
  41906. use Symfony\Component\Finder\Iterator\DepthRangeFilterIterator;
  41907. use Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator;
  41908. use Symfony\Component\Finder\Iterator\FilecontentFilterIterator;
  41909. use Symfony\Component\Finder\Iterator\FilenameFilterIterator;
  41910. use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator;
  41911. use Symfony\Component\Finder\Iterator\SortableIterator;
  41912. class Finder implements \IteratorAggregate, \Countable
  41913. {
  41914. const IGNORE_VCS_FILES = 1;
  41915. const IGNORE_DOT_FILES = 2;
  41916. private $mode = 0;
  41917. private $names = array();
  41918. private $notNames = array();
  41919. private $exclude = array();
  41920. private $filters = array();
  41921. private $depths = array();
  41922. private $sizes = array();
  41923. private $followLinks = false;
  41924. private $sort = false;
  41925. private $ignore = 0;
  41926. private $dirs = array();
  41927. private $dates = array();
  41928. private $iterators = array();
  41929. private $contains = array();
  41930. private $notContains = array();
  41931. private $adapters = null;
  41932. private $paths = array();
  41933. private $notPaths = array();
  41934. private $ignoreUnreadableDirs = false;
  41935. private static $vcsPatterns = array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg');
  41936. public function __construct()
  41937. {
  41938. $this->ignore = static::IGNORE_VCS_FILES | static::IGNORE_DOT_FILES;
  41939. }
  41940. public static function create()
  41941. {
  41942. return new static();
  41943. }
  41944. public function addAdapter(AdapterInterface $adapter, $priority = 0)
  41945. {
  41946. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41947. $this->initDefaultAdapters();
  41948. $this->adapters[$adapter->getName()] = array(
  41949. 'adapter' => $adapter,
  41950. 'priority' => $priority,
  41951. 'selected' => false,
  41952. );
  41953. return $this->sortAdapters();
  41954. }
  41955. public function useBestAdapter()
  41956. {
  41957. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41958. $this->initDefaultAdapters();
  41959. $this->resetAdapterSelection();
  41960. return $this->sortAdapters();
  41961. }
  41962. public function setAdapter($name)
  41963. {
  41964. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41965. $this->initDefaultAdapters();
  41966. if (!isset($this->adapters[$name])) {
  41967. throw new \InvalidArgumentException(sprintf('Adapter "%s" does not exist.', $name));
  41968. }
  41969. $this->resetAdapterSelection();
  41970. $this->adapters[$name]['selected'] = true;
  41971. return $this->sortAdapters();
  41972. }
  41973. public function removeAdapters()
  41974. {
  41975. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41976. $this->adapters = array();
  41977. return $this;
  41978. }
  41979. public function getAdapters()
  41980. {
  41981. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41982. $this->initDefaultAdapters();
  41983. return array_values(array_map(function (array $adapter) {
  41984. return $adapter['adapter'];
  41985. }, $this->adapters));
  41986. }
  41987. public function directories()
  41988. {
  41989. $this->mode = Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES;
  41990. return $this;
  41991. }
  41992. public function files()
  41993. {
  41994. $this->mode = Iterator\FileTypeFilterIterator::ONLY_FILES;
  41995. return $this;
  41996. }
  41997. public function depth($level)
  41998. {
  41999. $this->depths[] = new Comparator\NumberComparator($level);
  42000. return $this;
  42001. }
  42002. public function date($date)
  42003. {
  42004. $this->dates[] = new Comparator\DateComparator($date);
  42005. return $this;
  42006. }
  42007. public function name($pattern)
  42008. {
  42009. $this->names[] = $pattern;
  42010. return $this;
  42011. }
  42012. public function notName($pattern)
  42013. {
  42014. $this->notNames[] = $pattern;
  42015. return $this;
  42016. }
  42017. public function contains($pattern)
  42018. {
  42019. $this->contains[] = $pattern;
  42020. return $this;
  42021. }
  42022. public function notContains($pattern)
  42023. {
  42024. $this->notContains[] = $pattern;
  42025. return $this;
  42026. }
  42027. public function path($pattern)
  42028. {
  42029. $this->paths[] = $pattern;
  42030. return $this;
  42031. }
  42032. public function notPath($pattern)
  42033. {
  42034. $this->notPaths[] = $pattern;
  42035. return $this;
  42036. }
  42037. public function size($size)
  42038. {
  42039. $this->sizes[] = new Comparator\NumberComparator($size);
  42040. return $this;
  42041. }
  42042. public function exclude($dirs)
  42043. {
  42044. $this->exclude = array_merge($this->exclude, (array) $dirs);
  42045. return $this;
  42046. }
  42047. public function ignoreDotFiles($ignoreDotFiles)
  42048. {
  42049. if ($ignoreDotFiles) {
  42050. $this->ignore |= static::IGNORE_DOT_FILES;
  42051. } else {
  42052. $this->ignore &= ~static::IGNORE_DOT_FILES;
  42053. }
  42054. return $this;
  42055. }
  42056. public function ignoreVCS($ignoreVCS)
  42057. {
  42058. if ($ignoreVCS) {
  42059. $this->ignore |= static::IGNORE_VCS_FILES;
  42060. } else {
  42061. $this->ignore &= ~static::IGNORE_VCS_FILES;
  42062. }
  42063. return $this;
  42064. }
  42065. public static function addVCSPattern($pattern)
  42066. {
  42067. foreach ((array) $pattern as $p) {
  42068. self::$vcsPatterns[] = $p;
  42069. }
  42070. self::$vcsPatterns = array_unique(self::$vcsPatterns);
  42071. }
  42072. public function sort(\Closure $closure)
  42073. {
  42074. $this->sort = $closure;
  42075. return $this;
  42076. }
  42077. public function sortByName()
  42078. {
  42079. $this->sort = Iterator\SortableIterator::SORT_BY_NAME;
  42080. return $this;
  42081. }
  42082. public function sortByType()
  42083. {
  42084. $this->sort = Iterator\SortableIterator::SORT_BY_TYPE;
  42085. return $this;
  42086. }
  42087. public function sortByAccessedTime()
  42088. {
  42089. $this->sort = Iterator\SortableIterator::SORT_BY_ACCESSED_TIME;
  42090. return $this;
  42091. }
  42092. public function sortByChangedTime()
  42093. {
  42094. $this->sort = Iterator\SortableIterator::SORT_BY_CHANGED_TIME;
  42095. return $this;
  42096. }
  42097. public function sortByModifiedTime()
  42098. {
  42099. $this->sort = Iterator\SortableIterator::SORT_BY_MODIFIED_TIME;
  42100. return $this;
  42101. }
  42102. public function filter(\Closure $closure)
  42103. {
  42104. $this->filters[] = $closure;
  42105. return $this;
  42106. }
  42107. public function followLinks()
  42108. {
  42109. $this->followLinks = true;
  42110. return $this;
  42111. }
  42112. public function ignoreUnreadableDirs($ignore = true)
  42113. {
  42114. $this->ignoreUnreadableDirs = (bool) $ignore;
  42115. return $this;
  42116. }
  42117. public function in($dirs)
  42118. {
  42119. $resolvedDirs = array();
  42120. foreach ((array) $dirs as $dir) {
  42121. if (is_dir($dir)) {
  42122. $resolvedDirs[] = $this->normalizeDir($dir);
  42123. } elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
  42124. $resolvedDirs = array_merge($resolvedDirs, array_map(array($this, 'normalizeDir'), $glob));
  42125. } else {
  42126. throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir));
  42127. }
  42128. }
  42129. $this->dirs = array_merge($this->dirs, $resolvedDirs);
  42130. return $this;
  42131. }
  42132. public function getIterator()
  42133. {
  42134. if (0 === \count($this->dirs) && 0 === \count($this->iterators)) {
  42135. throw new \LogicException('You must call one of in() or append() methods before iterating over a Finder.');
  42136. }
  42137. if (1 === \count($this->dirs) && 0 === \count($this->iterators)) {
  42138. return $this->searchInDirectory($this->dirs[0]);
  42139. }
  42140. $iterator = new \AppendIterator();
  42141. foreach ($this->dirs as $dir) {
  42142. $iterator->append($this->searchInDirectory($dir));
  42143. }
  42144. foreach ($this->iterators as $it) {
  42145. $iterator->append($it);
  42146. }
  42147. return $iterator;
  42148. }
  42149. public function append($iterator)
  42150. {
  42151. if ($iterator instanceof \IteratorAggregate) {
  42152. $this->iterators[] = $iterator->getIterator();
  42153. } elseif ($iterator instanceof \Iterator) {
  42154. $this->iterators[] = $iterator;
  42155. } elseif ($iterator instanceof \Traversable || \is_array($iterator)) {
  42156. $it = new \ArrayIterator();
  42157. foreach ($iterator as $file) {
  42158. $it->append($file instanceof \SplFileInfo ? $file : new \SplFileInfo($file));
  42159. }
  42160. $this->iterators[] = $it;
  42161. } else {
  42162. throw new \InvalidArgumentException('Finder::append() method wrong argument type.');
  42163. }
  42164. return $this;
  42165. }
  42166. public function count()
  42167. {
  42168. return iterator_count($this->getIterator());
  42169. }
  42170. private function sortAdapters()
  42171. {
  42172. uasort($this->adapters, function (array $a, array $b) {
  42173. if ($a['selected'] || $b['selected']) {
  42174. return $a['selected'] ? -1 : 1;
  42175. }
  42176. return $a['priority'] > $b['priority'] ? -1 : 1;
  42177. });
  42178. return $this;
  42179. }
  42180. private function searchInDirectory($dir)
  42181. {
  42182. if (static::IGNORE_VCS_FILES === (static::IGNORE_VCS_FILES & $this->ignore)) {
  42183. $this->exclude = array_merge($this->exclude, self::$vcsPatterns);
  42184. }
  42185. if (static::IGNORE_DOT_FILES === (static::IGNORE_DOT_FILES & $this->ignore)) {
  42186. $this->notPaths[] = '#(^|/)\..+(/|$)#';
  42187. }
  42188. if ($this->adapters) {
  42189. foreach ($this->adapters as $adapter) {
  42190. if ($adapter['adapter']->isSupported()) {
  42191. try {
  42192. return $this
  42193. ->buildAdapter($adapter['adapter'])
  42194. ->searchInDirectory($dir);
  42195. } catch (ExceptionInterface $e) {
  42196. }
  42197. }
  42198. }
  42199. }
  42200. $minDepth = 0;
  42201. $maxDepth = PHP_INT_MAX;
  42202. foreach ($this->depths as $comparator) {
  42203. switch ($comparator->getOperator()) {
  42204. case '>':
  42205. $minDepth = $comparator->getTarget() + 1;
  42206. break;
  42207. case '>=':
  42208. $minDepth = $comparator->getTarget();
  42209. break;
  42210. case '<':
  42211. $maxDepth = $comparator->getTarget() - 1;
  42212. break;
  42213. case '<=':
  42214. $maxDepth = $comparator->getTarget();
  42215. break;
  42216. default:
  42217. $minDepth = $maxDepth = $comparator->getTarget();
  42218. }
  42219. }
  42220. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  42221. if ($this->followLinks) {
  42222. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  42223. }
  42224. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  42225. if ($this->exclude) {
  42226. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  42227. }
  42228. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  42229. if ($minDepth > 0 || $maxDepth < PHP_INT_MAX) {
  42230. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $minDepth, $maxDepth);
  42231. }
  42232. if ($this->mode) {
  42233. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  42234. }
  42235. if ($this->names || $this->notNames) {
  42236. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  42237. }
  42238. if ($this->contains || $this->notContains) {
  42239. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  42240. }
  42241. if ($this->sizes) {
  42242. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  42243. }
  42244. if ($this->dates) {
  42245. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  42246. }
  42247. if ($this->filters) {
  42248. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  42249. }
  42250. if ($this->paths || $this->notPaths) {
  42251. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  42252. }
  42253. if ($this->sort) {
  42254. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  42255. $iterator = $iteratorAggregate->getIterator();
  42256. }
  42257. return $iterator;
  42258. }
  42259. private function buildAdapter(AdapterInterface $adapter)
  42260. {
  42261. return $adapter
  42262. ->setFollowLinks($this->followLinks)
  42263. ->setDepths($this->depths)
  42264. ->setMode($this->mode)
  42265. ->setExclude($this->exclude)
  42266. ->setNames($this->names)
  42267. ->setNotNames($this->notNames)
  42268. ->setContains($this->contains)
  42269. ->setNotContains($this->notContains)
  42270. ->setSizes($this->sizes)
  42271. ->setDates($this->dates)
  42272. ->setFilters($this->filters)
  42273. ->setSort($this->sort)
  42274. ->setPath($this->paths)
  42275. ->setNotPath($this->notPaths)
  42276. ->ignoreUnreadableDirs($this->ignoreUnreadableDirs);
  42277. }
  42278. private function resetAdapterSelection()
  42279. {
  42280. $this->adapters = array_map(function (array $properties) {
  42281. $properties['selected'] = false;
  42282. return $properties;
  42283. }, $this->adapters);
  42284. }
  42285. private function initDefaultAdapters()
  42286. {
  42287. if (null === $this->adapters) {
  42288. $this->adapters = array();
  42289. $this
  42290. ->addAdapter(new GnuFindAdapter())
  42291. ->addAdapter(new BsdFindAdapter())
  42292. ->addAdapter(new PhpAdapter(), -50)
  42293. ->setAdapter('php')
  42294. ;
  42295. }
  42296. }
  42297. private function normalizeDir($dir)
  42298. {
  42299. return rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
  42300. }
  42301. }
  42302. <?php
  42303. namespace Symfony\Component\Finder;
  42304. class Glob
  42305. {
  42306. public static function toRegex($glob, $strictLeadingDot = true, $strictWildcardSlash = true, $delimiter = '#')
  42307. {
  42308. $firstByte = true;
  42309. $escaping = false;
  42310. $inCurlies = 0;
  42311. $regex = '';
  42312. $sizeGlob = \strlen($glob);
  42313. for ($i = 0; $i < $sizeGlob; ++$i) {
  42314. $car = $glob[$i];
  42315. if ($firstByte) {
  42316. if ($strictLeadingDot && '.' !== $car) {
  42317. $regex .= '(?=[^\.])';
  42318. }
  42319. $firstByte = false;
  42320. }
  42321. if ('/' === $car) {
  42322. $firstByte = true;
  42323. }
  42324. if ($delimiter === $car || '.' === $car || '(' === $car || ')' === $car || '|' === $car || '+' === $car || '^' === $car || '$' === $car) {
  42325. $regex .= "\\$car";
  42326. } elseif ('*' === $car) {
  42327. $regex .= $escaping ? '\\*' : ($strictWildcardSlash ? '[^/]*' : '.*');
  42328. } elseif ('?' === $car) {
  42329. $regex .= $escaping ? '\\?' : ($strictWildcardSlash ? '[^/]' : '.');
  42330. } elseif ('{' === $car) {
  42331. $regex .= $escaping ? '\\{' : '(';
  42332. if (!$escaping) {
  42333. ++$inCurlies;
  42334. }
  42335. } elseif ('}' === $car && $inCurlies) {
  42336. $regex .= $escaping ? '}' : ')';
  42337. if (!$escaping) {
  42338. --$inCurlies;
  42339. }
  42340. } elseif (',' === $car && $inCurlies) {
  42341. $regex .= $escaping ? ',' : '|';
  42342. } elseif ('\\' === $car) {
  42343. if ($escaping) {
  42344. $regex .= '\\\\';
  42345. $escaping = false;
  42346. } else {
  42347. $escaping = true;
  42348. }
  42349. continue;
  42350. } else {
  42351. $regex .= $car;
  42352. }
  42353. $escaping = false;
  42354. }
  42355. return $delimiter.'^'.$regex.'$'.$delimiter;
  42356. }
  42357. }
  42358. <?php
  42359. namespace Symfony\Component\Finder\Iterator;
  42360. class CustomFilterIterator extends FilterIterator
  42361. {
  42362. private $filters = array();
  42363. public function __construct(\Iterator $iterator, array $filters)
  42364. {
  42365. foreach ($filters as $filter) {
  42366. if (!\is_callable($filter)) {
  42367. throw new \InvalidArgumentException('Invalid PHP callback.');
  42368. }
  42369. }
  42370. $this->filters = $filters;
  42371. parent::__construct($iterator);
  42372. }
  42373. public function accept()
  42374. {
  42375. $fileinfo = $this->current();
  42376. foreach ($this->filters as $filter) {
  42377. if (false === \call_user_func($filter, $fileinfo)) {
  42378. return false;
  42379. }
  42380. }
  42381. return true;
  42382. }
  42383. }
  42384. <?php
  42385. namespace Symfony\Component\Finder\Iterator;
  42386. use Symfony\Component\Finder\Comparator\DateComparator;
  42387. class DateRangeFilterIterator extends FilterIterator
  42388. {
  42389. private $comparators = array();
  42390. public function __construct(\Iterator $iterator, array $comparators)
  42391. {
  42392. $this->comparators = $comparators;
  42393. parent::__construct($iterator);
  42394. }
  42395. public function accept()
  42396. {
  42397. $fileinfo = $this->current();
  42398. if (!file_exists($fileinfo->getPathname())) {
  42399. return false;
  42400. }
  42401. $filedate = $fileinfo->getMTime();
  42402. foreach ($this->comparators as $compare) {
  42403. if (!$compare->test($filedate)) {
  42404. return false;
  42405. }
  42406. }
  42407. return true;
  42408. }
  42409. }
  42410. <?php
  42411. namespace Symfony\Component\Finder\Iterator;
  42412. class DepthRangeFilterIterator extends FilterIterator
  42413. {
  42414. private $minDepth = 0;
  42415. public function __construct(\RecursiveIteratorIterator $iterator, $minDepth = 0, $maxDepth = PHP_INT_MAX)
  42416. {
  42417. $this->minDepth = $minDepth;
  42418. $iterator->setMaxDepth(PHP_INT_MAX === $maxDepth ? -1 : $maxDepth);
  42419. parent::__construct($iterator);
  42420. }
  42421. public function accept()
  42422. {
  42423. return $this->getInnerIterator()->getDepth() >= $this->minDepth;
  42424. }
  42425. }
  42426. <?php
  42427. namespace Symfony\Component\Finder\Iterator;
  42428. class ExcludeDirectoryFilterIterator extends FilterIterator implements \RecursiveIterator
  42429. {
  42430. private $iterator;
  42431. private $isRecursive;
  42432. private $excludedDirs = array();
  42433. private $excludedPattern;
  42434. public function __construct(\Iterator $iterator, array $directories)
  42435. {
  42436. $this->iterator = $iterator;
  42437. $this->isRecursive = $iterator instanceof \RecursiveIterator;
  42438. $patterns = array();
  42439. foreach ($directories as $directory) {
  42440. $directory = rtrim($directory, '/');
  42441. if (!$this->isRecursive || false !== strpos($directory, '/')) {
  42442. $patterns[] = preg_quote($directory, '#');
  42443. } else {
  42444. $this->excludedDirs[$directory] = true;
  42445. }
  42446. }
  42447. if ($patterns) {
  42448. $this->excludedPattern = '#(?:^|/)(?:'.implode('|', $patterns).')(?:/|$)#';
  42449. }
  42450. parent::__construct($iterator);
  42451. }
  42452. public function accept()
  42453. {
  42454. if ($this->isRecursive && isset($this->excludedDirs[$this->getFilename()]) && $this->isDir()) {
  42455. return false;
  42456. }
  42457. if ($this->excludedPattern) {
  42458. $path = $this->isDir() ? $this->current()->getRelativePathname() : $this->current()->getRelativePath();
  42459. $path = str_replace('\\', '/', $path);
  42460. return !preg_match($this->excludedPattern, $path);
  42461. }
  42462. return true;
  42463. }
  42464. public function hasChildren()
  42465. {
  42466. return $this->isRecursive && $this->iterator->hasChildren();
  42467. }
  42468. public function getChildren()
  42469. {
  42470. $children = new self($this->iterator->getChildren(), array());
  42471. $children->excludedDirs = $this->excludedDirs;
  42472. $children->excludedPattern = $this->excludedPattern;
  42473. return $children;
  42474. }
  42475. }
  42476. <?php
  42477. namespace Symfony\Component\Finder\Iterator;
  42478. @trigger_error('The '.__NAMESPACE__.'\FilePathsIterator class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42479. use Symfony\Component\Finder\SplFileInfo;
  42480. class FilePathsIterator extends \ArrayIterator
  42481. {
  42482. private $baseDir;
  42483. private $baseDirLength;
  42484. private $subPath;
  42485. private $subPathname;
  42486. private $current;
  42487. public function __construct(array $paths, $baseDir)
  42488. {
  42489. $this->baseDir = $baseDir;
  42490. $this->baseDirLength = \strlen($baseDir);
  42491. parent::__construct($paths);
  42492. }
  42493. public function __call($name, array $arguments)
  42494. {
  42495. return \call_user_func_array(array($this->current(), $name), $arguments);
  42496. }
  42497. public function current()
  42498. {
  42499. return $this->current;
  42500. }
  42501. public function key()
  42502. {
  42503. return $this->current->getPathname();
  42504. }
  42505. public function next()
  42506. {
  42507. parent::next();
  42508. $this->buildProperties();
  42509. }
  42510. public function rewind()
  42511. {
  42512. parent::rewind();
  42513. $this->buildProperties();
  42514. }
  42515. public function getSubPath()
  42516. {
  42517. return $this->subPath;
  42518. }
  42519. public function getSubPathname()
  42520. {
  42521. return $this->subPathname;
  42522. }
  42523. private function buildProperties()
  42524. {
  42525. $absolutePath = parent::current();
  42526. if ($this->baseDir === substr($absolutePath, 0, $this->baseDirLength)) {
  42527. $this->subPathname = ltrim(substr($absolutePath, $this->baseDirLength), '/\\');
  42528. $dir = \dirname($this->subPathname);
  42529. $this->subPath = '.' === $dir ? '' : $dir;
  42530. } else {
  42531. $this->subPath = $this->subPathname = '';
  42532. }
  42533. $this->current = new SplFileInfo(parent::current(), $this->subPath, $this->subPathname);
  42534. }
  42535. }
  42536. <?php
  42537. namespace Symfony\Component\Finder\Iterator;
  42538. class FileTypeFilterIterator extends FilterIterator
  42539. {
  42540. const ONLY_FILES = 1;
  42541. const ONLY_DIRECTORIES = 2;
  42542. private $mode;
  42543. public function __construct(\Iterator $iterator, $mode)
  42544. {
  42545. $this->mode = $mode;
  42546. parent::__construct($iterator);
  42547. }
  42548. public function accept()
  42549. {
  42550. $fileinfo = $this->current();
  42551. if (self::ONLY_DIRECTORIES === (self::ONLY_DIRECTORIES & $this->mode) && $fileinfo->isFile()) {
  42552. return false;
  42553. } elseif (self::ONLY_FILES === (self::ONLY_FILES & $this->mode) && $fileinfo->isDir()) {
  42554. return false;
  42555. }
  42556. return true;
  42557. }
  42558. }
  42559. <?php
  42560. namespace Symfony\Component\Finder\Iterator;
  42561. class FilecontentFilterIterator extends MultiplePcreFilterIterator
  42562. {
  42563. public function accept()
  42564. {
  42565. if (!$this->matchRegexps && !$this->noMatchRegexps) {
  42566. return true;
  42567. }
  42568. $fileinfo = $this->current();
  42569. if ($fileinfo->isDir() || !$fileinfo->isReadable()) {
  42570. return false;
  42571. }
  42572. $content = $fileinfo->getContents();
  42573. if (!$content) {
  42574. return false;
  42575. }
  42576. return $this->isAccepted($content);
  42577. }
  42578. protected function toRegex($str)
  42579. {
  42580. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  42581. }
  42582. }
  42583. <?php
  42584. namespace Symfony\Component\Finder\Iterator;
  42585. use Symfony\Component\Finder\Glob;
  42586. class FilenameFilterIterator extends MultiplePcreFilterIterator
  42587. {
  42588. public function accept()
  42589. {
  42590. return $this->isAccepted($this->current()->getFilename());
  42591. }
  42592. protected function toRegex($str)
  42593. {
  42594. return $this->isRegex($str) ? $str : Glob::toRegex($str);
  42595. }
  42596. }
  42597. <?php
  42598. namespace Symfony\Component\Finder\Iterator;
  42599. abstract class FilterIterator extends \FilterIterator
  42600. {
  42601. public function rewind()
  42602. {
  42603. if (\PHP_VERSION_ID > 50607 || (\PHP_VERSION_ID > 50523 && \PHP_VERSION_ID < 50600)) {
  42604. parent::rewind();
  42605. return;
  42606. }
  42607. $iterator = $this;
  42608. while ($iterator instanceof \OuterIterator) {
  42609. $innerIterator = $iterator->getInnerIterator();
  42610. if ($innerIterator instanceof RecursiveDirectoryIterator) {
  42611. if ($innerIterator->isRewindable()) {
  42612. $innerIterator->next();
  42613. $innerIterator->rewind();
  42614. }
  42615. } elseif ($innerIterator instanceof \FilesystemIterator) {
  42616. $innerIterator->next();
  42617. $innerIterator->rewind();
  42618. }
  42619. $iterator = $innerIterator;
  42620. }
  42621. parent::rewind();
  42622. }
  42623. }
  42624. <?php
  42625. namespace Symfony\Component\Finder\Iterator;
  42626. abstract class MultiplePcreFilterIterator extends FilterIterator
  42627. {
  42628. protected $matchRegexps = array();
  42629. protected $noMatchRegexps = array();
  42630. public function __construct(\Iterator $iterator, array $matchPatterns, array $noMatchPatterns)
  42631. {
  42632. foreach ($matchPatterns as $pattern) {
  42633. $this->matchRegexps[] = $this->toRegex($pattern);
  42634. }
  42635. foreach ($noMatchPatterns as $pattern) {
  42636. $this->noMatchRegexps[] = $this->toRegex($pattern);
  42637. }
  42638. parent::__construct($iterator);
  42639. }
  42640. protected function isAccepted($string)
  42641. {
  42642. foreach ($this->noMatchRegexps as $regex) {
  42643. if (preg_match($regex, $string)) {
  42644. return false;
  42645. }
  42646. }
  42647. if ($this->matchRegexps) {
  42648. foreach ($this->matchRegexps as $regex) {
  42649. if (preg_match($regex, $string)) {
  42650. return true;
  42651. }
  42652. }
  42653. return false;
  42654. }
  42655. return true;
  42656. }
  42657. protected function isRegex($str)
  42658. {
  42659. if (preg_match('/^(.{3,}?)[imsxuADU]*$/', $str, $m)) {
  42660. $start = substr($m[1], 0, 1);
  42661. $end = substr($m[1], -1);
  42662. if ($start === $end) {
  42663. return !preg_match('/[*?[:alnum:] \\\\]/', $start);
  42664. }
  42665. foreach (array(array('{', '}'), array('(', ')'), array('[', ']'), array('<', '>')) as $delimiters) {
  42666. if ($start === $delimiters[0] && $end === $delimiters[1]) {
  42667. return true;
  42668. }
  42669. }
  42670. }
  42671. return false;
  42672. }
  42673. abstract protected function toRegex($str);
  42674. }
  42675. <?php
  42676. namespace Symfony\Component\Finder\Iterator;
  42677. class PathFilterIterator extends MultiplePcreFilterIterator
  42678. {
  42679. public function accept()
  42680. {
  42681. $filename = $this->current()->getRelativePathname();
  42682. if ('\\' === \DIRECTORY_SEPARATOR) {
  42683. $filename = str_replace('\\', '/', $filename);
  42684. }
  42685. return $this->isAccepted($filename);
  42686. }
  42687. protected function toRegex($str)
  42688. {
  42689. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  42690. }
  42691. }
  42692. <?php
  42693. namespace Symfony\Component\Finder\Iterator;
  42694. use Symfony\Component\Finder\Exception\AccessDeniedException;
  42695. use Symfony\Component\Finder\SplFileInfo;
  42696. class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
  42697. {
  42698. private $ignoreUnreadableDirs;
  42699. private $rewindable;
  42700. private $rootPath;
  42701. private $subPath;
  42702. private $directorySeparator = '/';
  42703. public function __construct($path, $flags, $ignoreUnreadableDirs = false)
  42704. {
  42705. if ($flags & (self::CURRENT_AS_PATHNAME | self::CURRENT_AS_SELF)) {
  42706. throw new \RuntimeException('This iterator only support returning current as fileinfo.');
  42707. }
  42708. parent::__construct($path, $flags);
  42709. $this->ignoreUnreadableDirs = $ignoreUnreadableDirs;
  42710. $this->rootPath = (string) $path;
  42711. if ('/' !== \DIRECTORY_SEPARATOR && !($flags & self::UNIX_PATHS)) {
  42712. $this->directorySeparator = \DIRECTORY_SEPARATOR;
  42713. }
  42714. }
  42715. public function current()
  42716. {
  42717. if (null === $subPathname = $this->subPath) {
  42718. $subPathname = $this->subPath = (string) $this->getSubPath();
  42719. }
  42720. if ('' !== $subPathname) {
  42721. $subPathname .= $this->directorySeparator;
  42722. }
  42723. $subPathname .= $this->getFilename();
  42724. return new SplFileInfo($this->rootPath.$this->directorySeparator.$subPathname, $this->subPath, $subPathname);
  42725. }
  42726. public function getChildren()
  42727. {
  42728. try {
  42729. $children = parent::getChildren();
  42730. if ($children instanceof self) {
  42731. $children->ignoreUnreadableDirs = $this->ignoreUnreadableDirs;
  42732. $children->rewindable = &$this->rewindable;
  42733. $children->rootPath = $this->rootPath;
  42734. }
  42735. return $children;
  42736. } catch (\UnexpectedValueException $e) {
  42737. if ($this->ignoreUnreadableDirs) {
  42738. return new \RecursiveArrayIterator(array());
  42739. } else {
  42740. throw new AccessDeniedException($e->getMessage(), $e->getCode(), $e);
  42741. }
  42742. }
  42743. }
  42744. public function rewind()
  42745. {
  42746. if (false === $this->isRewindable()) {
  42747. return;
  42748. }
  42749. if (\PHP_VERSION_ID < 50523 || \PHP_VERSION_ID >= 50600 && \PHP_VERSION_ID < 50607) {
  42750. parent::next();
  42751. }
  42752. parent::rewind();
  42753. }
  42754. public function isRewindable()
  42755. {
  42756. if (null !== $this->rewindable) {
  42757. return $this->rewindable;
  42758. }
  42759. if ('' === $this->getPath()) {
  42760. return $this->rewindable = false;
  42761. }
  42762. if (false !== $stream = @opendir($this->getPath())) {
  42763. $infos = stream_get_meta_data($stream);
  42764. closedir($stream);
  42765. if ($infos['seekable']) {
  42766. return $this->rewindable = true;
  42767. }
  42768. }
  42769. return $this->rewindable = false;
  42770. }
  42771. }
  42772. <?php
  42773. namespace Symfony\Component\Finder\Iterator;
  42774. use Symfony\Component\Finder\Comparator\NumberComparator;
  42775. class SizeRangeFilterIterator extends FilterIterator
  42776. {
  42777. private $comparators = array();
  42778. public function __construct(\Iterator $iterator, array $comparators)
  42779. {
  42780. $this->comparators = $comparators;
  42781. parent::__construct($iterator);
  42782. }
  42783. public function accept()
  42784. {
  42785. $fileinfo = $this->current();
  42786. if (!$fileinfo->isFile()) {
  42787. return true;
  42788. }
  42789. $filesize = $fileinfo->getSize();
  42790. foreach ($this->comparators as $compare) {
  42791. if (!$compare->test($filesize)) {
  42792. return false;
  42793. }
  42794. }
  42795. return true;
  42796. }
  42797. }
  42798. <?php
  42799. namespace Symfony\Component\Finder\Iterator;
  42800. class SortableIterator implements \IteratorAggregate
  42801. {
  42802. const SORT_BY_NAME = 1;
  42803. const SORT_BY_TYPE = 2;
  42804. const SORT_BY_ACCESSED_TIME = 3;
  42805. const SORT_BY_CHANGED_TIME = 4;
  42806. const SORT_BY_MODIFIED_TIME = 5;
  42807. private $iterator;
  42808. private $sort;
  42809. public function __construct(\Traversable $iterator, $sort)
  42810. {
  42811. $this->iterator = $iterator;
  42812. if (self::SORT_BY_NAME === $sort) {
  42813. $this->sort = function ($a, $b) {
  42814. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  42815. };
  42816. } elseif (self::SORT_BY_TYPE === $sort) {
  42817. $this->sort = function ($a, $b) {
  42818. if ($a->isDir() && $b->isFile()) {
  42819. return -1;
  42820. } elseif ($a->isFile() && $b->isDir()) {
  42821. return 1;
  42822. }
  42823. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  42824. };
  42825. } elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
  42826. $this->sort = function ($a, $b) {
  42827. return $a->getATime() - $b->getATime();
  42828. };
  42829. } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
  42830. $this->sort = function ($a, $b) {
  42831. return $a->getCTime() - $b->getCTime();
  42832. };
  42833. } elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
  42834. $this->sort = function ($a, $b) {
  42835. return $a->getMTime() - $b->getMTime();
  42836. };
  42837. } elseif (\is_callable($sort)) {
  42838. $this->sort = $sort;
  42839. } else {
  42840. throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.');
  42841. }
  42842. }
  42843. public function getIterator()
  42844. {
  42845. $array = iterator_to_array($this->iterator, true);
  42846. uasort($array, $this->sort);
  42847. return new \ArrayIterator($array);
  42848. }
  42849. }
  42850. Copyright (c) 2004-2018 Fabien Potencier
  42851. Permission is hereby granted, free of charge, to any person obtaining a copy
  42852. of this software and associated documentation files (the "Software"), to deal
  42853. in the Software without restriction, including without limitation the rights
  42854. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  42855. copies of the Software, and to permit persons to whom the Software is furnished
  42856. to do so, subject to the following conditions:
  42857. The above copyright notice and this permission notice shall be included in all
  42858. copies or substantial portions of the Software.
  42859. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  42860. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  42861. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  42862. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  42863. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  42864. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  42865. THE SOFTWARE.
  42866. <?php
  42867. namespace Symfony\Component\Finder\Shell;
  42868. @trigger_error('The '.__NAMESPACE__.'\Command class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42869. class Command
  42870. {
  42871. private $parent;
  42872. private $bits = array();
  42873. private $labels = array();
  42874. private $errorHandler;
  42875. public function __construct(Command $parent = null)
  42876. {
  42877. $this->parent = $parent;
  42878. }
  42879. public function __toString()
  42880. {
  42881. return $this->join();
  42882. }
  42883. public static function create(Command $parent = null)
  42884. {
  42885. return new self($parent);
  42886. }
  42887. public static function escape($input)
  42888. {
  42889. return escapeshellcmd($input);
  42890. }
  42891. public static function quote($input)
  42892. {
  42893. return escapeshellarg($input);
  42894. }
  42895. public function add($bit)
  42896. {
  42897. $this->bits[] = $bit;
  42898. return $this;
  42899. }
  42900. public function top($bit)
  42901. {
  42902. array_unshift($this->bits, $bit);
  42903. foreach ($this->labels as $label => $index) {
  42904. ++$this->labels[$label];
  42905. }
  42906. return $this;
  42907. }
  42908. public function arg($arg)
  42909. {
  42910. $this->bits[] = self::quote($arg);
  42911. return $this;
  42912. }
  42913. public function cmd($esc)
  42914. {
  42915. $this->bits[] = self::escape($esc);
  42916. return $this;
  42917. }
  42918. public function ins($label)
  42919. {
  42920. if (isset($this->labels[$label])) {
  42921. throw new \RuntimeException(sprintf('Label "%s" already exists.', $label));
  42922. }
  42923. $this->bits[] = self::create($this);
  42924. $this->labels[$label] = \count($this->bits) - 1;
  42925. return $this->bits[$this->labels[$label]];
  42926. }
  42927. public function get($label)
  42928. {
  42929. if (!isset($this->labels[$label])) {
  42930. throw new \RuntimeException(sprintf('Label "%s" does not exist.', $label));
  42931. }
  42932. return $this->bits[$this->labels[$label]];
  42933. }
  42934. public function end()
  42935. {
  42936. if (null === $this->parent) {
  42937. throw new \RuntimeException('Calling end on root command doesn\'t make sense.');
  42938. }
  42939. return $this->parent;
  42940. }
  42941. public function length()
  42942. {
  42943. return \count($this->bits);
  42944. }
  42945. public function setErrorHandler(\Closure $errorHandler)
  42946. {
  42947. $this->errorHandler = $errorHandler;
  42948. return $this;
  42949. }
  42950. public function getErrorHandler()
  42951. {
  42952. return $this->errorHandler;
  42953. }
  42954. public function execute()
  42955. {
  42956. if (null === $errorHandler = $this->errorHandler) {
  42957. exec($this->join(), $output);
  42958. } else {
  42959. $process = proc_open($this->join(), array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w')), $pipes);
  42960. $output = preg_split('~(\r\n|\r|\n)~', stream_get_contents($pipes[1]), -1, PREG_SPLIT_NO_EMPTY);
  42961. if ($error = stream_get_contents($pipes[2])) {
  42962. $errorHandler($error);
  42963. }
  42964. proc_close($process);
  42965. }
  42966. return $output ?: array();
  42967. }
  42968. public function join()
  42969. {
  42970. return implode(' ', array_filter(
  42971. array_map(function ($bit) {
  42972. return $bit instanceof Command ? $bit->join() : ($bit ?: null);
  42973. }, $this->bits),
  42974. function ($bit) { return null !== $bit; }
  42975. ));
  42976. }
  42977. public function addAtIndex($bit, $index)
  42978. {
  42979. array_splice($this->bits, $index, 0, $bit instanceof self ? array($bit) : $bit);
  42980. return $this;
  42981. }
  42982. }
  42983. <?php
  42984. namespace Symfony\Component\Finder\Shell;
  42985. @trigger_error('The '.__NAMESPACE__.'\Shell class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42986. class Shell
  42987. {
  42988. const TYPE_UNIX = 1;
  42989. const TYPE_DARWIN = 2;
  42990. const TYPE_CYGWIN = 3;
  42991. const TYPE_WINDOWS = 4;
  42992. const TYPE_BSD = 5;
  42993. private $type;
  42994. public function getType()
  42995. {
  42996. if (null === $this->type) {
  42997. $this->type = $this->guessType();
  42998. }
  42999. return $this->type;
  43000. }
  43001. public function testCommand($command)
  43002. {
  43003. if (!\function_exists('exec')) {
  43004. return false;
  43005. }
  43006. $testCommand = 'which ';
  43007. if (self::TYPE_WINDOWS === $this->type) {
  43008. $testCommand = 'where ';
  43009. }
  43010. $command = escapeshellcmd($command);
  43011. exec($testCommand.$command, $output, $code);
  43012. return 0 === $code && \count($output) > 0;
  43013. }
  43014. private function guessType()
  43015. {
  43016. $os = strtolower(PHP_OS);
  43017. if (false !== strpos($os, 'cygwin')) {
  43018. return self::TYPE_CYGWIN;
  43019. }
  43020. if (false !== strpos($os, 'darwin')) {
  43021. return self::TYPE_DARWIN;
  43022. }
  43023. if (false !== strpos($os, 'bsd')) {
  43024. return self::TYPE_BSD;
  43025. }
  43026. if (0 === strpos($os, 'win')) {
  43027. return self::TYPE_WINDOWS;
  43028. }
  43029. return self::TYPE_UNIX;
  43030. }
  43031. }
  43032. <?php
  43033. namespace Symfony\Component\Finder;
  43034. class SplFileInfo extends \SplFileInfo
  43035. {
  43036. private $relativePath;
  43037. private $relativePathname;
  43038. public function __construct($file, $relativePath, $relativePathname)
  43039. {
  43040. parent::__construct($file);
  43041. $this->relativePath = $relativePath;
  43042. $this->relativePathname = $relativePathname;
  43043. }
  43044. public function getRelativePath()
  43045. {
  43046. return $this->relativePath;
  43047. }
  43048. public function getRelativePathname()
  43049. {
  43050. return $this->relativePathname;
  43051. }
  43052. public function getContents()
  43053. {
  43054. set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
  43055. $content = file_get_contents($this->getPathname());
  43056. restore_error_handler();
  43057. if (false === $content) {
  43058. throw new \RuntimeException($error);
  43059. }
  43060. return $content;
  43061. }
  43062. }
  43063. <?php
  43064. namespace Symfony\Polyfill\Ctype;
  43065. final class Ctype
  43066. {
  43067. public static function ctype_alnum($text)
  43068. {
  43069. $text = self::convert_int_to_char_for_ctype($text);
  43070. return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z0-9]/', $text);
  43071. }
  43072. public static function ctype_alpha($text)
  43073. {
  43074. $text = self::convert_int_to_char_for_ctype($text);
  43075. return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z]/', $text);
  43076. }
  43077. public static function ctype_cntrl($text)
  43078. {
  43079. $text = self::convert_int_to_char_for_ctype($text);
  43080. return \is_string($text) && '' !== $text && !preg_match('/[^\x00-\x1f\x7f]/', $text);
  43081. }
  43082. public static function ctype_digit($text)
  43083. {
  43084. $text = self::convert_int_to_char_for_ctype($text);
  43085. return \is_string($text) && '' !== $text && !preg_match('/[^0-9]/', $text);
  43086. }
  43087. public static function ctype_graph($text)
  43088. {
  43089. $text = self::convert_int_to_char_for_ctype($text);
  43090. return \is_string($text) && '' !== $text && !preg_match('/[^!-~]/', $text);
  43091. }
  43092. public static function ctype_lower($text)
  43093. {
  43094. $text = self::convert_int_to_char_for_ctype($text);
  43095. return \is_string($text) && '' !== $text && !preg_match('/[^a-z]/', $text);
  43096. }
  43097. public static function ctype_print($text)
  43098. {
  43099. $text = self::convert_int_to_char_for_ctype($text);
  43100. return \is_string($text) && '' !== $text && !preg_match('/[^ -~]/', $text);
  43101. }
  43102. public static function ctype_punct($text)
  43103. {
  43104. $text = self::convert_int_to_char_for_ctype($text);
  43105. return \is_string($text) && '' !== $text && !preg_match('/[^!-\/\:-@\[-`\{-~]/', $text);
  43106. }
  43107. public static function ctype_space($text)
  43108. {
  43109. $text = self::convert_int_to_char_for_ctype($text);
  43110. return \is_string($text) && '' !== $text && !preg_match('/[^\s]/', $text);
  43111. }
  43112. public static function ctype_upper($text)
  43113. {
  43114. $text = self::convert_int_to_char_for_ctype($text);
  43115. return \is_string($text) && '' !== $text && !preg_match('/[^A-Z]/', $text);
  43116. }
  43117. public static function ctype_xdigit($text)
  43118. {
  43119. $text = self::convert_int_to_char_for_ctype($text);
  43120. return \is_string($text) && '' !== $text && !preg_match('/[^A-Fa-f0-9]/', $text);
  43121. }
  43122. private static function convert_int_to_char_for_ctype($int)
  43123. {
  43124. if (!\is_int($int)) {
  43125. return $int;
  43126. }
  43127. if ($int < -128 || $int > 255) {
  43128. return (string) $int;
  43129. }
  43130. if ($int < 0) {
  43131. $int += 256;
  43132. }
  43133. return \chr($int);
  43134. }
  43135. }
  43136. Copyright (c) 2018-2019 Fabien Potencier
  43137. Permission is hereby granted, free of charge, to any person obtaining a copy
  43138. of this software and associated documentation files (the "Software"), to deal
  43139. in the Software without restriction, including without limitation the rights
  43140. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  43141. copies of the Software, and to permit persons to whom the Software is furnished
  43142. to do so, subject to the following conditions:
  43143. The above copyright notice and this permission notice shall be included in all
  43144. copies or substantial portions of the Software.
  43145. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  43146. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  43147. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  43148. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  43149. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  43150. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  43151. THE SOFTWARE.
  43152. <?php
  43153. use Symfony\Polyfill\Ctype as p;
  43154. if (!function_exists('ctype_alnum')) {
  43155. function ctype_alnum($text) { return p\Ctype::ctype_alnum($text); }
  43156. function ctype_alpha($text) { return p\Ctype::ctype_alpha($text); }
  43157. function ctype_cntrl($text) { return p\Ctype::ctype_cntrl($text); }
  43158. function ctype_digit($text) { return p\Ctype::ctype_digit($text); }
  43159. function ctype_graph($text) { return p\Ctype::ctype_graph($text); }
  43160. function ctype_lower($text) { return p\Ctype::ctype_lower($text); }
  43161. function ctype_print($text) { return p\Ctype::ctype_print($text); }
  43162. function ctype_punct($text) { return p\Ctype::ctype_punct($text); }
  43163. function ctype_space($text) { return p\Ctype::ctype_space($text); }
  43164. function ctype_upper($text) { return p\Ctype::ctype_upper($text); }
  43165. function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text); }
  43166. }
  43167. Copyright (c) 2015-2019 Fabien Potencier
  43168. Permission is hereby granted, free of charge, to any person obtaining a copy
  43169. of this software and associated documentation files (the "Software"), to deal
  43170. in the Software without restriction, including without limitation the rights
  43171. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  43172. copies of the Software, and to permit persons to whom the Software is furnished
  43173. to do so, subject to the following conditions:
  43174. The above copyright notice and this permission notice shall be included in all
  43175. copies or substantial portions of the Software.
  43176. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  43177. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  43178. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  43179. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  43180. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  43181. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  43182. THE SOFTWARE.
  43183. <?php
  43184. namespace Symfony\Polyfill\Mbstring;
  43185. final class Mbstring
  43186. {
  43187. const MB_CASE_FOLD = PHP_INT_MAX;
  43188. private static $encodingList = array('ASCII', 'UTF-8');
  43189. private static $language = 'neutral';
  43190. private static $internalEncoding = 'UTF-8';
  43191. private static $caseFold = array(
  43192. array('µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"),
  43193. array('μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', '�', 'ε', "\xE1\xB9\xA1", 'ι'),
  43194. );
  43195. public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null)
  43196. {
  43197. if (\is_array($fromEncoding) || false !== strpos($fromEncoding, ',')) {
  43198. $fromEncoding = self::mb_detect_encoding($s, $fromEncoding);
  43199. } else {
  43200. $fromEncoding = self::getEncoding($fromEncoding);
  43201. }
  43202. $toEncoding = self::getEncoding($toEncoding);
  43203. if ('BASE64' === $fromEncoding) {
  43204. $s = base64_decode($s);
  43205. $fromEncoding = $toEncoding;
  43206. }
  43207. if ('BASE64' === $toEncoding) {
  43208. return base64_encode($s);
  43209. }
  43210. if ('HTML-ENTITIES' === $toEncoding || 'HTML' === $toEncoding) {
  43211. if ('HTML-ENTITIES' === $fromEncoding || 'HTML' === $fromEncoding) {
  43212. $fromEncoding = 'Windows-1252';
  43213. }
  43214. if ('UTF-8' !== $fromEncoding) {
  43215. $s = iconv($fromEncoding, 'UTF-8//IGNORE', $s);
  43216. }
  43217. return preg_replace_callback('/[\x80-\xFF]+/', array(__CLASS__, 'html_encoding_callback'), $s);
  43218. }
  43219. if ('HTML-ENTITIES' === $fromEncoding) {
  43220. $s = html_entity_decode($s, ENT_COMPAT, 'UTF-8');
  43221. $fromEncoding = 'UTF-8';
  43222. }
  43223. return iconv($fromEncoding, $toEncoding.'//IGNORE', $s);
  43224. }
  43225. public static function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null)
  43226. {
  43227. $vars = array(&$a, &$b, &$c, &$d, &$e, &$f);
  43228. $ok = true;
  43229. array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) {
  43230. if (false === $v = Mbstring::mb_convert_encoding($v, $toEncoding, $fromEncoding)) {
  43231. $ok = false;
  43232. }
  43233. });
  43234. return $ok ? $fromEncoding : false;
  43235. }
  43236. public static function mb_decode_mimeheader($s)
  43237. {
  43238. return iconv_mime_decode($s, 2, self::$internalEncoding);
  43239. }
  43240. public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null)
  43241. {
  43242. trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', E_USER_WARNING);
  43243. }
  43244. public static function mb_decode_numericentity($s, $convmap, $encoding = null)
  43245. {
  43246. if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) {
  43247. trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING);
  43248. return null;
  43249. }
  43250. if (!\is_array($convmap) || !$convmap) {
  43251. return false;
  43252. }
  43253. if (null !== $encoding && !\is_scalar($encoding)) {
  43254. trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING);
  43255. return '';
  43256. }
  43257. $s = (string) $s;
  43258. if ('' === $s) {
  43259. return '';
  43260. }
  43261. $encoding = self::getEncoding($encoding);
  43262. if ('UTF-8' === $encoding) {
  43263. $encoding = null;
  43264. if (!preg_match('//u', $s)) {
  43265. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  43266. }
  43267. } else {
  43268. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  43269. }
  43270. $cnt = floor(\count($convmap) / 4) * 4;
  43271. for ($i = 0; $i < $cnt; $i += 4) {
  43272. $convmap[$i] += $convmap[$i + 2];
  43273. $convmap[$i + 1] += $convmap[$i + 2];
  43274. }
  43275. $s = preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function (array $m) use ($cnt, $convmap) {
  43276. $c = isset($m[2]) ? (int) hexdec($m[2]) : $m[1];
  43277. for ($i = 0; $i < $cnt; $i += 4) {
  43278. if ($c >= $convmap[$i] && $c <= $convmap[$i + 1]) {
  43279. return Mbstring::mb_chr($c - $convmap[$i + 2]);
  43280. }
  43281. }
  43282. return $m[0];
  43283. }, $s);
  43284. if (null === $encoding) {
  43285. return $s;
  43286. }
  43287. return iconv('UTF-8', $encoding.'//IGNORE', $s);
  43288. }
  43289. public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false)
  43290. {
  43291. if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) {
  43292. trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING);
  43293. return null;
  43294. }
  43295. if (!\is_array($convmap) || !$convmap) {
  43296. return false;
  43297. }
  43298. if (null !== $encoding && !\is_scalar($encoding)) {
  43299. trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING);
  43300. return null;
  43301. }
  43302. if (null !== $is_hex && !\is_scalar($is_hex)) {
  43303. trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.\gettype($s).' given', E_USER_WARNING);
  43304. return null;
  43305. }
  43306. $s = (string) $s;
  43307. if ('' === $s) {
  43308. return '';
  43309. }
  43310. $encoding = self::getEncoding($encoding);
  43311. if ('UTF-8' === $encoding) {
  43312. $encoding = null;
  43313. if (!preg_match('//u', $s)) {
  43314. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  43315. }
  43316. } else {
  43317. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  43318. }
  43319. static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
  43320. $cnt = floor(\count($convmap) / 4) * 4;
  43321. $i = 0;
  43322. $len = \strlen($s);
  43323. $result = '';
  43324. while ($i < $len) {
  43325. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  43326. $uchr = substr($s, $i, $ulen);
  43327. $i += $ulen;
  43328. $c = self::mb_ord($uchr);
  43329. for ($j = 0; $j < $cnt; $j += 4) {
  43330. if ($c >= $convmap[$j] && $c <= $convmap[$j + 1]) {
  43331. $cOffset = ($c + $convmap[$j + 2]) & $convmap[$j + 3];
  43332. $result .= $is_hex ? sprintf('&#x%X;', $cOffset) : '&#'.$cOffset.';';
  43333. continue 2;
  43334. }
  43335. }
  43336. $result .= $uchr;
  43337. }
  43338. if (null === $encoding) {
  43339. return $result;
  43340. }
  43341. return iconv('UTF-8', $encoding.'//IGNORE', $result);
  43342. }
  43343. public static function mb_convert_case($s, $mode, $encoding = null)
  43344. {
  43345. $s = (string) $s;
  43346. if ('' === $s) {
  43347. return '';
  43348. }
  43349. $encoding = self::getEncoding($encoding);
  43350. if ('UTF-8' === $encoding) {
  43351. $encoding = null;
  43352. if (!preg_match('//u', $s)) {
  43353. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  43354. }
  43355. } else {
  43356. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  43357. }
  43358. if (MB_CASE_TITLE == $mode) {
  43359. static $titleRegexp = null;
  43360. if (null === $titleRegexp) {
  43361. $titleRegexp = self::getData('titleCaseRegexp');
  43362. }
  43363. $s = preg_replace_callback($titleRegexp, array(__CLASS__, 'title_case'), $s);
  43364. } else {
  43365. if (MB_CASE_UPPER == $mode) {
  43366. static $upper = null;
  43367. if (null === $upper) {
  43368. $upper = self::getData('upperCase');
  43369. }
  43370. $map = $upper;
  43371. } else {
  43372. if (self::MB_CASE_FOLD === $mode) {
  43373. $s = str_replace(self::$caseFold[0], self::$caseFold[1], $s);
  43374. }
  43375. static $lower = null;
  43376. if (null === $lower) {
  43377. $lower = self::getData('lowerCase');
  43378. }
  43379. $map = $lower;
  43380. }
  43381. static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
  43382. $i = 0;
  43383. $len = \strlen($s);
  43384. while ($i < $len) {
  43385. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  43386. $uchr = substr($s, $i, $ulen);
  43387. $i += $ulen;
  43388. if (isset($map[$uchr])) {
  43389. $uchr = $map[$uchr];
  43390. $nlen = \strlen($uchr);
  43391. if ($nlen == $ulen) {
  43392. $nlen = $i;
  43393. do {
  43394. $s[--$nlen] = $uchr[--$ulen];
  43395. } while ($ulen);
  43396. } else {
  43397. $s = substr_replace($s, $uchr, $i - $ulen, $ulen);
  43398. $len += $nlen - $ulen;
  43399. $i += $nlen - $ulen;
  43400. }
  43401. }
  43402. }
  43403. }
  43404. if (null === $encoding) {
  43405. return $s;
  43406. }
  43407. return iconv('UTF-8', $encoding.'//IGNORE', $s);
  43408. }
  43409. public static function mb_internal_encoding($encoding = null)
  43410. {
  43411. if (null === $encoding) {
  43412. return self::$internalEncoding;
  43413. }
  43414. $encoding = self::getEncoding($encoding);
  43415. if ('UTF-8' === $encoding || false !== @iconv($encoding, $encoding, ' ')) {
  43416. self::$internalEncoding = $encoding;
  43417. return true;
  43418. }
  43419. return false;
  43420. }
  43421. public static function mb_language($lang = null)
  43422. {
  43423. if (null === $lang) {
  43424. return self::$language;
  43425. }
  43426. switch ($lang = strtolower($lang)) {
  43427. case 'uni':
  43428. case 'neutral':
  43429. self::$language = $lang;
  43430. return true;
  43431. }
  43432. return false;
  43433. }
  43434. public static function mb_list_encodings()
  43435. {
  43436. return array('UTF-8');
  43437. }
  43438. public static function mb_encoding_aliases($encoding)
  43439. {
  43440. switch (strtoupper($encoding)) {
  43441. case 'UTF8':
  43442. case 'UTF-8':
  43443. return array('utf8');
  43444. }
  43445. return false;
  43446. }
  43447. public static function mb_check_encoding($var = null, $encoding = null)
  43448. {
  43449. if (null === $encoding) {
  43450. if (null === $var) {
  43451. return false;
  43452. }
  43453. $encoding = self::$internalEncoding;
  43454. }
  43455. return self::mb_detect_encoding($var, array($encoding)) || false !== @iconv($encoding, $encoding, $var);
  43456. }
  43457. public static function mb_detect_encoding($str, $encodingList = null, $strict = false)
  43458. {
  43459. if (null === $encodingList) {
  43460. $encodingList = self::$encodingList;
  43461. } else {
  43462. if (!\is_array($encodingList)) {
  43463. $encodingList = array_map('trim', explode(',', $encodingList));
  43464. }
  43465. $encodingList = array_map('strtoupper', $encodingList);
  43466. }
  43467. foreach ($encodingList as $enc) {
  43468. switch ($enc) {
  43469. case 'ASCII':
  43470. if (!preg_match('/[\x80-\xFF]/', $str)) {
  43471. return $enc;
  43472. }
  43473. break;
  43474. case 'UTF8':
  43475. case 'UTF-8':
  43476. if (preg_match('//u', $str)) {
  43477. return 'UTF-8';
  43478. }
  43479. break;
  43480. default:
  43481. if (0 === strncmp($enc, 'ISO-8859-', 9)) {
  43482. return $enc;
  43483. }
  43484. }
  43485. }
  43486. return false;
  43487. }
  43488. public static function mb_detect_order($encodingList = null)
  43489. {
  43490. if (null === $encodingList) {
  43491. return self::$encodingList;
  43492. }
  43493. if (!\is_array($encodingList)) {
  43494. $encodingList = array_map('trim', explode(',', $encodingList));
  43495. }
  43496. $encodingList = array_map('strtoupper', $encodingList);
  43497. foreach ($encodingList as $enc) {
  43498. switch ($enc) {
  43499. default:
  43500. if (strncmp($enc, 'ISO-8859-', 9)) {
  43501. return false;
  43502. }
  43503. case 'ASCII':
  43504. case 'UTF8':
  43505. case 'UTF-8':
  43506. }
  43507. }
  43508. self::$encodingList = $encodingList;
  43509. return true;
  43510. }
  43511. public static function mb_strlen($s, $encoding = null)
  43512. {
  43513. $encoding = self::getEncoding($encoding);
  43514. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  43515. return \strlen($s);
  43516. }
  43517. return @iconv_strlen($s, $encoding);
  43518. }
  43519. public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null)
  43520. {
  43521. $encoding = self::getEncoding($encoding);
  43522. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  43523. return strpos($haystack, $needle, $offset);
  43524. }
  43525. $needle = (string) $needle;
  43526. if ('' === $needle) {
  43527. trigger_error(__METHOD__.': Empty delimiter', E_USER_WARNING);
  43528. return false;
  43529. }
  43530. return iconv_strpos($haystack, $needle, $offset, $encoding);
  43531. }
  43532. public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null)
  43533. {
  43534. $encoding = self::getEncoding($encoding);
  43535. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  43536. return strrpos($haystack, $needle, $offset);
  43537. }
  43538. if ($offset != (int) $offset) {
  43539. $offset = 0;
  43540. } elseif ($offset = (int) $offset) {
  43541. if ($offset < 0) {
  43542. $haystack = self::mb_substr($haystack, 0, $offset, $encoding);
  43543. $offset = 0;
  43544. } else {
  43545. $haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding);
  43546. }
  43547. }
  43548. $pos = iconv_strrpos($haystack, $needle, $encoding);
  43549. return false !== $pos ? $offset + $pos : false;
  43550. }
  43551. public static function mb_str_split($string, $split_length = 1, $encoding = null)
  43552. {
  43553. if (null !== $string && !\is_scalar($string) && !(\is_object($string) && \method_exists($string, '__toString'))) {
  43554. trigger_error('mb_str_split() expects parameter 1 to be string, '.\gettype($string).' given', E_USER_WARNING);
  43555. return null;
  43556. }
  43557. if ($split_length < 1) {
  43558. trigger_error('The length of each segment must be greater than zero', E_USER_WARNING);
  43559. return false;
  43560. }
  43561. if (null === $encoding) {
  43562. $encoding = mb_internal_encoding();
  43563. }
  43564. $result = array();
  43565. $length = mb_strlen($string, $encoding);
  43566. for ($i = 0; $i < $length; $i += $split_length) {
  43567. $result[] = mb_substr($string, $i, $split_length, $encoding);
  43568. }
  43569. return $result;
  43570. }
  43571. public static function mb_strtolower($s, $encoding = null)
  43572. {
  43573. return self::mb_convert_case($s, MB_CASE_LOWER, $encoding);
  43574. }
  43575. public static function mb_strtoupper($s, $encoding = null)
  43576. {
  43577. return self::mb_convert_case($s, MB_CASE_UPPER, $encoding);
  43578. }
  43579. public static function mb_substitute_character($c = null)
  43580. {
  43581. if (0 === strcasecmp($c, 'none')) {
  43582. return true;
  43583. }
  43584. return null !== $c ? false : 'none';
  43585. }
  43586. public static function mb_substr($s, $start, $length = null, $encoding = null)
  43587. {
  43588. $encoding = self::getEncoding($encoding);
  43589. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  43590. return (string) substr($s, $start, null === $length ? 2147483647 : $length);
  43591. }
  43592. if ($start < 0) {
  43593. $start = iconv_strlen($s, $encoding) + $start;
  43594. if ($start < 0) {
  43595. $start = 0;
  43596. }
  43597. }
  43598. if (null === $length) {
  43599. $length = 2147483647;
  43600. } elseif ($length < 0) {
  43601. $length = iconv_strlen($s, $encoding) + $length - $start;
  43602. if ($length < 0) {
  43603. return '';
  43604. }
  43605. }
  43606. return (string) iconv_substr($s, $start, $length, $encoding);
  43607. }
  43608. public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null)
  43609. {
  43610. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  43611. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  43612. return self::mb_strpos($haystack, $needle, $offset, $encoding);
  43613. }
  43614. public static function mb_stristr($haystack, $needle, $part = false, $encoding = null)
  43615. {
  43616. $pos = self::mb_stripos($haystack, $needle, 0, $encoding);
  43617. return self::getSubpart($pos, $part, $haystack, $encoding);
  43618. }
  43619. public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null)
  43620. {
  43621. $encoding = self::getEncoding($encoding);
  43622. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  43623. return strrchr($haystack, $needle, $part);
  43624. }
  43625. $needle = self::mb_substr($needle, 0, 1, $encoding);
  43626. $pos = iconv_strrpos($haystack, $needle, $encoding);
  43627. return self::getSubpart($pos, $part, $haystack, $encoding);
  43628. }
  43629. public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null)
  43630. {
  43631. $needle = self::mb_substr($needle, 0, 1, $encoding);
  43632. $pos = self::mb_strripos($haystack, $needle, $encoding);
  43633. return self::getSubpart($pos, $part, $haystack, $encoding);
  43634. }
  43635. public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null)
  43636. {
  43637. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  43638. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  43639. return self::mb_strrpos($haystack, $needle, $offset, $encoding);
  43640. }
  43641. public static function mb_strstr($haystack, $needle, $part = false, $encoding = null)
  43642. {
  43643. $pos = strpos($haystack, $needle);
  43644. if (false === $pos) {
  43645. return false;
  43646. }
  43647. if ($part) {
  43648. return substr($haystack, 0, $pos);
  43649. }
  43650. return substr($haystack, $pos);
  43651. }
  43652. public static function mb_get_info($type = 'all')
  43653. {
  43654. $info = array(
  43655. 'internal_encoding' => self::$internalEncoding,
  43656. 'http_output' => 'pass',
  43657. 'http_output_conv_mimetypes' => '^(text/|application/xhtml\+xml)',
  43658. 'func_overload' => 0,
  43659. 'func_overload_list' => 'no overload',
  43660. 'mail_charset' => 'UTF-8',
  43661. 'mail_header_encoding' => 'BASE64',
  43662. 'mail_body_encoding' => 'BASE64',
  43663. 'illegal_chars' => 0,
  43664. 'encoding_translation' => 'Off',
  43665. 'language' => self::$language,
  43666. 'detect_order' => self::$encodingList,
  43667. 'substitute_character' => 'none',
  43668. 'strict_detection' => 'Off',
  43669. );
  43670. if ('all' === $type) {
  43671. return $info;
  43672. }
  43673. if (isset($info[$type])) {
  43674. return $info[$type];
  43675. }
  43676. return false;
  43677. }
  43678. public static function mb_http_input($type = '')
  43679. {
  43680. return false;
  43681. }
  43682. public static function mb_http_output($encoding = null)
  43683. {
  43684. return null !== $encoding ? 'pass' === $encoding : 'pass';
  43685. }
  43686. public static function mb_strwidth($s, $encoding = null)
  43687. {
  43688. $encoding = self::getEncoding($encoding);
  43689. if ('UTF-8' !== $encoding) {
  43690. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  43691. }
  43692. $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);
  43693. return ($wide << 1) + iconv_strlen($s, 'UTF-8');
  43694. }
  43695. public static function mb_substr_count($haystack, $needle, $encoding = null)
  43696. {
  43697. return substr_count($haystack, $needle);
  43698. }
  43699. public static function mb_output_handler($contents, $status)
  43700. {
  43701. return $contents;
  43702. }
  43703. public static function mb_chr($code, $encoding = null)
  43704. {
  43705. if (0x80 > $code %= 0x200000) {
  43706. $s = \chr($code);
  43707. } elseif (0x800 > $code) {
  43708. $s = \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F);
  43709. } elseif (0x10000 > $code) {
  43710. $s = \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
  43711. } else {
  43712. $s = \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
  43713. }
  43714. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  43715. $s = mb_convert_encoding($s, $encoding, 'UTF-8');
  43716. }
  43717. return $s;
  43718. }
  43719. public static function mb_ord($s, $encoding = null)
  43720. {
  43721. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  43722. $s = mb_convert_encoding($s, 'UTF-8', $encoding);
  43723. }
  43724. if (1 === \strlen($s)) {
  43725. return \ord($s);
  43726. }
  43727. $code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0;
  43728. if (0xF0 <= $code) {
  43729. return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80;
  43730. }
  43731. if (0xE0 <= $code) {
  43732. return (($code - 0xE0) << 12) + (($s[2] - 0x80) << 6) + $s[3] - 0x80;
  43733. }
  43734. if (0xC0 <= $code) {
  43735. return (($code - 0xC0) << 6) + $s[2] - 0x80;
  43736. }
  43737. return $code;
  43738. }
  43739. private static function getSubpart($pos, $part, $haystack, $encoding)
  43740. {
  43741. if (false === $pos) {
  43742. return false;
  43743. }
  43744. if ($part) {
  43745. return self::mb_substr($haystack, 0, $pos, $encoding);
  43746. }
  43747. return self::mb_substr($haystack, $pos, null, $encoding);
  43748. }
  43749. private static function html_encoding_callback(array $m)
  43750. {
  43751. $i = 1;
  43752. $entities = '';
  43753. $m = unpack('C*', htmlentities($m[0], ENT_COMPAT, 'UTF-8'));
  43754. while (isset($m[$i])) {
  43755. if (0x80 > $m[$i]) {
  43756. $entities .= \chr($m[$i++]);
  43757. continue;
  43758. }
  43759. if (0xF0 <= $m[$i]) {
  43760. $c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  43761. } elseif (0xE0 <= $m[$i]) {
  43762. $c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  43763. } else {
  43764. $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80;
  43765. }
  43766. $entities .= '&#'.$c.';';
  43767. }
  43768. return $entities;
  43769. }
  43770. private static function title_case(array $s)
  43771. {
  43772. return self::mb_convert_case($s[1], MB_CASE_UPPER, 'UTF-8').self::mb_convert_case($s[2], MB_CASE_LOWER, 'UTF-8');
  43773. }
  43774. private static function getData($file)
  43775. {
  43776. if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) {
  43777. return require $file;
  43778. }
  43779. return false;
  43780. }
  43781. private static function getEncoding($encoding)
  43782. {
  43783. if (null === $encoding) {
  43784. return self::$internalEncoding;
  43785. }
  43786. $encoding = strtoupper($encoding);
  43787. if ('8BIT' === $encoding || 'BINARY' === $encoding) {
  43788. return 'CP850';
  43789. }
  43790. if ('UTF8' === $encoding) {
  43791. return 'UTF-8';
  43792. }
  43793. return $encoding;
  43794. }
  43795. }
  43796. <?php
  43797. return array(
  43798. 'A' => 'a',
  43799. 'B' => 'b',
  43800. 'C' => 'c',
  43801. 'D' => 'd',
  43802. 'E' => 'e',
  43803. 'F' => 'f',
  43804. 'G' => 'g',
  43805. 'H' => 'h',
  43806. 'I' => 'i',
  43807. 'J' => 'j',
  43808. 'K' => 'k',
  43809. 'L' => 'l',
  43810. 'M' => 'm',
  43811. 'N' => 'n',
  43812. 'O' => 'o',
  43813. 'P' => 'p',
  43814. 'Q' => 'q',
  43815. 'R' => 'r',
  43816. 'S' => 's',
  43817. 'T' => 't',
  43818. 'U' => 'u',
  43819. 'V' => 'v',
  43820. 'W' => 'w',
  43821. 'X' => 'x',
  43822. 'Y' => 'y',
  43823. 'Z' => 'z',
  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. 'Ħ' => 'ħ',
  43874. 'Ĩ' => 'ĩ',
  43875. 'Ī' => 'ī',
  43876. 'Ĭ' => 'ĭ',
  43877. 'Į' => 'į',
  43878. 'Ä°' => 'i',
  43879. 'IJ' => 'ij',
  43880. 'Ĵ' => 'ĵ',
  43881. 'Ķ' => 'ķ',
  43882. 'Ĺ' => 'ĺ',
  43883. 'Ļ' => 'ļ',
  43884. 'Ľ' => 'ľ',
  43885. 'Ä¿' => 'Å€',
  43886. '�' => 'ł',
  43887. 'Ń' => 'ń',
  43888. 'Ņ' => 'ņ',
  43889. 'Ň' => 'ň',
  43890. 'ÅŠ' => 'Å‹',
  43891. 'Ō' => '�',
  43892. 'Ŏ' => '�',
  43893. '�' => 'ő',
  43894. 'Å’' => 'Å“',
  43895. 'Å”' => 'Å•',
  43896. 'Å–' => 'Å—',
  43897. 'Ř' => 'ř',
  43898. 'Åš' => 'Å›',
  43899. 'Ŝ' => '�',
  43900. 'Åž' => 'ÅŸ',
  43901. 'Å ' => 'Å¡',
  43902. 'Å¢' => 'Å£',
  43903. 'Ť' => 'ť',
  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. 'DŽ' => 'dž',
  43954. 'Dž' => 'dž',
  43955. 'LJ' => 'lj',
  43956. 'Lj' => 'lj',
  43957. 'NJ' => 'nj',
  43958. 'Nj' => 'nj',
  43959. '�' => 'ǎ',
  43960. '�' => '�',
  43961. 'Ç‘' => 'Ç’',
  43962. 'Ç“' => 'Ç”',
  43963. 'Ç•' => 'Ç–',
  43964. 'Ǘ' => 'ǘ',
  43965. 'Ç™' => 'Çš',
  43966. 'Ǜ' => 'ǜ',
  43967. 'Çž' => 'ÇŸ',
  43968. 'Ç ' => 'Ç¡',
  43969. 'Ç¢' => 'Ç£',
  43970. 'Ǥ' => 'ǥ',
  43971. 'Ǧ' => 'ǧ',
  43972. 'Ǩ' => 'ǩ',
  43973. 'Ǫ' => 'ǫ',
  43974. 'Ǭ' => 'ǭ',
  43975. 'Ǯ' => 'ǯ',
  43976. 'DZ' => 'dz',
  43977. 'Dz' => 'dz',
  43978. 'Ǵ' => 'ǵ',
  43979. 'Ƕ' => 'ƕ',
  43980. 'Ç·' => 'Æ¿',
  43981. 'Ǹ' => 'ǹ',
  43982. 'Ǻ' => 'ǻ',
  43983. 'Ǽ' => 'ǽ',
  43984. 'Ǿ' => 'ǿ',
  43985. 'Ȁ' => '�',
  43986. 'Ȃ' => 'ȃ',
  43987. 'È„' => 'È…',
  43988. 'Ȇ' => 'ȇ',
  43989. 'Ȉ' => 'ȉ',
  43990. 'ÈŠ' => 'È‹',
  43991. 'Ȍ' => '�',
  43992. 'Ȏ' => '�',
  43993. '�' => 'ȑ',
  43994. 'È’' => 'È“',
  43995. 'È”' => 'È•',
  43996. 'È–' => 'È—',
  43997. 'Ș' => 'ș',
  43998. 'Èš' => 'È›',
  43999. 'Ȝ' => '�',
  44000. 'Èž' => 'ÈŸ',
  44001. 'È ' => 'Æž',
  44002. 'È¢' => 'È£',
  44003. 'Ȥ' => 'ȥ',
  44004. 'Ȧ' => 'ȧ',
  44005. 'Ȩ' => 'ȩ',
  44006. 'Ȫ' => 'ȫ',
  44007. 'Ȭ' => 'ȭ',
  44008. 'Ȯ' => 'ȯ',
  44009. 'Ȱ' => 'ȱ',
  44010. 'Ȳ' => 'ȳ',
  44011. 'Ⱥ' => 'ⱥ',
  44012. 'Ȼ' => 'ȼ',
  44013. 'Ƚ' => 'ƚ',
  44014. 'Ⱦ' => 'ⱦ',
  44015. '�' => 'ɂ',
  44016. 'Ƀ' => 'ƀ',
  44017. 'Ʉ' => 'ʉ',
  44018. 'Ʌ' => 'ʌ',
  44019. 'Ɇ' => 'ɇ',
  44020. 'Ɉ' => 'ɉ',
  44021. 'ÉŠ' => 'É‹',
  44022. 'Ɍ' => '�',
  44023. 'Ɏ' => '�',
  44024. 'Ͱ' => 'ͱ',
  44025. 'Ͳ' => 'ͳ',
  44026. 'Ͷ' => 'ͷ',
  44027. 'Ϳ' => 'ϳ',
  44028. 'Ά' => 'ά',
  44029. 'Έ' => 'έ',
  44030. 'Ή' => 'ή',
  44031. 'Ί' => 'ί',
  44032. 'Ό' => 'ό',
  44033. 'Ύ' => '�',
  44034. '�' => 'ώ',
  44035. 'Α' => 'α',
  44036. 'Β' => 'β',
  44037. 'Γ' => 'γ',
  44038. 'Δ' => 'δ',
  44039. 'Ε' => 'ε',
  44040. 'Ζ' => 'ζ',
  44041. 'Η' => 'η',
  44042. 'Θ' => 'θ',
  44043. 'Ι' => 'ι',
  44044. 'Κ' => 'κ',
  44045. 'Λ' => 'λ',
  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. 'K' => 'k',
  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. 'A' => '�',
  44793. 'B' => 'b',
  44794. 'C' => 'c',
  44795. 'D' => 'd',
  44796. 'ï¼¥' => 'ï½…',
  44797. 'F' => 'f',
  44798. 'G' => 'g',
  44799. 'H' => 'h',
  44800. 'I' => 'i',
  44801. 'J' => 'j',
  44802. 'K' => 'k',
  44803. 'L' => 'l',
  44804. 'M' => '�',
  44805. 'N' => 'n',
  44806. 'O' => '�',
  44807. 'P' => '�',
  44808. 'Q' => 'q',
  44809. 'ï¼²' => 'ï½’',
  44810. 'S' => 's',
  44811. 'ï¼´' => 'ï½”',
  44812. 'U' => 'u',
  44813. 'V' => 'v',
  44814. 'ï¼·' => 'ï½—',
  44815. 'X' => 'x',
  44816. 'ï¼¹' => 'ï½™',
  44817. 'Z' => 'z',
  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. '𑢶' => '𑣖',
  44881. 'ð‘¢·' => 'ð‘£—',
  44882. '𑢸' => '𑣘',
  44883. 'ð‘¢¹' => 'ð‘£™',
  44884. '𑢺' => '𑣚',
  44885. 'ð‘¢»' => 'ð‘£›',
  44886. '𑢼' => '𑣜',
  44887. '𑢽' => '�',
  44888. '𑢾' => '𑣞',
  44889. '𑢿' => '𑣟',
  44890. );
  44891. <?php
  44892. return '/(?<![\x{0027}\x{002E}\x{003A}\x{005E}\x{0060}\x{00A8}\x{00AD}\x{00AF}\x{00B4}\x{00B7}\x{00B8}\x{02B0}-\x{02C1}\x{02C2}-\x{02C5}\x{02C6}-\x{02D1}\x{02D2}-\x{02DF}\x{02E0}-\x{02E4}\x{02E5}-\x{02EB}\x{02EC}\x{02ED}\x{02EE}\x{02EF}-\x{02FF}\x{0300}-\x{036F}\x{0374}\x{0375}\x{037A}\x{0384}-\x{0385}\x{0387}\x{0483}-\x{0487}\x{0488}-\x{0489}\x{0559}\x{0591}-\x{05BD}\x{05BF}\x{05C1}-\x{05C2}\x{05C4}-\x{05C5}\x{05C7}\x{05F4}\x{0600}-\x{0605}\x{0610}-\x{061A}\x{061C}\x{0640}\x{064B}-\x{065F}\x{0670}\x{06D6}-\x{06DC}\x{06DD}\x{06DF}-\x{06E4}\x{06E5}-\x{06E6}\x{06E7}-\x{06E8}\x{06EA}-\x{06ED}\x{070F}\x{0711}\x{0730}-\x{074A}\x{07A6}-\x{07B0}\x{07EB}-\x{07F3}\x{07F4}-\x{07F5}\x{07FA}\x{07FD}\x{0816}-\x{0819}\x{081A}\x{081B}-\x{0823}\x{0824}\x{0825}-\x{0827}\x{0828}\x{0829}-\x{082D}\x{0859}-\x{085B}\x{08D3}-\x{08E1}\x{08E2}\x{08E3}-\x{0902}\x{093A}\x{093C}\x{0941}-\x{0948}\x{094D}\x{0951}-\x{0957}\x{0962}-\x{0963}\x{0971}\x{0981}\x{09BC}\x{09C1}-\x{09C4}\x{09CD}\x{09E2}-\x{09E3}\x{09FE}\x{0A01}-\x{0A02}\x{0A3C}\x{0A41}-\x{0A42}\x{0A47}-\x{0A48}\x{0A4B}-\x{0A4D}\x{0A51}\x{0A70}-\x{0A71}\x{0A75}\x{0A81}-\x{0A82}\x{0ABC}\x{0AC1}-\x{0AC5}\x{0AC7}-\x{0AC8}\x{0ACD}\x{0AE2}-\x{0AE3}\x{0AFA}-\x{0AFF}\x{0B01}\x{0B3C}\x{0B3F}\x{0B41}-\x{0B44}\x{0B4D}\x{0B56}\x{0B62}-\x{0B63}\x{0B82}\x{0BC0}\x{0BCD}\x{0C00}\x{0C04}\x{0C3E}-\x{0C40}\x{0C46}-\x{0C48}\x{0C4A}-\x{0C4D}\x{0C55}-\x{0C56}\x{0C62}-\x{0C63}\x{0C81}\x{0CBC}\x{0CBF}\x{0CC6}\x{0CCC}-\x{0CCD}\x{0CE2}-\x{0CE3}\x{0D00}-\x{0D01}\x{0D3B}-\x{0D3C}\x{0D41}-\x{0D44}\x{0D4D}\x{0D62}-\x{0D63}\x{0DCA}\x{0DD2}-\x{0DD4}\x{0DD6}\x{0E31}\x{0E34}-\x{0E3A}\x{0E46}\x{0E47}-\x{0E4E}\x{0EB1}\x{0EB4}-\x{0EB9}\x{0EBB}-\x{0EBC}\x{0EC6}\x{0EC8}-\x{0ECD}\x{0F18}-\x{0F19}\x{0F35}\x{0F37}\x{0F39}\x{0F71}-\x{0F7E}\x{0F80}-\x{0F84}\x{0F86}-\x{0F87}\x{0F8D}-\x{0F97}\x{0F99}-\x{0FBC}\x{0FC6}\x{102D}-\x{1030}\x{1032}-\x{1037}\x{1039}-\x{103A}\x{103D}-\x{103E}\x{1058}-\x{1059}\x{105E}-\x{1060}\x{1071}-\x{1074}\x{1082}\x{1085}-\x{1086}\x{108D}\x{109D}\x{10FC}\x{135D}-\x{135F}\x{1712}-\x{1714}\x{1732}-\x{1734}\x{1752}-\x{1753}\x{1772}-\x{1773}\x{17B4}-\x{17B5}\x{17B7}-\x{17BD}\x{17C6}\x{17C9}-\x{17D3}\x{17D7}\x{17DD}\x{180B}-\x{180D}\x{180E}\x{1843}\x{1885}-\x{1886}\x{18A9}\x{1920}-\x{1922}\x{1927}-\x{1928}\x{1932}\x{1939}-\x{193B}\x{1A17}-\x{1A18}\x{1A1B}\x{1A56}\x{1A58}-\x{1A5E}\x{1A60}\x{1A62}\x{1A65}-\x{1A6C}\x{1A73}-\x{1A7C}\x{1A7F}\x{1AA7}\x{1AB0}-\x{1ABD}\x{1ABE}\x{1B00}-\x{1B03}\x{1B34}\x{1B36}-\x{1B3A}\x{1B3C}\x{1B42}\x{1B6B}-\x{1B73}\x{1B80}-\x{1B81}\x{1BA2}-\x{1BA5}\x{1BA8}-\x{1BA9}\x{1BAB}-\x{1BAD}\x{1BE6}\x{1BE8}-\x{1BE9}\x{1BED}\x{1BEF}-\x{1BF1}\x{1C2C}-\x{1C33}\x{1C36}-\x{1C37}\x{1C78}-\x{1C7D}\x{1CD0}-\x{1CD2}\x{1CD4}-\x{1CE0}\x{1CE2}-\x{1CE8}\x{1CED}\x{1CF4}\x{1CF8}-\x{1CF9}\x{1D2C}-\x{1D6A}\x{1D78}\x{1D9B}-\x{1DBF}\x{1DC0}-\x{1DF9}\x{1DFB}-\x{1DFF}\x{1FBD}\x{1FBF}-\x{1FC1}\x{1FCD}-\x{1FCF}\x{1FDD}-\x{1FDF}\x{1FED}-\x{1FEF}\x{1FFD}-\x{1FFE}\x{200B}-\x{200F}\x{2018}\x{2019}\x{2024}\x{2027}\x{202A}-\x{202E}\x{2060}-\x{2064}\x{2066}-\x{206F}\x{2071}\x{207F}\x{2090}-\x{209C}\x{20D0}-\x{20DC}\x{20DD}-\x{20E0}\x{20E1}\x{20E2}-\x{20E4}\x{20E5}-\x{20F0}\x{2C7C}-\x{2C7D}\x{2CEF}-\x{2CF1}\x{2D6F}\x{2D7F}\x{2DE0}-\x{2DFF}\x{2E2F}\x{3005}\x{302A}-\x{302D}\x{3031}-\x{3035}\x{303B}\x{3099}-\x{309A}\x{309B}-\x{309C}\x{309D}-\x{309E}\x{30FC}-\x{30FE}\x{A015}\x{A4F8}-\x{A4FD}\x{A60C}\x{A66F}\x{A670}-\x{A672}\x{A674}-\x{A67D}\x{A67F}\x{A69C}-\x{A69D}\x{A69E}-\x{A69F}\x{A6F0}-\x{A6F1}\x{A700}-\x{A716}\x{A717}-\x{A71F}\x{A720}-\x{A721}\x{A770}\x{A788}\x{A789}-\x{A78A}\x{A7F8}-\x{A7F9}\x{A802}\x{A806}\x{A80B}\x{A825}-\x{A826}\x{A8C4}-\x{A8C5}\x{A8E0}-\x{A8F1}\x{A8FF}\x{A926}-\x{A92D}\x{A947}-\x{A951}\x{A980}-\x{A982}\x{A9B3}\x{A9B6}-\x{A9B9}\x{A9BC}\x{A9CF}\x{A9E5}\x{A9E6}\x{AA29}-\x{AA2E}\x{AA31}-\x{AA32}\x{AA35}-\x{AA36}\x{AA43}\x{AA4C}\x{AA70}\x{AA7C}\x{AAB0}\x{AAB2}-\x{AAB4}\x{AAB7}-\x{AAB8}\x{AABE}-\x{AABF}\x{AAC1}\x{AADD}\x{AAEC}-\x{AAED}\x{AAF3}-\x{AAF4}\x{AAF6}\x{AB5B}\x{AB5C}-\x{AB5F}\x{ABE5}\x{ABE8}\x{ABED}\x{FB1E}\x{FBB2}-\x{FBC1}\x{FE00}-\x{FE0F}\x{FE13}\x{FE20}-\x{FE2F}\x{FE52}\x{FE55}\x{FEFF}\x{FF07}\x{FF0E}\x{FF1A}\x{FF3E}\x{FF40}\x{FF70}\x{FF9E}-\x{FF9F}\x{FFE3}\x{FFF9}-\x{FFFB}\x{101FD}\x{102E0}\x{10376}-\x{1037A}\x{10A01}-\x{10A03}\x{10A05}-\x{10A06}\x{10A0C}-\x{10A0F}\x{10A38}-\x{10A3A}\x{10A3F}\x{10AE5}-\x{10AE6}\x{10D24}-\x{10D27}\x{10F46}-\x{10F50}\x{11001}\x{11038}-\x{11046}\x{1107F}-\x{11081}\x{110B3}-\x{110B6}\x{110B9}-\x{110BA}\x{110BD}\x{110CD}\x{11100}-\x{11102}\x{11127}-\x{1112B}\x{1112D}-\x{11134}\x{11173}\x{11180}-\x{11181}\x{111B6}-\x{111BE}\x{111C9}-\x{111CC}\x{1122F}-\x{11231}\x{11234}\x{11236}-\x{11237}\x{1123E}\x{112DF}\x{112E3}-\x{112EA}\x{11300}-\x{11301}\x{1133B}-\x{1133C}\x{11340}\x{11366}-\x{1136C}\x{11370}-\x{11374}\x{11438}-\x{1143F}\x{11442}-\x{11444}\x{11446}\x{1145E}\x{114B3}-\x{114B8}\x{114BA}\x{114BF}-\x{114C0}\x{114C2}-\x{114C3}\x{115B2}-\x{115B5}\x{115BC}-\x{115BD}\x{115BF}-\x{115C0}\x{115DC}-\x{115DD}\x{11633}-\x{1163A}\x{1163D}\x{1163F}-\x{11640}\x{116AB}\x{116AD}\x{116B0}-\x{116B5}\x{116B7}\x{1171D}-\x{1171F}\x{11722}-\x{11725}\x{11727}-\x{1172B}\x{1182F}-\x{11837}\x{11839}-\x{1183A}\x{11A01}-\x{11A0A}\x{11A33}-\x{11A38}\x{11A3B}-\x{11A3E}\x{11A47}\x{11A51}-\x{11A56}\x{11A59}-\x{11A5B}\x{11A8A}-\x{11A96}\x{11A98}-\x{11A99}\x{11C30}-\x{11C36}\x{11C38}-\x{11C3D}\x{11C3F}\x{11C92}-\x{11CA7}\x{11CAA}-\x{11CB0}\x{11CB2}-\x{11CB3}\x{11CB5}-\x{11CB6}\x{11D31}-\x{11D36}\x{11D3A}\x{11D3C}-\x{11D3D}\x{11D3F}-\x{11D45}\x{11D47}\x{11D90}-\x{11D91}\x{11D95}\x{11D97}\x{11EF3}-\x{11EF4}\x{16AF0}-\x{16AF4}\x{16B30}-\x{16B36}\x{16B40}-\x{16B43}\x{16F8F}-\x{16F92}\x{16F93}-\x{16F9F}\x{16FE0}-\x{16FE1}\x{1BC9D}-\x{1BC9E}\x{1BCA0}-\x{1BCA3}\x{1D167}-\x{1D169}\x{1D173}-\x{1D17A}\x{1D17B}-\x{1D182}\x{1D185}-\x{1D18B}\x{1D1AA}-\x{1D1AD}\x{1D242}-\x{1D244}\x{1DA00}-\x{1DA36}\x{1DA3B}-\x{1DA6C}\x{1DA75}\x{1DA84}\x{1DA9B}-\x{1DA9F}\x{1DAA1}-\x{1DAAF}\x{1E000}-\x{1E006}\x{1E008}-\x{1E018}\x{1E01B}-\x{1E021}\x{1E023}-\x{1E024}\x{1E026}-\x{1E02A}\x{1E8D0}-\x{1E8D6}\x{1E944}-\x{1E94A}\x{1F3FB}-\x{1F3FF}\x{E0001}\x{E0020}-\x{E007F}\x{E0100}-\x{E01EF}])(\pL)(\pL*+)/u';
  44893. <?php
  44894. return array(
  44895. 'a' => 'A',
  44896. 'b' => 'B',
  44897. 'c' => 'C',
  44898. 'd' => 'D',
  44899. 'e' => 'E',
  44900. 'f' => 'F',
  44901. 'g' => 'G',
  44902. 'h' => 'H',
  44903. 'i' => 'I',
  44904. 'j' => 'J',
  44905. 'k' => 'K',
  44906. 'l' => 'L',
  44907. 'm' => 'M',
  44908. 'n' => 'N',
  44909. 'o' => 'O',
  44910. 'p' => 'P',
  44911. 'q' => 'Q',
  44912. 'r' => 'R',
  44913. 's' => 'S',
  44914. 't' => 'T',
  44915. 'u' => 'U',
  44916. 'v' => 'V',
  44917. 'w' => 'W',
  44918. 'x' => 'X',
  44919. 'y' => 'Y',
  44920. 'z' => 'Z',
  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. 'ı' => 'I',
  44978. 'ij' => 'IJ',
  44979. 'ĵ' => 'Ĵ',
  44980. 'ķ' => 'Ķ',
  44981. 'ĺ' => 'Ĺ',
  44982. 'ļ' => 'Ļ',
  44983. 'ľ' => 'Ľ',
  44984. 'Å€' => 'Ä¿',
  44985. 'ł' => '�',
  44986. 'ń' => 'Ń',
  44987. 'ņ' => 'Ņ',
  44988. 'ň' => 'Ň',
  44989. 'Å‹' => 'ÅŠ',
  44990. '�' => 'Ō',
  44991. '�' => 'Ŏ',
  44992. 'ő' => '�',
  44993. 'Å“' => 'Å’',
  44994. 'Å•' => 'Å”',
  44995. 'Å—' => 'Å–',
  44996. 'ř' => 'Ř',
  44997. 'Å›' => 'Åš',
  44998. '�' => 'Ŝ',
  44999. 'ÅŸ' => 'Åž',
  45000. 'Å¡' => 'Å ',
  45001. 'Å£' => 'Å¢',
  45002. 'ť' => 'Ť',
  45003. 'ŧ' => 'Ŧ',
  45004. 'ũ' => 'Ũ',
  45005. 'ū' => 'Ū',
  45006. 'ŭ' => 'Ŭ',
  45007. 'ů' => 'Ů',
  45008. 'ű' => 'Ű',
  45009. 'ų' => 'Ų',
  45010. 'ŵ' => 'Ŵ',
  45011. 'ŷ' => 'Ŷ',
  45012. 'ź' => 'Ź',
  45013. 'ż' => 'Ż',
  45014. 'ž' => 'Ž',
  45015. 'Å¿' => 'S',
  45016. 'ƀ' => 'Ƀ',
  45017. 'ƃ' => 'Ƃ',
  45018. 'Æ…' => 'Æ„',
  45019. 'ƈ' => 'Ƈ',
  45020. 'ƌ' => 'Ƌ',
  45021. 'Æ’' => 'Æ‘',
  45022. 'ƕ' => 'Ƕ',
  45023. 'ƙ' => 'Ƙ',
  45024. 'ƚ' => 'Ƚ',
  45025. 'Æž' => 'È ',
  45026. 'Æ¡' => 'Æ ',
  45027. 'Æ£' => 'Æ¢',
  45028. 'ƥ' => 'Ƥ',
  45029. 'ƨ' => 'Ƨ',
  45030. 'ƭ' => 'Ƭ',
  45031. 'ư' => 'Ư',
  45032. 'ƴ' => 'Ƴ',
  45033. 'ƶ' => 'Ƶ',
  45034. 'ƹ' => 'Ƹ',
  45035. 'ƽ' => 'Ƽ',
  45036. 'Æ¿' => 'Ç·',
  45037. 'Ç…' => 'Ç„',
  45038. 'dž' => 'DŽ',
  45039. 'Lj' => 'LJ',
  45040. 'lj' => 'LJ',
  45041. 'Ç‹' => 'ÇŠ',
  45042. 'nj' => 'NJ',
  45043. 'ǎ' => '�',
  45044. '�' => '�',
  45045. 'Ç’' => 'Ç‘',
  45046. 'Ç”' => 'Ç“',
  45047. 'Ç–' => 'Ç•',
  45048. 'ǘ' => 'Ǘ',
  45049. 'Çš' => 'Ç™',
  45050. 'ǜ' => 'Ǜ',
  45051. '�' => 'Ǝ',
  45052. 'ÇŸ' => 'Çž',
  45053. 'Ç¡' => 'Ç ',
  45054. 'Ç£' => 'Ç¢',
  45055. 'ǥ' => 'Ǥ',
  45056. 'ǧ' => 'Ǧ',
  45057. 'ǩ' => 'Ǩ',
  45058. 'ǫ' => 'Ǫ',
  45059. 'ǭ' => 'Ǭ',
  45060. 'ǯ' => 'Ǯ',
  45061. 'Dz' => 'DZ',
  45062. 'dz' => 'DZ',
  45063. 'ǵ' => 'Ǵ',
  45064. 'ǹ' => 'Ǹ',
  45065. 'ǻ' => 'Ǻ',
  45066. 'ǽ' => 'Ǽ',
  45067. 'ǿ' => 'Ǿ',
  45068. '�' => 'Ȁ',
  45069. 'ȃ' => 'Ȃ',
  45070. 'È…' => 'È„',
  45071. 'ȇ' => 'Ȇ',
  45072. 'ȉ' => 'Ȉ',
  45073. 'È‹' => 'ÈŠ',
  45074. '�' => 'Ȍ',
  45075. '�' => 'Ȏ',
  45076. 'ȑ' => '�',
  45077. 'È“' => 'È’',
  45078. 'È•' => 'È”',
  45079. 'È—' => 'È–',
  45080. 'ș' => 'Ș',
  45081. 'È›' => 'Èš',
  45082. '�' => 'Ȝ',
  45083. 'ÈŸ' => 'Èž',
  45084. 'È£' => 'È¢',
  45085. 'ȥ' => 'Ȥ',
  45086. 'ȧ' => 'Ȧ',
  45087. 'ȩ' => 'Ȩ',
  45088. 'ȫ' => 'Ȫ',
  45089. 'ȭ' => 'Ȭ',
  45090. 'ȯ' => 'Ȯ',
  45091. 'ȱ' => 'Ȱ',
  45092. 'ȳ' => 'Ȳ',
  45093. 'ȼ' => 'Ȼ',
  45094. 'È¿' => 'â±¾',
  45095. 'ɀ' => 'Ɀ',
  45096. 'ɂ' => '�',
  45097. 'ɇ' => 'Ɇ',
  45098. 'ɉ' => 'Ɉ',
  45099. 'É‹' => 'ÉŠ',
  45100. '�' => 'Ɍ',
  45101. '�' => 'Ɏ',
  45102. '�' => 'Ɐ',
  45103. 'É‘' => 'â±­',
  45104. 'É’' => 'â±°',
  45105. 'ɓ' => '�',
  45106. 'ɔ' => 'Ɔ',
  45107. 'ɖ' => 'Ɖ',
  45108. 'É—' => 'ÆŠ',
  45109. 'ə' => '�',
  45110. 'ɛ' => '�',
  45111. 'ɜ' => 'Ɜ',
  45112. 'É ' => 'Æ“',
  45113. 'ɡ' => 'Ɡ',
  45114. 'É£' => 'Æ”',
  45115. 'ɥ' => '�',
  45116. 'ɦ' => 'Ɦ',
  45117. 'ɨ' => 'Ɨ',
  45118. 'É©' => 'Æ–',
  45119. 'É«' => 'â±¢',
  45120. 'ɬ' => 'Ɬ',
  45121. 'ɯ' => 'Ɯ',
  45122. 'ɱ' => 'Ɱ',
  45123. 'ɲ' => '�',
  45124. 'ɵ' => 'Ɵ',
  45125. 'ɽ' => 'Ɽ',
  45126. 'ʀ' => 'Ʀ',
  45127. 'ʃ' => 'Ʃ',
  45128. 'ʇ' => 'Ʇ',
  45129. 'ʈ' => 'Ʈ',
  45130. 'ʉ' => 'Ʉ',
  45131. 'ʊ' => 'Ʊ',
  45132. 'ʋ' => 'Ʋ',
  45133. 'ʌ' => 'Ʌ',
  45134. 'Ê’' => 'Æ·',
  45135. 'Êž' => 'êž°',
  45136. 'ͅ' => 'Ι',
  45137. 'ͱ' => 'Ͱ',
  45138. 'ͳ' => 'Ͳ',
  45139. 'ͷ' => 'Ͷ',
  45140. 'ͻ' => 'Ͻ',
  45141. 'ͼ' => 'Ͼ',
  45142. 'ͽ' => 'Ͽ',
  45143. 'ά' => 'Ά',
  45144. 'έ' => 'Έ',
  45145. 'ή' => 'Ή',
  45146. 'ί' => 'Ί',
  45147. 'α' => 'Α',
  45148. 'β' => 'Β',
  45149. 'γ' => 'Γ',
  45150. 'δ' => 'Δ',
  45151. 'ε' => 'Ε',
  45152. 'ζ' => 'Ζ',
  45153. 'η' => 'Η',
  45154. 'θ' => 'Θ',
  45155. 'ι' => 'Ι',
  45156. 'κ' => 'Κ',
  45157. 'λ' => 'Λ',
  45158. 'μ' => 'Μ',
  45159. 'ν' => '�',
  45160. 'ξ' => 'Ξ',
  45161. 'ο' => 'Ο',
  45162. 'π' => 'Π',
  45163. '�' => 'Ρ',
  45164. 'ς' => 'Σ',
  45165. 'σ' => 'Σ',
  45166. 'τ' => 'Τ',
  45167. 'Ï…' => 'Î¥',
  45168. 'φ' => 'Φ',
  45169. 'χ' => 'Χ',
  45170. 'ψ' => 'Ψ',
  45171. 'ω' => 'Ω',
  45172. 'ϊ' => 'Ϊ',
  45173. 'ϋ' => 'Ϋ',
  45174. 'ό' => 'Ό',
  45175. '�' => 'Ύ',
  45176. 'ώ' => '�',
  45177. '�' => 'Β',
  45178. 'ϑ' => 'Θ',
  45179. 'ϕ' => 'Φ',
  45180. 'ϖ' => 'Π',
  45181. 'ϗ' => '�',
  45182. 'ϙ' => 'Ϙ',
  45183. 'Ï›' => 'Ïš',
  45184. '�' => 'Ϝ',
  45185. 'ÏŸ' => 'Ïž',
  45186. 'Ï¡' => 'Ï ',
  45187. 'Ï£' => 'Ï¢',
  45188. 'ϥ' => 'Ϥ',
  45189. 'ϧ' => 'Ϧ',
  45190. 'ϩ' => 'Ϩ',
  45191. 'ϫ' => 'Ϫ',
  45192. 'ϭ' => 'Ϭ',
  45193. 'ϯ' => 'Ϯ',
  45194. 'ϰ' => 'Κ',
  45195. 'ϱ' => 'Ρ',
  45196. 'ϲ' => 'Ϲ',
  45197. 'ϳ' => 'Ϳ',
  45198. 'ϵ' => 'Ε',
  45199. 'ϸ' => 'Ϸ',
  45200. 'ϻ' => 'Ϻ',
  45201. 'а' => '�',
  45202. 'б' => 'Б',
  45203. 'в' => 'В',
  45204. 'г' => 'Г',
  45205. 'д' => 'Д',
  45206. 'е' => 'Е',
  45207. 'ж' => 'Ж',
  45208. 'з' => 'З',
  45209. 'и' => 'И',
  45210. 'й' => 'Й',
  45211. 'к' => 'К',
  45212. 'л' => 'Л',
  45213. 'м' => 'М',
  45214. 'н' => '�',
  45215. 'о' => 'О',
  45216. 'п' => 'П',
  45217. 'р' => 'Р',
  45218. '�' => 'С',
  45219. 'т' => 'Т',
  45220. 'у' => 'У',
  45221. 'ф' => 'Ф',
  45222. 'Ñ…' => 'Ð¥',
  45223. 'ц' => 'Ц',
  45224. 'ч' => 'Ч',
  45225. 'ш' => 'Ш',
  45226. 'щ' => 'Щ',
  45227. 'ъ' => 'Ъ',
  45228. 'ы' => 'Ы',
  45229. 'ь' => 'Ь',
  45230. '�' => 'Э',
  45231. 'ю' => 'Ю',
  45232. '�' => 'Я',
  45233. '�' => 'Ѐ',
  45234. 'ё' => '�',
  45235. 'ђ' => 'Ђ',
  45236. 'ѓ' => 'Ѓ',
  45237. 'є' => 'Є',
  45238. 'Ñ•' => 'Ð…',
  45239. 'і' => 'І',
  45240. 'ї' => 'Ї',
  45241. 'ј' => 'Ј',
  45242. 'љ' => 'Љ',
  45243. 'њ' => 'Њ',
  45244. 'ћ' => 'Ћ',
  45245. 'ќ' => 'Ќ',
  45246. '�' => '�',
  45247. 'Ñž' => 'ÐŽ',
  45248. 'џ' => '�',
  45249. 'Ñ¡' => 'Ñ ',
  45250. 'Ñ£' => 'Ñ¢',
  45251. 'ѥ' => 'Ѥ',
  45252. 'ѧ' => 'Ѧ',
  45253. 'ѩ' => 'Ѩ',
  45254. 'ѫ' => 'Ѫ',
  45255. 'ѭ' => 'Ѭ',
  45256. 'ѯ' => 'Ѯ',
  45257. 'ѱ' => 'Ѱ',
  45258. 'ѳ' => 'Ѳ',
  45259. 'ѵ' => 'Ѵ',
  45260. 'ѷ' => 'Ѷ',
  45261. 'ѹ' => 'Ѹ',
  45262. 'ѻ' => 'Ѻ',
  45263. 'ѽ' => 'Ѽ',
  45264. 'ѿ' => 'Ѿ',
  45265. 'Ò�' => 'Ò€',
  45266. 'Ò‹' => 'ÒŠ',
  45267. '�' => 'Ҍ',
  45268. 'Ò�' => 'ÒŽ',
  45269. 'Ò‘' => 'Ò�',
  45270. 'Ò“' => 'Ò’',
  45271. 'Ò•' => 'Ò”',
  45272. 'Ò—' => 'Ò–',
  45273. 'Ò™' => 'Ò˜',
  45274. 'Ò›' => 'Òš',
  45275. '�' => 'Ҝ',
  45276. 'ÒŸ' => 'Òž',
  45277. 'Ò¡' => 'Ò ',
  45278. 'Ò£' => 'Ò¢',
  45279. 'Ò¥' => 'Ò¤',
  45280. 'Ò§' => 'Ò¦',
  45281. 'Ò©' => 'Ò¨',
  45282. 'Ò«' => 'Òª',
  45283. 'Ò­' => 'Ò¬',
  45284. 'Ò¯' => 'Ò®',
  45285. 'Ò±' => 'Ò°',
  45286. 'Ò³' => 'Ò²',
  45287. 'Òµ' => 'Ò´',
  45288. 'Ò·' => 'Ò¶',
  45289. 'Ò¹' => 'Ò¸',
  45290. 'Ò»' => 'Òº',
  45291. 'Ò½' => 'Ò¼',
  45292. 'Ò¿' => 'Ò¾',
  45293. 'Ó‚' => 'Ó�',
  45294. 'Ó„' => 'Óƒ',
  45295. 'Ó†' => 'Ó…',
  45296. 'Óˆ' => 'Ó‡',
  45297. 'ÓŠ' => 'Ó‰',
  45298. 'ӌ' => 'Ӌ',
  45299. 'ÓŽ' => 'Ó�',
  45300. 'Ó�' => 'Ó€',
  45301. 'Ó‘' => 'Ó�',
  45302. 'Ó“' => 'Ó’',
  45303. 'Ó•' => 'Ó”',
  45304. 'Ó—' => 'Ó–',
  45305. 'Ó™' => 'Ó˜',
  45306. 'Ó›' => 'Óš',
  45307. '�' => 'Ӝ',
  45308. 'ÓŸ' => 'Óž',
  45309. 'Ó¡' => 'Ó ',
  45310. 'Ó£' => 'Ó¢',
  45311. 'Ó¥' => 'Ó¤',
  45312. 'Ó§' => 'Ó¦',
  45313. 'Ó©' => 'Ó¨',
  45314. 'Ó«' => 'Óª',
  45315. 'Ó­' => 'Ó¬',
  45316. 'Ó¯' => 'Ó®',
  45317. 'Ó±' => 'Ó°',
  45318. 'Ó³' => 'Ó²',
  45319. 'Óµ' => 'Ó´',
  45320. 'Ó·' => 'Ó¶',
  45321. 'Ó¹' => 'Ó¸',
  45322. 'Ó»' => 'Óº',
  45323. 'Ó½' => 'Ó¼',
  45324. 'Ó¿' => 'Ó¾',
  45325. 'Ô�' => 'Ô€',
  45326. 'Ôƒ' => 'Ô‚',
  45327. 'Ô…' => 'Ô„',
  45328. 'Ô‡' => 'Ô†',
  45329. 'Ô‰' => 'Ôˆ',
  45330. 'Ô‹' => 'ÔŠ',
  45331. '�' => 'Ԍ',
  45332. 'Ô�' => 'ÔŽ',
  45333. 'Ô‘' => 'Ô�',
  45334. 'Ô“' => 'Ô’',
  45335. 'Ô•' => 'Ô”',
  45336. 'Ô—' => 'Ô–',
  45337. 'Ô™' => 'Ô˜',
  45338. 'Ô›' => 'Ôš',
  45339. '�' => 'Ԝ',
  45340. 'ÔŸ' => 'Ôž',
  45341. 'Ô¡' => 'Ô ',
  45342. 'Ô£' => 'Ô¢',
  45343. 'Ô¥' => 'Ô¤',
  45344. 'Ô§' => 'Ô¦',
  45345. 'Ô©' => 'Ô¨',
  45346. 'Ô«' => 'Ôª',
  45347. 'Ô­' => 'Ô¬',
  45348. 'Ô¯' => 'Ô®',
  45349. 'Õ¡' => 'Ô±',
  45350. 'Õ¢' => 'Ô²',
  45351. 'Õ£' => 'Ô³',
  45352. 'Õ¤' => 'Ô´',
  45353. 'Õ¥' => 'Ôµ',
  45354. 'Õ¦' => 'Ô¶',
  45355. 'Õ§' => 'Ô·',
  45356. 'Õ¨' => 'Ô¸',
  45357. 'Õ©' => 'Ô¹',
  45358. 'Õª' => 'Ôº',
  45359. 'Õ«' => 'Ô»',
  45360. 'Õ¬' => 'Ô¼',
  45361. 'Õ­' => 'Ô½',
  45362. 'Õ®' => 'Ô¾',
  45363. 'Õ¯' => 'Ô¿',
  45364. 'Õ°' => 'Õ€',
  45365. 'Õ±' => 'Õ�',
  45366. 'Õ²' => 'Õ‚',
  45367. 'Õ³' => 'Õƒ',
  45368. 'Õ´' => 'Õ„',
  45369. 'Õµ' => 'Õ…',
  45370. 'Õ¶' => 'Õ†',
  45371. 'Õ·' => 'Õ‡',
  45372. 'Õ¸' => 'Õˆ',
  45373. 'Õ¹' => 'Õ‰',
  45374. 'Õº' => 'ÕŠ',
  45375. 'Õ»' => 'Õ‹',
  45376. 'ռ' => 'Ռ',
  45377. 'Õ½' => 'Õ�',
  45378. 'Õ¾' => 'ÕŽ',
  45379. 'Õ¿' => 'Õ�',
  45380. 'Ö€' => 'Õ�',
  45381. 'Ö�' => 'Õ‘',
  45382. 'Ö‚' => 'Õ’',
  45383. 'Öƒ' => 'Õ“',
  45384. 'Ö„' => 'Õ”',
  45385. 'Ö…' => 'Õ•',
  45386. 'Ö†' => 'Õ–',
  45387. 'ᵹ' => '�',
  45388. 'áµ½' => 'â±£',
  45389. '�' => 'Ḁ',
  45390. 'ḃ' => 'Ḃ',
  45391. 'ḅ' => 'Ḅ',
  45392. 'ḇ' => 'Ḇ',
  45393. 'ḉ' => 'Ḉ',
  45394. 'ḋ' => 'Ḋ',
  45395. '�' => 'Ḍ',
  45396. '�' => 'Ḏ',
  45397. 'ḑ' => '�',
  45398. 'ḓ' => 'Ḓ',
  45399. 'ḕ' => 'Ḕ',
  45400. 'ḗ' => 'Ḗ',
  45401. 'ḙ' => 'Ḙ',
  45402. 'ḛ' => 'Ḛ',
  45403. '�' => 'Ḝ',
  45404. 'ḟ' => 'Ḟ',
  45405. 'ḡ' => 'Ḡ',
  45406. 'ḣ' => 'Ḣ',
  45407. 'ḥ' => 'Ḥ',
  45408. 'ḧ' => 'Ḧ',
  45409. 'ḩ' => 'Ḩ',
  45410. 'ḫ' => 'Ḫ',
  45411. 'ḭ' => 'Ḭ',
  45412. 'ḯ' => 'Ḯ',
  45413. 'ḱ' => 'Ḱ',
  45414. 'ḳ' => 'Ḳ',
  45415. 'ḵ' => 'Ḵ',
  45416. 'ḷ' => 'Ḷ',
  45417. 'ḹ' => 'Ḹ',
  45418. 'ḻ' => 'Ḻ',
  45419. 'ḽ' => 'Ḽ',
  45420. 'ḿ' => 'Ḿ',
  45421. '�' => 'Ṁ',
  45422. 'ṃ' => 'Ṃ',
  45423. 'ṅ' => 'Ṅ',
  45424. 'ṇ' => 'Ṇ',
  45425. 'ṉ' => 'Ṉ',
  45426. 'ṋ' => 'Ṋ',
  45427. '�' => 'Ṍ',
  45428. '�' => 'Ṏ',
  45429. 'ṑ' => '�',
  45430. 'ṓ' => 'Ṓ',
  45431. 'ṕ' => 'Ṕ',
  45432. 'á¹—' => 'á¹–',
  45433. 'ṙ' => 'Ṙ',
  45434. 'ṛ' => 'Ṛ',
  45435. '�' => 'Ṝ',
  45436. 'ṟ' => 'Ṟ',
  45437. 'ṡ' => 'Ṡ',
  45438. 'á¹£' => 'á¹¢',
  45439. 'ṥ' => 'Ṥ',
  45440. 'ṧ' => 'Ṧ',
  45441. 'ṩ' => 'Ṩ',
  45442. 'ṫ' => 'Ṫ',
  45443. 'ṭ' => 'Ṭ',
  45444. 'ṯ' => 'Ṯ',
  45445. 'á¹±' => 'á¹°',
  45446. 'á¹³' => 'á¹²',
  45447. 'á¹µ' => 'á¹´',
  45448. 'ṷ' => 'Ṷ',
  45449. 'ṹ' => 'Ṹ',
  45450. 'ṻ' => 'Ṻ',
  45451. 'á¹½' => 'á¹¼',
  45452. 'ṿ' => 'Ṿ',
  45453. '�' => 'Ẁ',
  45454. 'ẃ' => 'Ẃ',
  45455. 'ẅ' => 'Ẅ',
  45456. 'ẇ' => 'Ẇ',
  45457. 'ẉ' => 'Ẉ',
  45458. 'ẋ' => 'Ẋ',
  45459. '�' => 'Ẍ',
  45460. '�' => 'Ẏ',
  45461. 'ẑ' => '�',
  45462. 'ẓ' => 'Ẓ',
  45463. 'ẕ' => 'Ẕ',
  45464. 'ẛ' => 'Ṡ',
  45465. 'ạ' => 'Ạ',
  45466. 'ả' => 'Ả',
  45467. 'ấ' => 'Ấ',
  45468. 'ầ' => 'Ầ',
  45469. 'ẩ' => 'Ẩ',
  45470. 'ẫ' => 'Ẫ',
  45471. 'ậ' => 'Ậ',
  45472. 'ắ' => 'Ắ',
  45473. 'ằ' => 'Ằ',
  45474. 'ẳ' => 'Ẳ',
  45475. 'ẵ' => 'Ẵ',
  45476. 'ặ' => 'Ặ',
  45477. 'ẹ' => 'Ẹ',
  45478. 'ẻ' => 'Ẻ',
  45479. 'ẽ' => 'Ẽ',
  45480. 'ế' => 'Ế',
  45481. '�' => 'Ề',
  45482. 'ể' => 'Ể',
  45483. 'ễ' => 'Ễ',
  45484. 'ệ' => 'Ệ',
  45485. 'ỉ' => 'Ỉ',
  45486. 'ị' => 'Ị',
  45487. '�' => 'Ọ',
  45488. '�' => 'Ỏ',
  45489. 'ố' => '�',
  45490. 'ồ' => 'Ồ',
  45491. 'ổ' => 'Ổ',
  45492. 'á»—' => 'á»–',
  45493. 'ộ' => 'Ộ',
  45494. 'ớ' => 'Ớ',
  45495. '�' => 'Ờ',
  45496. 'ở' => 'Ở',
  45497. 'ỡ' => 'Ỡ',
  45498. 'ợ' => 'Ợ',
  45499. 'ụ' => 'Ụ',
  45500. 'ủ' => 'Ủ',
  45501. 'ứ' => 'Ứ',
  45502. 'ừ' => 'Ừ',
  45503. 'ử' => 'Ử',
  45504. 'ữ' => 'Ữ',
  45505. 'á»±' => 'á»°',
  45506. 'ỳ' => 'Ỳ',
  45507. 'ỵ' => 'Ỵ',
  45508. 'ỷ' => 'Ỷ',
  45509. 'ỹ' => 'Ỹ',
  45510. 'ỻ' => 'Ỻ',
  45511. 'ỽ' => 'Ỽ',
  45512. 'ỿ' => 'Ỿ',
  45513. 'ἀ' => 'Ἀ',
  45514. '�' => 'Ἁ',
  45515. 'ἂ' => 'Ἂ',
  45516. 'ἃ' => 'Ἃ',
  45517. 'ἄ' => 'Ἄ',
  45518. 'ἅ' => '�',
  45519. 'ἆ' => 'Ἆ',
  45520. 'ἇ' => '�',
  45521. '�' => 'Ἐ',
  45522. 'ἑ' => 'Ἑ',
  45523. 'ἒ' => 'Ἒ',
  45524. 'ἓ' => 'Ἓ',
  45525. 'ἔ' => 'Ἔ',
  45526. 'ἕ' => '�',
  45527. 'ἠ' => 'Ἠ',
  45528. 'ἡ' => 'Ἡ',
  45529. 'ἢ' => 'Ἢ',
  45530. 'ἣ' => 'Ἣ',
  45531. 'ἤ' => 'Ἤ',
  45532. 'á¼¥' => 'á¼­',
  45533. 'ἦ' => 'Ἦ',
  45534. 'ἧ' => 'Ἧ',
  45535. 'ἰ' => 'Ἰ',
  45536. 'á¼±' => 'á¼¹',
  45537. 'ἲ' => 'Ἲ',
  45538. 'á¼³' => 'á¼»',
  45539. 'á¼´' => 'á¼¼',
  45540. 'á¼µ' => 'á¼½',
  45541. 'ἶ' => 'Ἶ',
  45542. 'ἷ' => 'Ἷ',
  45543. 'ὀ' => 'Ὀ',
  45544. '�' => 'Ὁ',
  45545. 'ὂ' => 'Ὂ',
  45546. 'ὃ' => 'Ὃ',
  45547. 'ὄ' => 'Ὄ',
  45548. 'ὅ' => '�',
  45549. 'ὑ' => 'Ὑ',
  45550. 'ὓ' => 'Ὓ',
  45551. 'ὕ' => '�',
  45552. 'ὗ' => 'Ὗ',
  45553. 'ὠ' => 'Ὠ',
  45554. 'ὡ' => 'Ὡ',
  45555. 'ὢ' => 'Ὢ',
  45556. 'ὣ' => 'Ὣ',
  45557. 'ὤ' => 'Ὤ',
  45558. 'á½¥' => 'á½­',
  45559. 'ὦ' => 'Ὦ',
  45560. 'ὧ' => 'Ὧ',
  45561. 'ὰ' => 'Ὰ',
  45562. 'á½±' => 'á¾»',
  45563. 'ὲ' => 'Ὲ',
  45564. 'έ' => 'Έ',
  45565. 'á½´' => 'á¿Š',
  45566. 'á½µ' => 'á¿‹',
  45567. 'ὶ' => 'Ὶ',
  45568. 'á½·' => 'á¿›',
  45569. 'ὸ' => 'Ὸ',
  45570. 'ό' => 'Ό',
  45571. 'ὺ' => 'Ὺ',
  45572. 'á½»' => 'á¿«',
  45573. 'ὼ' => 'Ὼ',
  45574. 'á½½' => 'á¿»',
  45575. 'ᾀ' => 'ᾈ',
  45576. '�' => 'ᾉ',
  45577. 'ᾂ' => 'ᾊ',
  45578. 'ᾃ' => 'ᾋ',
  45579. 'ᾄ' => 'ᾌ',
  45580. 'ᾅ' => '�',
  45581. 'ᾆ' => 'ᾎ',
  45582. 'ᾇ' => '�',
  45583. '�' => 'ᾘ',
  45584. 'ᾑ' => 'ᾙ',
  45585. 'ᾒ' => 'ᾚ',
  45586. 'ᾓ' => 'ᾛ',
  45587. 'ᾔ' => 'ᾜ',
  45588. 'ᾕ' => '�',
  45589. 'ᾖ' => 'ᾞ',
  45590. 'ᾗ' => 'ᾟ',
  45591. 'ᾠ' => 'ᾨ',
  45592. 'ᾡ' => 'ᾩ',
  45593. 'ᾢ' => 'ᾪ',
  45594. 'ᾣ' => 'ᾫ',
  45595. 'ᾤ' => 'ᾬ',
  45596. 'á¾¥' => 'á¾­',
  45597. 'ᾦ' => 'ᾮ',
  45598. 'ᾧ' => 'ᾯ',
  45599. 'ᾰ' => 'Ᾰ',
  45600. 'á¾±' => 'á¾¹',
  45601. 'á¾³' => 'á¾¼',
  45602. 'ι' => 'Ι',
  45603. 'ῃ' => 'ῌ',
  45604. '�' => 'Ῐ',
  45605. 'á¿‘' => 'á¿™',
  45606. 'ῠ' => 'Ῠ',
  45607. 'á¿¡' => 'á¿©',
  45608. 'ῥ' => 'Ῥ',
  45609. 'ῳ' => 'ῼ',
  45610. 'ⅎ' => 'Ⅎ',
  45611. 'â…°' => 'â… ',
  45612. 'â…±' => 'â…¡',
  45613. 'â…²' => 'â…¢',
  45614. 'â…³' => 'â…£',
  45615. 'â…´' => 'â…¤',
  45616. 'â…µ' => 'â…¥',
  45617. 'â…¶' => 'â…¦',
  45618. 'â…·' => 'â…§',
  45619. 'â…¸' => 'â…¨',
  45620. 'â…¹' => 'â…©',
  45621. 'â…º' => 'â…ª',
  45622. 'â…»' => 'â…«',
  45623. 'â…¼' => 'â…¬',
  45624. 'â…½' => 'â…­',
  45625. 'â…¾' => 'â…®',
  45626. 'â…¿' => 'â…¯',
  45627. 'ↄ' => 'Ↄ',
  45628. '�' => 'Ⓐ',
  45629. 'â“‘' => 'â’·',
  45630. 'â“’' => 'â’¸',
  45631. 'â““' => 'â’¹',
  45632. 'â“”' => 'â’º',
  45633. 'â“•' => 'â’»',
  45634. 'â“–' => 'â’¼',
  45635. 'â“—' => 'â’½',
  45636. 'ⓘ' => 'Ⓘ',
  45637. 'â“™' => 'â’¿',
  45638. 'â“š' => 'â“€',
  45639. 'ⓛ' => '�',
  45640. 'ⓜ' => 'Ⓜ',
  45641. '�' => 'Ⓝ',
  45642. 'â“ž' => 'â“„',
  45643. 'â“Ÿ' => 'â“…',
  45644. 'ⓠ' => 'Ⓠ',
  45645. 'ⓡ' => 'Ⓡ',
  45646. 'ⓢ' => 'Ⓢ',
  45647. 'ⓣ' => 'Ⓣ',
  45648. 'ⓤ' => 'Ⓤ',
  45649. 'â“¥' => 'â“‹',
  45650. 'ⓦ' => 'Ⓦ',
  45651. 'ⓧ' => '�',
  45652. 'ⓨ' => 'Ⓨ',
  45653. 'ⓩ' => '�',
  45654. 'â°°' => 'â°€',
  45655. 'â°±' => 'â°�',
  45656. 'â°²' => 'â°‚',
  45657. 'â°³' => 'â°ƒ',
  45658. 'â°´' => 'â°„',
  45659. 'â°µ' => 'â°…',
  45660. 'â°¶' => 'â°†',
  45661. 'â°·' => 'â°‡',
  45662. 'â°¸' => 'â°ˆ',
  45663. 'â°¹' => 'â°‰',
  45664. 'â°º' => 'â°Š',
  45665. 'â°»' => 'â°‹',
  45666. 'ⰼ' => 'Ⰼ',
  45667. 'â°½' => 'â°�',
  45668. 'â°¾' => 'â°Ž',
  45669. 'â°¿' => 'â°�',
  45670. 'â±€' => 'â°�',
  45671. '�' => 'Ⱁ',
  45672. 'ⱂ' => 'Ⱂ',
  45673. 'ⱃ' => 'Ⱃ',
  45674. 'ⱄ' => 'Ⱄ',
  45675. 'â±…' => 'â°•',
  45676. 'ⱆ' => 'Ⱆ',
  45677. 'ⱇ' => 'Ⱇ',
  45678. 'ⱈ' => 'Ⱈ',
  45679. 'ⱉ' => 'Ⱉ',
  45680. 'ⱊ' => 'Ⱊ',
  45681. 'ⱋ' => 'Ⱋ',
  45682. 'ⱌ' => 'Ⱌ',
  45683. '�' => '�',
  45684. 'ⱎ' => 'Ⱎ',
  45685. '�' => 'Ⱏ',
  45686. '�' => 'Ⱐ',
  45687. 'ⱑ' => 'Ⱑ',
  45688. 'â±’' => 'â°¢',
  45689. 'ⱓ' => 'Ⱓ',
  45690. 'â±”' => 'â°¤',
  45691. 'ⱕ' => 'Ⱕ',
  45692. 'â±–' => 'â°¦',
  45693. 'â±—' => 'â°§',
  45694. 'ⱘ' => 'Ⱘ',
  45695. 'â±™' => 'â°©',
  45696. 'ⱚ' => 'Ⱚ',
  45697. 'â±›' => 'â°«',
  45698. 'ⱜ' => 'Ⱜ',
  45699. '�' => 'Ⱝ',
  45700. 'ⱞ' => 'Ⱞ',
  45701. 'ⱡ' => 'Ⱡ',
  45702. 'ⱥ' => 'Ⱥ',
  45703. 'ⱦ' => 'Ⱦ',
  45704. 'ⱨ' => 'Ⱨ',
  45705. 'ⱪ' => 'Ⱪ',
  45706. 'ⱬ' => 'Ⱬ',
  45707. 'â±³' => 'â±²',
  45708. 'ⱶ' => 'Ⱶ',
  45709. '�' => 'Ⲁ',
  45710. 'ⲃ' => 'Ⲃ',
  45711. 'ⲅ' => 'Ⲅ',
  45712. 'ⲇ' => 'Ⲇ',
  45713. 'ⲉ' => 'Ⲉ',
  45714. 'ⲋ' => 'Ⲋ',
  45715. '�' => 'Ⲍ',
  45716. '�' => 'Ⲏ',
  45717. 'ⲑ' => '�',
  45718. 'ⲓ' => 'Ⲓ',
  45719. 'ⲕ' => 'Ⲕ',
  45720. 'â²—' => 'â²–',
  45721. 'ⲙ' => 'Ⲙ',
  45722. 'ⲛ' => 'Ⲛ',
  45723. '�' => 'Ⲝ',
  45724. 'ⲟ' => 'Ⲟ',
  45725. 'ⲡ' => 'Ⲡ',
  45726. 'â²£' => 'â²¢',
  45727. 'ⲥ' => 'Ⲥ',
  45728. 'ⲧ' => 'Ⲧ',
  45729. 'ⲩ' => 'Ⲩ',
  45730. 'ⲫ' => 'Ⲫ',
  45731. 'ⲭ' => 'Ⲭ',
  45732. 'ⲯ' => 'Ⲯ',
  45733. 'â²±' => 'â²°',
  45734. 'â²³' => 'â²²',
  45735. 'â²µ' => 'â²´',
  45736. 'ⲷ' => 'Ⲷ',
  45737. 'ⲹ' => 'Ⲹ',
  45738. 'ⲻ' => 'Ⲻ',
  45739. 'â²½' => 'â²¼',
  45740. 'ⲿ' => 'Ⲿ',
  45741. '�' => 'Ⳁ',
  45742. 'ⳃ' => 'Ⳃ',
  45743. 'ⳅ' => 'Ⳅ',
  45744. 'ⳇ' => 'Ⳇ',
  45745. 'ⳉ' => 'Ⳉ',
  45746. 'ⳋ' => 'Ⳋ',
  45747. '�' => 'Ⳍ',
  45748. '�' => 'Ⳏ',
  45749. 'ⳑ' => '�',
  45750. 'ⳓ' => 'Ⳓ',
  45751. 'ⳕ' => 'Ⳕ',
  45752. 'â³—' => 'â³–',
  45753. 'ⳙ' => 'Ⳙ',
  45754. 'ⳛ' => 'Ⳛ',
  45755. '�' => 'Ⳝ',
  45756. 'ⳟ' => 'Ⳟ',
  45757. 'ⳡ' => 'Ⳡ',
  45758. 'â³£' => 'â³¢',
  45759. 'ⳬ' => 'Ⳬ',
  45760. 'â³®' => 'â³­',
  45761. 'â³³' => 'â³²',
  45762. 'â´€' => 'á‚ ',
  45763. 'â´�' => 'á‚¡',
  45764. 'â´‚' => 'á‚¢',
  45765. 'â´ƒ' => 'á‚£',
  45766. 'ⴄ' => 'Ⴄ',
  45767. 'â´…' => 'á‚¥',
  45768. 'ⴆ' => 'Ⴆ',
  45769. 'ⴇ' => 'Ⴇ',
  45770. 'ⴈ' => 'Ⴈ',
  45771. 'â´‰' => 'á‚©',
  45772. 'ⴊ' => 'Ⴊ',
  45773. 'â´‹' => 'á‚«',
  45774. 'ⴌ' => 'Ⴌ',
  45775. 'â´�' => 'á‚­',
  45776. 'â´Ž' => 'á‚®',
  45777. '�' => 'Ⴏ',
  45778. 'â´�' => 'á‚°',
  45779. 'ⴑ' => 'Ⴑ',
  45780. 'ⴒ' => 'Ⴒ',
  45781. 'ⴓ' => 'Ⴓ',
  45782. 'â´”' => 'á‚´',
  45783. 'ⴕ' => 'Ⴕ',
  45784. 'ⴖ' => 'Ⴖ',
  45785. 'â´—' => 'á‚·',
  45786. 'ⴘ' => 'Ⴘ',
  45787. 'ⴙ' => 'Ⴙ',
  45788. 'ⴚ' => 'Ⴚ',
  45789. 'â´›' => 'á‚»',
  45790. 'ⴜ' => 'Ⴜ',
  45791. '�' => 'Ⴝ',
  45792. 'ⴞ' => 'Ⴞ',
  45793. 'â´Ÿ' => 'á‚¿',
  45794. 'ⴠ' => 'Ⴠ',
  45795. 'ⴡ' => '�',
  45796. 'ⴢ' => 'Ⴢ',
  45797. 'ⴣ' => 'Ⴣ',
  45798. 'ⴤ' => 'Ⴤ',
  45799. 'ⴥ' => 'Ⴥ',
  45800. 'ⴧ' => 'Ⴧ',
  45801. 'ⴭ' => '�',
  45802. '�' => 'Ꙁ',
  45803. 'ꙃ' => 'Ꙃ',
  45804. 'ꙅ' => 'Ꙅ',
  45805. 'ꙇ' => 'Ꙇ',
  45806. 'ꙉ' => 'Ꙉ',
  45807. 'ꙋ' => 'Ꙋ',
  45808. '�' => 'Ꙍ',
  45809. '�' => 'Ꙏ',
  45810. 'ꙑ' => '�',
  45811. 'ꙓ' => 'Ꙓ',
  45812. 'ꙕ' => 'Ꙕ',
  45813. 'ê™—' => 'ê™–',
  45814. 'ꙙ' => 'Ꙙ',
  45815. 'ꙛ' => 'Ꙛ',
  45816. '�' => 'Ꙝ',
  45817. 'ꙟ' => 'Ꙟ',
  45818. 'ꙡ' => 'Ꙡ',
  45819. 'ꙣ' => 'Ꙣ',
  45820. 'ꙥ' => 'Ꙥ',
  45821. 'ꙧ' => 'Ꙧ',
  45822. 'ꙩ' => 'Ꙩ',
  45823. 'ꙫ' => 'Ꙫ',
  45824. 'ꙭ' => 'Ꙭ',
  45825. '�' => 'Ꚁ',
  45826. 'ꚃ' => 'Ꚃ',
  45827. 'êš…' => 'êš„',
  45828. 'ꚇ' => 'Ꚇ',
  45829. 'ꚉ' => 'Ꚉ',
  45830. 'ꚋ' => 'Ꚋ',
  45831. '�' => 'Ꚍ',
  45832. '�' => 'Ꚏ',
  45833. 'ꚑ' => '�',
  45834. 'êš“' => 'êš’',
  45835. 'êš•' => 'êš”',
  45836. 'êš—' => 'êš–',
  45837. 'ꚙ' => 'Ꚙ',
  45838. 'êš›' => 'êšš',
  45839. 'ꜣ' => 'Ꜣ',
  45840. 'ꜥ' => 'Ꜥ',
  45841. 'ꜧ' => 'Ꜧ',
  45842. 'ꜩ' => 'Ꜩ',
  45843. 'ꜫ' => 'Ꜫ',
  45844. 'ꜭ' => 'Ꜭ',
  45845. 'ꜯ' => 'Ꜯ',
  45846. 'ꜳ' => 'Ꜳ',
  45847. 'ꜵ' => 'Ꜵ',
  45848. 'ꜷ' => 'Ꜷ',
  45849. 'ꜹ' => 'Ꜹ',
  45850. 'ꜻ' => 'Ꜻ',
  45851. 'ꜽ' => 'Ꜽ',
  45852. 'ꜿ' => 'Ꜿ',
  45853. '�' => '�',
  45854. '�' => '�',
  45855. '�' => '�',
  45856. '�' => '�',
  45857. '�' => '�',
  45858. '�' => '�',
  45859. '�' => '�',
  45860. '�' => '�',
  45861. '�' => '�',
  45862. '�' => '�',
  45863. '�' => '�',
  45864. '�' => '�',
  45865. '�' => '�',
  45866. '�' => '�',
  45867. '�' => '�',
  45868. '�' => '�',
  45869. '�' => '�',
  45870. '�' => '�',
  45871. '�' => '�',
  45872. '�' => '�',
  45873. '�' => '�',
  45874. '�' => '�',
  45875. '�' => '�',
  45876. '�' => '�',
  45877. '�' => '�',
  45878. '�' => '�',
  45879. '�' => '�',
  45880. '�' => 'Ꞁ',
  45881. 'ꞃ' => 'Ꞃ',
  45882. 'êž…' => 'êž„',
  45883. 'ꞇ' => 'Ꞇ',
  45884. 'ꞌ' => 'Ꞌ',
  45885. 'ꞑ' => '�',
  45886. 'êž“' => 'êž’',
  45887. 'êž—' => 'êž–',
  45888. 'ꞙ' => 'Ꞙ',
  45889. 'êž›' => 'êžš',
  45890. '�' => 'Ꞝ',
  45891. 'ꞟ' => 'Ꞟ',
  45892. 'êž¡' => 'êž ',
  45893. 'ꞣ' => 'Ꞣ',
  45894. 'ꞥ' => 'Ꞥ',
  45895. 'ꞧ' => 'Ꞧ',
  45896. 'ꞩ' => 'Ꞩ',
  45897. '�' => 'A',
  45898. 'b' => 'B',
  45899. 'c' => 'C',
  45900. 'd' => 'D',
  45901. 'ï½…' => 'ï¼¥',
  45902. 'f' => 'F',
  45903. 'g' => 'G',
  45904. 'h' => 'H',
  45905. 'i' => 'I',
  45906. 'j' => 'J',
  45907. 'k' => 'K',
  45908. 'l' => 'L',
  45909. '�' => 'M',
  45910. 'n' => 'N',
  45911. '�' => 'O',
  45912. '�' => 'P',
  45913. 'q' => 'Q',
  45914. 'ï½’' => 'ï¼²',
  45915. 's' => 'S',
  45916. 'ï½”' => 'ï¼´',
  45917. 'u' => 'U',
  45918. 'v' => 'V',
  45919. 'ï½—' => 'ï¼·',
  45920. 'x' => 'X',
  45921. 'ï½™' => 'ï¼¹',
  45922. 'z' => 'Z',
  45923. '�' => '�',
  45924. '�' => '�',
  45925. '�' => '�',
  45926. '�' => '�',
  45927. '�' => '�',
  45928. '�' => '�',
  45929. '�' => '�',
  45930. '�' => '�',
  45931. '�' => '�',
  45932. '�' => '�',
  45933. '�' => '�',
  45934. '�' => '�',
  45935. '�' => '�',
  45936. '�' => '�',
  45937. '�' => '�',
  45938. '�' => '�',
  45939. '�' => '�',
  45940. '�' => '�',
  45941. '�' => '�',
  45942. '�' => '�',
  45943. '�' => '�',
  45944. '�' => '�',
  45945. '�' => '�',
  45946. '�' => '�',
  45947. '�' => '�',
  45948. '�' => '�',
  45949. '�' => '�',
  45950. '�' => '�',
  45951. '�' => '�',
  45952. '�' => '�',
  45953. '�' => '�',
  45954. '�' => '�',
  45955. '�' => '�',
  45956. '�' => '�',
  45957. '�' => '�',
  45958. '�' => '�',
  45959. '�' => '�',
  45960. '�' => '�',
  45961. '�' => '�',
  45962. '�' => '�',
  45963. 'ð‘£€' => 'ð‘¢ ',
  45964. '�' => '𑢡',
  45965. '𑣂' => '𑢢',
  45966. '𑣃' => '𑢣',
  45967. '𑣄' => '𑢤',
  45968. 'ð‘£…' => 'ð‘¢¥',
  45969. '𑣆' => '𑢦',
  45970. '𑣇' => '𑢧',
  45971. '𑣈' => '𑢨',
  45972. '𑣉' => '𑢩',
  45973. '𑣊' => '𑢪',
  45974. '𑣋' => '𑢫',
  45975. '𑣌' => '𑢬',
  45976. '�' => '𑢭',
  45977. '𑣎' => '𑢮',
  45978. '�' => '𑢯',
  45979. '�' => '𑢰',
  45980. '𑣑' => '𑢱',
  45981. 'ð‘£’' => 'ð‘¢²',
  45982. '𑣓' => '𑢳',
  45983. 'ð‘£”' => 'ð‘¢´',
  45984. '𑣕' => '𑢵',
  45985. '𑣖' => '𑢶',
  45986. 'ð‘£—' => 'ð‘¢·',
  45987. '𑣘' => '𑢸',
  45988. 'ð‘£™' => 'ð‘¢¹',
  45989. '𑣚' => '𑢺',
  45990. 'ð‘£›' => 'ð‘¢»',
  45991. '𑣜' => '𑢼',
  45992. '�' => '𑢽',
  45993. '𑣞' => '𑢾',
  45994. '𑣟' => '𑢿',
  45995. );
  45996. <?php
  45997. use Symfony\Polyfill\Mbstring as p;
  45998. if (!function_exists('mb_strlen')) {
  45999. define('MB_CASE_UPPER', 0);
  46000. define('MB_CASE_LOWER', 1);
  46001. define('MB_CASE_TITLE', 2);
  46002. function mb_convert_encoding($s, $to, $from = null) { return p\Mbstring::mb_convert_encoding($s, $to, $from); }
  46003. function mb_decode_mimeheader($s) { return p\Mbstring::mb_decode_mimeheader($s); }
  46004. function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) { return p\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); }
  46005. function mb_decode_numericentity($s, $convmap, $enc = null) { return p\Mbstring::mb_decode_numericentity($s, $convmap, $enc); }
  46006. function mb_encode_numericentity($s, $convmap, $enc = null, $is_hex = false) { return p\Mbstring::mb_encode_numericentity($s, $convmap, $enc, $is_hex); }
  46007. function mb_convert_case($s, $mode, $enc = null) { return p\Mbstring::mb_convert_case($s, $mode, $enc); }
  46008. function mb_internal_encoding($enc = null) { return p\Mbstring::mb_internal_encoding($enc); }
  46009. function mb_language($lang = null) { return p\Mbstring::mb_language($lang); }
  46010. function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); }
  46011. function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); }
  46012. function mb_check_encoding($var = null, $encoding = null) { return p\Mbstring::mb_check_encoding($var, $encoding); }
  46013. function mb_detect_encoding($str, $encodingList = null, $strict = false) { return p\Mbstring::mb_detect_encoding($str, $encodingList, $strict); }
  46014. function mb_detect_order($encodingList = null) { return p\Mbstring::mb_detect_order($encodingList); }
  46015. function mb_parse_str($s, &$result = array()) { parse_str($s, $result); }
  46016. function mb_strlen($s, $enc = null) { return p\Mbstring::mb_strlen($s, $enc); }
  46017. function mb_strpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strpos($s, $needle, $offset, $enc); }
  46018. function mb_strtolower($s, $enc = null) { return p\Mbstring::mb_strtolower($s, $enc); }
  46019. function mb_strtoupper($s, $enc = null) { return p\Mbstring::mb_strtoupper($s, $enc); }
  46020. function mb_substitute_character($char = null) { return p\Mbstring::mb_substitute_character($char); }
  46021. function mb_substr($s, $start, $length = 2147483647, $enc = null) { return p\Mbstring::mb_substr($s, $start, $length, $enc); }
  46022. function mb_stripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_stripos($s, $needle, $offset, $enc); }
  46023. function mb_stristr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_stristr($s, $needle, $part, $enc); }
  46024. function mb_strrchr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrchr($s, $needle, $part, $enc); }
  46025. function mb_strrichr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrichr($s, $needle, $part, $enc); }
  46026. function mb_strripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strripos($s, $needle, $offset, $enc); }
  46027. function mb_strrpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strrpos($s, $needle, $offset, $enc); }
  46028. function mb_strstr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strstr($s, $needle, $part, $enc); }
  46029. function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); }
  46030. function mb_http_output($enc = null) { return p\Mbstring::mb_http_output($enc); }
  46031. function mb_strwidth($s, $enc = null) { return p\Mbstring::mb_strwidth($s, $enc); }
  46032. function mb_substr_count($haystack, $needle, $enc = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $enc); }
  46033. function mb_output_handler($contents, $status) { return p\Mbstring::mb_output_handler($contents, $status); }
  46034. function mb_http_input($type = '') { return p\Mbstring::mb_http_input($type); }
  46035. 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); }
  46036. }
  46037. if (!function_exists('mb_chr')) {
  46038. function mb_ord($s, $enc = null) { return p\Mbstring::mb_ord($s, $enc); }
  46039. function mb_chr($code, $enc = null) { return p\Mbstring::mb_chr($code, $enc); }
  46040. function mb_scrub($s, $enc = null) { $enc = null === $enc ? mb_internal_encoding() : $enc; return mb_convert_encoding($s, $enc, $enc); }
  46041. }
  46042. if (!function_exists('mb_str_split')) {
  46043. function mb_str_split($string, $split_length = 1, $encoding = null) { return p\Mbstring::mb_str_split($string, $split_length, $encoding); }
  46044. }
  46045. <?php
  46046. namespace Symfony\Component\Process\Exception;
  46047. interface ExceptionInterface
  46048. {
  46049. }
  46050. <?php
  46051. namespace Symfony\Component\Process\Exception;
  46052. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  46053. {
  46054. }
  46055. <?php
  46056. namespace Symfony\Component\Process\Exception;
  46057. class LogicException extends \LogicException implements ExceptionInterface
  46058. {
  46059. }
  46060. <?php
  46061. namespace Symfony\Component\Process\Exception;
  46062. use Symfony\Component\Process\Process;
  46063. class ProcessFailedException extends RuntimeException
  46064. {
  46065. private $process;
  46066. public function __construct(Process $process)
  46067. {
  46068. if ($process->isSuccessful()) {
  46069. throw new InvalidArgumentException('Expected a failed process, but the given process was successful.');
  46070. }
  46071. $error = sprintf('The command "%s" failed.'."\n\nExit Code: %s(%s)\n\nWorking directory: %s",
  46072. $process->getCommandLine(),
  46073. $process->getExitCode(),
  46074. $process->getExitCodeText(),
  46075. $process->getWorkingDirectory()
  46076. );
  46077. if (!$process->isOutputDisabled()) {
  46078. $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s",
  46079. $process->getOutput(),
  46080. $process->getErrorOutput()
  46081. );
  46082. }
  46083. parent::__construct($error);
  46084. $this->process = $process;
  46085. }
  46086. public function getProcess()
  46087. {
  46088. return $this->process;
  46089. }
  46090. }
  46091. <?php
  46092. namespace Symfony\Component\Process\Exception;
  46093. use Symfony\Component\Process\Process;
  46094. class ProcessTimedOutException extends RuntimeException
  46095. {
  46096. const TYPE_GENERAL = 1;
  46097. const TYPE_IDLE = 2;
  46098. private $process;
  46099. private $timeoutType;
  46100. public function __construct(Process $process, $timeoutType)
  46101. {
  46102. $this->process = $process;
  46103. $this->timeoutType = $timeoutType;
  46104. parent::__construct(sprintf(
  46105. 'The process "%s" exceeded the timeout of %s seconds.',
  46106. $process->getCommandLine(),
  46107. $this->getExceededTimeout()
  46108. ));
  46109. }
  46110. public function getProcess()
  46111. {
  46112. return $this->process;
  46113. }
  46114. public function isGeneralTimeout()
  46115. {
  46116. return self::TYPE_GENERAL === $this->timeoutType;
  46117. }
  46118. public function isIdleTimeout()
  46119. {
  46120. return self::TYPE_IDLE === $this->timeoutType;
  46121. }
  46122. public function getExceededTimeout()
  46123. {
  46124. switch ($this->timeoutType) {
  46125. case self::TYPE_GENERAL:
  46126. return $this->process->getTimeout();
  46127. case self::TYPE_IDLE:
  46128. return $this->process->getIdleTimeout();
  46129. default:
  46130. throw new \LogicException(sprintf('Unknown timeout type "%d".', $this->timeoutType));
  46131. }
  46132. }
  46133. }
  46134. <?php
  46135. namespace Symfony\Component\Process\Exception;
  46136. class RuntimeException extends \RuntimeException implements ExceptionInterface
  46137. {
  46138. }
  46139. <?php
  46140. namespace Symfony\Component\Process;
  46141. class ExecutableFinder
  46142. {
  46143. private $suffixes = array('.exe', '.bat', '.cmd', '.com');
  46144. public function setSuffixes(array $suffixes)
  46145. {
  46146. $this->suffixes = $suffixes;
  46147. }
  46148. public function addSuffix($suffix)
  46149. {
  46150. $this->suffixes[] = $suffix;
  46151. }
  46152. public function find($name, $default = null, array $extraDirs = array())
  46153. {
  46154. if (ini_get('open_basedir')) {
  46155. $searchPath = explode(PATH_SEPARATOR, ini_get('open_basedir'));
  46156. $dirs = array();
  46157. foreach ($searchPath as $path) {
  46158. if (@is_dir($path)) {
  46159. $dirs[] = $path;
  46160. } else {
  46161. if (basename($path) == $name && @is_executable($path)) {
  46162. return $path;
  46163. }
  46164. }
  46165. }
  46166. } else {
  46167. $dirs = array_merge(
  46168. explode(PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),
  46169. $extraDirs
  46170. );
  46171. }
  46172. $suffixes = array('');
  46173. if ('\\' === \DIRECTORY_SEPARATOR) {
  46174. $pathExt = getenv('PATHEXT');
  46175. $suffixes = array_merge($pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes, $suffixes);
  46176. }
  46177. foreach ($suffixes as $suffix) {
  46178. foreach ($dirs as $dir) {
  46179. if (@is_file($file = $dir.\DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === \DIRECTORY_SEPARATOR || @is_executable($file))) {
  46180. return $file;
  46181. }
  46182. }
  46183. }
  46184. return $default;
  46185. }
  46186. }
  46187. Copyright (c) 2004-2018 Fabien Potencier
  46188. Permission is hereby granted, free of charge, to any person obtaining a copy
  46189. of this software and associated documentation files (the "Software"), to deal
  46190. in the Software without restriction, including without limitation the rights
  46191. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  46192. copies of the Software, and to permit persons to whom the Software is furnished
  46193. to do so, subject to the following conditions:
  46194. The above copyright notice and this permission notice shall be included in all
  46195. copies or substantial portions of the Software.
  46196. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  46197. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  46198. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  46199. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  46200. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  46201. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  46202. THE SOFTWARE.
  46203. <?php
  46204. namespace Symfony\Component\Process;
  46205. class PhpExecutableFinder
  46206. {
  46207. private $executableFinder;
  46208. public function __construct()
  46209. {
  46210. $this->executableFinder = new ExecutableFinder();
  46211. }
  46212. public function find($includeArgs = true)
  46213. {
  46214. $args = $this->findArguments();
  46215. $args = $includeArgs && $args ? ' '.implode(' ', $args) : '';
  46216. if (\defined('HHVM_VERSION')) {
  46217. return (getenv('PHP_BINARY') ?: PHP_BINARY).$args;
  46218. }
  46219. if (\defined('PHP_BINARY') && PHP_BINARY && \in_array(\PHP_SAPI, array('cli', 'cli-server', 'phpdbg'), true)) {
  46220. return PHP_BINARY.$args;
  46221. }
  46222. if ($php = getenv('PHP_PATH')) {
  46223. if (!@is_executable($php)) {
  46224. return false;
  46225. }
  46226. return $php;
  46227. }
  46228. if ($php = getenv('PHP_PEAR_PHP_BIN')) {
  46229. if (@is_executable($php)) {
  46230. return $php;
  46231. }
  46232. }
  46233. if (@is_executable($php = PHP_BINDIR.('\\' === \DIRECTORY_SEPARATOR ? '\\php.exe' : '/php'))) {
  46234. return $php;
  46235. }
  46236. $dirs = array(PHP_BINDIR);
  46237. if ('\\' === \DIRECTORY_SEPARATOR) {
  46238. $dirs[] = 'C:\xampp\php\\';
  46239. }
  46240. return $this->executableFinder->find('php', false, $dirs);
  46241. }
  46242. public function findArguments()
  46243. {
  46244. $arguments = array();
  46245. if (\defined('HHVM_VERSION')) {
  46246. $arguments[] = '--php';
  46247. } elseif ('phpdbg' === \PHP_SAPI) {
  46248. $arguments[] = '-qrr';
  46249. }
  46250. return $arguments;
  46251. }
  46252. }
  46253. <?php
  46254. namespace Symfony\Component\Process;
  46255. use Symfony\Component\Process\Exception\RuntimeException;
  46256. class PhpProcess extends Process
  46257. {
  46258. public function __construct($script, $cwd = null, array $env = null, $timeout = 60, array $options = array())
  46259. {
  46260. $executableFinder = new PhpExecutableFinder();
  46261. if (false === $php = $executableFinder->find()) {
  46262. $php = null;
  46263. }
  46264. if ('phpdbg' === \PHP_SAPI) {
  46265. $file = tempnam(sys_get_temp_dir(), 'dbg');
  46266. file_put_contents($file, $script);
  46267. register_shutdown_function('unlink', $file);
  46268. $php .= ' '.ProcessUtils::escapeArgument($file);
  46269. $script = null;
  46270. }
  46271. if ('\\' !== \DIRECTORY_SEPARATOR && null !== $php) {
  46272. $php = 'exec '.$php;
  46273. }
  46274. parent::__construct($php, $cwd, $env, $script, $timeout, $options);
  46275. }
  46276. public function setPhpBinary($php)
  46277. {
  46278. $this->setCommandLine($php);
  46279. }
  46280. public function start($callback = null)
  46281. {
  46282. if (null === $this->getCommandLine()) {
  46283. throw new RuntimeException('Unable to find the PHP executable.');
  46284. }
  46285. parent::start($callback);
  46286. }
  46287. }
  46288. <?php
  46289. namespace Symfony\Component\Process\Pipes;
  46290. abstract class AbstractPipes implements PipesInterface
  46291. {
  46292. public $pipes = array();
  46293. private $inputBuffer = '';
  46294. private $input;
  46295. private $blocked = true;
  46296. private $lastError;
  46297. public function __construct($input)
  46298. {
  46299. if (\is_resource($input)) {
  46300. $this->input = $input;
  46301. } elseif (\is_string($input)) {
  46302. $this->inputBuffer = $input;
  46303. } else {
  46304. $this->inputBuffer = (string) $input;
  46305. }
  46306. }
  46307. public function close()
  46308. {
  46309. foreach ($this->pipes as $pipe) {
  46310. fclose($pipe);
  46311. }
  46312. $this->pipes = array();
  46313. }
  46314. protected function hasSystemCallBeenInterrupted()
  46315. {
  46316. $lastError = $this->lastError;
  46317. $this->lastError = null;
  46318. return null !== $lastError && false !== stripos($lastError, 'interrupted system call');
  46319. }
  46320. protected function unblock()
  46321. {
  46322. if (!$this->blocked) {
  46323. return;
  46324. }
  46325. foreach ($this->pipes as $pipe) {
  46326. stream_set_blocking($pipe, 0);
  46327. }
  46328. if (null !== $this->input) {
  46329. stream_set_blocking($this->input, 0);
  46330. }
  46331. $this->blocked = false;
  46332. }
  46333. protected function write()
  46334. {
  46335. if (!isset($this->pipes[0])) {
  46336. return;
  46337. }
  46338. $input = $this->input;
  46339. $r = $e = array();
  46340. $w = array($this->pipes[0]);
  46341. if (false === @stream_select($r, $w, $e, 0, 0)) {
  46342. return;
  46343. }
  46344. foreach ($w as $stdin) {
  46345. if (isset($this->inputBuffer[0])) {
  46346. $written = fwrite($stdin, $this->inputBuffer);
  46347. $this->inputBuffer = substr($this->inputBuffer, $written);
  46348. if (isset($this->inputBuffer[0])) {
  46349. return array($this->pipes[0]);
  46350. }
  46351. }
  46352. if ($input) {
  46353. for (;;) {
  46354. $data = fread($input, self::CHUNK_SIZE);
  46355. if (!isset($data[0])) {
  46356. break;
  46357. }
  46358. $written = fwrite($stdin, $data);
  46359. $data = substr($data, $written);
  46360. if (isset($data[0])) {
  46361. $this->inputBuffer = $data;
  46362. return array($this->pipes[0]);
  46363. }
  46364. }
  46365. if (feof($input)) {
  46366. $this->input = null;
  46367. }
  46368. }
  46369. }
  46370. if (null === $this->input && !isset($this->inputBuffer[0])) {
  46371. fclose($this->pipes[0]);
  46372. unset($this->pipes[0]);
  46373. } elseif (!$w) {
  46374. return array($this->pipes[0]);
  46375. }
  46376. }
  46377. public function handleError($type, $msg)
  46378. {
  46379. $this->lastError = $msg;
  46380. }
  46381. }
  46382. <?php
  46383. namespace Symfony\Component\Process\Pipes;
  46384. interface PipesInterface
  46385. {
  46386. const CHUNK_SIZE = 16384;
  46387. public function getDescriptors();
  46388. public function getFiles();
  46389. public function readAndWrite($blocking, $close = false);
  46390. public function areOpen();
  46391. public function close();
  46392. }
  46393. <?php
  46394. namespace Symfony\Component\Process\Pipes;
  46395. use Symfony\Component\Process\Process;
  46396. class UnixPipes extends AbstractPipes
  46397. {
  46398. private $ttyMode;
  46399. private $ptyMode;
  46400. private $disableOutput;
  46401. public function __construct($ttyMode, $ptyMode, $input, $disableOutput)
  46402. {
  46403. $this->ttyMode = (bool) $ttyMode;
  46404. $this->ptyMode = (bool) $ptyMode;
  46405. $this->disableOutput = (bool) $disableOutput;
  46406. parent::__construct($input);
  46407. }
  46408. public function __destruct()
  46409. {
  46410. $this->close();
  46411. }
  46412. public function getDescriptors()
  46413. {
  46414. if ($this->disableOutput) {
  46415. $nullstream = fopen('/dev/null', 'c');
  46416. return array(
  46417. array('pipe', 'r'),
  46418. $nullstream,
  46419. $nullstream,
  46420. );
  46421. }
  46422. if ($this->ttyMode) {
  46423. return array(
  46424. array('file', '/dev/tty', 'r'),
  46425. array('file', '/dev/tty', 'w'),
  46426. array('file', '/dev/tty', 'w'),
  46427. );
  46428. }
  46429. if ($this->ptyMode && Process::isPtySupported()) {
  46430. return array(
  46431. array('pty'),
  46432. array('pty'),
  46433. array('pty'),
  46434. );
  46435. }
  46436. return array(
  46437. array('pipe', 'r'),
  46438. array('pipe', 'w'),
  46439. array('pipe', 'w'),
  46440. );
  46441. }
  46442. public function getFiles()
  46443. {
  46444. return array();
  46445. }
  46446. public function readAndWrite($blocking, $close = false)
  46447. {
  46448. $this->unblock();
  46449. $w = $this->write();
  46450. $read = $e = array();
  46451. $r = $this->pipes;
  46452. unset($r[0]);
  46453. set_error_handler(array($this, 'handleError'));
  46454. if (($r || $w) && false === stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) {
  46455. restore_error_handler();
  46456. if (!$this->hasSystemCallBeenInterrupted()) {
  46457. $this->pipes = array();
  46458. }
  46459. return $read;
  46460. }
  46461. restore_error_handler();
  46462. foreach ($r as $pipe) {
  46463. $read[$type = array_search($pipe, $this->pipes, true)] = '';
  46464. do {
  46465. $data = fread($pipe, self::CHUNK_SIZE);
  46466. $read[$type] .= $data;
  46467. } while (isset($data[0]) && ($close || isset($data[self::CHUNK_SIZE - 1])));
  46468. if (!isset($read[$type][0])) {
  46469. unset($read[$type]);
  46470. }
  46471. if ($close && feof($pipe)) {
  46472. fclose($pipe);
  46473. unset($this->pipes[$type]);
  46474. }
  46475. }
  46476. return $read;
  46477. }
  46478. public function areOpen()
  46479. {
  46480. return (bool) $this->pipes;
  46481. }
  46482. public static function create(Process $process, $input)
  46483. {
  46484. return new static($process->isTty(), $process->isPty(), $input, $process->isOutputDisabled());
  46485. }
  46486. }
  46487. <?php
  46488. namespace Symfony\Component\Process\Pipes;
  46489. use Symfony\Component\Process\Exception\RuntimeException;
  46490. use Symfony\Component\Process\Process;
  46491. class WindowsPipes extends AbstractPipes
  46492. {
  46493. private $files = array();
  46494. private $fileHandles = array();
  46495. private $lockHandles = array();
  46496. private $readBytes = array(
  46497. Process::STDOUT => 0,
  46498. Process::STDERR => 0,
  46499. );
  46500. private $disableOutput;
  46501. public function __construct($disableOutput, $input)
  46502. {
  46503. $this->disableOutput = (bool) $disableOutput;
  46504. if (!$this->disableOutput) {
  46505. $pipes = array(
  46506. Process::STDOUT => Process::OUT,
  46507. Process::STDERR => Process::ERR,
  46508. );
  46509. $tmpDir = sys_get_temp_dir();
  46510. $lastError = 'unknown reason';
  46511. set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; });
  46512. for ($i = 0;; ++$i) {
  46513. foreach ($pipes as $pipe => $name) {
  46514. $file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name);
  46515. if (!$h = fopen($file.'.lock', 'w')) {
  46516. restore_error_handler();
  46517. throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s', $lastError));
  46518. }
  46519. if (!flock($h, LOCK_EX | LOCK_NB)) {
  46520. continue 2;
  46521. }
  46522. if (isset($this->lockHandles[$pipe])) {
  46523. flock($this->lockHandles[$pipe], LOCK_UN);
  46524. fclose($this->lockHandles[$pipe]);
  46525. }
  46526. $this->lockHandles[$pipe] = $h;
  46527. if (!fclose(fopen($file, 'w')) || !$h = fopen($file, 'r')) {
  46528. flock($this->lockHandles[$pipe], LOCK_UN);
  46529. fclose($this->lockHandles[$pipe]);
  46530. unset($this->lockHandles[$pipe]);
  46531. continue 2;
  46532. }
  46533. $this->fileHandles[$pipe] = $h;
  46534. $this->files[$pipe] = $file;
  46535. }
  46536. break;
  46537. }
  46538. restore_error_handler();
  46539. }
  46540. parent::__construct($input);
  46541. }
  46542. public function __destruct()
  46543. {
  46544. $this->close();
  46545. }
  46546. public function getDescriptors()
  46547. {
  46548. if ($this->disableOutput) {
  46549. $nullstream = fopen('NUL', 'c');
  46550. return array(
  46551. array('pipe', 'r'),
  46552. $nullstream,
  46553. $nullstream,
  46554. );
  46555. }
  46556. return array(
  46557. array('pipe', 'r'),
  46558. array('file', 'NUL', 'w'),
  46559. array('file', 'NUL', 'w'),
  46560. );
  46561. }
  46562. public function getFiles()
  46563. {
  46564. return $this->files;
  46565. }
  46566. public function readAndWrite($blocking, $close = false)
  46567. {
  46568. $this->unblock();
  46569. $w = $this->write();
  46570. $read = $r = $e = array();
  46571. if ($blocking) {
  46572. if ($w) {
  46573. @stream_select($r, $w, $e, 0, Process::TIMEOUT_PRECISION * 1E6);
  46574. } elseif ($this->fileHandles) {
  46575. usleep(Process::TIMEOUT_PRECISION * 1E6);
  46576. }
  46577. }
  46578. foreach ($this->fileHandles as $type => $fileHandle) {
  46579. $data = stream_get_contents($fileHandle, -1, $this->readBytes[$type]);
  46580. if (isset($data[0])) {
  46581. $this->readBytes[$type] += \strlen($data);
  46582. $read[$type] = $data;
  46583. }
  46584. if ($close) {
  46585. ftruncate($fileHandle, 0);
  46586. fclose($fileHandle);
  46587. flock($this->lockHandles[$type], LOCK_UN);
  46588. fclose($this->lockHandles[$type]);
  46589. unset($this->fileHandles[$type], $this->lockHandles[$type]);
  46590. }
  46591. }
  46592. return $read;
  46593. }
  46594. public function areOpen()
  46595. {
  46596. return $this->pipes && $this->fileHandles;
  46597. }
  46598. public function close()
  46599. {
  46600. parent::close();
  46601. foreach ($this->fileHandles as $type => $handle) {
  46602. ftruncate($handle, 0);
  46603. fclose($handle);
  46604. flock($this->lockHandles[$type], LOCK_UN);
  46605. fclose($this->lockHandles[$type]);
  46606. }
  46607. $this->fileHandles = $this->lockHandles = array();
  46608. }
  46609. public static function create(Process $process, $input)
  46610. {
  46611. return new static($process->isOutputDisabled(), $input);
  46612. }
  46613. }
  46614. <?php
  46615. namespace Symfony\Component\Process;
  46616. use Symfony\Component\Process\Exception\InvalidArgumentException;
  46617. use Symfony\Component\Process\Exception\LogicException;
  46618. use Symfony\Component\Process\Exception\ProcessFailedException;
  46619. use Symfony\Component\Process\Exception\ProcessTimedOutException;
  46620. use Symfony\Component\Process\Exception\RuntimeException;
  46621. use Symfony\Component\Process\Pipes\PipesInterface;
  46622. use Symfony\Component\Process\Pipes\UnixPipes;
  46623. use Symfony\Component\Process\Pipes\WindowsPipes;
  46624. class Process
  46625. {
  46626. const ERR = 'err';
  46627. const OUT = 'out';
  46628. const STATUS_READY = 'ready';
  46629. const STATUS_STARTED = 'started';
  46630. const STATUS_TERMINATED = 'terminated';
  46631. const STDIN = 0;
  46632. const STDOUT = 1;
  46633. const STDERR = 2;
  46634. const TIMEOUT_PRECISION = 0.2;
  46635. private $callback;
  46636. private $commandline;
  46637. private $cwd;
  46638. private $env;
  46639. private $input;
  46640. private $starttime;
  46641. private $lastOutputTime;
  46642. private $timeout;
  46643. private $idleTimeout;
  46644. private $options;
  46645. private $exitcode;
  46646. private $fallbackStatus = array();
  46647. private $processInformation;
  46648. private $outputDisabled = false;
  46649. private $stdout;
  46650. private $stderr;
  46651. private $enhanceWindowsCompatibility = true;
  46652. private $enhanceSigchildCompatibility;
  46653. private $process;
  46654. private $status = self::STATUS_READY;
  46655. private $incrementalOutputOffset = 0;
  46656. private $incrementalErrorOutputOffset = 0;
  46657. private $tty;
  46658. private $pty;
  46659. private $useFileHandles = false;
  46660. private $processPipes;
  46661. private $latestSignal;
  46662. private static $sigchild;
  46663. public static $exitCodes = array(
  46664. 0 => 'OK',
  46665. 1 => 'General error',
  46666. 2 => 'Misuse of shell builtins',
  46667. 126 => 'Invoked command cannot execute',
  46668. 127 => 'Command not found',
  46669. 128 => 'Invalid exit argument',
  46670. 129 => 'Hangup',
  46671. 130 => 'Interrupt',
  46672. 131 => 'Quit and dump core',
  46673. 132 => 'Illegal instruction',
  46674. 133 => 'Trace/breakpoint trap',
  46675. 134 => 'Process aborted',
  46676. 135 => 'Bus error: "access to undefined portion of memory object"',
  46677. 136 => 'Floating point exception: "erroneous arithmetic operation"',
  46678. 137 => 'Kill (terminate immediately)',
  46679. 138 => 'User-defined 1',
  46680. 139 => 'Segmentation violation',
  46681. 140 => 'User-defined 2',
  46682. 141 => 'Write to pipe with no one reading',
  46683. 142 => 'Signal raised by alarm',
  46684. 143 => 'Termination (request to terminate)',
  46685. 145 => 'Child process terminated, stopped (or continued*)',
  46686. 146 => 'Continue if stopped',
  46687. 147 => 'Stop executing temporarily',
  46688. 148 => 'Terminal stop signal',
  46689. 149 => 'Background process attempting to read from tty ("in")',
  46690. 150 => 'Background process attempting to write to tty ("out")',
  46691. 151 => 'Urgent data available on socket',
  46692. 152 => 'CPU time limit exceeded',
  46693. 153 => 'File size limit exceeded',
  46694. 154 => 'Signal raised by timer counting virtual time: "virtual timer expired"',
  46695. 155 => 'Profiling timer expired',
  46696. 157 => 'Pollable event',
  46697. 159 => 'Bad syscall',
  46698. );
  46699. public function __construct($commandline, $cwd = null, array $env = null, $input = null, $timeout = 60, array $options = array())
  46700. {
  46701. if (!\function_exists('proc_open')) {
  46702. throw new RuntimeException('The Process class relies on proc_open, which is not available on your PHP installation.');
  46703. }
  46704. $this->commandline = $commandline;
  46705. $this->cwd = $cwd;
  46706. if (null === $this->cwd && (\defined('ZEND_THREAD_SAFE') || '\\' === \DIRECTORY_SEPARATOR)) {
  46707. $this->cwd = getcwd();
  46708. }
  46709. if (null !== $env) {
  46710. $this->setEnv($env);
  46711. }
  46712. $this->setInput($input);
  46713. $this->setTimeout($timeout);
  46714. $this->useFileHandles = '\\' === \DIRECTORY_SEPARATOR;
  46715. $this->pty = false;
  46716. $this->enhanceSigchildCompatibility = '\\' !== \DIRECTORY_SEPARATOR && $this->isSigchildEnabled();
  46717. $this->options = array_replace(array('suppress_errors' => true, 'binary_pipes' => true), $options);
  46718. }
  46719. public function __destruct()
  46720. {
  46721. $this->stop(0);
  46722. }
  46723. public function __clone()
  46724. {
  46725. $this->resetProcessData();
  46726. }
  46727. public function run($callback = null)
  46728. {
  46729. $this->start($callback);
  46730. return $this->wait();
  46731. }
  46732. public function mustRun($callback = null)
  46733. {
  46734. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  46735. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  46736. }
  46737. if (0 !== $this->run($callback)) {
  46738. throw new ProcessFailedException($this);
  46739. }
  46740. return $this;
  46741. }
  46742. public function start($callback = null)
  46743. {
  46744. if ($this->isRunning()) {
  46745. throw new RuntimeException('Process is already running');
  46746. }
  46747. if ($this->outputDisabled && null !== $callback) {
  46748. throw new LogicException('Output has been disabled, enable it to allow the use of a callback.');
  46749. }
  46750. $this->resetProcessData();
  46751. $this->starttime = $this->lastOutputTime = microtime(true);
  46752. $this->callback = $this->buildCallback($callback);
  46753. $descriptors = $this->getDescriptors();
  46754. $commandline = $this->commandline;
  46755. if ('\\' === \DIRECTORY_SEPARATOR && $this->enhanceWindowsCompatibility) {
  46756. $commandline = 'cmd /V:ON /E:ON /D /C "('.$commandline.')';
  46757. foreach ($this->processPipes->getFiles() as $offset => $filename) {
  46758. $commandline .= ' '.$offset.'>'.ProcessUtils::escapeArgument($filename);
  46759. }
  46760. $commandline .= '"';
  46761. if (!isset($this->options['bypass_shell'])) {
  46762. $this->options['bypass_shell'] = true;
  46763. }
  46764. } elseif (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  46765. $descriptors[3] = array('pipe', 'w');
  46766. $commandline = '{ ('.$this->commandline.') <&3 3<&- 3>/dev/null & } 3<&0;';
  46767. $commandline .= 'pid=$!; echo $pid >&3; wait $pid; code=$?; echo $code >&3; exit $code';
  46768. $ptsWorkaround = fopen(__FILE__, 'r');
  46769. }
  46770. $this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $this->env, $this->options);
  46771. if (!\is_resource($this->process)) {
  46772. throw new RuntimeException('Unable to launch a new process.');
  46773. }
  46774. $this->status = self::STATUS_STARTED;
  46775. if (isset($descriptors[3])) {
  46776. $this->fallbackStatus['pid'] = (int) fgets($this->processPipes->pipes[3]);
  46777. }
  46778. if ($this->tty) {
  46779. return;
  46780. }
  46781. $this->updateStatus(false);
  46782. $this->checkTimeout();
  46783. }
  46784. public function restart($callback = null)
  46785. {
  46786. if ($this->isRunning()) {
  46787. throw new RuntimeException('Process is already running');
  46788. }
  46789. $process = clone $this;
  46790. $process->start($callback);
  46791. return $process;
  46792. }
  46793. public function wait($callback = null)
  46794. {
  46795. $this->requireProcessIsStarted(__FUNCTION__);
  46796. $this->updateStatus(false);
  46797. if (null !== $callback) {
  46798. $this->callback = $this->buildCallback($callback);
  46799. }
  46800. do {
  46801. $this->checkTimeout();
  46802. $running = '\\' === \DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
  46803. $this->readPipes($running, '\\' !== \DIRECTORY_SEPARATOR || !$running);
  46804. } while ($running);
  46805. while ($this->isRunning()) {
  46806. usleep(1000);
  46807. }
  46808. if ($this->processInformation['signaled'] && $this->processInformation['termsig'] !== $this->latestSignal) {
  46809. throw new RuntimeException(sprintf('The process has been signaled with signal "%s".', $this->processInformation['termsig']));
  46810. }
  46811. return $this->exitcode;
  46812. }
  46813. public function getPid()
  46814. {
  46815. return $this->isRunning() ? $this->processInformation['pid'] : null;
  46816. }
  46817. public function signal($signal)
  46818. {
  46819. $this->doSignal($signal, true);
  46820. return $this;
  46821. }
  46822. public function disableOutput()
  46823. {
  46824. if ($this->isRunning()) {
  46825. throw new RuntimeException('Disabling output while the process is running is not possible.');
  46826. }
  46827. if (null !== $this->idleTimeout) {
  46828. throw new LogicException('Output can not be disabled while an idle timeout is set.');
  46829. }
  46830. $this->outputDisabled = true;
  46831. return $this;
  46832. }
  46833. public function enableOutput()
  46834. {
  46835. if ($this->isRunning()) {
  46836. throw new RuntimeException('Enabling output while the process is running is not possible.');
  46837. }
  46838. $this->outputDisabled = false;
  46839. return $this;
  46840. }
  46841. public function isOutputDisabled()
  46842. {
  46843. return $this->outputDisabled;
  46844. }
  46845. public function getOutput()
  46846. {
  46847. $this->readPipesForOutput(__FUNCTION__);
  46848. if (false === $ret = stream_get_contents($this->stdout, -1, 0)) {
  46849. return '';
  46850. }
  46851. return $ret;
  46852. }
  46853. public function getIncrementalOutput()
  46854. {
  46855. $this->readPipesForOutput(__FUNCTION__);
  46856. $latest = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset);
  46857. $this->incrementalOutputOffset = ftell($this->stdout);
  46858. if (false === $latest) {
  46859. return '';
  46860. }
  46861. return $latest;
  46862. }
  46863. public function clearOutput()
  46864. {
  46865. ftruncate($this->stdout, 0);
  46866. fseek($this->stdout, 0);
  46867. $this->incrementalOutputOffset = 0;
  46868. return $this;
  46869. }
  46870. public function getErrorOutput()
  46871. {
  46872. $this->readPipesForOutput(__FUNCTION__);
  46873. if (false === $ret = stream_get_contents($this->stderr, -1, 0)) {
  46874. return '';
  46875. }
  46876. return $ret;
  46877. }
  46878. public function getIncrementalErrorOutput()
  46879. {
  46880. $this->readPipesForOutput(__FUNCTION__);
  46881. $latest = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);
  46882. $this->incrementalErrorOutputOffset = ftell($this->stderr);
  46883. if (false === $latest) {
  46884. return '';
  46885. }
  46886. return $latest;
  46887. }
  46888. public function clearErrorOutput()
  46889. {
  46890. ftruncate($this->stderr, 0);
  46891. fseek($this->stderr, 0);
  46892. $this->incrementalErrorOutputOffset = 0;
  46893. return $this;
  46894. }
  46895. public function getExitCode()
  46896. {
  46897. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  46898. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  46899. }
  46900. $this->updateStatus(false);
  46901. return $this->exitcode;
  46902. }
  46903. public function getExitCodeText()
  46904. {
  46905. if (null === $exitcode = $this->getExitCode()) {
  46906. return;
  46907. }
  46908. return isset(self::$exitCodes[$exitcode]) ? self::$exitCodes[$exitcode] : 'Unknown error';
  46909. }
  46910. public function isSuccessful()
  46911. {
  46912. return 0 === $this->getExitCode();
  46913. }
  46914. public function hasBeenSignaled()
  46915. {
  46916. $this->requireProcessIsTerminated(__FUNCTION__);
  46917. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  46918. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  46919. }
  46920. return $this->processInformation['signaled'];
  46921. }
  46922. public function getTermSignal()
  46923. {
  46924. $this->requireProcessIsTerminated(__FUNCTION__);
  46925. if ($this->isSigchildEnabled() && (!$this->enhanceSigchildCompatibility || -1 === $this->processInformation['termsig'])) {
  46926. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  46927. }
  46928. return $this->processInformation['termsig'];
  46929. }
  46930. public function hasBeenStopped()
  46931. {
  46932. $this->requireProcessIsTerminated(__FUNCTION__);
  46933. return $this->processInformation['stopped'];
  46934. }
  46935. public function getStopSignal()
  46936. {
  46937. $this->requireProcessIsTerminated(__FUNCTION__);
  46938. return $this->processInformation['stopsig'];
  46939. }
  46940. public function isRunning()
  46941. {
  46942. if (self::STATUS_STARTED !== $this->status) {
  46943. return false;
  46944. }
  46945. $this->updateStatus(false);
  46946. return $this->processInformation['running'];
  46947. }
  46948. public function isStarted()
  46949. {
  46950. return self::STATUS_READY != $this->status;
  46951. }
  46952. public function isTerminated()
  46953. {
  46954. $this->updateStatus(false);
  46955. return self::STATUS_TERMINATED == $this->status;
  46956. }
  46957. public function getStatus()
  46958. {
  46959. $this->updateStatus(false);
  46960. return $this->status;
  46961. }
  46962. public function stop($timeout = 10, $signal = null)
  46963. {
  46964. $timeoutMicro = microtime(true) + $timeout;
  46965. if ($this->isRunning()) {
  46966. $this->doSignal(15, false);
  46967. do {
  46968. usleep(1000);
  46969. } while ($this->isRunning() && microtime(true) < $timeoutMicro);
  46970. if ($this->isRunning()) {
  46971. $this->doSignal($signal ?: 9, false);
  46972. }
  46973. }
  46974. if ($this->isRunning()) {
  46975. if (isset($this->fallbackStatus['pid'])) {
  46976. unset($this->fallbackStatus['pid']);
  46977. return $this->stop(0, $signal);
  46978. }
  46979. $this->close();
  46980. }
  46981. return $this->exitcode;
  46982. }
  46983. public function addOutput($line)
  46984. {
  46985. $this->lastOutputTime = microtime(true);
  46986. fseek($this->stdout, 0, SEEK_END);
  46987. fwrite($this->stdout, $line);
  46988. fseek($this->stdout, $this->incrementalOutputOffset);
  46989. }
  46990. public function addErrorOutput($line)
  46991. {
  46992. $this->lastOutputTime = microtime(true);
  46993. fseek($this->stderr, 0, SEEK_END);
  46994. fwrite($this->stderr, $line);
  46995. fseek($this->stderr, $this->incrementalErrorOutputOffset);
  46996. }
  46997. public function getCommandLine()
  46998. {
  46999. return $this->commandline;
  47000. }
  47001. public function setCommandLine($commandline)
  47002. {
  47003. $this->commandline = $commandline;
  47004. return $this;
  47005. }
  47006. public function getTimeout()
  47007. {
  47008. return $this->timeout;
  47009. }
  47010. public function getIdleTimeout()
  47011. {
  47012. return $this->idleTimeout;
  47013. }
  47014. public function setTimeout($timeout)
  47015. {
  47016. $this->timeout = $this->validateTimeout($timeout);
  47017. return $this;
  47018. }
  47019. public function setIdleTimeout($timeout)
  47020. {
  47021. if (null !== $timeout && $this->outputDisabled) {
  47022. throw new LogicException('Idle timeout can not be set while the output is disabled.');
  47023. }
  47024. $this->idleTimeout = $this->validateTimeout($timeout);
  47025. return $this;
  47026. }
  47027. public function setTty($tty)
  47028. {
  47029. if ('\\' === \DIRECTORY_SEPARATOR && $tty) {
  47030. throw new RuntimeException('TTY mode is not supported on Windows platform.');
  47031. }
  47032. if ($tty) {
  47033. static $isTtySupported;
  47034. if (null === $isTtySupported) {
  47035. $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);
  47036. }
  47037. if (!$isTtySupported) {
  47038. throw new RuntimeException('TTY mode requires /dev/tty to be read/writable.');
  47039. }
  47040. }
  47041. $this->tty = (bool) $tty;
  47042. return $this;
  47043. }
  47044. public function isTty()
  47045. {
  47046. return $this->tty;
  47047. }
  47048. public function setPty($bool)
  47049. {
  47050. $this->pty = (bool) $bool;
  47051. return $this;
  47052. }
  47053. public function isPty()
  47054. {
  47055. return $this->pty;
  47056. }
  47057. public function getWorkingDirectory()
  47058. {
  47059. if (null === $this->cwd) {
  47060. return getcwd() ?: null;
  47061. }
  47062. return $this->cwd;
  47063. }
  47064. public function setWorkingDirectory($cwd)
  47065. {
  47066. $this->cwd = $cwd;
  47067. return $this;
  47068. }
  47069. public function getEnv()
  47070. {
  47071. return $this->env;
  47072. }
  47073. public function setEnv(array $env)
  47074. {
  47075. $env = array_filter($env, function ($value) {
  47076. return !\is_array($value);
  47077. });
  47078. $this->env = array();
  47079. foreach ($env as $key => $value) {
  47080. $this->env[$key] = (string) $value;
  47081. }
  47082. return $this;
  47083. }
  47084. public function getStdin()
  47085. {
  47086. @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);
  47087. return $this->getInput();
  47088. }
  47089. public function getInput()
  47090. {
  47091. return $this->input;
  47092. }
  47093. public function setStdin($stdin)
  47094. {
  47095. @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);
  47096. return $this->setInput($stdin);
  47097. }
  47098. public function setInput($input)
  47099. {
  47100. if ($this->isRunning()) {
  47101. throw new LogicException('Input can not be set while the process is running.');
  47102. }
  47103. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  47104. return $this;
  47105. }
  47106. public function getOptions()
  47107. {
  47108. return $this->options;
  47109. }
  47110. public function setOptions(array $options)
  47111. {
  47112. $this->options = $options;
  47113. return $this;
  47114. }
  47115. public function getEnhanceWindowsCompatibility()
  47116. {
  47117. return $this->enhanceWindowsCompatibility;
  47118. }
  47119. public function setEnhanceWindowsCompatibility($enhance)
  47120. {
  47121. $this->enhanceWindowsCompatibility = (bool) $enhance;
  47122. return $this;
  47123. }
  47124. public function getEnhanceSigchildCompatibility()
  47125. {
  47126. return $this->enhanceSigchildCompatibility;
  47127. }
  47128. public function setEnhanceSigchildCompatibility($enhance)
  47129. {
  47130. $this->enhanceSigchildCompatibility = (bool) $enhance;
  47131. return $this;
  47132. }
  47133. public function checkTimeout()
  47134. {
  47135. if (self::STATUS_STARTED !== $this->status) {
  47136. return;
  47137. }
  47138. if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) {
  47139. $this->stop(0);
  47140. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_GENERAL);
  47141. }
  47142. if (null !== $this->idleTimeout && $this->idleTimeout < microtime(true) - $this->lastOutputTime) {
  47143. $this->stop(0);
  47144. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_IDLE);
  47145. }
  47146. }
  47147. public static function isPtySupported()
  47148. {
  47149. static $result;
  47150. if (null !== $result) {
  47151. return $result;
  47152. }
  47153. if ('\\' === \DIRECTORY_SEPARATOR) {
  47154. return $result = false;
  47155. }
  47156. return $result = (bool) @proc_open('echo 1 >/dev/null', array(array('pty'), array('pty'), array('pty')), $pipes);
  47157. }
  47158. private function getDescriptors()
  47159. {
  47160. if ('\\' === \DIRECTORY_SEPARATOR) {
  47161. $this->processPipes = WindowsPipes::create($this, $this->input);
  47162. } else {
  47163. $this->processPipes = UnixPipes::create($this, $this->input);
  47164. }
  47165. return $this->processPipes->getDescriptors();
  47166. }
  47167. protected function buildCallback($callback)
  47168. {
  47169. $that = $this;
  47170. $out = self::OUT;
  47171. $callback = function ($type, $data) use ($that, $callback, $out) {
  47172. if ($out == $type) {
  47173. $that->addOutput($data);
  47174. } else {
  47175. $that->addErrorOutput($data);
  47176. }
  47177. if (null !== $callback) {
  47178. \call_user_func($callback, $type, $data);
  47179. }
  47180. };
  47181. return $callback;
  47182. }
  47183. protected function updateStatus($blocking)
  47184. {
  47185. if (self::STATUS_STARTED !== $this->status) {
  47186. return;
  47187. }
  47188. $this->processInformation = proc_get_status($this->process);
  47189. $running = $this->processInformation['running'];
  47190. $this->readPipes($running && $blocking, '\\' !== \DIRECTORY_SEPARATOR || !$running);
  47191. if ($this->fallbackStatus && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  47192. $this->processInformation = $this->fallbackStatus + $this->processInformation;
  47193. }
  47194. if (!$running) {
  47195. $this->close();
  47196. }
  47197. }
  47198. protected function isSigchildEnabled()
  47199. {
  47200. if (null !== self::$sigchild) {
  47201. return self::$sigchild;
  47202. }
  47203. if (!\function_exists('phpinfo') || \defined('HHVM_VERSION')) {
  47204. return self::$sigchild = false;
  47205. }
  47206. ob_start();
  47207. phpinfo(INFO_GENERAL);
  47208. return self::$sigchild = false !== strpos(ob_get_clean(), '--enable-sigchild');
  47209. }
  47210. private function readPipesForOutput($caller)
  47211. {
  47212. if ($this->outputDisabled) {
  47213. throw new LogicException('Output has been disabled.');
  47214. }
  47215. $this->requireProcessIsStarted($caller);
  47216. $this->updateStatus(false);
  47217. }
  47218. private function validateTimeout($timeout)
  47219. {
  47220. $timeout = (float) $timeout;
  47221. if (0.0 === $timeout) {
  47222. $timeout = null;
  47223. } elseif ($timeout < 0) {
  47224. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  47225. }
  47226. return $timeout;
  47227. }
  47228. private function readPipes($blocking, $close)
  47229. {
  47230. $result = $this->processPipes->readAndWrite($blocking, $close);
  47231. $callback = $this->callback;
  47232. foreach ($result as $type => $data) {
  47233. if (3 !== $type) {
  47234. $callback(self::STDOUT === $type ? self::OUT : self::ERR, $data);
  47235. } elseif (!isset($this->fallbackStatus['signaled'])) {
  47236. $this->fallbackStatus['exitcode'] = (int) $data;
  47237. }
  47238. }
  47239. }
  47240. private function close()
  47241. {
  47242. $this->processPipes->close();
  47243. if (\is_resource($this->process)) {
  47244. proc_close($this->process);
  47245. }
  47246. $this->exitcode = $this->processInformation['exitcode'];
  47247. $this->status = self::STATUS_TERMINATED;
  47248. if (-1 === $this->exitcode) {
  47249. if ($this->processInformation['signaled'] && 0 < $this->processInformation['termsig']) {
  47250. $this->exitcode = 128 + $this->processInformation['termsig'];
  47251. } elseif ($this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  47252. $this->processInformation['signaled'] = true;
  47253. $this->processInformation['termsig'] = -1;
  47254. }
  47255. }
  47256. $this->callback = null;
  47257. return $this->exitcode;
  47258. }
  47259. private function resetProcessData()
  47260. {
  47261. $this->starttime = null;
  47262. $this->callback = null;
  47263. $this->exitcode = null;
  47264. $this->fallbackStatus = array();
  47265. $this->processInformation = null;
  47266. $this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+b');
  47267. $this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+b');
  47268. $this->process = null;
  47269. $this->latestSignal = null;
  47270. $this->status = self::STATUS_READY;
  47271. $this->incrementalOutputOffset = 0;
  47272. $this->incrementalErrorOutputOffset = 0;
  47273. }
  47274. private function doSignal($signal, $throwException)
  47275. {
  47276. if (null === $pid = $this->getPid()) {
  47277. if ($throwException) {
  47278. throw new LogicException('Can not send signal on a non running process.');
  47279. }
  47280. return false;
  47281. }
  47282. if ('\\' === \DIRECTORY_SEPARATOR) {
  47283. exec(sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode);
  47284. if ($exitCode && $this->isRunning()) {
  47285. if ($throwException) {
  47286. throw new RuntimeException(sprintf('Unable to kill the process (%s).', implode(' ', $output)));
  47287. }
  47288. return false;
  47289. }
  47290. } else {
  47291. if (!$this->enhanceSigchildCompatibility || !$this->isSigchildEnabled()) {
  47292. $ok = @proc_terminate($this->process, $signal);
  47293. } elseif (\function_exists('posix_kill')) {
  47294. $ok = @posix_kill($pid, $signal);
  47295. } elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), array(2 => array('pipe', 'w')), $pipes)) {
  47296. $ok = false === fgets($pipes[2]);
  47297. }
  47298. if (!$ok) {
  47299. if ($throwException) {
  47300. throw new RuntimeException(sprintf('Error while sending signal `%s`.', $signal));
  47301. }
  47302. return false;
  47303. }
  47304. }
  47305. $this->latestSignal = (int) $signal;
  47306. $this->fallbackStatus['signaled'] = true;
  47307. $this->fallbackStatus['exitcode'] = -1;
  47308. $this->fallbackStatus['termsig'] = $this->latestSignal;
  47309. return true;
  47310. }
  47311. private function requireProcessIsStarted($functionName)
  47312. {
  47313. if (!$this->isStarted()) {
  47314. throw new LogicException(sprintf('Process must be started before calling %s.', $functionName));
  47315. }
  47316. }
  47317. private function requireProcessIsTerminated($functionName)
  47318. {
  47319. if (!$this->isTerminated()) {
  47320. throw new LogicException(sprintf('Process must be terminated before calling %s.', $functionName));
  47321. }
  47322. }
  47323. }
  47324. <?php
  47325. namespace Symfony\Component\Process;
  47326. use Symfony\Component\Process\Exception\InvalidArgumentException;
  47327. use Symfony\Component\Process\Exception\LogicException;
  47328. class ProcessBuilder
  47329. {
  47330. private $arguments;
  47331. private $cwd;
  47332. private $env = array();
  47333. private $input;
  47334. private $timeout = 60;
  47335. private $options = array();
  47336. private $inheritEnv = true;
  47337. private $prefix = array();
  47338. private $outputDisabled = false;
  47339. public function __construct(array $arguments = array())
  47340. {
  47341. $this->arguments = $arguments;
  47342. }
  47343. public static function create(array $arguments = array())
  47344. {
  47345. return new static($arguments);
  47346. }
  47347. public function add($argument)
  47348. {
  47349. $this->arguments[] = $argument;
  47350. return $this;
  47351. }
  47352. public function setPrefix($prefix)
  47353. {
  47354. $this->prefix = \is_array($prefix) ? $prefix : array($prefix);
  47355. return $this;
  47356. }
  47357. public function setArguments(array $arguments)
  47358. {
  47359. $this->arguments = $arguments;
  47360. return $this;
  47361. }
  47362. public function setWorkingDirectory($cwd)
  47363. {
  47364. $this->cwd = $cwd;
  47365. return $this;
  47366. }
  47367. public function inheritEnvironmentVariables($inheritEnv = true)
  47368. {
  47369. $this->inheritEnv = $inheritEnv;
  47370. return $this;
  47371. }
  47372. public function setEnv($name, $value)
  47373. {
  47374. $this->env[$name] = $value;
  47375. return $this;
  47376. }
  47377. public function addEnvironmentVariables(array $variables)
  47378. {
  47379. $this->env = array_replace($this->env, $variables);
  47380. return $this;
  47381. }
  47382. public function setInput($input)
  47383. {
  47384. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  47385. return $this;
  47386. }
  47387. public function setTimeout($timeout)
  47388. {
  47389. if (null === $timeout) {
  47390. $this->timeout = null;
  47391. return $this;
  47392. }
  47393. $timeout = (float) $timeout;
  47394. if ($timeout < 0) {
  47395. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  47396. }
  47397. $this->timeout = $timeout;
  47398. return $this;
  47399. }
  47400. public function setOption($name, $value)
  47401. {
  47402. $this->options[$name] = $value;
  47403. return $this;
  47404. }
  47405. public function disableOutput()
  47406. {
  47407. $this->outputDisabled = true;
  47408. return $this;
  47409. }
  47410. public function enableOutput()
  47411. {
  47412. $this->outputDisabled = false;
  47413. return $this;
  47414. }
  47415. public function getProcess()
  47416. {
  47417. if (0 === \count($this->prefix) && 0 === \count($this->arguments)) {
  47418. throw new LogicException('You must add() command arguments before calling getProcess().');
  47419. }
  47420. $options = $this->options;
  47421. $arguments = array_merge($this->prefix, $this->arguments);
  47422. $script = implode(' ', array_map(array(__NAMESPACE__.'\\ProcessUtils', 'escapeArgument'), $arguments));
  47423. if ($this->inheritEnv) {
  47424. $env = array_replace($_ENV, $_SERVER, $this->env);
  47425. } else {
  47426. $env = $this->env;
  47427. }
  47428. $process = new Process($script, $this->cwd, $env, $this->input, $this->timeout, $options);
  47429. if ($this->outputDisabled) {
  47430. $process->disableOutput();
  47431. }
  47432. return $process;
  47433. }
  47434. }
  47435. <?php
  47436. namespace Symfony\Component\Process;
  47437. use Symfony\Component\Process\Exception\InvalidArgumentException;
  47438. class ProcessUtils
  47439. {
  47440. private function __construct()
  47441. {
  47442. }
  47443. public static function escapeArgument($argument)
  47444. {
  47445. if ('\\' === \DIRECTORY_SEPARATOR) {
  47446. if ('' === $argument) {
  47447. return escapeshellarg($argument);
  47448. }
  47449. $escapedArgument = '';
  47450. $quote = false;
  47451. foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
  47452. if ('"' === $part) {
  47453. $escapedArgument .= '\\"';
  47454. } elseif (self::isSurroundedBy($part, '%')) {
  47455. $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%';
  47456. } else {
  47457. if ('\\' === substr($part, -1)) {
  47458. $part .= '\\';
  47459. }
  47460. $quote = true;
  47461. $escapedArgument .= $part;
  47462. }
  47463. }
  47464. if ($quote) {
  47465. $escapedArgument = '"'.$escapedArgument.'"';
  47466. }
  47467. return $escapedArgument;
  47468. }
  47469. return "'".str_replace("'", "'\\''", $argument)."'";
  47470. }
  47471. public static function validateInput($caller, $input)
  47472. {
  47473. if (null !== $input) {
  47474. if (\is_resource($input)) {
  47475. return $input;
  47476. }
  47477. if (\is_string($input)) {
  47478. return $input;
  47479. }
  47480. if (is_scalar($input)) {
  47481. return (string) $input;
  47482. }
  47483. if (\is_object($input) && method_exists($input, '__toString')) {
  47484. @trigger_error('Passing an object as an input is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  47485. return (string) $input;
  47486. }
  47487. throw new InvalidArgumentException(sprintf('%s only accepts strings or stream resources.', $caller));
  47488. }
  47489. return $input;
  47490. }
  47491. private static function isSurroundedBy($arg, $char)
  47492. {
  47493. return 2 < \strlen($arg) && $char === $arg[0] && $char === $arg[\strlen($arg) - 1];
  47494. }
  47495. }
  47496. Copyright (c) 2011 Jordi Boggiano
  47497. Permission is hereby granted, free of charge, to any person obtaining a copy
  47498. of this software and associated documentation files (the "Software"), to deal
  47499. in the Software without restriction, including without limitation the rights
  47500. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  47501. copies of the Software, and to permit persons to whom the Software is furnished
  47502. to do so, subject to the following conditions:
  47503. The above copyright notice and this permission notice shall be included in all
  47504. copies or substantial portions of the Software.
  47505. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  47506. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  47507. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  47508. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  47509. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  47510. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  47511. THE SOFTWARE.
  47512. <?php
  47513. namespace Seld\JsonLint;
  47514. class DuplicateKeyException extends ParsingException
  47515. {
  47516. public function __construct($message, $key, array $details = array())
  47517. {
  47518. $details['key'] = $key;
  47519. parent::__construct($message, $details);
  47520. }
  47521. public function getKey()
  47522. {
  47523. return $this->details['key'];
  47524. }
  47525. }
  47526. <?php
  47527. namespace Seld\JsonLint;
  47528. use stdClass;
  47529. class JsonParser
  47530. {
  47531. const DETECT_KEY_CONFLICTS = 1;
  47532. const ALLOW_DUPLICATE_KEYS = 2;
  47533. const PARSE_TO_ASSOC = 4;
  47534. private $lexer;
  47535. private $flags;
  47536. private $stack;
  47537. private $vstack;
  47538. private $lstack;
  47539. private $symbols = array(
  47540. 'error' => 2,
  47541. 'JSONString' => 3,
  47542. 'STRING' => 4,
  47543. 'JSONNumber' => 5,
  47544. 'NUMBER' => 6,
  47545. 'JSONNullLiteral' => 7,
  47546. 'NULL' => 8,
  47547. 'JSONBooleanLiteral' => 9,
  47548. 'TRUE' => 10,
  47549. 'FALSE' => 11,
  47550. 'JSONText' => 12,
  47551. 'JSONValue' => 13,
  47552. 'EOF' => 14,
  47553. 'JSONObject' => 15,
  47554. 'JSONArray' => 16,
  47555. '{' => 17,
  47556. '}' => 18,
  47557. 'JSONMemberList' => 19,
  47558. 'JSONMember' => 20,
  47559. ':' => 21,
  47560. ',' => 22,
  47561. '[' => 23,
  47562. ']' => 24,
  47563. 'JSONElementList' => 25,
  47564. '$accept' => 0,
  47565. '$end' => 1,
  47566. );
  47567. private $terminals_ = array(
  47568. 2 => "error",
  47569. 4 => "STRING",
  47570. 6 => "NUMBER",
  47571. 8 => "NULL",
  47572. 10 => "TRUE",
  47573. 11 => "FALSE",
  47574. 14 => "EOF",
  47575. 17 => "{",
  47576. 18 => "}",
  47577. 21 => ":",
  47578. 22 => ",",
  47579. 23 => "[",
  47580. 24 => "]",
  47581. );
  47582. private $productions_ = array(
  47583. 0,
  47584. array(3, 1),
  47585. array(5, 1),
  47586. array(7, 1),
  47587. array(9, 1),
  47588. array(9, 1),
  47589. array(12, 2),
  47590. array(13, 1),
  47591. array(13, 1),
  47592. array(13, 1),
  47593. array(13, 1),
  47594. array(13, 1),
  47595. array(13, 1),
  47596. array(15, 2),
  47597. array(15, 3),
  47598. array(20, 3),
  47599. array(19, 1),
  47600. array(19, 3),
  47601. array(16, 2),
  47602. array(16, 3),
  47603. array(25, 1),
  47604. array(25, 3)
  47605. );
  47606. 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)),
  47607. );
  47608. private $defaultActions = array(
  47609. 16 => array(2, 6)
  47610. );
  47611. public function lint($input, $flags = 0)
  47612. {
  47613. try {
  47614. $this->parse($input, $flags);
  47615. } catch (ParsingException $e) {
  47616. return $e;
  47617. }
  47618. }
  47619. public function parse($input, $flags = 0)
  47620. {
  47621. $this->failOnBOM($input);
  47622. $this->flags = $flags;
  47623. $this->stack = array(0);
  47624. $this->vstack = array(null);
  47625. $this->lstack = array();
  47626. $yytext = '';
  47627. $yylineno = 0;
  47628. $yyleng = 0;
  47629. $recovering = 0;
  47630. $TERROR = 2;
  47631. $EOF = 1;
  47632. $this->lexer = new Lexer();
  47633. $this->lexer->setInput($input);
  47634. $yyloc = $this->lexer->yylloc;
  47635. $this->lstack[] = $yyloc;
  47636. $symbol = null;
  47637. $preErrorSymbol = null;
  47638. $state = null;
  47639. $action = null;
  47640. $a = null;
  47641. $r = null;
  47642. $yyval = new stdClass;
  47643. $p = null;
  47644. $len = null;
  47645. $newState = null;
  47646. $expected = null;
  47647. $errStr = null;
  47648. while (true) {
  47649. $state = $this->stack[count($this->stack)-1];
  47650. if (isset($this->defaultActions[$state])) {
  47651. $action = $this->defaultActions[$state];
  47652. } else {
  47653. if ($symbol == null) {
  47654. $symbol = $this->lex();
  47655. }
  47656. $action = isset($this->table[$state][$symbol]) ? $this->table[$state][$symbol] : false;
  47657. }
  47658. if (!$action || !$action[0]) {
  47659. if (!$recovering) {
  47660. $expected = array();
  47661. foreach ($this->table[$state] as $p => $ignore) {
  47662. if (isset($this->terminals_[$p]) && $p > 2) {
  47663. $expected[] = "'" . $this->terminals_[$p] . "'";
  47664. }
  47665. }
  47666. $message = null;
  47667. if (in_array("'STRING'", $expected) && in_array(substr($this->lexer->match, 0, 1), array('"', "'"))) {
  47668. $message = "Invalid string";
  47669. if ("'" === substr($this->lexer->match, 0, 1)) {
  47670. $message .= ", it appears you used single quotes instead of double quotes";
  47671. } elseif (preg_match('{".+?(\\\\[^"bfnrt/\\\\u])}', $this->lexer->getUpcomingInput(), $match)) {
  47672. $message .= ", it appears you have an unescaped backslash at: ".$match[1];
  47673. } elseif (preg_match('{"(?:[^"]+|\\\\")*$}m', $this->lexer->getUpcomingInput())) {
  47674. $message .= ", it appears you forgot to terminate a string, or attempted to write a multiline string which is invalid";
  47675. }
  47676. }
  47677. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  47678. $errStr .= $this->lexer->showPosition() . "\n";
  47679. if ($message) {
  47680. $errStr .= $message;
  47681. } else {
  47682. $errStr .= (count($expected) > 1) ? "Expected one of: " : "Expected: ";
  47683. $errStr .= implode(', ', $expected);
  47684. }
  47685. if (',' === substr(trim($this->lexer->getPastInput()), -1)) {
  47686. $errStr .= " - It appears you have an extra trailing comma";
  47687. }
  47688. $this->parseError($errStr, array(
  47689. 'text' => $this->lexer->match,
  47690. 'token' => !empty($this->terminals_[$symbol]) ? $this->terminals_[$symbol] : $symbol,
  47691. 'line' => $this->lexer->yylineno,
  47692. 'loc' => $yyloc,
  47693. 'expected' => $expected,
  47694. ));
  47695. }
  47696. if ($recovering == 3) {
  47697. if ($symbol == $EOF) {
  47698. throw new ParsingException($errStr ?: 'Parsing halted.');
  47699. }
  47700. $yyleng = $this->lexer->yyleng;
  47701. $yytext = $this->lexer->yytext;
  47702. $yylineno = $this->lexer->yylineno;
  47703. $yyloc = $this->lexer->yylloc;
  47704. $symbol = $this->lex();
  47705. }
  47706. while (true) {
  47707. if (array_key_exists($TERROR, $this->table[$state])) {
  47708. break;
  47709. }
  47710. if ($state == 0) {
  47711. throw new ParsingException($errStr ?: 'Parsing halted.');
  47712. }
  47713. $this->popStack(1);
  47714. $state = $this->stack[count($this->stack)-1];
  47715. }
  47716. $preErrorSymbol = $symbol;
  47717. $symbol = $TERROR;
  47718. $state = $this->stack[count($this->stack)-1];
  47719. $action = isset($this->table[$state][$TERROR]) ? $this->table[$state][$TERROR] : false;
  47720. $recovering = 3;
  47721. }
  47722. if (is_array($action[0]) && count($action) > 1) {
  47723. throw new ParsingException('Parse Error: multiple actions possible at state: ' . $state . ', token: ' . $symbol);
  47724. }
  47725. switch ($action[0]) {
  47726. case 1:
  47727. $this->stack[] = $symbol;
  47728. $this->vstack[] = $this->lexer->yytext;
  47729. $this->lstack[] = $this->lexer->yylloc;
  47730. $this->stack[] = $action[1];
  47731. $symbol = null;
  47732. if (!$preErrorSymbol) {
  47733. $yyleng = $this->lexer->yyleng;
  47734. $yytext = $this->lexer->yytext;
  47735. $yylineno = $this->lexer->yylineno;
  47736. $yyloc = $this->lexer->yylloc;
  47737. if ($recovering > 0) {
  47738. $recovering--;
  47739. }
  47740. } else {
  47741. $symbol = $preErrorSymbol;
  47742. $preErrorSymbol = null;
  47743. }
  47744. break;
  47745. case 2:
  47746. $len = $this->productions_[$action[1]][1];
  47747. $yyval->token = $this->vstack[count($this->vstack) - $len];
  47748. $yyval->store = array(
  47749. 'first_line' => $this->lstack[count($this->lstack) - ($len ?: 1)]['first_line'],
  47750. 'last_line' => $this->lstack[count($this->lstack) - 1]['last_line'],
  47751. 'first_column' => $this->lstack[count($this->lstack) - ($len ?: 1)]['first_column'],
  47752. 'last_column' => $this->lstack[count($this->lstack) - 1]['last_column'],
  47753. );
  47754. $r = $this->performAction($yyval, $yytext, $yyleng, $yylineno, $action[1], $this->vstack, $this->lstack);
  47755. if (!$r instanceof Undefined) {
  47756. return $r;
  47757. }
  47758. if ($len) {
  47759. $this->popStack($len);
  47760. }
  47761. $this->stack[] = $this->productions_[$action[1]][0];
  47762. $this->vstack[] = $yyval->token;
  47763. $this->lstack[] = $yyval->store;
  47764. $newState = $this->table[$this->stack[count($this->stack)-2]][$this->stack[count($this->stack)-1]];
  47765. $this->stack[] = $newState;
  47766. break;
  47767. case 3:
  47768. return true;
  47769. }
  47770. }
  47771. return true;
  47772. }
  47773. protected function parseError($str, $hash)
  47774. {
  47775. throw new ParsingException($str, $hash);
  47776. }
  47777. private function performAction(stdClass $yyval, $yytext, $yyleng, $yylineno, $yystate, &$tokens)
  47778. {
  47779. $len = count($tokens) - 1;
  47780. switch ($yystate) {
  47781. case 1:
  47782. $yytext = preg_replace_callback('{(?:\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4})}', array($this, 'stringInterpolation'), $yytext);
  47783. $yyval->token = $yytext;
  47784. break;
  47785. case 2:
  47786. if (strpos($yytext, 'e') !== false || strpos($yytext, 'E') !== false) {
  47787. $yyval->token = floatval($yytext);
  47788. } else {
  47789. $yyval->token = strpos($yytext, '.') === false ? intval($yytext) : floatval($yytext);
  47790. }
  47791. break;
  47792. case 3:
  47793. $yyval->token = null;
  47794. break;
  47795. case 4:
  47796. $yyval->token = true;
  47797. break;
  47798. case 5:
  47799. $yyval->token = false;
  47800. break;
  47801. case 6:
  47802. return $yyval->token = $tokens[$len-1];
  47803. case 13:
  47804. if ($this->flags & self::PARSE_TO_ASSOC) {
  47805. $yyval->token = array();
  47806. } else {
  47807. $yyval->token = new stdClass;
  47808. }
  47809. break;
  47810. case 14:
  47811. $yyval->token = $tokens[$len-1];
  47812. break;
  47813. case 15:
  47814. $yyval->token = array($tokens[$len-2], $tokens[$len]);
  47815. break;
  47816. case 16:
  47817. if (PHP_VERSION_ID < 70100) {
  47818. $property = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  47819. } else {
  47820. $property = $tokens[$len][0];
  47821. }
  47822. if ($this->flags & self::PARSE_TO_ASSOC) {
  47823. $yyval->token = array();
  47824. $yyval->token[$property] = $tokens[$len][1];
  47825. } else {
  47826. $yyval->token = new stdClass;
  47827. $yyval->token->$property = $tokens[$len][1];
  47828. }
  47829. break;
  47830. case 17:
  47831. if ($this->flags & self::PARSE_TO_ASSOC) {
  47832. $yyval->token =& $tokens[$len-2];
  47833. $key = $tokens[$len][0];
  47834. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2][$key])) {
  47835. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  47836. $errStr .= $this->lexer->showPosition() . "\n";
  47837. $errStr .= "Duplicate key: ".$tokens[$len][0];
  47838. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  47839. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2][$key])) {
  47840. $duplicateCount = 1;
  47841. do {
  47842. $duplicateKey = $key . '.' . $duplicateCount++;
  47843. } while (isset($tokens[$len-2][$duplicateKey]));
  47844. $key = $duplicateKey;
  47845. }
  47846. $tokens[$len-2][$key] = $tokens[$len][1];
  47847. } else {
  47848. $yyval->token = $tokens[$len-2];
  47849. if (PHP_VERSION_ID < 70100) {
  47850. $key = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  47851. } else {
  47852. $key = $tokens[$len][0];
  47853. }
  47854. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2]->{$key})) {
  47855. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  47856. $errStr .= $this->lexer->showPosition() . "\n";
  47857. $errStr .= "Duplicate key: ".$tokens[$len][0];
  47858. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  47859. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2]->{$key})) {
  47860. $duplicateCount = 1;
  47861. do {
  47862. $duplicateKey = $key . '.' . $duplicateCount++;
  47863. } while (isset($tokens[$len-2]->$duplicateKey));
  47864. $key = $duplicateKey;
  47865. }
  47866. $tokens[$len-2]->$key = $tokens[$len][1];
  47867. }
  47868. break;
  47869. case 18:
  47870. $yyval->token = array();
  47871. break;
  47872. case 19:
  47873. $yyval->token = $tokens[$len-1];
  47874. break;
  47875. case 20:
  47876. $yyval->token = array($tokens[$len]);
  47877. break;
  47878. case 21:
  47879. $tokens[$len-2][] = $tokens[$len];
  47880. $yyval->token = $tokens[$len-2];
  47881. break;
  47882. }
  47883. return new Undefined();
  47884. }
  47885. private function stringInterpolation($match)
  47886. {
  47887. switch ($match[0]) {
  47888. case '\\\\':
  47889. return '\\';
  47890. case '\"':
  47891. return '"';
  47892. case '\b':
  47893. return chr(8);
  47894. case '\f':
  47895. return chr(12);
  47896. case '\n':
  47897. return "\n";
  47898. case '\r':
  47899. return "\r";
  47900. case '\t':
  47901. return "\t";
  47902. case '\/':
  47903. return "/";
  47904. default:
  47905. return html_entity_decode('&#x'.ltrim(substr($match[0], 2), '0').';', ENT_QUOTES, 'UTF-8');
  47906. }
  47907. }
  47908. private function popStack($n)
  47909. {
  47910. $this->stack = array_slice($this->stack, 0, - (2 * $n));
  47911. $this->vstack = array_slice($this->vstack, 0, - $n);
  47912. $this->lstack = array_slice($this->lstack, 0, - $n);
  47913. }
  47914. private function lex()
  47915. {
  47916. $token = $this->lexer->lex() ?: 1;
  47917. if (!is_numeric($token)) {
  47918. $token = isset($this->symbols[$token]) ? $this->symbols[$token] : $token;
  47919. }
  47920. return $token;
  47921. }
  47922. private function failOnBOM($input)
  47923. {
  47924. $bom = "\xEF\xBB\xBF";
  47925. if (substr($input, 0, 3) === $bom) {
  47926. $this->parseError("BOM detected, make sure your input does not include a Unicode Byte-Order-Mark", array());
  47927. }
  47928. }
  47929. }
  47930. <?php
  47931. namespace Seld\JsonLint;
  47932. class Lexer
  47933. {
  47934. private $EOF = 1;
  47935. private $rules = array(
  47936. 0 => '/^\s+/',
  47937. 1 => '/^-?([0-9]|[1-9][0-9]+)(\.[0-9]+)?([eE][+-]?[0-9]+)?\b/',
  47938. 2 => '{^"(?>\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4}|[^\0-\x1f\\\\"]++)*+"}',
  47939. 3 => '/^\{/',
  47940. 4 => '/^\}/',
  47941. 5 => '/^\[/',
  47942. 6 => '/^\]/',
  47943. 7 => '/^,/',
  47944. 8 => '/^:/',
  47945. 9 => '/^true\b/',
  47946. 10 => '/^false\b/',
  47947. 11 => '/^null\b/',
  47948. 12 => '/^$/',
  47949. 13 => '/^./',
  47950. );
  47951. private $conditions = array(
  47952. "INITIAL" => array(
  47953. "rules" => array(0,1,2,3,4,5,6,7,8,9,10,11,12,13),
  47954. "inclusive" => true,
  47955. ),
  47956. );
  47957. private $conditionStack;
  47958. private $input;
  47959. private $more;
  47960. private $done;
  47961. private $matched;
  47962. public $match;
  47963. public $yylineno;
  47964. public $yyleng;
  47965. public $yytext;
  47966. public $yylloc;
  47967. public function lex()
  47968. {
  47969. $r = $this->next();
  47970. if (!$r instanceof Undefined) {
  47971. return $r;
  47972. }
  47973. return $this->lex();
  47974. }
  47975. public function setInput($input)
  47976. {
  47977. $this->input = $input;
  47978. $this->more = false;
  47979. $this->done = false;
  47980. $this->yylineno = $this->yyleng = 0;
  47981. $this->yytext = $this->matched = $this->match = '';
  47982. $this->conditionStack = array('INITIAL');
  47983. $this->yylloc = array('first_line' => 1, 'first_column' => 0, 'last_line' => 1, 'last_column' => 0);
  47984. return $this;
  47985. }
  47986. public function showPosition()
  47987. {
  47988. $pre = str_replace("\n", '', $this->getPastInput());
  47989. $c = str_repeat('-', max(0, strlen($pre) - 1));
  47990. return $pre . str_replace("\n", '', $this->getUpcomingInput()) . "\n" . $c . "^";
  47991. }
  47992. public function getPastInput()
  47993. {
  47994. $past = substr($this->matched, 0, strlen($this->matched) - strlen($this->match));
  47995. return (strlen($past) > 20 ? '...' : '') . substr($past, -20);
  47996. }
  47997. public function getUpcomingInput()
  47998. {
  47999. $next = $this->match;
  48000. if (strlen($next) < 20) {
  48001. $next .= substr($this->input, 0, 20 - strlen($next));
  48002. }
  48003. return substr($next, 0, 20) . (strlen($next) > 20 ? '...' : '');
  48004. }
  48005. protected function parseError($str, $hash)
  48006. {
  48007. throw new \Exception($str);
  48008. }
  48009. private function next()
  48010. {
  48011. if ($this->done) {
  48012. return $this->EOF;
  48013. }
  48014. if ($this->input === '') {
  48015. $this->done = true;
  48016. }
  48017. $token = null;
  48018. $match = null;
  48019. $col = null;
  48020. $lines = null;
  48021. if (!$this->more) {
  48022. $this->yytext = '';
  48023. $this->match = '';
  48024. }
  48025. $rules = $this->getCurrentRules();
  48026. $rulesLen = count($rules);
  48027. for ($i=0; $i < $rulesLen; $i++) {
  48028. if (preg_match($this->rules[$rules[$i]], $this->input, $match)) {
  48029. preg_match_all('/\n.*/', $match[0], $lines);
  48030. $lines = $lines[0];
  48031. if ($lines) {
  48032. $this->yylineno += count($lines);
  48033. }
  48034. $this->yylloc = array(
  48035. 'first_line' => $this->yylloc['last_line'],
  48036. 'last_line' => $this->yylineno+1,
  48037. 'first_column' => $this->yylloc['last_column'],
  48038. 'last_column' => $lines ? strlen($lines[count($lines) - 1]) - 1 : $this->yylloc['last_column'] + strlen($match[0]),
  48039. );
  48040. $this->yytext .= $match[0];
  48041. $this->match .= $match[0];
  48042. $this->yyleng = strlen($this->yytext);
  48043. $this->more = false;
  48044. $this->input = substr($this->input, strlen($match[0]));
  48045. $this->matched .= $match[0];
  48046. $token = $this->performAction($rules[$i], $this->conditionStack[count($this->conditionStack)-1]);
  48047. if ($token) {
  48048. return $token;
  48049. }
  48050. return new Undefined();
  48051. }
  48052. }
  48053. if ($this->input === "") {
  48054. return $this->EOF;
  48055. }
  48056. $this->parseError(
  48057. 'Lexical error on line ' . ($this->yylineno+1) . ". Unrecognized text.\n" . $this->showPosition(),
  48058. array(
  48059. 'text' => "",
  48060. 'token' => null,
  48061. 'line' => $this->yylineno,
  48062. )
  48063. );
  48064. }
  48065. private function getCurrentRules()
  48066. {
  48067. return $this->conditions[$this->conditionStack[count($this->conditionStack)-1]]['rules'];
  48068. }
  48069. private function performAction($avoiding_name_collisions, $YY_START)
  48070. {
  48071. switch ($avoiding_name_collisions) {
  48072. case 0:
  48073. break;
  48074. case 1:
  48075. return 6;
  48076. break;
  48077. case 2:
  48078. $this->yytext = substr($this->yytext, 1, $this->yyleng-2);
  48079. return 4;
  48080. case 3:
  48081. return 17;
  48082. case 4:
  48083. return 18;
  48084. case 5:
  48085. return 23;
  48086. case 6:
  48087. return 24;
  48088. case 7:
  48089. return 22;
  48090. case 8:
  48091. return 21;
  48092. case 9:
  48093. return 10;
  48094. case 10:
  48095. return 11;
  48096. case 11:
  48097. return 8;
  48098. case 12:
  48099. return 14;
  48100. case 13:
  48101. return 'INVALID';
  48102. }
  48103. }
  48104. }
  48105. <?php
  48106. namespace Seld\JsonLint;
  48107. class ParsingException extends \Exception
  48108. {
  48109. protected $details;
  48110. public function __construct($message, $details = array())
  48111. {
  48112. $this->details = $details;
  48113. parent::__construct($message);
  48114. }
  48115. public function getDetails()
  48116. {
  48117. return $this->details;
  48118. }
  48119. }
  48120. <?php
  48121. namespace Seld\JsonLint;
  48122. class Undefined
  48123. {
  48124. }
  48125. MIT License
  48126. Copyright (c) 2016
  48127. Permission is hereby granted, free of charge, to any person obtaining a copy
  48128. of this software and associated documentation files (the "Software"), to deal
  48129. in the Software without restriction, including without limitation the rights
  48130. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  48131. copies of the Software, and to permit persons to whom the Software is
  48132. furnished to do so, subject to the following conditions:
  48133. The above copyright notice and this permission notice shall be included in all
  48134. copies or substantial portions of the Software.
  48135. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  48136. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  48137. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  48138. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  48139. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  48140. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  48141. SOFTWARE.
  48142. <?php
  48143. require __DIR__ . '/../vendor/autoload.php';
  48144. $data = json_decode(file_get_contents('data.json'));
  48145. $validator = new JsonSchema\Validator();
  48146. $validator->check($data, (object) array('$ref' => 'file://' . realpath('schema.json')));
  48147. if ($validator->isValid()) {
  48148. echo "The supplied JSON validates against the schema.\n";
  48149. } else {
  48150. echo "JSON does not validate. Violations:\n";
  48151. foreach ($validator->getErrors() as $error) {
  48152. echo sprintf("[%s] %s\n", $error['property'], $error['message']);
  48153. }
  48154. }
  48155. <?php
  48156. namespace JsonSchema\Constraints;
  48157. use JsonSchema\Entity\JsonPointer;
  48158. use JsonSchema\Exception\InvalidArgumentException;
  48159. use JsonSchema\Exception\ValidationException;
  48160. use JsonSchema\Validator;
  48161. class BaseConstraint
  48162. {
  48163. protected $errors = array();
  48164. protected $errorMask = Validator::ERROR_NONE;
  48165. protected $factory;
  48166. public function __construct(Factory $factory = null)
  48167. {
  48168. $this->factory = $factory ?: new Factory();
  48169. }
  48170. public function addError(JsonPointer $path = null, $message, $constraint = '', array $more = null)
  48171. {
  48172. $error = array(
  48173. 'property' => $this->convertJsonPointerIntoPropertyPath($path ?: new JsonPointer('')),
  48174. 'pointer' => ltrim(strval($path ?: new JsonPointer('')), '#'),
  48175. 'message' => $message,
  48176. 'constraint' => $constraint,
  48177. 'context' => $this->factory->getErrorContext(),
  48178. );
  48179. if ($this->factory->getConfig(Constraint::CHECK_MODE_EXCEPTIONS)) {
  48180. throw new ValidationException(sprintf('Error validating %s: %s', $error['pointer'], $error['message']));
  48181. }
  48182. if (is_array($more) && count($more) > 0) {
  48183. $error += $more;
  48184. }
  48185. $this->errors[] = $error;
  48186. $this->errorMask |= $error['context'];
  48187. }
  48188. public function addErrors(array $errors)
  48189. {
  48190. if ($errors) {
  48191. $this->errors = array_merge($this->errors, $errors);
  48192. $errorMask = &$this->errorMask;
  48193. array_walk($errors, function ($error) use (&$errorMask) {
  48194. if (isset($error['context'])) {
  48195. $errorMask |= $error['context'];
  48196. }
  48197. });
  48198. }
  48199. }
  48200. public function getErrors($errorContext = Validator::ERROR_ALL)
  48201. {
  48202. if ($errorContext === Validator::ERROR_ALL) {
  48203. return $this->errors;
  48204. }
  48205. return array_filter($this->errors, function ($error) use ($errorContext) {
  48206. if ($errorContext & $error['context']) {
  48207. return true;
  48208. }
  48209. });
  48210. }
  48211. public function numErrors($errorContext = Validator::ERROR_ALL)
  48212. {
  48213. if ($errorContext === Validator::ERROR_ALL) {
  48214. return count($this->errors);
  48215. }
  48216. return count($this->getErrors($errorContext));
  48217. }
  48218. public function isValid()
  48219. {
  48220. return !$this->getErrors();
  48221. }
  48222. public function reset()
  48223. {
  48224. $this->errors = array();
  48225. $this->errorMask = Validator::ERROR_NONE;
  48226. }
  48227. public function getErrorMask()
  48228. {
  48229. return $this->errorMask;
  48230. }
  48231. public static function arrayToObjectRecursive($array)
  48232. {
  48233. $json = json_encode($array);
  48234. if (json_last_error() !== \JSON_ERROR_NONE) {
  48235. $message = 'Unable to encode schema array as JSON';
  48236. if (function_exists('json_last_error_msg')) {
  48237. $message .= ': ' . json_last_error_msg();
  48238. }
  48239. throw new InvalidArgumentException($message);
  48240. }
  48241. return (object) json_decode($json);
  48242. }
  48243. }
  48244. <?php
  48245. namespace JsonSchema\Constraints;
  48246. use JsonSchema\Entity\JsonPointer;
  48247. class CollectionConstraint extends Constraint
  48248. {
  48249. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null)
  48250. {
  48251. if (isset($schema->minItems) && count($value) < $schema->minItems) {
  48252. $this->addError($path, 'There must be a minimum of ' . $schema->minItems . ' items in the array', 'minItems', array('minItems' => $schema->minItems));
  48253. }
  48254. if (isset($schema->maxItems) && count($value) > $schema->maxItems) {
  48255. $this->addError($path, 'There must be a maximum of ' . $schema->maxItems . ' items in the array', 'maxItems', array('maxItems' => $schema->maxItems));
  48256. }
  48257. if (isset($schema->uniqueItems) && $schema->uniqueItems) {
  48258. $unique = $value;
  48259. if (is_array($value) && count($value)) {
  48260. $unique = array_map(function ($e) {
  48261. return var_export($e, true);
  48262. }, $value);
  48263. }
  48264. if (count(array_unique($unique)) != count($value)) {
  48265. $this->addError($path, 'There are no duplicates allowed in the array', 'uniqueItems');
  48266. }
  48267. }
  48268. if (isset($schema->items)) {
  48269. $this->validateItems($value, $schema, $path, $i);
  48270. }
  48271. }
  48272. protected function validateItems(&$value, $schema = null, JsonPointer $path = null, $i = null)
  48273. {
  48274. if (is_object($schema->items)) {
  48275. foreach ($value as $k => &$v) {
  48276. $initErrors = $this->getErrors();
  48277. $this->checkUndefined($v, $schema->items, $path, $k);
  48278. if (count($initErrors) < count($this->getErrors()) && (isset($schema->additionalItems) && $schema->additionalItems !== false)) {
  48279. $secondErrors = $this->getErrors();
  48280. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  48281. }
  48282. if (isset($secondErrors) && count($secondErrors) < count($this->getErrors())) {
  48283. $this->errors = $secondErrors;
  48284. } elseif (isset($secondErrors) && count($secondErrors) === count($this->getErrors())) {
  48285. $this->errors = $initErrors;
  48286. }
  48287. }
  48288. unset($v);
  48289. } else {
  48290. foreach ($value as $k => &$v) {
  48291. if (array_key_exists($k, $schema->items)) {
  48292. $this->checkUndefined($v, $schema->items[$k], $path, $k);
  48293. } else {
  48294. if (property_exists($schema, 'additionalItems')) {
  48295. if ($schema->additionalItems !== false) {
  48296. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  48297. } else {
  48298. $this->addError(
  48299. $path, 'The item ' . $i . '[' . $k . '] is not defined and the definition does not allow additional items', 'additionalItems', array('additionalItems' => $schema->additionalItems));
  48300. }
  48301. } else {
  48302. $this->checkUndefined($v, new \stdClass(), $path, $k);
  48303. }
  48304. }
  48305. }
  48306. unset($v);
  48307. if (count($value) > 0) {
  48308. for ($k = count($value); $k < count($schema->items); $k++) {
  48309. $undefinedInstance = $this->factory->createInstanceFor('undefined');
  48310. $this->checkUndefined($undefinedInstance, $schema->items[$k], $path, $k);
  48311. }
  48312. }
  48313. }
  48314. }
  48315. }
  48316. <?php
  48317. namespace JsonSchema\Constraints;
  48318. use JsonSchema\Entity\JsonPointer;
  48319. abstract class Constraint extends BaseConstraint implements ConstraintInterface
  48320. {
  48321. protected $inlineSchemaProperty = '$schema';
  48322. const CHECK_MODE_NONE = 0x00000000;
  48323. const CHECK_MODE_NORMAL = 0x00000001;
  48324. const CHECK_MODE_TYPE_CAST = 0x00000002;
  48325. const CHECK_MODE_COERCE_TYPES = 0x00000004;
  48326. const CHECK_MODE_APPLY_DEFAULTS = 0x00000008;
  48327. const CHECK_MODE_EXCEPTIONS = 0x00000010;
  48328. const CHECK_MODE_DISABLE_FORMAT = 0x00000020;
  48329. const CHECK_MODE_ONLY_REQUIRED_DEFAULTS = 0x00000080;
  48330. const CHECK_MODE_VALIDATE_SCHEMA = 0x00000100;
  48331. protected function incrementPath(JsonPointer $path = null, $i)
  48332. {
  48333. $path = $path ?: new JsonPointer('');
  48334. $path = $path->withPropertyPaths(
  48335. array_merge(
  48336. $path->getPropertyPaths(),
  48337. array_filter(array($i), 'strlen')
  48338. )
  48339. );
  48340. return $path;
  48341. }
  48342. protected function checkArray(&$value, $schema = null, JsonPointer $path = null, $i = null)
  48343. {
  48344. $validator = $this->factory->createInstanceFor('collection');
  48345. $validator->check($value, $schema, $path, $i);
  48346. $this->addErrors($validator->getErrors());
  48347. }
  48348. protected function checkObject(&$value, $schema = null, JsonPointer $path = null, $properties = null,
  48349. $additionalProperties = null, $patternProperties = null, $appliedDefaults = array())
  48350. {
  48351. $validator = $this->factory->createInstanceFor('object');
  48352. $validator->check($value, $schema, $path, $properties, $additionalProperties, $patternProperties, $appliedDefaults);
  48353. $this->addErrors($validator->getErrors());
  48354. }
  48355. protected function checkType(&$value, $schema = null, JsonPointer $path = null, $i = null)
  48356. {
  48357. $validator = $this->factory->createInstanceFor('type');
  48358. $validator->check($value, $schema, $path, $i);
  48359. $this->addErrors($validator->getErrors());
  48360. }
  48361. protected function checkUndefined(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
  48362. {
  48363. $validator = $this->factory->createInstanceFor('undefined');
  48364. $validator->check($value, $this->factory->getSchemaStorage()->resolveRefSchema($schema), $path, $i, $fromDefault);
  48365. $this->addErrors($validator->getErrors());
  48366. }
  48367. protected function checkString($value, $schema = null, JsonPointer $path = null, $i = null)
  48368. {
  48369. $validator = $this->factory->createInstanceFor('string');
  48370. $validator->check($value, $schema, $path, $i);
  48371. $this->addErrors($validator->getErrors());
  48372. }
  48373. protected function checkNumber($value, $schema = null, JsonPointer $path = null, $i = null)
  48374. {
  48375. $validator = $this->factory->createInstanceFor('number');
  48376. $validator->check($value, $schema, $path, $i);
  48377. $this->addErrors($validator->getErrors());
  48378. }
  48379. protected function checkEnum($value, $schema = null, JsonPointer $path = null, $i = null)
  48380. {
  48381. $validator = $this->factory->createInstanceFor('enum');
  48382. $validator->check($value, $schema, $path, $i);
  48383. $this->addErrors($validator->getErrors());
  48384. }
  48385. protected function checkFormat($value, $schema = null, JsonPointer $path = null, $i = null)
  48386. {
  48387. $validator = $this->factory->createInstanceFor('format');
  48388. $validator->check($value, $schema, $path, $i);
  48389. $this->addErrors($validator->getErrors());
  48390. }
  48391. protected function getTypeCheck()
  48392. {
  48393. return $this->factory->getTypeCheck();
  48394. }
  48395. protected function convertJsonPointerIntoPropertyPath(JsonPointer $pointer)
  48396. {
  48397. $result = array_map(
  48398. function ($path) {
  48399. return sprintf(is_numeric($path) ? '[%d]' : '.%s', $path);
  48400. },
  48401. $pointer->getPropertyPaths()
  48402. );
  48403. return trim(implode('', $result), '.');
  48404. }
  48405. }
  48406. <?php
  48407. namespace JsonSchema\Constraints;
  48408. use JsonSchema\Entity\JsonPointer;
  48409. interface ConstraintInterface
  48410. {
  48411. public function getErrors();
  48412. public function addErrors(array $errors);
  48413. public function addError(JsonPointer $path = null, $message, $constraint='', array $more = null);
  48414. public function isValid();
  48415. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null);
  48416. }
  48417. <?php
  48418. namespace JsonSchema\Constraints;
  48419. use JsonSchema\Entity\JsonPointer;
  48420. class EnumConstraint extends Constraint
  48421. {
  48422. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  48423. {
  48424. if ($element instanceof UndefinedConstraint && (!isset($schema->required) || !$schema->required)) {
  48425. return;
  48426. }
  48427. $type = gettype($element);
  48428. foreach ($schema->enum as $enum) {
  48429. $enumType = gettype($enum);
  48430. if ($this->factory->getConfig(self::CHECK_MODE_TYPE_CAST) && $type == 'array' && $enumType == 'object') {
  48431. if ((object) $element == $enum) {
  48432. return;
  48433. }
  48434. }
  48435. if ($type === gettype($enum)) {
  48436. if ($type == 'object') {
  48437. if ($element == $enum) {
  48438. return;
  48439. }
  48440. } elseif ($element === $enum) {
  48441. return;
  48442. }
  48443. }
  48444. }
  48445. $this->addError($path, 'Does not have a value in the enumeration ' . json_encode($schema->enum), 'enum', array('enum' => $schema->enum));
  48446. }
  48447. }
  48448. <?php
  48449. namespace JsonSchema\Constraints;
  48450. use JsonSchema\Exception\InvalidArgumentException;
  48451. use JsonSchema\SchemaStorage;
  48452. use JsonSchema\SchemaStorageInterface;
  48453. use JsonSchema\Uri\UriRetriever;
  48454. use JsonSchema\UriRetrieverInterface;
  48455. use JsonSchema\Validator;
  48456. class Factory
  48457. {
  48458. protected $schemaStorage;
  48459. protected $uriRetriever;
  48460. private $checkMode = Constraint::CHECK_MODE_NORMAL;
  48461. private $typeCheck = array();
  48462. protected $errorContext = Validator::ERROR_DOCUMENT_VALIDATION;
  48463. protected $constraintMap = array(
  48464. 'array' => 'JsonSchema\Constraints\CollectionConstraint',
  48465. 'collection' => 'JsonSchema\Constraints\CollectionConstraint',
  48466. 'object' => 'JsonSchema\Constraints\ObjectConstraint',
  48467. 'type' => 'JsonSchema\Constraints\TypeConstraint',
  48468. 'undefined' => 'JsonSchema\Constraints\UndefinedConstraint',
  48469. 'string' => 'JsonSchema\Constraints\StringConstraint',
  48470. 'number' => 'JsonSchema\Constraints\NumberConstraint',
  48471. 'enum' => 'JsonSchema\Constraints\EnumConstraint',
  48472. 'format' => 'JsonSchema\Constraints\FormatConstraint',
  48473. 'schema' => 'JsonSchema\Constraints\SchemaConstraint',
  48474. 'validator' => 'JsonSchema\Validator'
  48475. );
  48476. private $instanceCache = array();
  48477. public function __construct(
  48478. SchemaStorageInterface $schemaStorage = null,
  48479. UriRetrieverInterface $uriRetriever = null,
  48480. $checkMode = Constraint::CHECK_MODE_NORMAL
  48481. ) {
  48482. $this->setConfig($checkMode);
  48483. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  48484. $this->schemaStorage = $schemaStorage ?: new SchemaStorage($this->uriRetriever);
  48485. }
  48486. public function setConfig($checkMode = Constraint::CHECK_MODE_NORMAL)
  48487. {
  48488. $this->checkMode = $checkMode;
  48489. }
  48490. public function addConfig($options)
  48491. {
  48492. $this->checkMode |= $options;
  48493. }
  48494. public function removeConfig($options)
  48495. {
  48496. $this->checkMode &= ~$options;
  48497. }
  48498. public function getConfig($options = null)
  48499. {
  48500. if ($options === null) {
  48501. return $this->checkMode;
  48502. }
  48503. return $this->checkMode & $options;
  48504. }
  48505. public function getUriRetriever()
  48506. {
  48507. return $this->uriRetriever;
  48508. }
  48509. public function getSchemaStorage()
  48510. {
  48511. return $this->schemaStorage;
  48512. }
  48513. public function getTypeCheck()
  48514. {
  48515. if (!isset($this->typeCheck[$this->checkMode])) {
  48516. $this->typeCheck[$this->checkMode] = ($this->checkMode & Constraint::CHECK_MODE_TYPE_CAST)
  48517. ? new TypeCheck\LooseTypeCheck()
  48518. : new TypeCheck\StrictTypeCheck();
  48519. }
  48520. return $this->typeCheck[$this->checkMode];
  48521. }
  48522. public function setConstraintClass($name, $class)
  48523. {
  48524. if (!class_exists($class)) {
  48525. throw new InvalidArgumentException('Unknown constraint ' . $name);
  48526. }
  48527. if (!in_array('JsonSchema\Constraints\ConstraintInterface', class_implements($class))) {
  48528. throw new InvalidArgumentException('Invalid class ' . $name);
  48529. }
  48530. $this->constraintMap[$name] = $class;
  48531. return $this;
  48532. }
  48533. public function createInstanceFor($constraintName)
  48534. {
  48535. if (!isset($this->constraintMap[$constraintName])) {
  48536. throw new InvalidArgumentException('Unknown constraint ' . $constraintName);
  48537. }
  48538. if (!isset($this->instanceCache[$constraintName])) {
  48539. $this->instanceCache[$constraintName] = new $this->constraintMap[$constraintName]($this);
  48540. }
  48541. return clone $this->instanceCache[$constraintName];
  48542. }
  48543. public function getErrorContext()
  48544. {
  48545. return $this->errorContext;
  48546. }
  48547. public function setErrorContext($errorContext)
  48548. {
  48549. $this->errorContext = $errorContext;
  48550. }
  48551. }
  48552. <?php
  48553. namespace JsonSchema\Constraints;
  48554. use JsonSchema\Entity\JsonPointer;
  48555. use JsonSchema\Rfc3339;
  48556. class FormatConstraint extends Constraint
  48557. {
  48558. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  48559. {
  48560. if (!isset($schema->format) || $this->factory->getConfig(self::CHECK_MODE_DISABLE_FORMAT)) {
  48561. return;
  48562. }
  48563. switch ($schema->format) {
  48564. case 'date':
  48565. if (!$date = $this->validateDateTime($element, 'Y-m-d')) {
  48566. $this->addError($path, sprintf('Invalid date %s, expected format YYYY-MM-DD', json_encode($element)), 'format', array('format' => $schema->format));
  48567. }
  48568. break;
  48569. case 'time':
  48570. if (!$this->validateDateTime($element, 'H:i:s')) {
  48571. $this->addError($path, sprintf('Invalid time %s, expected format hh:mm:ss', json_encode($element)), 'format', array('format' => $schema->format));
  48572. }
  48573. break;
  48574. case 'date-time':
  48575. if (null === Rfc3339::createFromString($element)) {
  48576. $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));
  48577. }
  48578. break;
  48579. case 'utc-millisec':
  48580. if (!$this->validateDateTime($element, 'U')) {
  48581. $this->addError($path, sprintf('Invalid time %s, expected integer of milliseconds since Epoch', json_encode($element)), 'format', array('format' => $schema->format));
  48582. }
  48583. break;
  48584. case 'regex':
  48585. if (!$this->validateRegex($element)) {
  48586. $this->addError($path, 'Invalid regex format ' . $element, 'format', array('format' => $schema->format));
  48587. }
  48588. break;
  48589. case 'color':
  48590. if (!$this->validateColor($element)) {
  48591. $this->addError($path, 'Invalid color', 'format', array('format' => $schema->format));
  48592. }
  48593. break;
  48594. case 'style':
  48595. if (!$this->validateStyle($element)) {
  48596. $this->addError($path, 'Invalid style', 'format', array('format' => $schema->format));
  48597. }
  48598. break;
  48599. case 'phone':
  48600. if (!$this->validatePhone($element)) {
  48601. $this->addError($path, 'Invalid phone number', 'format', array('format' => $schema->format));
  48602. }
  48603. break;
  48604. case 'uri':
  48605. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  48606. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  48607. }
  48608. break;
  48609. case 'uriref':
  48610. case 'uri-reference':
  48611. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  48612. if (substr($element, 0, 2) === '//') {
  48613. $validURL = filter_var('scheme:' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  48614. } elseif (substr($element, 0, 1) === '/') {
  48615. $validURL = filter_var('scheme://host' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  48616. } elseif (strlen($element)) {
  48617. $pathParts = explode('/', $element, 2);
  48618. if (strpos($pathParts[0], ':') !== false) {
  48619. $validURL = null;
  48620. } else {
  48621. $validURL = filter_var('scheme://host/' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  48622. }
  48623. } else {
  48624. $validURL = null;
  48625. }
  48626. if ($validURL === null) {
  48627. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  48628. }
  48629. }
  48630. break;
  48631. case 'email':
  48632. $filterFlags = FILTER_NULL_ON_FAILURE;
  48633. if (defined('FILTER_FLAG_EMAIL_UNICODE')) {
  48634. $filterFlags |= constant('FILTER_FLAG_EMAIL_UNICODE');
  48635. }
  48636. if (null === filter_var($element, FILTER_VALIDATE_EMAIL, $filterFlags)) {
  48637. $this->addError($path, 'Invalid email', 'format', array('format' => $schema->format));
  48638. }
  48639. break;
  48640. case 'ip-address':
  48641. case 'ipv4':
  48642. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV4)) {
  48643. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  48644. }
  48645. break;
  48646. case 'ipv6':
  48647. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV6)) {
  48648. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  48649. }
  48650. break;
  48651. case 'host-name':
  48652. case 'hostname':
  48653. if (!$this->validateHostname($element)) {
  48654. $this->addError($path, 'Invalid hostname', 'format', array('format' => $schema->format));
  48655. }
  48656. break;
  48657. default:
  48658. break;
  48659. }
  48660. }
  48661. protected function validateDateTime($datetime, $format)
  48662. {
  48663. $dt = \DateTime::createFromFormat($format, $datetime);
  48664. if (!$dt) {
  48665. return false;
  48666. }
  48667. if ($datetime === $dt->format($format)) {
  48668. return true;
  48669. }
  48670. if ((strpos('u', $format) !== -1) && (preg_match('/\.\d+Z$/', $datetime))) {
  48671. return true;
  48672. }
  48673. return false;
  48674. }
  48675. protected function validateRegex($regex)
  48676. {
  48677. return false !== @preg_match('/' . $regex . '/u', '');
  48678. }
  48679. protected function validateColor($color)
  48680. {
  48681. if (in_array(strtolower($color), array('aqua', 'black', 'blue', 'fuchsia',
  48682. 'gray', 'green', 'lime', 'maroon', 'navy', 'olive', 'orange', 'purple',
  48683. 'red', 'silver', 'teal', 'white', 'yellow'))) {
  48684. return true;
  48685. }
  48686. return preg_match('/^#([a-f0-9]{3}|[a-f0-9]{6})$/i', $color);
  48687. }
  48688. protected function validateStyle($style)
  48689. {
  48690. $properties = explode(';', rtrim($style, ';'));
  48691. $invalidEntries = preg_grep('/^\s*[-a-z]+\s*:\s*.+$/i', $properties, PREG_GREP_INVERT);
  48692. return empty($invalidEntries);
  48693. }
  48694. protected function validatePhone($phone)
  48695. {
  48696. return preg_match('/^\+?(\(\d{3}\)|\d{3}) \d{3} \d{4}$/', $phone);
  48697. }
  48698. protected function validateHostname($host)
  48699. {
  48700. $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';
  48701. return preg_match($hostnameRegex, $host);
  48702. }
  48703. }
  48704. <?php
  48705. namespace JsonSchema\Constraints;
  48706. use JsonSchema\Entity\JsonPointer;
  48707. class NumberConstraint extends Constraint
  48708. {
  48709. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  48710. {
  48711. if (isset($schema->exclusiveMinimum)) {
  48712. if (isset($schema->minimum)) {
  48713. if ($schema->exclusiveMinimum && $element <= $schema->minimum) {
  48714. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'exclusiveMinimum', array('minimum' => $schema->minimum));
  48715. } elseif ($element < $schema->minimum) {
  48716. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  48717. }
  48718. } else {
  48719. $this->addError($path, 'Use of exclusiveMinimum requires presence of minimum', 'missingMinimum');
  48720. }
  48721. } elseif (isset($schema->minimum) && $element < $schema->minimum) {
  48722. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  48723. }
  48724. if (isset($schema->exclusiveMaximum)) {
  48725. if (isset($schema->maximum)) {
  48726. if ($schema->exclusiveMaximum && $element >= $schema->maximum) {
  48727. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'exclusiveMaximum', array('maximum' => $schema->maximum));
  48728. } elseif ($element > $schema->maximum) {
  48729. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  48730. }
  48731. } else {
  48732. $this->addError($path, 'Use of exclusiveMaximum requires presence of maximum', 'missingMaximum');
  48733. }
  48734. } elseif (isset($schema->maximum) && $element > $schema->maximum) {
  48735. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  48736. }
  48737. if (isset($schema->divisibleBy) && $this->fmod($element, $schema->divisibleBy) != 0) {
  48738. $this->addError($path, 'Is not divisible by ' . $schema->divisibleBy, 'divisibleBy', array('divisibleBy' => $schema->divisibleBy));
  48739. }
  48740. if (isset($schema->multipleOf) && $this->fmod($element, $schema->multipleOf) != 0) {
  48741. $this->addError($path, 'Must be a multiple of ' . $schema->multipleOf, 'multipleOf', array('multipleOf' => $schema->multipleOf));
  48742. }
  48743. $this->checkFormat($element, $schema, $path, $i);
  48744. }
  48745. private function fmod($number1, $number2)
  48746. {
  48747. $modulus = ($number1 - round($number1 / $number2) * $number2);
  48748. $precision = 0.0000000001;
  48749. if (-$precision < $modulus && $modulus < $precision) {
  48750. return 0.0;
  48751. }
  48752. return $modulus;
  48753. }
  48754. }
  48755. <?php
  48756. namespace JsonSchema\Constraints;
  48757. use JsonSchema\Entity\JsonPointer;
  48758. class ObjectConstraint extends Constraint
  48759. {
  48760. protected $appliedDefaults = array();
  48761. public function check(&$element, $schema = null, JsonPointer $path = null, $properties = null,
  48762. $additionalProp = null, $patternProperties = null, $appliedDefaults = array())
  48763. {
  48764. if ($element instanceof UndefinedConstraint) {
  48765. return;
  48766. }
  48767. $this->appliedDefaults = $appliedDefaults;
  48768. $matches = array();
  48769. if ($patternProperties) {
  48770. $matches = $this->validatePatternProperties($element, $path, $patternProperties);
  48771. }
  48772. if ($properties) {
  48773. $this->validateProperties($element, $properties, $path);
  48774. }
  48775. $this->validateElement($element, $matches, $schema, $path, $properties, $additionalProp);
  48776. }
  48777. public function validatePatternProperties($element, JsonPointer $path = null, $patternProperties)
  48778. {
  48779. $try = array('/', '#', '+', '~', '%');
  48780. $matches = array();
  48781. foreach ($patternProperties as $pregex => $schema) {
  48782. $delimiter = '/';
  48783. foreach ($try as $delimiter) {
  48784. if (strpos($pregex, $delimiter) === false) {
  48785. break;
  48786. }
  48787. }
  48788. if (@preg_match($delimiter . $pregex . $delimiter . 'u', '') === false) {
  48789. $this->addError($path, 'The pattern "' . $pregex . '" is invalid', 'pregex', array('pregex' => $pregex));
  48790. continue;
  48791. }
  48792. foreach ($element as $i => $value) {
  48793. if (preg_match($delimiter . $pregex . $delimiter . 'u', $i)) {
  48794. $matches[] = $i;
  48795. $this->checkUndefined($value, $schema ?: new \stdClass(), $path, $i, in_array($i, $this->appliedDefaults));
  48796. }
  48797. }
  48798. }
  48799. return $matches;
  48800. }
  48801. public function validateElement($element, $matches, $schema = null, JsonPointer $path = null,
  48802. $properties = null, $additionalProp = null)
  48803. {
  48804. $this->validateMinMaxConstraint($element, $schema, $path);
  48805. foreach ($element as $i => $value) {
  48806. $definition = $this->getProperty($properties, $i);
  48807. if (!in_array($i, $matches) && $additionalProp === false && $this->inlineSchemaProperty !== $i && !$definition) {
  48808. $this->addError($path, 'The property ' . $i . ' is not defined and the definition does not allow additional properties', 'additionalProp');
  48809. }
  48810. if (!in_array($i, $matches) && $additionalProp && !$definition) {
  48811. if ($additionalProp === true) {
  48812. $this->checkUndefined($value, null, $path, $i, in_array($i, $this->appliedDefaults));
  48813. } else {
  48814. $this->checkUndefined($value, $additionalProp, $path, $i, in_array($i, $this->appliedDefaults));
  48815. }
  48816. }
  48817. $require = $this->getProperty($definition, 'requires');
  48818. if ($require && !$this->getProperty($element, $require)) {
  48819. $this->addError($path, 'The presence of the property ' . $i . ' requires that ' . $require . ' also be present', 'requires');
  48820. }
  48821. $property = $this->getProperty($element, $i, $this->factory->createInstanceFor('undefined'));
  48822. if (is_object($property)) {
  48823. $this->validateMinMaxConstraint(!($property instanceof UndefinedConstraint) ? $property : $element, $definition, $path);
  48824. }
  48825. }
  48826. }
  48827. public function validateProperties(&$element, $properties = null, JsonPointer $path = null)
  48828. {
  48829. $undefinedConstraint = $this->factory->createInstanceFor('undefined');
  48830. foreach ($properties as $i => $value) {
  48831. $property = &$this->getProperty($element, $i, $undefinedConstraint);
  48832. $definition = $this->getProperty($properties, $i);
  48833. if (is_object($definition)) {
  48834. $this->checkUndefined($property, $definition, $path, $i, in_array($i, $this->appliedDefaults));
  48835. }
  48836. }
  48837. }
  48838. protected function &getProperty(&$element, $property, $fallback = null)
  48839. {
  48840. if (is_array($element) && (isset($element[$property]) || array_key_exists($property, $element)) ) {
  48841. return $element[$property];
  48842. } elseif (is_object($element) && property_exists($element, $property)) {
  48843. return $element->$property;
  48844. }
  48845. return $fallback;
  48846. }
  48847. protected function validateMinMaxConstraint($element, $objectDefinition, JsonPointer $path = null)
  48848. {
  48849. if (isset($objectDefinition->minProperties) && !is_object($objectDefinition->minProperties)) {
  48850. if ($this->getTypeCheck()->propertyCount($element) < $objectDefinition->minProperties) {
  48851. $this->addError($path, 'Must contain a minimum of ' . $objectDefinition->minProperties . ' properties', 'minProperties', array('minProperties' => $objectDefinition->minProperties));
  48852. }
  48853. }
  48854. if (isset($objectDefinition->maxProperties) && !is_object($objectDefinition->maxProperties)) {
  48855. if ($this->getTypeCheck()->propertyCount($element) > $objectDefinition->maxProperties) {
  48856. $this->addError($path, 'Must contain no more than ' . $objectDefinition->maxProperties . ' properties', 'maxProperties', array('maxProperties' => $objectDefinition->maxProperties));
  48857. }
  48858. }
  48859. }
  48860. }
  48861. <?php
  48862. namespace JsonSchema\Constraints;
  48863. use JsonSchema\Entity\JsonPointer;
  48864. use JsonSchema\Exception\InvalidArgumentException;
  48865. use JsonSchema\Exception\InvalidSchemaException;
  48866. use JsonSchema\Exception\RuntimeException;
  48867. use JsonSchema\Validator;
  48868. class SchemaConstraint extends Constraint
  48869. {
  48870. const DEFAULT_SCHEMA_SPEC = 'http://json-schema.org/draft-04/schema#';
  48871. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  48872. {
  48873. if ($schema !== null) {
  48874. $validationSchema = $schema;
  48875. } elseif ($this->getTypeCheck()->propertyExists($element, $this->inlineSchemaProperty)) {
  48876. $validationSchema = $this->getTypeCheck()->propertyGet($element, $this->inlineSchemaProperty);
  48877. } else {
  48878. throw new InvalidArgumentException('no schema found to verify against');
  48879. }
  48880. if (is_array($validationSchema)) {
  48881. $validationSchema = BaseConstraint::arrayToObjectRecursive($validationSchema);
  48882. }
  48883. if ($this->factory->getConfig(self::CHECK_MODE_VALIDATE_SCHEMA)) {
  48884. if (!$this->getTypeCheck()->isObject($validationSchema)) {
  48885. throw new RuntimeException('Cannot validate the schema of a non-object');
  48886. }
  48887. if ($this->getTypeCheck()->propertyExists($validationSchema, '$schema')) {
  48888. $schemaSpec = $this->getTypeCheck()->propertyGet($validationSchema, '$schema');
  48889. } else {
  48890. $schemaSpec = self::DEFAULT_SCHEMA_SPEC;
  48891. }
  48892. $schemaStorage = $this->factory->getSchemaStorage();
  48893. if (!$this->getTypeCheck()->isObject($schemaSpec)) {
  48894. $schemaSpec = $schemaStorage->getSchema($schemaSpec);
  48895. }
  48896. $initialErrorCount = $this->numErrors();
  48897. $initialConfig = $this->factory->getConfig();
  48898. $initialContext = $this->factory->getErrorContext();
  48899. $this->factory->removeConfig(self::CHECK_MODE_VALIDATE_SCHEMA | self::CHECK_MODE_APPLY_DEFAULTS);
  48900. $this->factory->addConfig(self::CHECK_MODE_TYPE_CAST);
  48901. $this->factory->setErrorContext(Validator::ERROR_SCHEMA_VALIDATION);
  48902. try {
  48903. $this->check($validationSchema, $schemaSpec);
  48904. } catch (\Exception $e) {
  48905. if ($this->factory->getConfig(self::CHECK_MODE_EXCEPTIONS)) {
  48906. throw new InvalidSchemaException('Schema did not pass validation', 0, $e);
  48907. }
  48908. }
  48909. if ($this->numErrors() > $initialErrorCount) {
  48910. $this->addError($path, 'Schema is not valid', 'schema');
  48911. }
  48912. $this->factory->setConfig($initialConfig);
  48913. $this->factory->setErrorContext($initialContext);
  48914. }
  48915. $this->checkUndefined($element, $validationSchema, $path, $i);
  48916. }
  48917. }
  48918. <?php
  48919. namespace JsonSchema\Constraints;
  48920. use JsonSchema\Entity\JsonPointer;
  48921. class StringConstraint extends Constraint
  48922. {
  48923. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  48924. {
  48925. if (isset($schema->maxLength) && $this->strlen($element) > $schema->maxLength) {
  48926. $this->addError($path, 'Must be at most ' . $schema->maxLength . ' characters long', 'maxLength', array(
  48927. 'maxLength' => $schema->maxLength,
  48928. ));
  48929. }
  48930. if (isset($schema->minLength) && $this->strlen($element) < $schema->minLength) {
  48931. $this->addError($path, 'Must be at least ' . $schema->minLength . ' characters long', 'minLength', array(
  48932. 'minLength' => $schema->minLength,
  48933. ));
  48934. }
  48935. if (isset($schema->pattern) && !preg_match('#' . str_replace('#', '\\#', $schema->pattern) . '#u', $element)) {
  48936. $this->addError($path, 'Does not match the regex pattern ' . $schema->pattern, 'pattern', array(
  48937. 'pattern' => $schema->pattern,
  48938. ));
  48939. }
  48940. $this->checkFormat($element, $schema, $path, $i);
  48941. }
  48942. private function strlen($string)
  48943. {
  48944. if (extension_loaded('mbstring')) {
  48945. return mb_strlen($string, mb_detect_encoding($string));
  48946. }
  48947. return strlen($string);
  48948. }
  48949. }
  48950. <?php
  48951. namespace JsonSchema\Constraints\TypeCheck;
  48952. class LooseTypeCheck implements TypeCheckInterface
  48953. {
  48954. public static function isObject($value)
  48955. {
  48956. return
  48957. is_object($value) ||
  48958. (is_array($value) && (count($value) == 0 || self::isAssociativeArray($value)));
  48959. }
  48960. public static function isArray($value)
  48961. {
  48962. return
  48963. is_array($value) &&
  48964. (count($value) == 0 || !self::isAssociativeArray($value));
  48965. }
  48966. public static function propertyGet($value, $property)
  48967. {
  48968. if (is_object($value)) {
  48969. return $value->{$property};
  48970. }
  48971. return $value[$property];
  48972. }
  48973. public static function propertySet(&$value, $property, $data)
  48974. {
  48975. if (is_object($value)) {
  48976. $value->{$property} = $data;
  48977. } else {
  48978. $value[$property] = $data;
  48979. }
  48980. }
  48981. public static function propertyExists($value, $property)
  48982. {
  48983. if (is_object($value)) {
  48984. return property_exists($value, $property);
  48985. }
  48986. return array_key_exists($property, $value);
  48987. }
  48988. public static function propertyCount($value)
  48989. {
  48990. if (is_object($value)) {
  48991. return count(get_object_vars($value));
  48992. }
  48993. return count($value);
  48994. }
  48995. private static function isAssociativeArray($arr)
  48996. {
  48997. return array_keys($arr) !== range(0, count($arr) - 1);
  48998. }
  48999. }
  49000. <?php
  49001. namespace JsonSchema\Constraints\TypeCheck;
  49002. class StrictTypeCheck implements TypeCheckInterface
  49003. {
  49004. public static function isObject($value)
  49005. {
  49006. return is_object($value);
  49007. }
  49008. public static function isArray($value)
  49009. {
  49010. return is_array($value);
  49011. }
  49012. public static function propertyGet($value, $property)
  49013. {
  49014. return $value->{$property};
  49015. }
  49016. public static function propertySet(&$value, $property, $data)
  49017. {
  49018. $value->{$property} = $data;
  49019. }
  49020. public static function propertyExists($value, $property)
  49021. {
  49022. return property_exists($value, $property);
  49023. }
  49024. public static function propertyCount($value)
  49025. {
  49026. if (!is_object($value)) {
  49027. return 0;
  49028. }
  49029. return count(get_object_vars($value));
  49030. }
  49031. }
  49032. <?php
  49033. namespace JsonSchema\Constraints\TypeCheck;
  49034. interface TypeCheckInterface
  49035. {
  49036. public static function isObject($value);
  49037. public static function isArray($value);
  49038. public static function propertyGet($value, $property);
  49039. public static function propertySet(&$value, $property, $data);
  49040. public static function propertyExists($value, $property);
  49041. public static function propertyCount($value);
  49042. }
  49043. <?php
  49044. namespace JsonSchema\Constraints;
  49045. use JsonSchema\Entity\JsonPointer;
  49046. use JsonSchema\Exception\InvalidArgumentException;
  49047. use UnexpectedValueException as StandardUnexpectedValueException;
  49048. class TypeConstraint extends Constraint
  49049. {
  49050. public static $wording = array(
  49051. 'integer' => 'an integer',
  49052. 'number' => 'a number',
  49053. 'boolean' => 'a boolean',
  49054. 'object' => 'an object',
  49055. 'array' => 'an array',
  49056. 'string' => 'a string',
  49057. 'null' => 'a null',
  49058. 'any' => null,
  49059. 0 => null,
  49060. );
  49061. public function check(&$value = null, $schema = null, JsonPointer $path = null, $i = null)
  49062. {
  49063. $type = isset($schema->type) ? $schema->type : null;
  49064. $isValid = false;
  49065. $wording = array();
  49066. if (is_array($type)) {
  49067. $this->validateTypesArray($value, $type, $wording, $isValid, $path);
  49068. } elseif (is_object($type)) {
  49069. $this->checkUndefined($value, $type, $path);
  49070. return;
  49071. } else {
  49072. $isValid = $this->validateType($value, $type);
  49073. }
  49074. if ($isValid === false) {
  49075. if (!is_array($type)) {
  49076. $this->validateTypeNameWording($type);
  49077. $wording[] = self::$wording[$type];
  49078. }
  49079. $this->addError($path, ucwords(gettype($value)) . ' value found, but ' .
  49080. $this->implodeWith($wording, ', ', 'or') . ' is required', 'type');
  49081. }
  49082. }
  49083. protected function validateTypesArray(&$value, array $type, &$validTypesWording, &$isValid, $path)
  49084. {
  49085. foreach ($type as $tp) {
  49086. if (is_object($tp)) {
  49087. if (!$isValid) {
  49088. $validator = $this->factory->createInstanceFor('type');
  49089. $subSchema = new \stdClass();
  49090. $subSchema->type = $tp;
  49091. $validator->check($value, $subSchema, $path, null);
  49092. $error = $validator->getErrors();
  49093. $isValid = !(bool) $error;
  49094. $validTypesWording[] = self::$wording['object'];
  49095. }
  49096. } else {
  49097. $this->validateTypeNameWording($tp);
  49098. $validTypesWording[] = self::$wording[$tp];
  49099. if (!$isValid) {
  49100. $isValid = $this->validateType($value, $tp);
  49101. }
  49102. }
  49103. }
  49104. }
  49105. protected function implodeWith(array $elements, $delimiter = ', ', $listEnd = false)
  49106. {
  49107. if ($listEnd === false || !isset($elements[1])) {
  49108. return implode($delimiter, $elements);
  49109. }
  49110. $lastElement = array_slice($elements, -1);
  49111. $firsElements = join($delimiter, array_slice($elements, 0, -1));
  49112. $implodedElements = array_merge(array($firsElements), $lastElement);
  49113. return join(" $listEnd ", $implodedElements);
  49114. }
  49115. protected function validateTypeNameWording($type)
  49116. {
  49117. if (!isset(self::$wording[$type])) {
  49118. throw new StandardUnexpectedValueException(
  49119. sprintf(
  49120. 'No wording for %s available, expected wordings are: [%s]',
  49121. var_export($type, true),
  49122. implode(', ', array_filter(self::$wording)))
  49123. );
  49124. }
  49125. }
  49126. protected function validateType(&$value, $type)
  49127. {
  49128. if (!$type) {
  49129. return true;
  49130. }
  49131. if ('any' === $type) {
  49132. return true;
  49133. }
  49134. if ('object' === $type) {
  49135. return $this->getTypeCheck()->isObject($value);
  49136. }
  49137. if ('array' === $type) {
  49138. return $this->getTypeCheck()->isArray($value);
  49139. }
  49140. $coerce = $this->factory->getConfig(Constraint::CHECK_MODE_COERCE_TYPES);
  49141. if ('integer' === $type) {
  49142. if ($coerce) {
  49143. $value = $this->toInteger($value);
  49144. }
  49145. return is_int($value);
  49146. }
  49147. if ('number' === $type) {
  49148. if ($coerce) {
  49149. $value = $this->toNumber($value);
  49150. }
  49151. return is_numeric($value) && !is_string($value);
  49152. }
  49153. if ('boolean' === $type) {
  49154. if ($coerce) {
  49155. $value = $this->toBoolean($value);
  49156. }
  49157. return is_bool($value);
  49158. }
  49159. if ('string' === $type) {
  49160. return is_string($value);
  49161. }
  49162. if ('email' === $type) {
  49163. return is_string($value);
  49164. }
  49165. if ('null' === $type) {
  49166. return is_null($value);
  49167. }
  49168. throw new InvalidArgumentException((is_object($value) ? 'object' : $value) . ' is an invalid type for ' . $type);
  49169. }
  49170. protected function toBoolean($value)
  49171. {
  49172. if ($value === 'true') {
  49173. return true;
  49174. }
  49175. if ($value === 'false') {
  49176. return false;
  49177. }
  49178. return $value;
  49179. }
  49180. protected function toNumber($value)
  49181. {
  49182. if (is_numeric($value)) {
  49183. return $value + 0;
  49184. }
  49185. return $value;
  49186. }
  49187. protected function toInteger($value)
  49188. {
  49189. if (is_numeric($value) && (int) $value == $value) {
  49190. return (int) $value;
  49191. }
  49192. return $value;
  49193. }
  49194. }
  49195. <?php
  49196. namespace JsonSchema\Constraints;
  49197. use JsonSchema\Constraints\TypeCheck\LooseTypeCheck;
  49198. use JsonSchema\Entity\JsonPointer;
  49199. use JsonSchema\Exception\ValidationException;
  49200. use JsonSchema\Uri\UriResolver;
  49201. class UndefinedConstraint extends Constraint
  49202. {
  49203. protected $appliedDefaults = array();
  49204. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
  49205. {
  49206. if (is_null($schema) || !is_object($schema)) {
  49207. return;
  49208. }
  49209. $path = $this->incrementPath($path ?: new JsonPointer(''), $i);
  49210. if ($fromDefault) {
  49211. $path->setFromDefault();
  49212. }
  49213. $this->validateCommonProperties($value, $schema, $path, $i);
  49214. $this->validateOfProperties($value, $schema, $path, '');
  49215. $this->validateTypes($value, $schema, $path, $i);
  49216. }
  49217. public function validateTypes(&$value, $schema = null, JsonPointer $path, $i = null)
  49218. {
  49219. if ($this->getTypeCheck()->isArray($value)) {
  49220. $this->checkArray($value, $schema, $path, $i);
  49221. }
  49222. if (LooseTypeCheck::isObject($value)) {
  49223. $this->checkObject(
  49224. $value,
  49225. $schema,
  49226. $path,
  49227. isset($schema->properties) ? $schema->properties : null,
  49228. isset($schema->additionalProperties) ? $schema->additionalProperties : null,
  49229. isset($schema->patternProperties) ? $schema->patternProperties : null,
  49230. $this->appliedDefaults
  49231. );
  49232. }
  49233. if (is_string($value)) {
  49234. $this->checkString($value, $schema, $path, $i);
  49235. }
  49236. if (is_numeric($value)) {
  49237. $this->checkNumber($value, $schema, $path, $i);
  49238. }
  49239. if (isset($schema->enum)) {
  49240. $this->checkEnum($value, $schema, $path, $i);
  49241. }
  49242. }
  49243. protected function validateCommonProperties(&$value, $schema = null, JsonPointer $path, $i = '')
  49244. {
  49245. if (isset($schema->extends)) {
  49246. if (is_string($schema->extends)) {
  49247. $schema->extends = $this->validateUri($schema, $schema->extends);
  49248. }
  49249. if (is_array($schema->extends)) {
  49250. foreach ($schema->extends as $extends) {
  49251. $this->checkUndefined($value, $extends, $path, $i);
  49252. }
  49253. } else {
  49254. $this->checkUndefined($value, $schema->extends, $path, $i);
  49255. }
  49256. }
  49257. if (!$path->fromDefault()) {
  49258. $this->applyDefaultValues($value, $schema, $path);
  49259. }
  49260. if ($this->getTypeCheck()->isObject($value)) {
  49261. if (!($value instanceof self) && isset($schema->required) && is_array($schema->required)) {
  49262. foreach ($schema->required as $required) {
  49263. if (!$this->getTypeCheck()->propertyExists($value, $required)) {
  49264. $this->addError(
  49265. $this->incrementPath($path ?: new JsonPointer(''), $required),
  49266. 'The property ' . $required . ' is required',
  49267. 'required'
  49268. );
  49269. }
  49270. }
  49271. } elseif (isset($schema->required) && !is_array($schema->required)) {
  49272. if ($schema->required && $value instanceof self) {
  49273. $propertyPaths = $path->getPropertyPaths();
  49274. $propertyName = end($propertyPaths);
  49275. $this->addError(
  49276. $path,
  49277. 'The property ' . $propertyName . ' is required',
  49278. 'required'
  49279. );
  49280. }
  49281. } else {
  49282. if ($value instanceof self) {
  49283. return;
  49284. }
  49285. }
  49286. }
  49287. if (!($value instanceof self)) {
  49288. $this->checkType($value, $schema, $path, $i);
  49289. }
  49290. if (isset($schema->disallow)) {
  49291. $initErrors = $this->getErrors();
  49292. $typeSchema = new \stdClass();
  49293. $typeSchema->type = $schema->disallow;
  49294. $this->checkType($value, $typeSchema, $path);
  49295. if (count($this->getErrors()) == count($initErrors)) {
  49296. $this->addError($path, 'Disallowed value was matched', 'disallow');
  49297. } else {
  49298. $this->errors = $initErrors;
  49299. }
  49300. }
  49301. if (isset($schema->not)) {
  49302. $initErrors = $this->getErrors();
  49303. $this->checkUndefined($value, $schema->not, $path, $i);
  49304. if (count($this->getErrors()) == count($initErrors)) {
  49305. $this->addError($path, 'Matched a schema which it should not', 'not');
  49306. } else {
  49307. $this->errors = $initErrors;
  49308. }
  49309. }
  49310. if (isset($schema->dependencies) && $this->getTypeCheck()->isObject($value)) {
  49311. $this->validateDependencies($value, $schema->dependencies, $path);
  49312. }
  49313. }
  49314. private function shouldApplyDefaultValue($requiredOnly, $schema, $name = null, $parentSchema = null)
  49315. {
  49316. if (!$requiredOnly) {
  49317. return true;
  49318. }
  49319. if (
  49320. $name !== null
  49321. && isset($parentSchema->required)
  49322. && is_array($parentSchema->required)
  49323. && in_array($name, $parentSchema->required)
  49324. ) {
  49325. return true;
  49326. }
  49327. if (isset($schema->required) && !is_array($schema->required) && $schema->required) {
  49328. return true;
  49329. }
  49330. return false;
  49331. }
  49332. protected function applyDefaultValues(&$value, $schema, $path)
  49333. {
  49334. if (!$this->factory->getConfig(self::CHECK_MODE_APPLY_DEFAULTS)) {
  49335. return;
  49336. }
  49337. $requiredOnly = $this->factory->getConfig(self::CHECK_MODE_ONLY_REQUIRED_DEFAULTS);
  49338. if (isset($schema->properties) && LooseTypeCheck::isObject($value)) {
  49339. foreach ($schema->properties as $currentProperty => $propertyDefinition) {
  49340. $propertyDefinition = $this->factory->getSchemaStorage()->resolveRefSchema($propertyDefinition);
  49341. if (
  49342. !LooseTypeCheck::propertyExists($value, $currentProperty)
  49343. && property_exists($propertyDefinition, 'default')
  49344. && $this->shouldApplyDefaultValue($requiredOnly, $propertyDefinition, $currentProperty, $schema)
  49345. ) {
  49346. if (is_object($propertyDefinition->default)) {
  49347. LooseTypeCheck::propertySet($value, $currentProperty, clone $propertyDefinition->default);
  49348. } else {
  49349. LooseTypeCheck::propertySet($value, $currentProperty, $propertyDefinition->default);
  49350. }
  49351. $this->appliedDefaults[] = $currentProperty;
  49352. }
  49353. }
  49354. } elseif (isset($schema->items) && LooseTypeCheck::isArray($value)) {
  49355. $items = array();
  49356. if (LooseTypeCheck::isArray($schema->items)) {
  49357. $items = $schema->items;
  49358. } elseif (isset($schema->minItems) && count($value) < $schema->minItems) {
  49359. $items = array_fill(count($value), $schema->minItems - count($value), $schema->items);
  49360. }
  49361. foreach ($items as $currentItem => $itemDefinition) {
  49362. $itemDefinition = $this->factory->getSchemaStorage()->resolveRefSchema($itemDefinition);
  49363. if (
  49364. !array_key_exists($currentItem, $value)
  49365. && property_exists($itemDefinition, 'default')
  49366. && $this->shouldApplyDefaultValue($requiredOnly, $itemDefinition)) {
  49367. if (is_object($itemDefinition->default)) {
  49368. $value[$currentItem] = clone $itemDefinition->default;
  49369. } else {
  49370. $value[$currentItem] = $itemDefinition->default;
  49371. }
  49372. }
  49373. $path->setFromDefault();
  49374. }
  49375. } elseif (
  49376. $value instanceof self
  49377. && property_exists($schema, 'default')
  49378. && $this->shouldApplyDefaultValue($requiredOnly, $schema)) {
  49379. $value = is_object($schema->default) ? clone $schema->default : $schema->default;
  49380. $path->setFromDefault();
  49381. }
  49382. }
  49383. protected function validateOfProperties(&$value, $schema, JsonPointer $path, $i = '')
  49384. {
  49385. if ($value instanceof self) {
  49386. return;
  49387. }
  49388. if (isset($schema->allOf)) {
  49389. $isValid = true;
  49390. foreach ($schema->allOf as $allOf) {
  49391. $initErrors = $this->getErrors();
  49392. $this->checkUndefined($value, $allOf, $path, $i);
  49393. $isValid = $isValid && (count($this->getErrors()) == count($initErrors));
  49394. }
  49395. if (!$isValid) {
  49396. $this->addError($path, 'Failed to match all schemas', 'allOf');
  49397. }
  49398. }
  49399. if (isset($schema->anyOf)) {
  49400. $isValid = false;
  49401. $startErrors = $this->getErrors();
  49402. $caughtException = null;
  49403. foreach ($schema->anyOf as $anyOf) {
  49404. $initErrors = $this->getErrors();
  49405. try {
  49406. $this->checkUndefined($value, $anyOf, $path, $i);
  49407. if ($isValid = (count($this->getErrors()) == count($initErrors))) {
  49408. break;
  49409. }
  49410. } catch (ValidationException $e) {
  49411. $isValid = false;
  49412. }
  49413. }
  49414. if (!$isValid) {
  49415. $this->addError($path, 'Failed to match at least one schema', 'anyOf');
  49416. } else {
  49417. $this->errors = $startErrors;
  49418. }
  49419. }
  49420. if (isset($schema->oneOf)) {
  49421. $allErrors = array();
  49422. $matchedSchemas = 0;
  49423. $startErrors = $this->getErrors();
  49424. foreach ($schema->oneOf as $oneOf) {
  49425. try {
  49426. $this->errors = array();
  49427. $this->checkUndefined($value, $oneOf, $path, $i);
  49428. if (count($this->getErrors()) == 0) {
  49429. $matchedSchemas++;
  49430. }
  49431. $allErrors = array_merge($allErrors, array_values($this->getErrors()));
  49432. } catch (ValidationException $e) {
  49433. }
  49434. }
  49435. if ($matchedSchemas !== 1) {
  49436. $this->addErrors(array_merge($allErrors, $startErrors));
  49437. $this->addError($path, 'Failed to match exactly one schema', 'oneOf');
  49438. } else {
  49439. $this->errors = $startErrors;
  49440. }
  49441. }
  49442. }
  49443. protected function validateDependencies($value, $dependencies, JsonPointer $path, $i = '')
  49444. {
  49445. foreach ($dependencies as $key => $dependency) {
  49446. if ($this->getTypeCheck()->propertyExists($value, $key)) {
  49447. if (is_string($dependency)) {
  49448. if (!$this->getTypeCheck()->propertyExists($value, $dependency)) {
  49449. $this->addError($path, "$key depends on $dependency and $dependency is missing", 'dependencies');
  49450. }
  49451. } elseif (is_array($dependency)) {
  49452. foreach ($dependency as $d) {
  49453. if (!$this->getTypeCheck()->propertyExists($value, $d)) {
  49454. $this->addError($path, "$key depends on $d and $d is missing", 'dependencies');
  49455. }
  49456. }
  49457. } elseif (is_object($dependency)) {
  49458. $this->checkUndefined($value, $dependency, $path, $i);
  49459. }
  49460. }
  49461. }
  49462. }
  49463. protected function validateUri($schema, $schemaUri = null)
  49464. {
  49465. $resolver = new UriResolver();
  49466. $retriever = $this->factory->getUriRetriever();
  49467. $jsonSchema = null;
  49468. if ($resolver->isValid($schemaUri)) {
  49469. $schemaId = property_exists($schema, 'id') ? $schema->id : null;
  49470. $jsonSchema = $retriever->retrieve($schemaId, $schemaUri);
  49471. }
  49472. return $jsonSchema;
  49473. }
  49474. }
  49475. <?php
  49476. namespace JsonSchema\Entity;
  49477. use JsonSchema\Exception\InvalidArgumentException;
  49478. class JsonPointer
  49479. {
  49480. private $filename;
  49481. private $propertyPaths = array();
  49482. private $fromDefault = false;
  49483. public function __construct($value)
  49484. {
  49485. if (!is_string($value)) {
  49486. throw new InvalidArgumentException('Ref value must be a string');
  49487. }
  49488. $splitRef = explode('#', $value, 2);
  49489. $this->filename = $splitRef[0];
  49490. if (array_key_exists(1, $splitRef)) {
  49491. $this->propertyPaths = $this->decodePropertyPaths($splitRef[1]);
  49492. }
  49493. }
  49494. private function decodePropertyPaths($propertyPathString)
  49495. {
  49496. $paths = array();
  49497. foreach (explode('/', trim($propertyPathString, '/')) as $path) {
  49498. $path = $this->decodePath($path);
  49499. if (is_string($path) && '' !== $path) {
  49500. $paths[] = $path;
  49501. }
  49502. }
  49503. return $paths;
  49504. }
  49505. private function encodePropertyPaths()
  49506. {
  49507. return array_map(
  49508. array($this, 'encodePath'),
  49509. $this->getPropertyPaths()
  49510. );
  49511. }
  49512. private function decodePath($path)
  49513. {
  49514. return strtr($path, array('~1' => '/', '~0' => '~', '%25' => '%'));
  49515. }
  49516. private function encodePath($path)
  49517. {
  49518. return strtr($path, array('/' => '~1', '~' => '~0', '%' => '%25'));
  49519. }
  49520. public function getFilename()
  49521. {
  49522. return $this->filename;
  49523. }
  49524. public function getPropertyPaths()
  49525. {
  49526. return $this->propertyPaths;
  49527. }
  49528. public function withPropertyPaths(array $propertyPaths)
  49529. {
  49530. $new = clone $this;
  49531. $new->propertyPaths = $propertyPaths;
  49532. return $new;
  49533. }
  49534. public function getPropertyPathAsString()
  49535. {
  49536. return rtrim('#/' . implode('/', $this->encodePropertyPaths()), '/');
  49537. }
  49538. public function __toString()
  49539. {
  49540. return $this->getFilename() . $this->getPropertyPathAsString();
  49541. }
  49542. public function setFromDefault()
  49543. {
  49544. $this->fromDefault = true;
  49545. }
  49546. public function fromDefault()
  49547. {
  49548. return $this->fromDefault;
  49549. }
  49550. }
  49551. <?php
  49552. namespace JsonSchema\Exception;
  49553. interface ExceptionInterface
  49554. {
  49555. }
  49556. <?php
  49557. namespace JsonSchema\Exception;
  49558. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  49559. {
  49560. }
  49561. <?php
  49562. namespace JsonSchema\Exception;
  49563. class InvalidConfigException extends RuntimeException
  49564. {
  49565. }
  49566. <?php
  49567. namespace JsonSchema\Exception;
  49568. class InvalidSchemaException extends RuntimeException
  49569. {
  49570. }
  49571. <?php
  49572. namespace JsonSchema\Exception;
  49573. class InvalidSchemaMediaTypeException extends RuntimeException
  49574. {
  49575. }
  49576. <?php
  49577. namespace JsonSchema\Exception;
  49578. class InvalidSourceUriException extends InvalidArgumentException
  49579. {
  49580. }
  49581. <?php
  49582. namespace JsonSchema\Exception;
  49583. class JsonDecodingException extends RuntimeException
  49584. {
  49585. public function __construct($code = JSON_ERROR_NONE, \Exception $previous = null)
  49586. {
  49587. switch ($code) {
  49588. case JSON_ERROR_DEPTH:
  49589. $message = 'The maximum stack depth has been exceeded';
  49590. break;
  49591. case JSON_ERROR_STATE_MISMATCH:
  49592. $message = 'Invalid or malformed JSON';
  49593. break;
  49594. case JSON_ERROR_CTRL_CHAR:
  49595. $message = 'Control character error, possibly incorrectly encoded';
  49596. break;
  49597. case JSON_ERROR_UTF8:
  49598. $message = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  49599. break;
  49600. case JSON_ERROR_SYNTAX:
  49601. $message = 'JSON syntax is malformed';
  49602. break;
  49603. default:
  49604. $message = 'Syntax error';
  49605. }
  49606. parent::__construct($message, $code, $previous);
  49607. }
  49608. }
  49609. <?php
  49610. namespace JsonSchema\Exception;
  49611. class ResourceNotFoundException extends RuntimeException
  49612. {
  49613. }
  49614. <?php
  49615. namespace JsonSchema\Exception;
  49616. class RuntimeException extends \RuntimeException implements ExceptionInterface
  49617. {
  49618. }
  49619. <?php
  49620. namespace JsonSchema\Exception;
  49621. class UnresolvableJsonPointerException extends InvalidArgumentException
  49622. {
  49623. }
  49624. <?php
  49625. namespace JsonSchema\Exception;
  49626. class UriResolverException extends RuntimeException
  49627. {
  49628. }
  49629. <?php
  49630. namespace JsonSchema\Exception;
  49631. class ValidationException extends RuntimeException
  49632. {
  49633. }
  49634. <?php
  49635. namespace JsonSchema\Iterator;
  49636. class ObjectIterator implements \Iterator, \Countable
  49637. {
  49638. private $object;
  49639. private $position = 0;
  49640. private $data = array();
  49641. private $initialized = false;
  49642. public function __construct($object)
  49643. {
  49644. $this->object = $object;
  49645. }
  49646. public function current()
  49647. {
  49648. $this->initialize();
  49649. return $this->data[$this->position];
  49650. }
  49651. public function next()
  49652. {
  49653. $this->initialize();
  49654. $this->position++;
  49655. }
  49656. public function key()
  49657. {
  49658. $this->initialize();
  49659. return $this->position;
  49660. }
  49661. public function valid()
  49662. {
  49663. $this->initialize();
  49664. return isset($this->data[$this->position]);
  49665. }
  49666. public function rewind()
  49667. {
  49668. $this->initialize();
  49669. $this->position = 0;
  49670. }
  49671. public function count()
  49672. {
  49673. $this->initialize();
  49674. return count($this->data);
  49675. }
  49676. private function initialize()
  49677. {
  49678. if (!$this->initialized) {
  49679. $this->data = $this->buildDataFromObject($this->object);
  49680. $this->initialized = true;
  49681. }
  49682. }
  49683. private function buildDataFromObject($object)
  49684. {
  49685. $result = array();
  49686. $stack = new \SplStack();
  49687. $stack->push($object);
  49688. while (!$stack->isEmpty()) {
  49689. $current = $stack->pop();
  49690. if (is_object($current)) {
  49691. array_push($result, $current);
  49692. }
  49693. foreach ($this->getDataFromItem($current) as $propertyName => $propertyValue) {
  49694. if (is_object($propertyValue) || is_array($propertyValue)) {
  49695. $stack->push($propertyValue);
  49696. }
  49697. }
  49698. }
  49699. return $result;
  49700. }
  49701. private function getDataFromItem($item)
  49702. {
  49703. if (!is_object($item) && !is_array($item)) {
  49704. return array();
  49705. }
  49706. return is_object($item) ? get_object_vars($item) : $item;
  49707. }
  49708. }
  49709. <?php
  49710. namespace JsonSchema;
  49711. class Rfc3339
  49712. {
  49713. const REGEX = '/^(\d{4}-\d{2}-\d{2}[T ]{1}\d{2}:\d{2}:\d{2})(\.\d+)?(Z|([+-]\d{2}):?(\d{2}))$/';
  49714. public static function createFromString($string)
  49715. {
  49716. if (!preg_match(self::REGEX, strtoupper($string), $matches)) {
  49717. return null;
  49718. }
  49719. $dateAndTime = $matches[1];
  49720. $microseconds = $matches[2] ?: '.000000';
  49721. $timeZone = 'Z' !== $matches[3] ? $matches[4] . ':' . $matches[5] : '+00:00';
  49722. $dateFormat = strpos($dateAndTime, 'T') === false ? 'Y-m-d H:i:s.uP' : 'Y-m-d\TH:i:s.uP';
  49723. $dateTime = \DateTime::createFromFormat($dateFormat, $dateAndTime . $microseconds . $timeZone, new \DateTimeZone('UTC'));
  49724. return $dateTime ?: null;
  49725. }
  49726. }
  49727. <?php
  49728. namespace JsonSchema;
  49729. use JsonSchema\Constraints\BaseConstraint;
  49730. use JsonSchema\Entity\JsonPointer;
  49731. use JsonSchema\Exception\UnresolvableJsonPointerException;
  49732. use JsonSchema\Uri\UriResolver;
  49733. use JsonSchema\Uri\UriRetriever;
  49734. class SchemaStorage implements SchemaStorageInterface
  49735. {
  49736. const INTERNAL_PROVIDED_SCHEMA_URI = 'internal://provided-schema/';
  49737. protected $uriRetriever;
  49738. protected $uriResolver;
  49739. protected $schemas = array();
  49740. public function __construct(
  49741. UriRetrieverInterface $uriRetriever = null,
  49742. UriResolverInterface $uriResolver = null
  49743. ) {
  49744. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  49745. $this->uriResolver = $uriResolver ?: new UriResolver();
  49746. }
  49747. public function getUriRetriever()
  49748. {
  49749. return $this->uriRetriever;
  49750. }
  49751. public function getUriResolver()
  49752. {
  49753. return $this->uriResolver;
  49754. }
  49755. public function addSchema($id, $schema = null)
  49756. {
  49757. if (is_null($schema) && $id !== self::INTERNAL_PROVIDED_SCHEMA_URI) {
  49758. $schema = $this->uriRetriever->retrieve($id);
  49759. }
  49760. if (is_array($schema)) {
  49761. $schema = BaseConstraint::arrayToObjectRecursive($schema);
  49762. }
  49763. if (is_object($schema) && property_exists($schema, 'id')) {
  49764. if ($schema->id == 'http://json-schema.org/draft-04/schema#') {
  49765. $schema->properties->id->format = 'uri-reference';
  49766. } elseif ($schema->id == 'http://json-schema.org/draft-03/schema#') {
  49767. $schema->properties->id->format = 'uri-reference';
  49768. $schema->properties->{'$ref'}->format = 'uri-reference';
  49769. }
  49770. }
  49771. $this->expandRefs($schema, $id);
  49772. $this->schemas[$id] = $schema;
  49773. }
  49774. private function expandRefs(&$schema, $base = null)
  49775. {
  49776. if (!is_object($schema)) {
  49777. if (is_array($schema)) {
  49778. foreach ($schema as &$member) {
  49779. $this->expandRefs($member, $base);
  49780. }
  49781. }
  49782. return;
  49783. }
  49784. if (property_exists($schema, 'id') && is_string($schema->id) && $base != $schema->id) {
  49785. $base = $this->uriResolver->resolve($schema->id, $base);
  49786. }
  49787. if (property_exists($schema, '$ref') && is_string($schema->{'$ref'})) {
  49788. $refPointer = new JsonPointer($this->uriResolver->resolve($schema->{'$ref'}, $base));
  49789. $schema->{'$ref'} = (string) $refPointer;
  49790. }
  49791. foreach ($schema as &$member) {
  49792. $this->expandRefs($member, $base);
  49793. }
  49794. }
  49795. public function getSchema($id)
  49796. {
  49797. if (!array_key_exists($id, $this->schemas)) {
  49798. $this->addSchema($id);
  49799. }
  49800. return $this->schemas[$id];
  49801. }
  49802. public function resolveRef($ref)
  49803. {
  49804. $jsonPointer = new JsonPointer($ref);
  49805. $fileName = $jsonPointer->getFilename();
  49806. if (!strlen($fileName)) {
  49807. throw new UnresolvableJsonPointerException(sprintf(
  49808. "Could not resolve fragment '%s': no file is defined",
  49809. $jsonPointer->getPropertyPathAsString()
  49810. ));
  49811. }
  49812. $refSchema = $this->getSchema($fileName);
  49813. foreach ($jsonPointer->getPropertyPaths() as $path) {
  49814. if (is_object($refSchema) && property_exists($refSchema, $path)) {
  49815. $refSchema = $this->resolveRefSchema($refSchema->{$path});
  49816. } elseif (is_array($refSchema) && array_key_exists($path, $refSchema)) {
  49817. $refSchema = $this->resolveRefSchema($refSchema[$path]);
  49818. } else {
  49819. throw new UnresolvableJsonPointerException(sprintf(
  49820. 'File: %s is found, but could not resolve fragment: %s',
  49821. $jsonPointer->getFilename(),
  49822. $jsonPointer->getPropertyPathAsString()
  49823. ));
  49824. }
  49825. }
  49826. return $refSchema;
  49827. }
  49828. public function resolveRefSchema($refSchema)
  49829. {
  49830. if (is_object($refSchema) && property_exists($refSchema, '$ref') && is_string($refSchema->{'$ref'})) {
  49831. $newSchema = $this->resolveRef($refSchema->{'$ref'});
  49832. $refSchema = (object) (get_object_vars($refSchema) + get_object_vars($newSchema));
  49833. unset($refSchema->{'$ref'});
  49834. }
  49835. return $refSchema;
  49836. }
  49837. }
  49838. <?php
  49839. namespace JsonSchema;
  49840. interface SchemaStorageInterface
  49841. {
  49842. public function addSchema($id, $schema = null);
  49843. public function getSchema($id);
  49844. public function resolveRef($ref);
  49845. public function resolveRefSchema($refSchema);
  49846. }
  49847. <?php
  49848. namespace JsonSchema\Uri\Retrievers;
  49849. abstract class AbstractRetriever implements UriRetrieverInterface
  49850. {
  49851. protected $contentType;
  49852. public function getContentType()
  49853. {
  49854. return $this->contentType;
  49855. }
  49856. }
  49857. <?php
  49858. namespace JsonSchema\Uri\Retrievers;
  49859. use JsonSchema\Exception\RuntimeException;
  49860. use JsonSchema\Validator;
  49861. class Curl extends AbstractRetriever
  49862. {
  49863. protected $messageBody;
  49864. public function __construct()
  49865. {
  49866. if (!function_exists('curl_init')) {
  49867. throw new RuntimeException('cURL not installed');
  49868. }
  49869. }
  49870. public function retrieve($uri)
  49871. {
  49872. $ch = curl_init();
  49873. curl_setopt($ch, CURLOPT_URL, $uri);
  49874. curl_setopt($ch, CURLOPT_HEADER, true);
  49875. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  49876. curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: ' . Validator::SCHEMA_MEDIA_TYPE));
  49877. $response = curl_exec($ch);
  49878. if (false === $response) {
  49879. throw new \JsonSchema\Exception\ResourceNotFoundException('JSON schema not found');
  49880. }
  49881. $this->fetchMessageBody($response);
  49882. $this->fetchContentType($response);
  49883. curl_close($ch);
  49884. return $this->messageBody;
  49885. }
  49886. private function fetchMessageBody($response)
  49887. {
  49888. preg_match("/(?:\r\n){2}(.*)$/ms", $response, $match);
  49889. $this->messageBody = $match[1];
  49890. }
  49891. protected function fetchContentType($response)
  49892. {
  49893. if (0 < preg_match("/Content-Type:(\V*)/ims", $response, $match)) {
  49894. $this->contentType = trim($match[1]);
  49895. return true;
  49896. }
  49897. return false;
  49898. }
  49899. }
  49900. <?php
  49901. namespace JsonSchema\Uri\Retrievers;
  49902. use JsonSchema\Exception\ResourceNotFoundException;
  49903. class FileGetContents extends AbstractRetriever
  49904. {
  49905. protected $messageBody;
  49906. public function retrieve($uri)
  49907. {
  49908. $errorMessage = null;
  49909. set_error_handler(function ($errno, $errstr) use (&$errorMessage) {
  49910. $errorMessage = $errstr;
  49911. });
  49912. $response = file_get_contents($uri);
  49913. restore_error_handler();
  49914. if ($errorMessage) {
  49915. throw new ResourceNotFoundException($errorMessage);
  49916. }
  49917. if (false === $response) {
  49918. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  49919. }
  49920. if ($response == ''
  49921. && substr($uri, 0, 7) == 'file://' && substr($uri, -1) == '/'
  49922. ) {
  49923. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  49924. }
  49925. $this->messageBody = $response;
  49926. if (!empty($http_response_header)) {
  49927. $this->fetchContentType($http_response_header);
  49928. } else {
  49929. $this->contentType = null;
  49930. }
  49931. return $this->messageBody;
  49932. }
  49933. private function fetchContentType(array $headers)
  49934. {
  49935. foreach ($headers as $header) {
  49936. if ($this->contentType = self::getContentTypeMatchInHeader($header)) {
  49937. return true;
  49938. }
  49939. }
  49940. return false;
  49941. }
  49942. protected static function getContentTypeMatchInHeader($header)
  49943. {
  49944. if (0 < preg_match("/Content-Type:(\V*)/ims", $header, $match)) {
  49945. return trim($match[1]);
  49946. }
  49947. return null;
  49948. }
  49949. }
  49950. <?php
  49951. namespace JsonSchema\Uri\Retrievers;
  49952. use JsonSchema\Validator;
  49953. class PredefinedArray extends AbstractRetriever
  49954. {
  49955. private $schemas;
  49956. public function __construct(array $schemas, $contentType = Validator::SCHEMA_MEDIA_TYPE)
  49957. {
  49958. $this->schemas = $schemas;
  49959. $this->contentType = $contentType;
  49960. }
  49961. public function retrieve($uri)
  49962. {
  49963. if (!array_key_exists($uri, $this->schemas)) {
  49964. throw new \JsonSchema\Exception\ResourceNotFoundException(sprintf(
  49965. 'The JSON schema "%s" was not found.',
  49966. $uri
  49967. ));
  49968. }
  49969. return $this->schemas[$uri];
  49970. }
  49971. }
  49972. <?php
  49973. namespace JsonSchema\Uri\Retrievers;
  49974. interface UriRetrieverInterface
  49975. {
  49976. public function retrieve($uri);
  49977. public function getContentType();
  49978. }
  49979. <?php
  49980. namespace JsonSchema\Uri;
  49981. use JsonSchema\Exception\UriResolverException;
  49982. use JsonSchema\UriResolverInterface;
  49983. class UriResolver implements UriResolverInterface
  49984. {
  49985. public function parse($uri)
  49986. {
  49987. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  49988. $components = array();
  49989. if (5 < count($match)) {
  49990. $components = array(
  49991. 'scheme' => $match[2],
  49992. 'authority' => $match[4],
  49993. 'path' => $match[5]
  49994. );
  49995. }
  49996. if (7 < count($match)) {
  49997. $components['query'] = $match[7];
  49998. }
  49999. if (9 < count($match)) {
  50000. $components['fragment'] = $match[9];
  50001. }
  50002. return $components;
  50003. }
  50004. public function generate(array $components)
  50005. {
  50006. $uri = $components['scheme'] . '://'
  50007. . $components['authority']
  50008. . $components['path'];
  50009. if (array_key_exists('query', $components) && strlen($components['query'])) {
  50010. $uri .= '?' . $components['query'];
  50011. }
  50012. if (array_key_exists('fragment', $components)) {
  50013. $uri .= '#' . $components['fragment'];
  50014. }
  50015. return $uri;
  50016. }
  50017. public function resolve($uri, $baseUri = null)
  50018. {
  50019. if (
  50020. !is_null($baseUri) &&
  50021. !filter_var($baseUri, \FILTER_VALIDATE_URL) &&
  50022. !preg_match('|^[^/]+://|u', $baseUri)
  50023. ) {
  50024. if (is_file($baseUri)) {
  50025. $baseUri = 'file://' . realpath($baseUri);
  50026. } elseif (is_dir($baseUri)) {
  50027. $baseUri = 'file://' . realpath($baseUri) . '/';
  50028. } else {
  50029. $baseUri = 'file://' . getcwd() . '/' . $baseUri;
  50030. }
  50031. }
  50032. if ($uri == '') {
  50033. return $baseUri;
  50034. }
  50035. $components = $this->parse($uri);
  50036. $path = $components['path'];
  50037. if (!empty($components['scheme'])) {
  50038. return $uri;
  50039. }
  50040. $baseComponents = $this->parse($baseUri);
  50041. $basePath = $baseComponents['path'];
  50042. $baseComponents['path'] = self::combineRelativePathWithBasePath($path, $basePath);
  50043. if (isset($components['fragment'])) {
  50044. $baseComponents['fragment'] = $components['fragment'];
  50045. }
  50046. return $this->generate($baseComponents);
  50047. }
  50048. public static function combineRelativePathWithBasePath($relativePath, $basePath)
  50049. {
  50050. $relativePath = self::normalizePath($relativePath);
  50051. if ($relativePath == '') {
  50052. return $basePath;
  50053. }
  50054. if ($relativePath[0] == '/') {
  50055. return $relativePath;
  50056. }
  50057. $basePathSegments = explode('/', $basePath);
  50058. preg_match('|^/?(\.\./(?:\./)*)*|', $relativePath, $match);
  50059. $numLevelUp = strlen($match[0]) /3 + 1;
  50060. if ($numLevelUp >= count($basePathSegments)) {
  50061. throw new UriResolverException(sprintf("Unable to resolve URI '%s' from base '%s'", $relativePath, $basePath));
  50062. }
  50063. $basePathSegments = array_slice($basePathSegments, 0, -$numLevelUp);
  50064. $path = preg_replace('|^/?(\.\./(\./)*)*|', '', $relativePath);
  50065. return implode('/', $basePathSegments) . '/' . $path;
  50066. }
  50067. private static function normalizePath($path)
  50068. {
  50069. $path = preg_replace('|((?<!\.)\./)*|', '', $path);
  50070. $path = preg_replace('|//|', '/', $path);
  50071. return $path;
  50072. }
  50073. public function isValid($uri)
  50074. {
  50075. $components = $this->parse($uri);
  50076. return !empty($components);
  50077. }
  50078. }
  50079. <?php
  50080. namespace JsonSchema\Uri;
  50081. use JsonSchema\Exception\InvalidSchemaMediaTypeException;
  50082. use JsonSchema\Exception\JsonDecodingException;
  50083. use JsonSchema\Exception\ResourceNotFoundException;
  50084. use JsonSchema\Uri\Retrievers\FileGetContents;
  50085. use JsonSchema\Uri\Retrievers\UriRetrieverInterface;
  50086. use JsonSchema\UriRetrieverInterface as BaseUriRetrieverInterface;
  50087. use JsonSchema\Validator;
  50088. class UriRetriever implements BaseUriRetrieverInterface
  50089. {
  50090. protected $translationMap = array(
  50091. '|^https?://json-schema.org/draft-(0[34])/schema#?|' => 'package://dist/schema/json-schema-draft-$1.json'
  50092. );
  50093. protected $allowedInvalidContentTypeEndpoints = array(
  50094. 'http://json-schema.org/',
  50095. 'https://json-schema.org/'
  50096. );
  50097. protected $uriRetriever = null;
  50098. private $schemaCache = array();
  50099. public function addInvalidContentTypeEndpoint($endpoint)
  50100. {
  50101. $this->allowedInvalidContentTypeEndpoints[] = $endpoint;
  50102. }
  50103. public function confirmMediaType($uriRetriever, $uri)
  50104. {
  50105. $contentType = $uriRetriever->getContentType();
  50106. if (is_null($contentType)) {
  50107. return;
  50108. }
  50109. if (in_array($contentType, array(Validator::SCHEMA_MEDIA_TYPE, 'application/json'))) {
  50110. return;
  50111. }
  50112. foreach ($this->allowedInvalidContentTypeEndpoints as $endpoint) {
  50113. if (strpos($uri, $endpoint) === 0) {
  50114. return true;
  50115. }
  50116. }
  50117. throw new InvalidSchemaMediaTypeException(sprintf('Media type %s expected', Validator::SCHEMA_MEDIA_TYPE));
  50118. }
  50119. public function getUriRetriever()
  50120. {
  50121. if (is_null($this->uriRetriever)) {
  50122. $this->setUriRetriever(new FileGetContents());
  50123. }
  50124. return $this->uriRetriever;
  50125. }
  50126. public function resolvePointer($jsonSchema, $uri)
  50127. {
  50128. $resolver = new UriResolver();
  50129. $parsed = $resolver->parse($uri);
  50130. if (empty($parsed['fragment'])) {
  50131. return $jsonSchema;
  50132. }
  50133. $path = explode('/', $parsed['fragment']);
  50134. while ($path) {
  50135. $pathElement = array_shift($path);
  50136. if (!empty($pathElement)) {
  50137. $pathElement = str_replace('~1', '/', $pathElement);
  50138. $pathElement = str_replace('~0', '~', $pathElement);
  50139. if (!empty($jsonSchema->$pathElement)) {
  50140. $jsonSchema = $jsonSchema->$pathElement;
  50141. } else {
  50142. throw new ResourceNotFoundException(
  50143. 'Fragment "' . $parsed['fragment'] . '" not found'
  50144. . ' in ' . $uri
  50145. );
  50146. }
  50147. if (!is_object($jsonSchema)) {
  50148. throw new ResourceNotFoundException(
  50149. 'Fragment part "' . $pathElement . '" is no object '
  50150. . ' in ' . $uri
  50151. );
  50152. }
  50153. }
  50154. }
  50155. return $jsonSchema;
  50156. }
  50157. public function retrieve($uri, $baseUri = null, $translate = true)
  50158. {
  50159. $resolver = new UriResolver();
  50160. $resolvedUri = $fetchUri = $resolver->resolve($uri, $baseUri);
  50161. $arParts = $resolver->parse($resolvedUri);
  50162. if (isset($arParts['fragment'])) {
  50163. unset($arParts['fragment']);
  50164. $fetchUri = $resolver->generate($arParts);
  50165. }
  50166. if ($translate) {
  50167. $fetchUri = $this->translate($fetchUri);
  50168. }
  50169. $jsonSchema = $this->loadSchema($fetchUri);
  50170. $jsonSchema = $this->resolvePointer($jsonSchema, $resolvedUri);
  50171. if ($jsonSchema instanceof \stdClass) {
  50172. $jsonSchema->id = $resolvedUri;
  50173. }
  50174. return $jsonSchema;
  50175. }
  50176. protected function loadSchema($fetchUri)
  50177. {
  50178. if (isset($this->schemaCache[$fetchUri])) {
  50179. return $this->schemaCache[$fetchUri];
  50180. }
  50181. $uriRetriever = $this->getUriRetriever();
  50182. $contents = $this->uriRetriever->retrieve($fetchUri);
  50183. $this->confirmMediaType($uriRetriever, $fetchUri);
  50184. $jsonSchema = json_decode($contents);
  50185. if (JSON_ERROR_NONE < $error = json_last_error()) {
  50186. throw new JsonDecodingException($error);
  50187. }
  50188. $this->schemaCache[$fetchUri] = $jsonSchema;
  50189. return $jsonSchema;
  50190. }
  50191. public function setUriRetriever(UriRetrieverInterface $uriRetriever)
  50192. {
  50193. $this->uriRetriever = $uriRetriever;
  50194. return $this;
  50195. }
  50196. public function parse($uri)
  50197. {
  50198. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  50199. $components = array();
  50200. if (5 < count($match)) {
  50201. $components = array(
  50202. 'scheme' => $match[2],
  50203. 'authority' => $match[4],
  50204. 'path' => $match[5]
  50205. );
  50206. }
  50207. if (7 < count($match)) {
  50208. $components['query'] = $match[7];
  50209. }
  50210. if (9 < count($match)) {
  50211. $components['fragment'] = $match[9];
  50212. }
  50213. return $components;
  50214. }
  50215. public function generate(array $components)
  50216. {
  50217. $uri = $components['scheme'] . '://'
  50218. . $components['authority']
  50219. . $components['path'];
  50220. if (array_key_exists('query', $components)) {
  50221. $uri .= $components['query'];
  50222. }
  50223. if (array_key_exists('fragment', $components)) {
  50224. $uri .= $components['fragment'];
  50225. }
  50226. return $uri;
  50227. }
  50228. public function resolve($uri, $baseUri = null)
  50229. {
  50230. $components = $this->parse($uri);
  50231. $path = $components['path'];
  50232. if ((array_key_exists('scheme', $components)) && ('http' === $components['scheme'])) {
  50233. return $uri;
  50234. }
  50235. $baseComponents = $this->parse($baseUri);
  50236. $basePath = $baseComponents['path'];
  50237. $baseComponents['path'] = UriResolver::combineRelativePathWithBasePath($path, $basePath);
  50238. return $this->generate($baseComponents);
  50239. }
  50240. public function isValid($uri)
  50241. {
  50242. $components = $this->parse($uri);
  50243. return !empty($components);
  50244. }
  50245. public function setTranslation($from, $to)
  50246. {
  50247. $this->translationMap[$from] = $to;
  50248. }
  50249. public function translate($uri)
  50250. {
  50251. foreach ($this->translationMap as $from => $to) {
  50252. $uri = preg_replace($from, $to, $uri);
  50253. }
  50254. $uri = preg_replace('|^package://|', sprintf('file://%s/', realpath(__DIR__ . '/../../..')), $uri);
  50255. return $uri;
  50256. }
  50257. }
  50258. <?php
  50259. namespace JsonSchema;
  50260. interface UriResolverInterface
  50261. {
  50262. public function resolve($uri, $baseUri = null);
  50263. }
  50264. <?php
  50265. namespace JsonSchema;
  50266. interface UriRetrieverInterface
  50267. {
  50268. public function retrieve($uri, $baseUri = null);
  50269. }
  50270. <?php
  50271. namespace JsonSchema;
  50272. use JsonSchema\Constraints\BaseConstraint;
  50273. use JsonSchema\Constraints\Constraint;
  50274. class Validator extends BaseConstraint
  50275. {
  50276. const SCHEMA_MEDIA_TYPE = 'application/schema+json';
  50277. const ERROR_NONE = 0x00000000;
  50278. const ERROR_ALL = 0xFFFFFFFF;
  50279. const ERROR_DOCUMENT_VALIDATION = 0x00000001;
  50280. const ERROR_SCHEMA_VALIDATION = 0x00000002;
  50281. public function validate(&$value, $schema = null, $checkMode = null)
  50282. {
  50283. if (is_array($schema)) {
  50284. $schema = self::arrayToObjectRecursive($schema);
  50285. }
  50286. $initialCheckMode = $this->factory->getConfig();
  50287. if ($checkMode !== null) {
  50288. $this->factory->setConfig($checkMode);
  50289. }
  50290. if (is_object($schema) && property_exists($schema, 'id')) {
  50291. $schemaURI = $schema->id;
  50292. } else {
  50293. $schemaURI = SchemaStorage::INTERNAL_PROVIDED_SCHEMA_URI;
  50294. }
  50295. $this->factory->getSchemaStorage()->addSchema($schemaURI, $schema);
  50296. $validator = $this->factory->createInstanceFor('schema');
  50297. $validator->check(
  50298. $value,
  50299. $this->factory->getSchemaStorage()->getSchema($schemaURI)
  50300. );
  50301. $this->factory->setConfig($initialCheckMode);
  50302. $this->addErrors(array_unique($validator->getErrors(), SORT_REGULAR));
  50303. return $validator->getErrorMask();
  50304. }
  50305. public function check($value, $schema)
  50306. {
  50307. return $this->validate($value, $schema);
  50308. }
  50309. public function coerce(&$value, $schema)
  50310. {
  50311. return $this->validate($value, $schema, Constraint::CHECK_MODE_COERCE_TYPES);
  50312. }
  50313. }
  50314. Copyright (C) 2015 Composer
  50315. Permission is hereby granted, free of charge, to any person obtaining a copy of
  50316. this software and associated documentation files (the "Software"), to deal in
  50317. the Software without restriction, including without limitation the rights to
  50318. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  50319. of the Software, and to permit persons to whom the Software is furnished to do
  50320. so, subject to the following conditions:
  50321. The above copyright notice and this permission notice shall be included in all
  50322. copies or substantial portions of the Software.
  50323. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  50324. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  50325. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  50326. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  50327. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  50328. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  50329. SOFTWARE.
  50330. <?php
  50331. namespace Composer\Spdx;
  50332. class SpdxLicenses
  50333. {
  50334. const LICENSES_FILE = 'spdx-licenses.json';
  50335. const EXCEPTIONS_FILE = 'spdx-exceptions.json';
  50336. private $licenses;
  50337. private $licensesExpression;
  50338. private $exceptions;
  50339. private $exceptionsExpression;
  50340. public function __construct()
  50341. {
  50342. $this->loadLicenses();
  50343. $this->loadExceptions();
  50344. }
  50345. public function getLicenseByIdentifier($identifier)
  50346. {
  50347. $key = strtolower($identifier);
  50348. if (!isset($this->licenses[$key])) {
  50349. return;
  50350. }
  50351. list($identifier, $name, $isOsiApproved, $isDeprecatedLicenseId) = $this->licenses[$key];
  50352. return array(
  50353. $name,
  50354. $isOsiApproved,
  50355. 'https://spdx.org/licenses/' . $identifier . '.html#licenseText',
  50356. $isDeprecatedLicenseId,
  50357. );
  50358. }
  50359. public function getLicenses()
  50360. {
  50361. return $this->licenses;
  50362. }
  50363. public function getExceptionByIdentifier($identifier)
  50364. {
  50365. $key = strtolower($identifier);
  50366. if (!isset($this->exceptions[$key])) {
  50367. return;
  50368. }
  50369. list($identifier, $name) = $this->exceptions[$key];
  50370. return array(
  50371. $name,
  50372. 'https://spdx.org/licenses/' . $identifier . '.html#licenseExceptionText',
  50373. );
  50374. }
  50375. public function getIdentifierByName($name)
  50376. {
  50377. foreach ($this->licenses as $licenseData) {
  50378. if ($licenseData[1] === $name) {
  50379. return $licenseData[0];
  50380. }
  50381. }
  50382. foreach ($this->exceptions as $licenseData) {
  50383. if ($licenseData[1] === $name) {
  50384. return $licenseData[0];
  50385. }
  50386. }
  50387. }
  50388. public function isOsiApprovedByIdentifier($identifier)
  50389. {
  50390. return $this->licenses[strtolower($identifier)][2];
  50391. }
  50392. public function isDeprecatedByIdentifier($identifier)
  50393. {
  50394. return $this->licenses[strtolower($identifier)][3];
  50395. }
  50396. public function validate($license)
  50397. {
  50398. if (is_array($license)) {
  50399. $count = count($license);
  50400. if ($count !== count(array_filter($license, 'is_string'))) {
  50401. throw new \InvalidArgumentException('Array of strings expected.');
  50402. }
  50403. $license = $count > 1 ? '(' . implode(' OR ', $license) . ')' : (string) reset($license);
  50404. }
  50405. if (!is_string($license)) {
  50406. throw new \InvalidArgumentException(sprintf(
  50407. 'Array or String expected, %s given.',
  50408. gettype($license)
  50409. ));
  50410. }
  50411. return $this->isValidLicenseString($license);
  50412. }
  50413. public static function getResourcesDir()
  50414. {
  50415. return dirname(__DIR__) . '/res';
  50416. }
  50417. private function loadLicenses()
  50418. {
  50419. if (null !== $this->licenses) {
  50420. return;
  50421. }
  50422. $json = file_get_contents(self::getResourcesDir() . '/' . self::LICENSES_FILE);
  50423. $this->licenses = array();
  50424. foreach (json_decode($json, true) as $identifier => $license) {
  50425. $this->licenses[strtolower($identifier)] = array($identifier, $license[0], $license[1], $license[2]);
  50426. }
  50427. }
  50428. private function loadExceptions()
  50429. {
  50430. if (null !== $this->exceptions) {
  50431. return;
  50432. }
  50433. $json = file_get_contents(self::getResourcesDir() . '/' . self::EXCEPTIONS_FILE);
  50434. $this->exceptions = array();
  50435. foreach (json_decode($json, true) as $identifier => $exception) {
  50436. $this->exceptions[strtolower($identifier)] = array($identifier, $exception[0]);
  50437. }
  50438. }
  50439. private function getLicensesExpression()
  50440. {
  50441. if (null === $this->licensesExpression) {
  50442. $licenses = array_map('preg_quote', array_keys($this->licenses));
  50443. rsort($licenses);
  50444. $licenses = implode('|', $licenses);
  50445. $this->licensesExpression = $licenses;
  50446. }
  50447. return $this->licensesExpression;
  50448. }
  50449. private function getExceptionsExpression()
  50450. {
  50451. if (null === $this->exceptionsExpression) {
  50452. $exceptions = array_map('preg_quote', array_keys($this->exceptions));
  50453. rsort($exceptions);
  50454. $exceptions = implode('|', $exceptions);
  50455. $this->exceptionsExpression = $exceptions;
  50456. }
  50457. return $this->exceptionsExpression;
  50458. }
  50459. private function isValidLicenseString($license)
  50460. {
  50461. if (isset($this->licenses[strtolower($license)])) {
  50462. return true;
  50463. }
  50464. $licenses = $this->getLicensesExpression();
  50465. $exceptions = $this->getExceptionsExpression();
  50466. $regex = <<<REGEX
  50467. {
  50468. (?(DEFINE)
  50469. # idstring: 1*( ALPHA / DIGIT / - / . )
  50470. (?<idstring>[\pL\pN.-]{1,})
  50471. # license-id: taken from list
  50472. (?<licenseid>${licenses})
  50473. # license-exception-id: taken from list
  50474. (?<licenseexceptionid>${exceptions})
  50475. # license-ref: [DocumentRef-1*(idstring):]LicenseRef-1*(idstring)
  50476. (?<licenseref>(?:DocumentRef-(?&idstring):)?LicenseRef-(?&idstring))
  50477. # simple-expresssion: license-id / license-id+ / license-ref
  50478. (?<simple_expression>(?&licenseid)\+? | (?&licenseid) | (?&licenseref))
  50479. # compound-expression: 1*(
  50480. # simple-expression /
  50481. # simple-expression WITH license-exception-id /
  50482. # compound-expression AND compound-expression /
  50483. # compound-expression OR compound-expression
  50484. # ) / ( compound-expression ) )
  50485. (?<compound_head>
  50486. (?&simple_expression) ( \s+ WITH \s+ (?&licenseexceptionid))?
  50487. | \( \s* (?&compound_expression) \s* \)
  50488. )
  50489. (?<compound_expression>
  50490. (?&compound_head) (?: \s+ (?:AND|OR) \s+ (?&compound_expression))?
  50491. )
  50492. # license-expression: 1*1(simple-expression / compound-expression)
  50493. (?<license_expression>(?&compound_expression) | (?&simple_expression))
  50494. ) # end of define
  50495. ^(NONE | NOASSERTION | (?&license_expression))$
  50496. }xi
  50497. REGEX;
  50498. $match = preg_match($regex, $license);
  50499. if (0 === $match) {
  50500. return false;
  50501. }
  50502. if (false === $match) {
  50503. throw new \RuntimeException('Regex failed to compile/run.');
  50504. }
  50505. return true;
  50506. }
  50507. }
  50508. Copyright (C) 2015 Composer
  50509. Permission is hereby granted, free of charge, to any person obtaining a copy of
  50510. this software and associated documentation files (the "Software"), to deal in
  50511. the Software without restriction, including without limitation the rights to
  50512. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  50513. of the Software, and to permit persons to whom the Software is furnished to do
  50514. so, subject to the following conditions:
  50515. The above copyright notice and this permission notice shall be included in all
  50516. copies or substantial portions of the Software.
  50517. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  50518. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  50519. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  50520. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  50521. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  50522. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  50523. SOFTWARE.
  50524. <?php
  50525. namespace Composer\Semver;
  50526. use Composer\Semver\Constraint\Constraint;
  50527. class Comparator
  50528. {
  50529. public static function greaterThan($version1, $version2)
  50530. {
  50531. return self::compare($version1, '>', $version2);
  50532. }
  50533. public static function greaterThanOrEqualTo($version1, $version2)
  50534. {
  50535. return self::compare($version1, '>=', $version2);
  50536. }
  50537. public static function lessThan($version1, $version2)
  50538. {
  50539. return self::compare($version1, '<', $version2);
  50540. }
  50541. public static function lessThanOrEqualTo($version1, $version2)
  50542. {
  50543. return self::compare($version1, '<=', $version2);
  50544. }
  50545. public static function equalTo($version1, $version2)
  50546. {
  50547. return self::compare($version1, '==', $version2);
  50548. }
  50549. public static function notEqualTo($version1, $version2)
  50550. {
  50551. return self::compare($version1, '!=', $version2);
  50552. }
  50553. public static function compare($version1, $operator, $version2)
  50554. {
  50555. $constraint = new Constraint($operator, $version2);
  50556. return $constraint->matches(new Constraint('==', $version1));
  50557. }
  50558. }
  50559. <?php
  50560. namespace Composer\Semver\Constraint;
  50561. trigger_error('The ' . __NAMESPACE__ . '\AbstractConstraint abstract class is deprecated, there is no replacement for it, it will be removed in the next major version.', E_USER_DEPRECATED);
  50562. abstract class AbstractConstraint implements ConstraintInterface
  50563. {
  50564. protected $prettyString;
  50565. public function matches(ConstraintInterface $provider)
  50566. {
  50567. if ($provider instanceof $this) {
  50568. return $this->matchSpecific($provider);
  50569. }
  50570. return $provider->matches($this);
  50571. }
  50572. public function setPrettyString($prettyString)
  50573. {
  50574. $this->prettyString = $prettyString;
  50575. }
  50576. public function getPrettyString()
  50577. {
  50578. if ($this->prettyString) {
  50579. return $this->prettyString;
  50580. }
  50581. return $this->__toString();
  50582. }
  50583. }
  50584. <?php
  50585. namespace Composer\Semver\Constraint;
  50586. class Constraint implements ConstraintInterface
  50587. {
  50588. const OP_EQ = 0;
  50589. const OP_LT = 1;
  50590. const OP_LE = 2;
  50591. const OP_GT = 3;
  50592. const OP_GE = 4;
  50593. const OP_NE = 5;
  50594. private static $transOpStr = array(
  50595. '=' => self::OP_EQ,
  50596. '==' => self::OP_EQ,
  50597. '<' => self::OP_LT,
  50598. '<=' => self::OP_LE,
  50599. '>' => self::OP_GT,
  50600. '>=' => self::OP_GE,
  50601. '<>' => self::OP_NE,
  50602. '!=' => self::OP_NE,
  50603. );
  50604. private static $transOpInt = array(
  50605. self::OP_EQ => '==',
  50606. self::OP_LT => '<',
  50607. self::OP_LE => '<=',
  50608. self::OP_GT => '>',
  50609. self::OP_GE => '>=',
  50610. self::OP_NE => '!=',
  50611. );
  50612. protected $operator;
  50613. protected $version;
  50614. protected $prettyString;
  50615. public function matches(ConstraintInterface $provider)
  50616. {
  50617. if ($provider instanceof $this) {
  50618. return $this->matchSpecific($provider);
  50619. }
  50620. return $provider->matches($this);
  50621. }
  50622. public function setPrettyString($prettyString)
  50623. {
  50624. $this->prettyString = $prettyString;
  50625. }
  50626. public function getPrettyString()
  50627. {
  50628. if ($this->prettyString) {
  50629. return $this->prettyString;
  50630. }
  50631. return $this->__toString();
  50632. }
  50633. public static function getSupportedOperators()
  50634. {
  50635. return array_keys(self::$transOpStr);
  50636. }
  50637. public function __construct($operator, $version)
  50638. {
  50639. if (!isset(self::$transOpStr[$operator])) {
  50640. throw new \InvalidArgumentException(sprintf(
  50641. 'Invalid operator "%s" given, expected one of: %s',
  50642. $operator,
  50643. implode(', ', self::getSupportedOperators())
  50644. ));
  50645. }
  50646. $this->operator = self::$transOpStr[$operator];
  50647. $this->version = $version;
  50648. }
  50649. public function versionCompare($a, $b, $operator, $compareBranches = false)
  50650. {
  50651. if (!isset(self::$transOpStr[$operator])) {
  50652. throw new \InvalidArgumentException(sprintf(
  50653. 'Invalid operator "%s" given, expected one of: %s',
  50654. $operator,
  50655. implode(', ', self::getSupportedOperators())
  50656. ));
  50657. }
  50658. $aIsBranch = 'dev-' === substr($a, 0, 4);
  50659. $bIsBranch = 'dev-' === substr($b, 0, 4);
  50660. if ($aIsBranch && $bIsBranch) {
  50661. return $operator === '==' && $a === $b;
  50662. }
  50663. if (!$compareBranches && ($aIsBranch || $bIsBranch)) {
  50664. return false;
  50665. }
  50666. return version_compare($a, $b, $operator);
  50667. }
  50668. public function matchSpecific(Constraint $provider, $compareBranches = false)
  50669. {
  50670. $noEqualOp = str_replace('=', '', self::$transOpInt[$this->operator]);
  50671. $providerNoEqualOp = str_replace('=', '', self::$transOpInt[$provider->operator]);
  50672. $isEqualOp = self::OP_EQ === $this->operator;
  50673. $isNonEqualOp = self::OP_NE === $this->operator;
  50674. $isProviderEqualOp = self::OP_EQ === $provider->operator;
  50675. $isProviderNonEqualOp = self::OP_NE === $provider->operator;
  50676. if ($isNonEqualOp || $isProviderNonEqualOp) {
  50677. return !$isEqualOp && !$isProviderEqualOp
  50678. || $this->versionCompare($provider->version, $this->version, '!=', $compareBranches);
  50679. }
  50680. if ($this->operator !== self::OP_EQ && $noEqualOp === $providerNoEqualOp) {
  50681. return true;
  50682. }
  50683. if ($this->versionCompare($provider->version, $this->version, self::$transOpInt[$this->operator], $compareBranches)) {
  50684. if ($provider->version === $this->version
  50685. && self::$transOpInt[$provider->operator] === $providerNoEqualOp
  50686. && self::$transOpInt[$this->operator] !== $noEqualOp) {
  50687. return false;
  50688. }
  50689. return true;
  50690. }
  50691. return false;
  50692. }
  50693. public function __toString()
  50694. {
  50695. return self::$transOpInt[$this->operator] . ' ' . $this->version;
  50696. }
  50697. }
  50698. <?php
  50699. namespace Composer\Semver\Constraint;
  50700. interface ConstraintInterface
  50701. {
  50702. public function matches(ConstraintInterface $provider);
  50703. public function getPrettyString();
  50704. public function __toString();
  50705. }
  50706. <?php
  50707. namespace Composer\Semver\Constraint;
  50708. class EmptyConstraint implements ConstraintInterface
  50709. {
  50710. protected $prettyString;
  50711. public function matches(ConstraintInterface $provider)
  50712. {
  50713. return true;
  50714. }
  50715. public function setPrettyString($prettyString)
  50716. {
  50717. $this->prettyString = $prettyString;
  50718. }
  50719. public function getPrettyString()
  50720. {
  50721. if ($this->prettyString) {
  50722. return $this->prettyString;
  50723. }
  50724. return $this->__toString();
  50725. }
  50726. public function __toString()
  50727. {
  50728. return '[]';
  50729. }
  50730. }
  50731. <?php
  50732. namespace Composer\Semver\Constraint;
  50733. class MultiConstraint implements ConstraintInterface
  50734. {
  50735. protected $constraints;
  50736. protected $prettyString;
  50737. protected $conjunctive;
  50738. public function __construct(array $constraints, $conjunctive = true)
  50739. {
  50740. $this->constraints = $constraints;
  50741. $this->conjunctive = $conjunctive;
  50742. }
  50743. public function getConstraints()
  50744. {
  50745. return $this->constraints;
  50746. }
  50747. public function isConjunctive()
  50748. {
  50749. return $this->conjunctive;
  50750. }
  50751. public function isDisjunctive()
  50752. {
  50753. return !$this->conjunctive;
  50754. }
  50755. public function matches(ConstraintInterface $provider)
  50756. {
  50757. if (false === $this->conjunctive) {
  50758. foreach ($this->constraints as $constraint) {
  50759. if ($constraint->matches($provider)) {
  50760. return true;
  50761. }
  50762. }
  50763. return false;
  50764. }
  50765. foreach ($this->constraints as $constraint) {
  50766. if (!$constraint->matches($provider)) {
  50767. return false;
  50768. }
  50769. }
  50770. return true;
  50771. }
  50772. public function setPrettyString($prettyString)
  50773. {
  50774. $this->prettyString = $prettyString;
  50775. }
  50776. public function getPrettyString()
  50777. {
  50778. if ($this->prettyString) {
  50779. return $this->prettyString;
  50780. }
  50781. return $this->__toString();
  50782. }
  50783. public function __toString()
  50784. {
  50785. $constraints = array();
  50786. foreach ($this->constraints as $constraint) {
  50787. $constraints[] = (string) $constraint;
  50788. }
  50789. return '[' . implode($this->conjunctive ? ' ' : ' || ', $constraints) . ']';
  50790. }
  50791. }
  50792. <?php
  50793. namespace Composer\Semver;
  50794. use Composer\Semver\Constraint\Constraint;
  50795. class Semver
  50796. {
  50797. const SORT_ASC = 1;
  50798. const SORT_DESC = -1;
  50799. private static $versionParser;
  50800. public static function satisfies($version, $constraints)
  50801. {
  50802. if (null === self::$versionParser) {
  50803. self::$versionParser = new VersionParser();
  50804. }
  50805. $versionParser = self::$versionParser;
  50806. $provider = new Constraint('==', $versionParser->normalize($version));
  50807. $constraints = $versionParser->parseConstraints($constraints);
  50808. return $constraints->matches($provider);
  50809. }
  50810. public static function satisfiedBy(array $versions, $constraints)
  50811. {
  50812. $versions = array_filter($versions, function ($version) use ($constraints) {
  50813. return Semver::satisfies($version, $constraints);
  50814. });
  50815. return array_values($versions);
  50816. }
  50817. public static function sort(array $versions)
  50818. {
  50819. return self::usort($versions, self::SORT_ASC);
  50820. }
  50821. public static function rsort(array $versions)
  50822. {
  50823. return self::usort($versions, self::SORT_DESC);
  50824. }
  50825. private static function usort(array $versions, $direction)
  50826. {
  50827. if (null === self::$versionParser) {
  50828. self::$versionParser = new VersionParser();
  50829. }
  50830. $versionParser = self::$versionParser;
  50831. $normalized = array();
  50832. foreach ($versions as $key => $version) {
  50833. $normalized[] = array($versionParser->normalize($version), $key);
  50834. }
  50835. usort($normalized, function (array $left, array $right) use ($direction) {
  50836. if ($left[0] === $right[0]) {
  50837. return 0;
  50838. }
  50839. if (Comparator::lessThan($left[0], $right[0])) {
  50840. return -$direction;
  50841. }
  50842. return $direction;
  50843. });
  50844. $sorted = array();
  50845. foreach ($normalized as $item) {
  50846. $sorted[] = $versions[$item[1]];
  50847. }
  50848. return $sorted;
  50849. }
  50850. }
  50851. <?php
  50852. namespace Composer\Semver;
  50853. use Composer\Semver\Constraint\ConstraintInterface;
  50854. use Composer\Semver\Constraint\EmptyConstraint;
  50855. use Composer\Semver\Constraint\MultiConstraint;
  50856. use Composer\Semver\Constraint\Constraint;
  50857. class VersionParser
  50858. {
  50859. private static $modifierRegex = '[._-]?(?:(stable|beta|b|RC|alpha|a|patch|pl|p)((?:[.-]?\d+)*+)?)?([.-]?dev)?';
  50860. private static $stabilities = array('stable', 'RC', 'beta', 'alpha', 'dev');
  50861. public static function parseStability($version)
  50862. {
  50863. $version = preg_replace('{#.+$}i', '', $version);
  50864. if ('dev-' === substr($version, 0, 4) || '-dev' === substr($version, -4)) {
  50865. return 'dev';
  50866. }
  50867. preg_match('{' . self::$modifierRegex . '(?:\+.*)?$}i', strtolower($version), $match);
  50868. if (!empty($match[3])) {
  50869. return 'dev';
  50870. }
  50871. if (!empty($match[1])) {
  50872. if ('beta' === $match[1] || 'b' === $match[1]) {
  50873. return 'beta';
  50874. }
  50875. if ('alpha' === $match[1] || 'a' === $match[1]) {
  50876. return 'alpha';
  50877. }
  50878. if ('rc' === $match[1]) {
  50879. return 'RC';
  50880. }
  50881. }
  50882. return 'stable';
  50883. }
  50884. public static function normalizeStability($stability)
  50885. {
  50886. $stability = strtolower($stability);
  50887. return $stability === 'rc' ? 'RC' : $stability;
  50888. }
  50889. public function normalize($version, $fullVersion = null)
  50890. {
  50891. $version = trim($version);
  50892. if (null === $fullVersion) {
  50893. $fullVersion = $version;
  50894. }
  50895. if (preg_match('{^([^,\s]++) ++as ++([^,\s]++)$}', $version, $match)) {
  50896. $version = $match[1];
  50897. }
  50898. if (preg_match('{^(?:dev-)?(?:master|trunk|default)$}i', $version)) {
  50899. return '9999999-dev';
  50900. }
  50901. if ('dev-' === strtolower(substr($version, 0, 4))) {
  50902. return 'dev-' . substr($version, 4);
  50903. }
  50904. if (preg_match('{^([^,\s+]++)\+[^\s]++$}', $version, $match)) {
  50905. $version = $match[1];
  50906. }
  50907. if (preg_match('{^v?(\d{1,5})(\.\d++)?(\.\d++)?(\.\d++)?' . self::$modifierRegex . '$}i', $version, $matches)) {
  50908. $version = $matches[1]
  50909. . (!empty($matches[2]) ? $matches[2] : '.0')
  50910. . (!empty($matches[3]) ? $matches[3] : '.0')
  50911. . (!empty($matches[4]) ? $matches[4] : '.0');
  50912. $index = 5;
  50913. } elseif (preg_match('{^v?(\d{4}(?:[.:-]?\d{2}){1,6}(?:[.:-]?\d{1,3})?)' . self::$modifierRegex . '$}i', $version, $matches)) {
  50914. $version = preg_replace('{\D}', '.', $matches[1]);
  50915. $index = 2;
  50916. }
  50917. if (isset($index)) {
  50918. if (!empty($matches[$index])) {
  50919. if ('stable' === $matches[$index]) {
  50920. return $version;
  50921. }
  50922. $version .= '-' . $this->expandStability($matches[$index]) . (!empty($matches[$index + 1]) ? ltrim($matches[$index + 1], '.-') : '');
  50923. }
  50924. if (!empty($matches[$index + 2])) {
  50925. $version .= '-dev';
  50926. }
  50927. return $version;
  50928. }
  50929. if (preg_match('{(.*?)[.-]?dev$}i', $version, $match)) {
  50930. try {
  50931. return $this->normalizeBranch($match[1]);
  50932. } catch (\Exception $e) {
  50933. }
  50934. }
  50935. $extraMessage = '';
  50936. if (preg_match('{ +as +' . preg_quote($version) . '$}', $fullVersion)) {
  50937. $extraMessage = ' in "' . $fullVersion . '", the alias must be an exact version';
  50938. } elseif (preg_match('{^' . preg_quote($version) . ' +as +}', $fullVersion)) {
  50939. $extraMessage = ' in "' . $fullVersion . '", the alias source must be an exact version, if it is a branch name you should prefix it with dev-';
  50940. }
  50941. throw new \UnexpectedValueException('Invalid version string "' . $version . '"' . $extraMessage);
  50942. }
  50943. public function parseNumericAliasPrefix($branch)
  50944. {
  50945. if (preg_match('{^(?P<version>(\d++\\.)*\d++)(?:\.x)?-dev$}i', $branch, $matches)) {
  50946. return $matches['version'] . '.';
  50947. }
  50948. return false;
  50949. }
  50950. public function normalizeBranch($name)
  50951. {
  50952. $name = trim($name);
  50953. if (in_array($name, array('master', 'trunk', 'default'))) {
  50954. return $this->normalize($name);
  50955. }
  50956. if (preg_match('{^v?(\d++)(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?$}i', $name, $matches)) {
  50957. $version = '';
  50958. for ($i = 1; $i < 5; ++$i) {
  50959. $version .= isset($matches[$i]) ? str_replace(array('*', 'X'), 'x', $matches[$i]) : '.x';
  50960. }
  50961. return str_replace('x', '9999999', $version) . '-dev';
  50962. }
  50963. return 'dev-' . $name;
  50964. }
  50965. public function parseConstraints($constraints)
  50966. {
  50967. $prettyConstraint = $constraints;
  50968. if (preg_match('{^([^,\s]*?)@(' . implode('|', self::$stabilities) . ')$}i', $constraints, $match)) {
  50969. $constraints = empty($match[1]) ? '*' : $match[1];
  50970. }
  50971. if (preg_match('{^(dev-[^,\s@]+?|[^,\s@]+?\.x-dev)#.+$}i', $constraints, $match)) {
  50972. $constraints = $match[1];
  50973. }
  50974. $orConstraints = preg_split('{\s*\|\|?\s*}', trim($constraints));
  50975. $orGroups = array();
  50976. foreach ($orConstraints as $constraints) {
  50977. $andConstraints = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $constraints);
  50978. if (count($andConstraints) > 1) {
  50979. $constraintObjects = array();
  50980. foreach ($andConstraints as $constraint) {
  50981. foreach ($this->parseConstraint($constraint) as $parsedConstraint) {
  50982. $constraintObjects[] = $parsedConstraint;
  50983. }
  50984. }
  50985. } else {
  50986. $constraintObjects = $this->parseConstraint($andConstraints[0]);
  50987. }
  50988. if (1 === count($constraintObjects)) {
  50989. $constraint = $constraintObjects[0];
  50990. } else {
  50991. $constraint = new MultiConstraint($constraintObjects);
  50992. }
  50993. $orGroups[] = $constraint;
  50994. }
  50995. if (1 === count($orGroups)) {
  50996. $constraint = $orGroups[0];
  50997. } elseif (2 === count($orGroups)
  50998. && $orGroups[0] instanceof MultiConstraint
  50999. && $orGroups[1] instanceof MultiConstraint
  51000. && 2 === count($orGroups[0]->getConstraints())
  51001. && 2 === count($orGroups[1]->getConstraints())
  51002. && ($a = (string) $orGroups[0])
  51003. && substr($a, 0, 3) === '[>=' && (false !== ($posA = strpos($a, '<', 4)))
  51004. && ($b = (string) $orGroups[1])
  51005. && substr($b, 0, 3) === '[>=' && (false !== ($posB = strpos($b, '<', 4)))
  51006. && substr($a, $posA + 2, -1) === substr($b, 4, $posB - 5)
  51007. ) {
  51008. $constraint = new MultiConstraint(array(
  51009. new Constraint('>=', substr($a, 4, $posA - 5)),
  51010. new Constraint('<', substr($b, $posB + 2, -1)),
  51011. ));
  51012. } else {
  51013. $constraint = new MultiConstraint($orGroups, false);
  51014. }
  51015. $constraint->setPrettyString($prettyConstraint);
  51016. return $constraint;
  51017. }
  51018. private function parseConstraint($constraint)
  51019. {
  51020. if (preg_match('{^([^,\s]+?)@(' . implode('|', self::$stabilities) . ')$}i', $constraint, $match)) {
  51021. $constraint = $match[1];
  51022. if ($match[2] !== 'stable') {
  51023. $stabilityModifier = $match[2];
  51024. }
  51025. }
  51026. if (preg_match('{^v?[xX*](\.[xX*])*$}i', $constraint)) {
  51027. return array(new EmptyConstraint());
  51028. }
  51029. $versionRegex = 'v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.(\d++))?' . self::$modifierRegex . '(?:\+[^\s]+)?';
  51030. if (preg_match('{^~>?' . $versionRegex . '$}i', $constraint, $matches)) {
  51031. if (substr($constraint, 0, 2) === '~>') {
  51032. throw new \UnexpectedValueException(
  51033. 'Could not parse version constraint ' . $constraint . ': ' .
  51034. 'Invalid operator "~>", you probably meant to use the "~" operator'
  51035. );
  51036. }
  51037. if (isset($matches[4]) && '' !== $matches[4] && null !== $matches[4]) {
  51038. $position = 4;
  51039. } elseif (isset($matches[3]) && '' !== $matches[3] && null !== $matches[3]) {
  51040. $position = 3;
  51041. } elseif (isset($matches[2]) && '' !== $matches[2] && null !== $matches[2]) {
  51042. $position = 2;
  51043. } else {
  51044. $position = 1;
  51045. }
  51046. $stabilitySuffix = '';
  51047. if (empty($matches[5]) && empty($matches[7])) {
  51048. $stabilitySuffix .= '-dev';
  51049. }
  51050. $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
  51051. $lowerBound = new Constraint('>=', $lowVersion);
  51052. $highPosition = max(1, $position - 1);
  51053. $highVersion = $this->manipulateVersionString($matches, $highPosition, 1) . '-dev';
  51054. $upperBound = new Constraint('<', $highVersion);
  51055. return array(
  51056. $lowerBound,
  51057. $upperBound,
  51058. );
  51059. }
  51060. if (preg_match('{^\^' . $versionRegex . '($)}i', $constraint, $matches)) {
  51061. if ('0' !== $matches[1] || '' === $matches[2] || null === $matches[2]) {
  51062. $position = 1;
  51063. } elseif ('0' !== $matches[2] || '' === $matches[3] || null === $matches[3]) {
  51064. $position = 2;
  51065. } else {
  51066. $position = 3;
  51067. }
  51068. $stabilitySuffix = '';
  51069. if (empty($matches[5]) && empty($matches[7])) {
  51070. $stabilitySuffix .= '-dev';
  51071. }
  51072. $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
  51073. $lowerBound = new Constraint('>=', $lowVersion);
  51074. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  51075. $upperBound = new Constraint('<', $highVersion);
  51076. return array(
  51077. $lowerBound,
  51078. $upperBound,
  51079. );
  51080. }
  51081. if (preg_match('{^v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.[xX*])++$}', $constraint, $matches)) {
  51082. if (isset($matches[3]) && '' !== $matches[3] && null !== $matches[3]) {
  51083. $position = 3;
  51084. } elseif (isset($matches[2]) && '' !== $matches[2] && null !== $matches[2]) {
  51085. $position = 2;
  51086. } else {
  51087. $position = 1;
  51088. }
  51089. $lowVersion = $this->manipulateVersionString($matches, $position) . '-dev';
  51090. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  51091. if ($lowVersion === '0.0.0.0-dev') {
  51092. return array(new Constraint('<', $highVersion));
  51093. }
  51094. return array(
  51095. new Constraint('>=', $lowVersion),
  51096. new Constraint('<', $highVersion),
  51097. );
  51098. }
  51099. if (preg_match('{^(?P<from>' . $versionRegex . ') +- +(?P<to>' . $versionRegex . ')($)}i', $constraint, $matches)) {
  51100. $lowStabilitySuffix = '';
  51101. if (empty($matches[6]) && empty($matches[8])) {
  51102. $lowStabilitySuffix = '-dev';
  51103. }
  51104. $lowVersion = $this->normalize($matches['from']);
  51105. $lowerBound = new Constraint('>=', $lowVersion . $lowStabilitySuffix);
  51106. $empty = function ($x) {
  51107. return ($x === 0 || $x === '0') ? false : empty($x);
  51108. };
  51109. if ((!$empty($matches[11]) && !$empty($matches[12])) || !empty($matches[14]) || !empty($matches[16])) {
  51110. $highVersion = $this->normalize($matches['to']);
  51111. $upperBound = new Constraint('<=', $highVersion);
  51112. } else {
  51113. $highMatch = array('', $matches[10], $matches[11], $matches[12], $matches[13]);
  51114. $highVersion = $this->manipulateVersionString($highMatch, $empty($matches[11]) ? 1 : 2, 1) . '-dev';
  51115. $upperBound = new Constraint('<', $highVersion);
  51116. }
  51117. return array(
  51118. $lowerBound,
  51119. $upperBound,
  51120. );
  51121. }
  51122. if (preg_match('{^(<>|!=|>=?|<=?|==?)?\s*(.*)}', $constraint, $matches)) {
  51123. try {
  51124. $version = $this->normalize($matches[2]);
  51125. if (!empty($stabilityModifier) && $this->parseStability($version) === 'stable') {
  51126. $version .= '-' . $stabilityModifier;
  51127. } elseif ('<' === $matches[1] || '>=' === $matches[1]) {
  51128. if (!preg_match('/-' . self::$modifierRegex . '$/', strtolower($matches[2]))) {
  51129. if (substr($matches[2], 0, 4) !== 'dev-') {
  51130. $version .= '-dev';
  51131. }
  51132. }
  51133. }
  51134. return array(new Constraint($matches[1] ?: '=', $version));
  51135. } catch (\Exception $e) {
  51136. }
  51137. }
  51138. $message = 'Could not parse version constraint ' . $constraint;
  51139. if (isset($e)) {
  51140. $message .= ': ' . $e->getMessage();
  51141. }
  51142. throw new \UnexpectedValueException($message);
  51143. }
  51144. private function manipulateVersionString($matches, $position, $increment = 0, $pad = '0')
  51145. {
  51146. for ($i = 4; $i > 0; --$i) {
  51147. if ($i > $position) {
  51148. $matches[$i] = $pad;
  51149. } elseif ($i === $position && $increment) {
  51150. $matches[$i] += $increment;
  51151. if ($matches[$i] < 0) {
  51152. $matches[$i] = $pad;
  51153. --$position;
  51154. if ($i === 1) {
  51155. return;
  51156. }
  51157. }
  51158. }
  51159. }
  51160. return $matches[1] . '.' . $matches[2] . '.' . $matches[3] . '.' . $matches[4];
  51161. }
  51162. private function expandStability($stability)
  51163. {
  51164. $stability = strtolower($stability);
  51165. switch ($stability) {
  51166. case 'a':
  51167. return 'alpha';
  51168. case 'b':
  51169. return 'beta';
  51170. case 'p':
  51171. case 'pl':
  51172. return 'patch';
  51173. case 'rc':
  51174. return 'RC';
  51175. default:
  51176. return $stability;
  51177. }
  51178. }
  51179. }
  51180. Copyright (C) 2016 Composer
  51181. Permission is hereby granted, free of charge, to any person obtaining a copy of
  51182. this software and associated documentation files (the "Software"), to deal in
  51183. the Software without restriction, including without limitation the rights to
  51184. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  51185. of the Software, and to permit persons to whom the Software is furnished to do
  51186. so, subject to the following conditions:
  51187. The above copyright notice and this permission notice shall be included in all
  51188. copies or substantial portions of the Software.
  51189. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  51190. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  51191. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  51192. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  51193. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  51194. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  51195. SOFTWARE.
  51196. <?php
  51197. namespace Composer\CaBundle;
  51198. use Psr\Log\LoggerInterface;
  51199. use Symfony\Component\Process\PhpProcess;
  51200. class CaBundle
  51201. {
  51202. private static $caPath;
  51203. private static $caFileValidity = array();
  51204. private static $useOpensslParse;
  51205. public static function getSystemCaRootBundlePath(LoggerInterface $logger = null)
  51206. {
  51207. if (self::$caPath !== null) {
  51208. return self::$caPath;
  51209. }
  51210. $caBundlePaths = array();
  51211. $caBundlePaths[] = getenv('SSL_CERT_FILE');
  51212. $caBundlePaths[] = getenv('SSL_CERT_DIR');
  51213. $caBundlePaths[] = ini_get('openssl.cafile');
  51214. $caBundlePaths[] = ini_get('openssl.capath');
  51215. $otherLocations = array(
  51216. '/etc/pki/tls/certs/ca-bundle.crt',
  51217. '/etc/ssl/certs/ca-certificates.crt',
  51218. '/etc/ssl/ca-bundle.pem',
  51219. '/usr/local/share/certs/ca-root-nss.crt',
  51220. '/usr/ssl/certs/ca-bundle.crt',
  51221. '/opt/local/share/curl/curl-ca-bundle.crt',
  51222. '/usr/local/share/curl/curl-ca-bundle.crt',
  51223. '/usr/share/ssl/certs/ca-bundle.crt',
  51224. '/etc/ssl/cert.pem',
  51225. '/usr/local/etc/ssl/cert.pem',
  51226. '/usr/local/etc/openssl/cert.pem',
  51227. );
  51228. foreach($otherLocations as $location) {
  51229. $otherLocations[] = dirname($location);
  51230. }
  51231. $caBundlePaths = array_merge($caBundlePaths, $otherLocations);
  51232. foreach ($caBundlePaths as $caBundle) {
  51233. if (self::caFileUsable($caBundle, $logger)) {
  51234. return self::$caPath = $caBundle;
  51235. }
  51236. if (self::caDirUsable($caBundle)) {
  51237. return self::$caPath = $caBundle;
  51238. }
  51239. }
  51240. return self::$caPath = static::getBundledCaBundlePath();
  51241. }
  51242. public static function getBundledCaBundlePath()
  51243. {
  51244. $caBundleFile = __DIR__.'/../res/cacert.pem';
  51245. if (0 === strpos($caBundleFile, 'phar://')) {
  51246. file_put_contents(
  51247. $tempCaBundleFile = tempnam(sys_get_temp_dir(), 'openssl-ca-bundle-'),
  51248. file_get_contents($caBundleFile)
  51249. );
  51250. register_shutdown_function(function() use ($tempCaBundleFile) {
  51251. @unlink($tempCaBundleFile);
  51252. });
  51253. $caBundleFile = $tempCaBundleFile;
  51254. }
  51255. return $caBundleFile;
  51256. }
  51257. public static function validateCaFile($filename, LoggerInterface $logger = null)
  51258. {
  51259. static $warned = false;
  51260. if (isset(self::$caFileValidity[$filename])) {
  51261. return self::$caFileValidity[$filename];
  51262. }
  51263. $contents = file_get_contents($filename);
  51264. if (!static::isOpensslParseSafe()) {
  51265. if (!$warned && $logger) {
  51266. $logger->warning(sprintf(
  51267. 'Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.',
  51268. PHP_VERSION
  51269. ));
  51270. $warned = true;
  51271. }
  51272. $isValid = !empty($contents);
  51273. } else {
  51274. $isValid = (bool) openssl_x509_parse($contents);
  51275. }
  51276. if ($logger) {
  51277. $logger->debug('Checked CA file '.realpath($filename).': '.($isValid ? 'valid' : 'invalid'));
  51278. }
  51279. return self::$caFileValidity[$filename] = $isValid;
  51280. }
  51281. public static function isOpensslParseSafe()
  51282. {
  51283. if (null !== self::$useOpensslParse) {
  51284. return self::$useOpensslParse;
  51285. }
  51286. if (PHP_VERSION_ID >= 50600) {
  51287. return self::$useOpensslParse = true;
  51288. }
  51289. if (
  51290. (PHP_VERSION_ID < 50400 && PHP_VERSION_ID >= 50328)
  51291. || (PHP_VERSION_ID < 50500 && PHP_VERSION_ID >= 50423)
  51292. || (PHP_VERSION_ID < 50600 && PHP_VERSION_ID >= 50507)
  51293. ) {
  51294. return self::$useOpensslParse = true;
  51295. }
  51296. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  51297. return self::$useOpensslParse = false;
  51298. }
  51299. $compareDistroVersionPrefix = function ($prefix, $fixedVersion) {
  51300. $regex = '{^'.preg_quote($prefix).'([0-9]+)$}';
  51301. if (preg_match($regex, PHP_VERSION, $m)) {
  51302. return ((int) $m[1]) >= $fixedVersion;
  51303. }
  51304. return false;
  51305. };
  51306. if (
  51307. $compareDistroVersionPrefix('5.3.3-7+squeeze', 18)
  51308. || $compareDistroVersionPrefix('5.4.4-14+deb7u', 7)
  51309. || $compareDistroVersionPrefix('5.3.10-1ubuntu3.', 9)
  51310. ) {
  51311. return self::$useOpensslParse = true;
  51312. }
  51313. if (!class_exists('Symfony\Component\Process\PhpProcess')) {
  51314. return self::$useOpensslParse = false;
  51315. }
  51316. $cert = 'LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUVwRENDQTR5Z0F3SUJBZ0lKQUp6dThyNnU2ZUJjTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUhETVFzd0NRWUQKVlFRR0V3SkVSVEVjTUJvR0ExVUVDQXdUVG05eVpISm9aV2x1TFZkbGMzUm1ZV3hsYmpFUU1BNEdBMVVFQnd3SApTOE9Ed3Jac2JqRVVNQklHQTFVRUNnd0xVMlZyZEdsdmJrVnBibk14SHpBZEJnTlZCQXNNRmsxaGJHbGphVzkxCmN5QkRaWEowSUZObFkzUnBiMjR4SVRBZkJnTlZCQU1NR0cxaGJHbGphVzkxY3k1elpXdDBhVzl1WldsdWN5NWsKWlRFcU1DZ0dDU3FHU0liM0RRRUpBUlliYzNSbFptRnVMbVZ6YzJWeVFITmxhM1JwYjI1bGFXNXpMbVJsTUhVWQpaREU1TnpBd01UQXhNREF3TURBd1dnQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBCkFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUEKQUFBQUFBQVhEVEUwTVRFeU9ERXhNemt6TlZvd2djTXhDekFKQmdOVkJBWVRBa1JGTVJ3d0dnWURWUVFJREJOTwpiM0prY21obGFXNHRWMlZ6ZEdaaGJHVnVNUkF3RGdZRFZRUUhEQWRMdzRQQ3RteHVNUlF3RWdZRFZRUUtEQXRUClpXdDBhVzl1UldsdWN6RWZNQjBHQTFVRUN3d1dUV0ZzYVdOcGIzVnpJRU5sY25RZ1UyVmpkR2x2YmpFaE1COEcKQTFVRUF3d1liV0ZzYVdOcGIzVnpMbk5sYTNScGIyNWxhVzV6TG1SbE1Tb3dLQVlKS29aSWh2Y05BUWtCRmh0egpkR1ZtWVc0dVpYTnpaWEpBYzJWcmRHbHZibVZwYm5NdVpHVXdnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCCkR3QXdnZ0VLQW9JQkFRRERBZjNobDdKWTBYY0ZuaXlFSnBTU0RxbjBPcUJyNlFQNjV1c0pQUnQvOFBhRG9xQnUKd0VZVC9OYSs2ZnNnUGpDMHVLOURaZ1dnMnRIV1dvYW5TYmxBTW96NVBINlorUzRTSFJaN2UyZERJalBqZGhqaAowbUxnMlVNTzV5cDBWNzk3R2dzOWxOdDZKUmZIODFNTjJvYlhXczROdHp0TE11RDZlZ3FwcjhkRGJyMzRhT3M4CnBrZHVpNVVhd1Raa3N5NXBMUEhxNWNNaEZHbTA2djY1Q0xvMFYyUGQ5K0tBb2tQclBjTjVLTEtlYno3bUxwazYKU01lRVhPS1A0aWRFcXh5UTdPN2ZCdUhNZWRzUWh1K3ByWTNzaTNCVXlLZlF0UDVDWm5YMmJwMHdLSHhYMTJEWAoxbmZGSXQ5RGJHdkhUY3lPdU4rblpMUEJtM3ZXeG50eUlJdlZBZ01CQUFHalFqQkFNQWtHQTFVZEV3UUNNQUF3CkVRWUpZSVpJQVliNFFnRUJCQVFEQWdlQU1Bc0dBMVVkRHdRRUF3SUZvREFUQmdOVkhTVUVEREFLQmdnckJnRUYKQlFjREFqQU5CZ2txaGtpRzl3MEJBUVVGQUFPQ0FRRUFHMGZaWVlDVGJkajFYWWMrMVNub2FQUit2SThDOENhRAo4KzBVWWhkbnlVNGdnYTBCQWNEclk5ZTk0ZUVBdTZacXljRjZGakxxWFhkQWJvcHBXb2NyNlQ2R0QxeDMzQ2tsClZBcnpHL0t4UW9oR0QySmVxa2hJTWxEb214SE83a2EzOStPYThpMnZXTFZ5alU4QVp2V01BcnVIYTRFRU55RzcKbFcyQWFnYUZLRkNyOVRuWFRmcmR4R1ZFYnY3S1ZRNmJkaGc1cDVTanBXSDErTXEwM3VSM1pYUEJZZHlWODMxOQpvMGxWajFLRkkyRENML2xpV2lzSlJvb2YrMWNSMzVDdGQwd1lCY3BCNlRac2xNY09QbDc2ZHdLd0pnZUpvMlFnClpzZm1jMnZDMS9xT2xOdU5xLzBUenprVkd2OEVUVDNDZ2FVK1VYZTRYT1Z2a2NjZWJKbjJkZz09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K';
  51317. $script = <<<'EOT'
  51318. error_reporting(-1);
  51319. $info = openssl_x509_parse(base64_decode('%s'));
  51320. var_dump(PHP_VERSION, $info['issuer']['emailAddress'], $info['validFrom_time_t']);
  51321. EOT;
  51322. $script = '<'."?php\n".sprintf($script, $cert);
  51323. try {
  51324. $process = new PhpProcess($script);
  51325. $process->mustRun();
  51326. } catch (\Exception $e) {
  51327. return self::$useOpensslParse = false;
  51328. }
  51329. $output = preg_split('{\r?\n}', trim($process->getOutput()));
  51330. $errorOutput = trim($process->getErrorOutput());
  51331. if (
  51332. count($output) === 3
  51333. && $output[0] === sprintf('string(%d) "%s"', strlen(PHP_VERSION), PHP_VERSION)
  51334. && $output[1] === 'string(27) "stefan.esser@sektioneins.de"'
  51335. && $output[2] === 'int(-1)'
  51336. && preg_match('{openssl_x509_parse\(\): illegal (?:ASN1 data type for|length in) timestamp in - on line \d+}', $errorOutput)
  51337. ) {
  51338. return self::$useOpensslParse = true;
  51339. }
  51340. return self::$useOpensslParse = false;
  51341. }
  51342. public static function reset()
  51343. {
  51344. self::$caFileValidity = array();
  51345. self::$caPath = null;
  51346. self::$useOpensslParse = null;
  51347. }
  51348. private static function caFileUsable($certFile, LoggerInterface $logger = null)
  51349. {
  51350. return $certFile && @is_file($certFile) && @is_readable($certFile) && static::validateCaFile($certFile, $logger);
  51351. }
  51352. private static function caDirUsable($certDir)
  51353. {
  51354. return $certDir && @is_dir($certDir) && @is_readable($certDir) && glob($certDir . '/*');
  51355. }
  51356. }
  51357. MIT License
  51358. Copyright (c) 2017 Composer
  51359. Permission is hereby granted, free of charge, to any person obtaining a copy
  51360. of this software and associated documentation files (the "Software"), to deal
  51361. in the Software without restriction, including without limitation the rights
  51362. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  51363. copies of the Software, and to permit persons to whom the Software is
  51364. furnished to do so, subject to the following conditions:
  51365. The above copyright notice and this permission notice shall be included in all
  51366. copies or substantial portions of the Software.
  51367. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  51368. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  51369. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  51370. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  51371. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  51372. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  51373. SOFTWARE.
  51374. <?php
  51375. namespace Composer\XdebugHandler;
  51376. class PhpConfig
  51377. {
  51378. public function useOriginal()
  51379. {
  51380. $this->getDataAndReset();
  51381. return array();
  51382. }
  51383. public function useStandard()
  51384. {
  51385. if ($data = $this->getDataAndReset()) {
  51386. return array('-n', '-c', $data['tmpIni']);
  51387. }
  51388. return array();
  51389. }
  51390. public function usePersistent()
  51391. {
  51392. if ($data = $this->getDataAndReset()) {
  51393. Process::setEnv('PHPRC', $data['tmpIni']);
  51394. Process::setEnv('PHP_INI_SCAN_DIR', '');
  51395. }
  51396. return array();
  51397. }
  51398. private function getDataAndReset()
  51399. {
  51400. if ($data = XdebugHandler::getRestartSettings()) {
  51401. Process::setEnv('PHPRC', $data['phprc']);
  51402. Process::setEnv('PHP_INI_SCAN_DIR', $data['scanDir']);
  51403. }
  51404. return $data;
  51405. }
  51406. }
  51407. <?php
  51408. namespace Composer\XdebugHandler;
  51409. class Process
  51410. {
  51411. public static function addColorOption(array $args, $colorOption)
  51412. {
  51413. if (!$colorOption
  51414. || in_array($colorOption, $args)
  51415. || !preg_match('/^--([a-z]+$)|(^--[a-z]+=)/', $colorOption, $matches)) {
  51416. return $args;
  51417. }
  51418. if (isset($matches[2])) {
  51419. if (false !== ($index = array_search($matches[2].'auto', $args))) {
  51420. $args[$index] = $colorOption;
  51421. return $args;
  51422. } elseif (preg_grep('/^'.$matches[2].'/', $args)) {
  51423. return $args;
  51424. }
  51425. } elseif (in_array('--no-'.$matches[1], $args)) {
  51426. return $args;
  51427. }
  51428. if (false !== ($index = array_search('--', $args))) {
  51429. array_splice($args, $index, 0, $colorOption);
  51430. } else {
  51431. $args[] = $colorOption;
  51432. }
  51433. return $args;
  51434. }
  51435. public static function escape($arg, $meta = true, $module = false)
  51436. {
  51437. if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
  51438. return "'".str_replace("'", "'\\''", $arg)."'";
  51439. }
  51440. $quote = strpbrk($arg, " \t") !== false || $arg === '';
  51441. $arg = preg_replace('/(\\\\*)"/', '$1$1\\"', $arg, -1, $dquotes);
  51442. if ($meta) {
  51443. $meta = $dquotes || preg_match('/%[^%]+%/', $arg);
  51444. if (!$meta) {
  51445. $quote = $quote || strpbrk($arg, '^&|<>()') !== false;
  51446. } elseif ($module && !$dquotes && $quote) {
  51447. $meta = false;
  51448. }
  51449. }
  51450. if ($quote) {
  51451. $arg = '"'.preg_replace('/(\\\\*)$/', '$1$1', $arg).'"';
  51452. }
  51453. if ($meta) {
  51454. $arg = preg_replace('/(["^&|<>()%])/', '^$1', $arg);
  51455. }
  51456. return $arg;
  51457. }
  51458. public static function supportsColor($output)
  51459. {
  51460. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  51461. return (function_exists('sapi_windows_vt100_support')
  51462. && sapi_windows_vt100_support($output))
  51463. || false !== getenv('ANSICON')
  51464. || 'ON' === getenv('ConEmuANSI')
  51465. || 'xterm' === getenv('TERM');
  51466. }
  51467. if (function_exists('stream_isatty')) {
  51468. return stream_isatty($output);
  51469. } elseif (function_exists('posix_isatty')) {
  51470. return posix_isatty($output);
  51471. }
  51472. $stat = fstat($output);
  51473. return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
  51474. }
  51475. public static function setEnv($name, $value = false)
  51476. {
  51477. $unset = false === $value;
  51478. if (!putenv($unset ? $name : $name.'='.$value)) {
  51479. return false;
  51480. }
  51481. if ($unset) {
  51482. unset($_SERVER[$name]);
  51483. } else {
  51484. $_SERVER[$name] = $value;
  51485. }
  51486. if (false !== stripos((string) ini_get('variables_order'), 'E')) {
  51487. if ($unset) {
  51488. unset($_ENV[$name]);
  51489. } else {
  51490. $_ENV[$name] = $value;
  51491. }
  51492. }
  51493. return true;
  51494. }
  51495. }
  51496. <?php
  51497. namespace Composer\XdebugHandler;
  51498. use Psr\Log\LoggerInterface;
  51499. use Psr\Log\LogLevel;
  51500. class Status
  51501. {
  51502. const ENV_RESTART = 'XDEBUG_HANDLER_RESTART';
  51503. const CHECK = 'Check';
  51504. const ERROR = 'Error';
  51505. const INFO = 'Info';
  51506. const NORESTART = 'NoRestart';
  51507. const RESTART = 'Restart';
  51508. const RESTARTING = 'Restarting';
  51509. const RESTARTED = 'Restarted';
  51510. private $debug;
  51511. private $envAllowXdebug;
  51512. private $loaded;
  51513. private $logger;
  51514. private $time;
  51515. public function __construct($envAllowXdebug, $debug)
  51516. {
  51517. $start = getenv(self::ENV_RESTART);
  51518. Process::setEnv(self::ENV_RESTART);
  51519. $this->time = $start ? round((microtime(true) - $start) * 1000) : 0;
  51520. $this->envAllowXdebug = $envAllowXdebug;
  51521. $this->debug = $debug && defined('STDERR');
  51522. }
  51523. public function setLogger(LoggerInterface $logger)
  51524. {
  51525. $this->logger = $logger;
  51526. }
  51527. public function report($op, $data)
  51528. {
  51529. if ($this->logger || $this->debug) {
  51530. call_user_func(array($this, 'report'.$op), $data);
  51531. }
  51532. }
  51533. private function output($text, $level = null)
  51534. {
  51535. if ($this->logger) {
  51536. $this->logger->log($level ?: LogLevel::DEBUG, $text);
  51537. }
  51538. if ($this->debug) {
  51539. fwrite(STDERR, sprintf('xdebug-handler[%d] %s', getmypid(), $text.PHP_EOL));
  51540. }
  51541. }
  51542. private function reportCheck($loaded)
  51543. {
  51544. $this->loaded = $loaded;
  51545. $this->output('Checking '.$this->envAllowXdebug);
  51546. }
  51547. private function reportError($error)
  51548. {
  51549. $this->output(sprintf('No restart (%s)', $error), LogLevel::WARNING);
  51550. }
  51551. private function reportInfo($info)
  51552. {
  51553. $this->output($info);
  51554. }
  51555. private function reportNoRestart()
  51556. {
  51557. $this->output($this->getLoadedMessage());
  51558. if ($this->loaded) {
  51559. $text = sprintf('No restart (%s)', $this->getEnvAllow());
  51560. if (!getenv($this->envAllowXdebug)) {
  51561. $text .= ' Allowed by application';
  51562. }
  51563. $this->output($text);
  51564. }
  51565. }
  51566. private function reportRestart()
  51567. {
  51568. $this->output($this->getLoadedMessage());
  51569. Process::setEnv(self::ENV_RESTART, (string) microtime(true));
  51570. }
  51571. private function reportRestarted()
  51572. {
  51573. $loaded = $this->getLoadedMessage();
  51574. $text = sprintf('Restarted (%d ms). %s', $this->time, $loaded);
  51575. $level = $this->loaded ? LogLevel::WARNING : null;
  51576. $this->output($text, $level);
  51577. }
  51578. private function reportRestarting($command)
  51579. {
  51580. $text = sprintf('Process restarting (%s)', $this->getEnvAllow());
  51581. $this->output($text);
  51582. $text = 'Running '.$command;
  51583. $this->output($text);
  51584. }
  51585. private function getEnvAllow()
  51586. {
  51587. return $this->envAllowXdebug.'='.getenv($this->envAllowXdebug);
  51588. }
  51589. private function getLoadedMessage()
  51590. {
  51591. $loaded = $this->loaded ? sprintf('loaded (%s)', $this->loaded) : 'not loaded';
  51592. return 'The xdebug extension is '.$loaded;
  51593. }
  51594. }
  51595. <?php
  51596. namespace Composer\XdebugHandler;
  51597. use Psr\Log\LoggerInterface;
  51598. class XdebugHandler
  51599. {
  51600. const SUFFIX_ALLOW = '_ALLOW_XDEBUG';
  51601. const SUFFIX_INIS = '_ORIGINAL_INIS';
  51602. const RESTART_ID = 'internal';
  51603. const RESTART_SETTINGS = 'XDEBUG_HANDLER_SETTINGS';
  51604. const DEBUG = 'XDEBUG_HANDLER_DEBUG';
  51605. protected $tmpIni;
  51606. private static $inRestart;
  51607. private static $name;
  51608. private static $skipped;
  51609. private $cli;
  51610. private $colorOption;
  51611. private $debug;
  51612. private $envAllowXdebug;
  51613. private $envOriginalInis;
  51614. private $loaded;
  51615. private $persistent;
  51616. private $script;
  51617. private $statusWriter;
  51618. public function __construct($envPrefix, $colorOption = '')
  51619. {
  51620. if (!is_string($envPrefix) || empty($envPrefix) || !is_string($colorOption)) {
  51621. throw new \RuntimeException('Invalid constructor parameter');
  51622. }
  51623. self::$name = strtoupper($envPrefix);
  51624. $this->envAllowXdebug = self::$name.self::SUFFIX_ALLOW;
  51625. $this->envOriginalInis = self::$name.self::SUFFIX_INIS;
  51626. $this->colorOption = $colorOption;
  51627. if (extension_loaded('xdebug')) {
  51628. $ext = new \ReflectionExtension('xdebug');
  51629. $this->loaded = $ext->getVersion() ?: 'unknown';
  51630. }
  51631. if ($this->cli = PHP_SAPI === 'cli') {
  51632. $this->debug = getenv(self::DEBUG);
  51633. }
  51634. $this->statusWriter = new Status($this->envAllowXdebug, (bool) $this->debug);
  51635. }
  51636. public function setLogger(LoggerInterface $logger)
  51637. {
  51638. $this->statusWriter->setLogger($logger);
  51639. return $this;
  51640. }
  51641. public function setMainScript($script)
  51642. {
  51643. $this->script = $script;
  51644. return $this;
  51645. }
  51646. public function setPersistent()
  51647. {
  51648. $this->persistent = true;
  51649. return $this;
  51650. }
  51651. public function check()
  51652. {
  51653. $this->notify(Status::CHECK, $this->loaded);
  51654. $envArgs = explode('|', (string) getenv($this->envAllowXdebug));
  51655. if (empty($envArgs[0]) && $this->requiresRestart((bool) $this->loaded)) {
  51656. $this->notify(Status::RESTART);
  51657. if ($this->prepareRestart()) {
  51658. $command = $this->getCommand();
  51659. $this->notify(Status::RESTARTING, $command);
  51660. $this->restart($command);
  51661. }
  51662. return;
  51663. }
  51664. if (self::RESTART_ID === $envArgs[0] && count($envArgs) === 5) {
  51665. $this->notify(Status::RESTARTED);
  51666. Process::setEnv($this->envAllowXdebug);
  51667. self::$inRestart = true;
  51668. if (!$this->loaded) {
  51669. self::$skipped = $envArgs[1];
  51670. }
  51671. $this->setEnvRestartSettings($envArgs);
  51672. return;
  51673. }
  51674. $this->notify(Status::NORESTART);
  51675. if ($settings = self::getRestartSettings()) {
  51676. $this->syncSettings($settings);
  51677. }
  51678. }
  51679. public static function getAllIniFiles()
  51680. {
  51681. if (!empty(self::$name)) {
  51682. $env = getenv(self::$name.self::SUFFIX_INIS);
  51683. if (false !== $env) {
  51684. return explode(PATH_SEPARATOR, $env);
  51685. }
  51686. }
  51687. $paths = array((string) php_ini_loaded_file());
  51688. if ($scanned = php_ini_scanned_files()) {
  51689. $paths = array_merge($paths, array_map('trim', explode(',', $scanned)));
  51690. }
  51691. return $paths;
  51692. }
  51693. public static function getRestartSettings()
  51694. {
  51695. $envArgs = explode('|', (string) getenv(self::RESTART_SETTINGS));
  51696. if (count($envArgs) !== 6
  51697. || (!self::$inRestart && php_ini_loaded_file() !== $envArgs[0])) {
  51698. return;
  51699. }
  51700. return array(
  51701. 'tmpIni' => $envArgs[0],
  51702. 'scannedInis' => (bool) $envArgs[1],
  51703. 'scanDir' => '*' === $envArgs[2] ? false : $envArgs[2],
  51704. 'phprc' => '*' === $envArgs[3] ? false : $envArgs[3],
  51705. 'inis' => explode(PATH_SEPARATOR, $envArgs[4]),
  51706. 'skipped' => $envArgs[5],
  51707. );
  51708. }
  51709. public static function getSkippedVersion()
  51710. {
  51711. return (string) self::$skipped;
  51712. }
  51713. protected function requiresRestart($isLoaded)
  51714. {
  51715. return $isLoaded;
  51716. }
  51717. protected function restart($command)
  51718. {
  51719. $this->doRestart($command);
  51720. }
  51721. private function doRestart($command)
  51722. {
  51723. passthru($command, $exitCode);
  51724. $this->notify(Status::INFO, 'Restarted process exited '.$exitCode);
  51725. if ($this->debug === '2') {
  51726. $this->notify(Status::INFO, 'Temp ini saved: '.$this->tmpIni);
  51727. } else {
  51728. @unlink($this->tmpIni);
  51729. }
  51730. exit($exitCode);
  51731. }
  51732. private function prepareRestart()
  51733. {
  51734. $error = '';
  51735. $iniFiles = self::getAllIniFiles();
  51736. $scannedInis = count($iniFiles) > 1;
  51737. $tmpDir = sys_get_temp_dir();
  51738. if (!$this->cli) {
  51739. $error = 'Unsupported SAPI: '.PHP_SAPI;
  51740. } elseif (!defined('PHP_BINARY')) {
  51741. $error = 'PHP version is too old: '.PHP_VERSION;
  51742. } elseif (!$this->checkConfiguration($info)) {
  51743. $error = $info;
  51744. } elseif (!$this->checkScanDirConfig()) {
  51745. $error = 'PHP version does not report scanned inis: '.PHP_VERSION;
  51746. } elseif (!$this->checkMainScript()) {
  51747. $error = 'Unable to access main script: '.$this->script;
  51748. } elseif (!$this->writeTmpIni($iniFiles, $tmpDir, $error)) {
  51749. $error = $error ?: 'Unable to create temp ini file at: '.$tmpDir;
  51750. } elseif (!$this->setEnvironment($scannedInis, $iniFiles)) {
  51751. $error = 'Unable to set environment variables';
  51752. }
  51753. if ($error) {
  51754. $this->notify(Status::ERROR, $error);
  51755. }
  51756. return empty($error);
  51757. }
  51758. private function writeTmpIni(array $iniFiles, $tmpDir, &$error)
  51759. {
  51760. if (!$this->tmpIni = @tempnam($tmpDir, '')) {
  51761. return false;
  51762. }
  51763. if (empty($iniFiles[0])) {
  51764. array_shift($iniFiles);
  51765. }
  51766. $content = '';
  51767. $regex = '/^\s*(zend_extension\s*=.*xdebug.*)$/mi';
  51768. foreach ($iniFiles as $file) {
  51769. if (!$data = @file_get_contents($file)) {
  51770. $error = 'Unable to read ini: '.$file;
  51771. return false;
  51772. }
  51773. $content .= preg_replace($regex, ';$1', $data).PHP_EOL;
  51774. }
  51775. if ($config = parse_ini_string($content)) {
  51776. $loaded = ini_get_all(null, false);
  51777. $content .= $this->mergeLoadedConfig($loaded, $config);
  51778. }
  51779. $content .= 'opcache.enable_cli=0'.PHP_EOL;
  51780. return @file_put_contents($this->tmpIni, $content);
  51781. }
  51782. private function getCommand()
  51783. {
  51784. $php = array(PHP_BINARY);
  51785. $args = array_slice($_SERVER['argv'], 1);
  51786. if (!$this->persistent) {
  51787. array_push($php, '-n', '-c', $this->tmpIni);
  51788. }
  51789. if (defined('STDOUT') && Process::supportsColor(STDOUT)) {
  51790. $args = Process::addColorOption($args, $this->colorOption);
  51791. }
  51792. $args = array_merge($php, array($this->script), $args);
  51793. $cmd = Process::escape(array_shift($args), true, true);
  51794. foreach ($args as $arg) {
  51795. $cmd .= ' '.Process::escape($arg);
  51796. }
  51797. return $cmd;
  51798. }
  51799. private function setEnvironment($scannedInis, array $iniFiles)
  51800. {
  51801. $scanDir = getenv('PHP_INI_SCAN_DIR');
  51802. $phprc = getenv('PHPRC');
  51803. if (!putenv($this->envOriginalInis.'='.implode(PATH_SEPARATOR, $iniFiles))) {
  51804. return false;
  51805. }
  51806. if ($this->persistent) {
  51807. if (!putenv('PHP_INI_SCAN_DIR=') || !putenv('PHPRC='.$this->tmpIni)) {
  51808. return false;
  51809. }
  51810. }
  51811. $envArgs = array(
  51812. self::RESTART_ID,
  51813. $this->loaded,
  51814. (int) $scannedInis,
  51815. false === $scanDir ? '*' : $scanDir,
  51816. false === $phprc ? '*' : $phprc,
  51817. );
  51818. return putenv($this->envAllowXdebug.'='.implode('|', $envArgs));
  51819. }
  51820. private function notify($op, $data = null)
  51821. {
  51822. $this->statusWriter->report($op, $data);
  51823. }
  51824. private function mergeLoadedConfig(array $loadedConfig, array $iniConfig)
  51825. {
  51826. $content = '';
  51827. foreach ($loadedConfig as $name => $value) {
  51828. if (!is_string($value)
  51829. || strpos($name, 'xdebug') === 0
  51830. || $name === 'apc.mmap_file_mask') {
  51831. continue;
  51832. }
  51833. if (!isset($iniConfig[$name]) || $iniConfig[$name] !== $value) {
  51834. $content .= $name.'="'.addcslashes($value, '\\"').'"'.PHP_EOL;
  51835. }
  51836. }
  51837. return $content;
  51838. }
  51839. private function checkMainScript()
  51840. {
  51841. if (null !== $this->script) {
  51842. return file_exists($this->script) || '--' === $this->script;
  51843. }
  51844. if (file_exists($this->script = $_SERVER['argv'][0])) {
  51845. return true;
  51846. }
  51847. $options = PHP_VERSION_ID >= 50306 ? DEBUG_BACKTRACE_IGNORE_ARGS : false;
  51848. $trace = debug_backtrace($options);
  51849. if (($main = end($trace)) && isset($main['file'])) {
  51850. return file_exists($this->script = $main['file']);
  51851. }
  51852. return false;
  51853. }
  51854. private function setEnvRestartSettings($envArgs)
  51855. {
  51856. $settings = array(
  51857. php_ini_loaded_file(),
  51858. $envArgs[2],
  51859. $envArgs[3],
  51860. $envArgs[4],
  51861. getenv($this->envOriginalInis),
  51862. self::$skipped,
  51863. );
  51864. Process::setEnv(self::RESTART_SETTINGS, implode('|', $settings));
  51865. }
  51866. private function syncSettings(array $settings)
  51867. {
  51868. if (false === getenv($this->envOriginalInis)) {
  51869. Process::setEnv($this->envOriginalInis, implode(PATH_SEPARATOR, $settings['inis']));
  51870. }
  51871. self::$skipped = $settings['skipped'];
  51872. $this->notify(Status::INFO, 'Process called with existing restart settings');
  51873. }
  51874. private function checkScanDirConfig()
  51875. {
  51876. return !(getenv('PHP_INI_SCAN_DIR')
  51877. && !PHP_CONFIG_FILE_SCAN_DIR
  51878. && (PHP_VERSION_ID < 70113
  51879. || PHP_VERSION_ID === 70200));
  51880. }
  51881. private function checkConfiguration(&$info)
  51882. {
  51883. if (false !== strpos(ini_get('disable_functions'), 'passthru')) {
  51884. $info = 'passthru function is disabled';
  51885. return false;
  51886. }
  51887. if (extension_loaded('uopz')) {
  51888. if (function_exists('uopz_allow_exit')) {
  51889. @uopz_allow_exit(true);
  51890. } else {
  51891. $info = 'uopz extension is not compatible';
  51892. return false;
  51893. }
  51894. }
  51895. return true;
  51896. }
  51897. }
  51898. Copyright (c) 2012 PHP Framework Interoperability Group
  51899. Permission is hereby granted, free of charge, to any person obtaining a copy
  51900. of this software and associated documentation files (the "Software"), to deal
  51901. in the Software without restriction, including without limitation the rights
  51902. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  51903. copies of the Software, and to permit persons to whom the Software is
  51904. furnished to do so, subject to the following conditions:
  51905. The above copyright notice and this permission notice shall be included in
  51906. all copies or substantial portions of the Software.
  51907. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  51908. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  51909. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  51910. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  51911. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  51912. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  51913. THE SOFTWARE.
  51914. <?php
  51915. namespace Psr\Log;
  51916. abstract class AbstractLogger implements LoggerInterface
  51917. {
  51918. public function emergency($message, array $context = array())
  51919. {
  51920. $this->log(LogLevel::EMERGENCY, $message, $context);
  51921. }
  51922. public function alert($message, array $context = array())
  51923. {
  51924. $this->log(LogLevel::ALERT, $message, $context);
  51925. }
  51926. public function critical($message, array $context = array())
  51927. {
  51928. $this->log(LogLevel::CRITICAL, $message, $context);
  51929. }
  51930. public function error($message, array $context = array())
  51931. {
  51932. $this->log(LogLevel::ERROR, $message, $context);
  51933. }
  51934. public function warning($message, array $context = array())
  51935. {
  51936. $this->log(LogLevel::WARNING, $message, $context);
  51937. }
  51938. public function notice($message, array $context = array())
  51939. {
  51940. $this->log(LogLevel::NOTICE, $message, $context);
  51941. }
  51942. public function info($message, array $context = array())
  51943. {
  51944. $this->log(LogLevel::INFO, $message, $context);
  51945. }
  51946. public function debug($message, array $context = array())
  51947. {
  51948. $this->log(LogLevel::DEBUG, $message, $context);
  51949. }
  51950. }
  51951. <?php
  51952. namespace Psr\Log;
  51953. class InvalidArgumentException extends \InvalidArgumentException
  51954. {
  51955. }
  51956. <?php
  51957. namespace Psr\Log;
  51958. class LogLevel
  51959. {
  51960. const EMERGENCY = 'emergency';
  51961. const ALERT = 'alert';
  51962. const CRITICAL = 'critical';
  51963. const ERROR = 'error';
  51964. const WARNING = 'warning';
  51965. const NOTICE = 'notice';
  51966. const INFO = 'info';
  51967. const DEBUG = 'debug';
  51968. }
  51969. <?php
  51970. namespace Psr\Log;
  51971. interface LoggerAwareInterface
  51972. {
  51973. public function setLogger(LoggerInterface $logger);
  51974. }
  51975. <?php
  51976. namespace Psr\Log;
  51977. trait LoggerAwareTrait
  51978. {
  51979. protected $logger;
  51980. public function setLogger(LoggerInterface $logger)
  51981. {
  51982. $this->logger = $logger;
  51983. }
  51984. }
  51985. <?php
  51986. namespace Psr\Log;
  51987. interface LoggerInterface
  51988. {
  51989. public function emergency($message, array $context = array());
  51990. public function alert($message, array $context = array());
  51991. public function critical($message, array $context = array());
  51992. public function error($message, array $context = array());
  51993. public function warning($message, array $context = array());
  51994. public function notice($message, array $context = array());
  51995. public function info($message, array $context = array());
  51996. public function debug($message, array $context = array());
  51997. public function log($level, $message, array $context = array());
  51998. }
  51999. <?php
  52000. namespace Psr\Log;
  52001. trait LoggerTrait
  52002. {
  52003. public function emergency($message, array $context = array())
  52004. {
  52005. $this->log(LogLevel::EMERGENCY, $message, $context);
  52006. }
  52007. public function alert($message, array $context = array())
  52008. {
  52009. $this->log(LogLevel::ALERT, $message, $context);
  52010. }
  52011. public function critical($message, array $context = array())
  52012. {
  52013. $this->log(LogLevel::CRITICAL, $message, $context);
  52014. }
  52015. public function error($message, array $context = array())
  52016. {
  52017. $this->log(LogLevel::ERROR, $message, $context);
  52018. }
  52019. public function warning($message, array $context = array())
  52020. {
  52021. $this->log(LogLevel::WARNING, $message, $context);
  52022. }
  52023. public function notice($message, array $context = array())
  52024. {
  52025. $this->log(LogLevel::NOTICE, $message, $context);
  52026. }
  52027. public function info($message, array $context = array())
  52028. {
  52029. $this->log(LogLevel::INFO, $message, $context);
  52030. }
  52031. public function debug($message, array $context = array())
  52032. {
  52033. $this->log(LogLevel::DEBUG, $message, $context);
  52034. }
  52035. abstract public function log($level, $message, array $context = array());
  52036. }
  52037. <?php
  52038. namespace Psr\Log;
  52039. class NullLogger extends AbstractLogger
  52040. {
  52041. public function log($level, $message, array $context = array())
  52042. {
  52043. }
  52044. }
  52045. <?php
  52046. namespace Psr\Log\Test;
  52047. use Psr\Log\LoggerInterface;
  52048. use Psr\Log\LogLevel;
  52049. use PHPUnit\Framework\TestCase;
  52050. abstract class LoggerInterfaceTest extends TestCase
  52051. {
  52052. abstract public function getLogger();
  52053. abstract public function getLogs();
  52054. public function testImplements()
  52055. {
  52056. $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger());
  52057. }
  52058. public function testLogsAtAllLevels($level, $message)
  52059. {
  52060. $logger = $this->getLogger();
  52061. $logger->{$level}($message, array('user' => 'Bob'));
  52062. $logger->log($level, $message, array('user' => 'Bob'));
  52063. $expected = array(
  52064. $level.' message of level '.$level.' with context: Bob',
  52065. $level.' message of level '.$level.' with context: Bob',
  52066. );
  52067. $this->assertEquals($expected, $this->getLogs());
  52068. }
  52069. public function provideLevelsAndMessages()
  52070. {
  52071. return array(
  52072. LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'),
  52073. LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'),
  52074. LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'),
  52075. LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'),
  52076. LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'),
  52077. LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'),
  52078. LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'),
  52079. LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'),
  52080. );
  52081. }
  52082. public function testThrowsOnInvalidLevel()
  52083. {
  52084. $logger = $this->getLogger();
  52085. $logger->log('invalid level', 'Foo');
  52086. }
  52087. public function testContextReplacement()
  52088. {
  52089. $logger = $this->getLogger();
  52090. $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar'));
  52091. $expected = array('info {Message {nothing} Bob Bar a}');
  52092. $this->assertEquals($expected, $this->getLogs());
  52093. }
  52094. public function testObjectCastToString()
  52095. {
  52096. if (method_exists($this, 'createPartialMock')) {
  52097. $dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString'));
  52098. } else {
  52099. $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString'));
  52100. }
  52101. $dummy->expects($this->once())
  52102. ->method('__toString')
  52103. ->will($this->returnValue('DUMMY'));
  52104. $this->getLogger()->warning($dummy);
  52105. $expected = array('warning DUMMY');
  52106. $this->assertEquals($expected, $this->getLogs());
  52107. }
  52108. public function testContextCanContainAnything()
  52109. {
  52110. $closed = fopen('php://memory', 'r');
  52111. fclose($closed);
  52112. $context = array(
  52113. 'bool' => true,
  52114. 'null' => null,
  52115. 'string' => 'Foo',
  52116. 'int' => 0,
  52117. 'float' => 0.5,
  52118. 'nested' => array('with object' => new DummyTest),
  52119. 'object' => new \DateTime,
  52120. 'resource' => fopen('php://memory', 'r'),
  52121. 'closed' => $closed,
  52122. );
  52123. $this->getLogger()->warning('Crazy context data', $context);
  52124. $expected = array('warning Crazy context data');
  52125. $this->assertEquals($expected, $this->getLogs());
  52126. }
  52127. public function testContextExceptionKeyCanBeExceptionOrOtherValues()
  52128. {
  52129. $logger = $this->getLogger();
  52130. $logger->warning('Random message', array('exception' => 'oops'));
  52131. $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail')));
  52132. $expected = array(
  52133. 'warning Random message',
  52134. 'critical Uncaught Exception!'
  52135. );
  52136. $this->assertEquals($expected, $this->getLogs());
  52137. }
  52138. }
  52139. class DummyTest
  52140. {
  52141. public function __toString()
  52142. {
  52143. return 'DummyTest';
  52144. }
  52145. }
  52146. <?php
  52147. namespace Psr\Log\Test;
  52148. use Psr\Log\AbstractLogger;
  52149. class TestLogger extends AbstractLogger
  52150. {
  52151. public $records = [];
  52152. public $recordsByLevel = [];
  52153. public function log($level, $message, array $context = [])
  52154. {
  52155. $record = [
  52156. 'level' => $level,
  52157. 'message' => $message,
  52158. 'context' => $context,
  52159. ];
  52160. $this->recordsByLevel[$record['level']][] = $record;
  52161. $this->records[] = $record;
  52162. }
  52163. public function hasRecords($level)
  52164. {
  52165. return isset($this->recordsByLevel[$level]);
  52166. }
  52167. public function hasRecord($record, $level)
  52168. {
  52169. if (is_string($record)) {
  52170. $record = ['message' => $record];
  52171. }
  52172. return $this->hasRecordThatPasses(function ($rec) use ($record) {
  52173. if ($rec['message'] !== $record['message']) {
  52174. return false;
  52175. }
  52176. if (isset($record['context']) && $rec['context'] !== $record['context']) {
  52177. return false;
  52178. }
  52179. return true;
  52180. }, $level);
  52181. }
  52182. public function hasRecordThatContains($message, $level)
  52183. {
  52184. return $this->hasRecordThatPasses(function ($rec) use ($message) {
  52185. return strpos($rec['message'], $message) !== false;
  52186. }, $level);
  52187. }
  52188. public function hasRecordThatMatches($regex, $level)
  52189. {
  52190. return $this->hasRecordThatPasses(function ($rec) use ($regex) {
  52191. return preg_match($regex, $rec['message']) > 0;
  52192. }, $level);
  52193. }
  52194. public function hasRecordThatPasses(callable $predicate, $level)
  52195. {
  52196. if (!isset($this->recordsByLevel[$level])) {
  52197. return false;
  52198. }
  52199. foreach ($this->recordsByLevel[$level] as $i => $rec) {
  52200. if (call_user_func($predicate, $rec, $i)) {
  52201. return true;
  52202. }
  52203. }
  52204. return false;
  52205. }
  52206. public function __call($method, $args)
  52207. {
  52208. if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) {
  52209. $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3];
  52210. $level = strtolower($matches[2]);
  52211. if (method_exists($this, $genericMethod)) {
  52212. $args[] = $level;
  52213. return call_user_func_array([$this, $genericMethod], $args);
  52214. }
  52215. }
  52216. throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()');
  52217. }
  52218. public function reset()
  52219. {
  52220. $this->records = [];
  52221. $this->recordsByLevel = [];
  52222. }
  52223. }
  52224. <?php
  52225. require_once __DIR__ . '/composer/autoload_real.php';
  52226. return ComposerAutoloaderInitComposerPhar1574016857::getLoader();
  52227. <?php
  52228. $vendorDir = dirname(dirname(__FILE__));
  52229. $baseDir = dirname($vendorDir);
  52230. return array(
  52231. );
  52232. <?php
  52233. $vendorDir = dirname(dirname(__FILE__));
  52234. $baseDir = dirname($vendorDir);
  52235. return array(
  52236. 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
  52237. 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'),
  52238. 'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
  52239. 'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
  52240. 'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'),
  52241. 'Symfony\\Component\\Debug\\' => array($vendorDir . '/symfony/debug'),
  52242. 'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
  52243. 'Seld\\PharUtils\\' => array($vendorDir . '/seld/phar-utils/src'),
  52244. 'Seld\\JsonLint\\' => array($vendorDir . '/seld/jsonlint/src/Seld/JsonLint'),
  52245. 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
  52246. 'JsonSchema\\' => array($vendorDir . '/justinrainbow/json-schema/src/JsonSchema'),
  52247. 'Composer\\XdebugHandler\\' => array($vendorDir . '/composer/xdebug-handler/src'),
  52248. 'Composer\\Spdx\\' => array($vendorDir . '/composer/spdx-licenses/src'),
  52249. 'Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'),
  52250. 'Composer\\CaBundle\\' => array($vendorDir . '/composer/ca-bundle/src'),
  52251. 'Composer\\' => array($baseDir . '/src/Composer'),
  52252. );
  52253. <?php
  52254. $vendorDir = dirname(dirname(__FILE__));
  52255. $baseDir = dirname($vendorDir);
  52256. return array(
  52257. );
  52258. <?php
  52259. $vendorDir = dirname(dirname(__FILE__));
  52260. $baseDir = dirname($vendorDir);
  52261. return array(
  52262. '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
  52263. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
  52264. );
  52265. <?php
  52266. class ComposerAutoloaderInitComposerPhar1574016857
  52267. {
  52268. private static $loader;
  52269. public static function loadClassLoader($class)
  52270. {
  52271. if ('Composer\Autoload\ClassLoader' === $class) {
  52272. require __DIR__ . '/ClassLoader.php';
  52273. }
  52274. }
  52275. public static function getLoader()
  52276. {
  52277. if (null !== self::$loader) {
  52278. return self::$loader;
  52279. }
  52280. spl_autoload_register(array('ComposerAutoloaderInitComposerPhar1574016857', 'loadClassLoader'), true, true);
  52281. self::$loader = $loader = new \Composer\Autoload\ClassLoader();
  52282. spl_autoload_unregister(array('ComposerAutoloaderInitComposerPhar1574016857', 'loadClassLoader'));
  52283. $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
  52284. if ($useStaticLoader) {
  52285. require_once __DIR__ . '/autoload_static.php';
  52286. call_user_func(\Composer\Autoload\ComposerStaticInitComposerPhar1574016857::getInitializer($loader));
  52287. } else {
  52288. $map = require __DIR__ . '/autoload_namespaces.php';
  52289. foreach ($map as $namespace => $path) {
  52290. $loader->set($namespace, $path);
  52291. }
  52292. $map = require __DIR__ . '/autoload_psr4.php';
  52293. foreach ($map as $namespace => $path) {
  52294. $loader->setPsr4($namespace, $path);
  52295. }
  52296. $classMap = require __DIR__ . '/autoload_classmap.php';
  52297. if ($classMap) {
  52298. $loader->addClassMap($classMap);
  52299. }
  52300. }
  52301. $loader->register(true);
  52302. if ($useStaticLoader) {
  52303. $includeFiles = Composer\Autoload\ComposerStaticInitComposerPhar1574016857::$files;
  52304. } else {
  52305. $includeFiles = require __DIR__ . '/autoload_files.php';
  52306. }
  52307. foreach ($includeFiles as $fileIdentifier => $file) {
  52308. composerRequireComposerPhar1574016857($fileIdentifier, $file);
  52309. }
  52310. return $loader;
  52311. }
  52312. }
  52313. function composerRequireComposerPhar1574016857($fileIdentifier, $file)
  52314. {
  52315. if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  52316. require $file;
  52317. $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
  52318. }
  52319. }
  52320. <?php
  52321. namespace Composer\Autoload;
  52322. class ComposerStaticInitComposerPhar1574016857
  52323. {
  52324. public static $files = array (
  52325. '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
  52326. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
  52327. );
  52328. public static $prefixLengthsPsr4 = array (
  52329. 'S' =>
  52330. array (
  52331. 'Symfony\\Polyfill\\Mbstring\\' => 26,
  52332. 'Symfony\\Polyfill\\Ctype\\' => 23,
  52333. 'Symfony\\Component\\Process\\' => 26,
  52334. 'Symfony\\Component\\Finder\\' => 25,
  52335. 'Symfony\\Component\\Filesystem\\' => 29,
  52336. 'Symfony\\Component\\Debug\\' => 24,
  52337. 'Symfony\\Component\\Console\\' => 26,
  52338. 'Seld\\PharUtils\\' => 15,
  52339. 'Seld\\JsonLint\\' => 14,
  52340. ),
  52341. 'P' =>
  52342. array (
  52343. 'Psr\\Log\\' => 8,
  52344. ),
  52345. 'J' =>
  52346. array (
  52347. 'JsonSchema\\' => 11,
  52348. ),
  52349. 'C' =>
  52350. array (
  52351. 'Composer\\XdebugHandler\\' => 23,
  52352. 'Composer\\Spdx\\' => 14,
  52353. 'Composer\\Semver\\' => 16,
  52354. 'Composer\\CaBundle\\' => 18,
  52355. 'Composer\\' => 9,
  52356. ),
  52357. );
  52358. public static $prefixDirsPsr4 = array (
  52359. 'Symfony\\Polyfill\\Mbstring\\' =>
  52360. array (
  52361. 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
  52362. ),
  52363. 'Symfony\\Polyfill\\Ctype\\' =>
  52364. array (
  52365. 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype',
  52366. ),
  52367. 'Symfony\\Component\\Process\\' =>
  52368. array (
  52369. 0 => __DIR__ . '/..' . '/symfony/process',
  52370. ),
  52371. 'Symfony\\Component\\Finder\\' =>
  52372. array (
  52373. 0 => __DIR__ . '/..' . '/symfony/finder',
  52374. ),
  52375. 'Symfony\\Component\\Filesystem\\' =>
  52376. array (
  52377. 0 => __DIR__ . '/..' . '/symfony/filesystem',
  52378. ),
  52379. 'Symfony\\Component\\Debug\\' =>
  52380. array (
  52381. 0 => __DIR__ . '/..' . '/symfony/debug',
  52382. ),
  52383. 'Symfony\\Component\\Console\\' =>
  52384. array (
  52385. 0 => __DIR__ . '/..' . '/symfony/console',
  52386. ),
  52387. 'Seld\\PharUtils\\' =>
  52388. array (
  52389. 0 => __DIR__ . '/..' . '/seld/phar-utils/src',
  52390. ),
  52391. 'Seld\\JsonLint\\' =>
  52392. array (
  52393. 0 => __DIR__ . '/..' . '/seld/jsonlint/src/Seld/JsonLint',
  52394. ),
  52395. 'Psr\\Log\\' =>
  52396. array (
  52397. 0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
  52398. ),
  52399. 'JsonSchema\\' =>
  52400. array (
  52401. 0 => __DIR__ . '/..' . '/justinrainbow/json-schema/src/JsonSchema',
  52402. ),
  52403. 'Composer\\XdebugHandler\\' =>
  52404. array (
  52405. 0 => __DIR__ . '/..' . '/composer/xdebug-handler/src',
  52406. ),
  52407. 'Composer\\Spdx\\' =>
  52408. array (
  52409. 0 => __DIR__ . '/..' . '/composer/spdx-licenses/src',
  52410. ),
  52411. 'Composer\\Semver\\' =>
  52412. array (
  52413. 0 => __DIR__ . '/..' . '/composer/semver/src',
  52414. ),
  52415. 'Composer\\CaBundle\\' =>
  52416. array (
  52417. 0 => __DIR__ . '/..' . '/composer/ca-bundle/src',
  52418. ),
  52419. 'Composer\\' =>
  52420. array (
  52421. 0 => __DIR__ . '/../..' . '/src/Composer',
  52422. ),
  52423. );
  52424. public static function getInitializer(ClassLoader $loader)
  52425. {
  52426. return \Closure::bind(function () use ($loader) {
  52427. $loader->prefixLengthsPsr4 = ComposerStaticInitComposerPhar1574016857::$prefixLengthsPsr4;
  52428. $loader->prefixDirsPsr4 = ComposerStaticInitComposerPhar1574016857::$prefixDirsPsr4;
  52429. }, null, ClassLoader::class);
  52430. }
  52431. }
  52432. <?php
  52433. namespace Composer\Autoload;
  52434. class ClassLoader
  52435. {
  52436. private $prefixLengthsPsr4 = array();
  52437. private $prefixDirsPsr4 = array();
  52438. private $fallbackDirsPsr4 = array();
  52439. private $prefixesPsr0 = array();
  52440. private $fallbackDirsPsr0 = array();
  52441. private $useIncludePath = false;
  52442. private $classMap = array();
  52443. private $classMapAuthoritative = false;
  52444. private $missingClasses = array();
  52445. private $apcuPrefix;
  52446. public function getPrefixes()
  52447. {
  52448. if (!empty($this->prefixesPsr0)) {
  52449. return call_user_func_array('array_merge', $this->prefixesPsr0);
  52450. }
  52451. return array();
  52452. }
  52453. public function getPrefixesPsr4()
  52454. {
  52455. return $this->prefixDirsPsr4;
  52456. }
  52457. public function getFallbackDirs()
  52458. {
  52459. return $this->fallbackDirsPsr0;
  52460. }
  52461. public function getFallbackDirsPsr4()
  52462. {
  52463. return $this->fallbackDirsPsr4;
  52464. }
  52465. public function getClassMap()
  52466. {
  52467. return $this->classMap;
  52468. }
  52469. public function addClassMap(array $classMap)
  52470. {
  52471. if ($this->classMap) {
  52472. $this->classMap = array_merge($this->classMap, $classMap);
  52473. } else {
  52474. $this->classMap = $classMap;
  52475. }
  52476. }
  52477. public function add($prefix, $paths, $prepend = false)
  52478. {
  52479. if (!$prefix) {
  52480. if ($prepend) {
  52481. $this->fallbackDirsPsr0 = array_merge(
  52482. (array) $paths,
  52483. $this->fallbackDirsPsr0
  52484. );
  52485. } else {
  52486. $this->fallbackDirsPsr0 = array_merge(
  52487. $this->fallbackDirsPsr0,
  52488. (array) $paths
  52489. );
  52490. }
  52491. return;
  52492. }
  52493. $first = $prefix[0];
  52494. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  52495. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  52496. return;
  52497. }
  52498. if ($prepend) {
  52499. $this->prefixesPsr0[$first][$prefix] = array_merge(
  52500. (array) $paths,
  52501. $this->prefixesPsr0[$first][$prefix]
  52502. );
  52503. } else {
  52504. $this->prefixesPsr0[$first][$prefix] = array_merge(
  52505. $this->prefixesPsr0[$first][$prefix],
  52506. (array) $paths
  52507. );
  52508. }
  52509. }
  52510. public function addPsr4($prefix, $paths, $prepend = false)
  52511. {
  52512. if (!$prefix) {
  52513. if ($prepend) {
  52514. $this->fallbackDirsPsr4 = array_merge(
  52515. (array) $paths,
  52516. $this->fallbackDirsPsr4
  52517. );
  52518. } else {
  52519. $this->fallbackDirsPsr4 = array_merge(
  52520. $this->fallbackDirsPsr4,
  52521. (array) $paths
  52522. );
  52523. }
  52524. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  52525. $length = strlen($prefix);
  52526. if ('\\' !== $prefix[$length - 1]) {
  52527. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  52528. }
  52529. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  52530. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  52531. } elseif ($prepend) {
  52532. $this->prefixDirsPsr4[$prefix] = array_merge(
  52533. (array) $paths,
  52534. $this->prefixDirsPsr4[$prefix]
  52535. );
  52536. } else {
  52537. $this->prefixDirsPsr4[$prefix] = array_merge(
  52538. $this->prefixDirsPsr4[$prefix],
  52539. (array) $paths
  52540. );
  52541. }
  52542. }
  52543. public function set($prefix, $paths)
  52544. {
  52545. if (!$prefix) {
  52546. $this->fallbackDirsPsr0 = (array) $paths;
  52547. } else {
  52548. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  52549. }
  52550. }
  52551. public function setPsr4($prefix, $paths)
  52552. {
  52553. if (!$prefix) {
  52554. $this->fallbackDirsPsr4 = (array) $paths;
  52555. } else {
  52556. $length = strlen($prefix);
  52557. if ('\\' !== $prefix[$length - 1]) {
  52558. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  52559. }
  52560. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  52561. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  52562. }
  52563. }
  52564. public function setUseIncludePath($useIncludePath)
  52565. {
  52566. $this->useIncludePath = $useIncludePath;
  52567. }
  52568. public function getUseIncludePath()
  52569. {
  52570. return $this->useIncludePath;
  52571. }
  52572. public function setClassMapAuthoritative($classMapAuthoritative)
  52573. {
  52574. $this->classMapAuthoritative = $classMapAuthoritative;
  52575. }
  52576. public function isClassMapAuthoritative()
  52577. {
  52578. return $this->classMapAuthoritative;
  52579. }
  52580. public function setApcuPrefix($apcuPrefix)
  52581. {
  52582. $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
  52583. }
  52584. public function getApcuPrefix()
  52585. {
  52586. return $this->apcuPrefix;
  52587. }
  52588. public function register($prepend = false)
  52589. {
  52590. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  52591. }
  52592. public function unregister()
  52593. {
  52594. spl_autoload_unregister(array($this, 'loadClass'));
  52595. }
  52596. public function loadClass($class)
  52597. {
  52598. if ($file = $this->findFile($class)) {
  52599. includeFile($file);
  52600. return true;
  52601. }
  52602. }
  52603. public function findFile($class)
  52604. {
  52605. if (isset($this->classMap[$class])) {
  52606. return $this->classMap[$class];
  52607. }
  52608. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  52609. return false;
  52610. }
  52611. if (null !== $this->apcuPrefix) {
  52612. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  52613. if ($hit) {
  52614. return $file;
  52615. }
  52616. }
  52617. $file = $this->findFileWithExtension($class, '.php');
  52618. if (false === $file && defined('HHVM_VERSION')) {
  52619. $file = $this->findFileWithExtension($class, '.hh');
  52620. }
  52621. if (null !== $this->apcuPrefix) {
  52622. apcu_add($this->apcuPrefix.$class, $file);
  52623. }
  52624. if (false === $file) {
  52625. $this->missingClasses[$class] = true;
  52626. }
  52627. return $file;
  52628. }
  52629. private function findFileWithExtension($class, $ext)
  52630. {
  52631. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  52632. $first = $class[0];
  52633. if (isset($this->prefixLengthsPsr4[$first])) {
  52634. $subPath = $class;
  52635. while (false !== $lastPos = strrpos($subPath, '\\')) {
  52636. $subPath = substr($subPath, 0, $lastPos);
  52637. $search = $subPath . '\\';
  52638. if (isset($this->prefixDirsPsr4[$search])) {
  52639. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  52640. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  52641. if (file_exists($file = $dir . $pathEnd)) {
  52642. return $file;
  52643. }
  52644. }
  52645. }
  52646. }
  52647. }
  52648. foreach ($this->fallbackDirsPsr4 as $dir) {
  52649. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  52650. return $file;
  52651. }
  52652. }
  52653. if (false !== $pos = strrpos($class, '\\')) {
  52654. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  52655. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  52656. } else {
  52657. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  52658. }
  52659. if (isset($this->prefixesPsr0[$first])) {
  52660. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  52661. if (0 === strpos($class, $prefix)) {
  52662. foreach ($dirs as $dir) {
  52663. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  52664. return $file;
  52665. }
  52666. }
  52667. }
  52668. }
  52669. }
  52670. foreach ($this->fallbackDirsPsr0 as $dir) {
  52671. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  52672. return $file;
  52673. }
  52674. }
  52675. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  52676. return $file;
  52677. }
  52678. return false;
  52679. }
  52680. }
  52681. function includeFile($file)
  52682. {
  52683. include $file;
  52684. }
  52685. ##
  52686. ## Bundle of CA Root Certificates
  52687. ##
  52688. ## Certificate data from Mozilla as of: Wed Aug 28 03:12:10 2019 GMT
  52689. ##
  52690. ## This is a bundle of X.509 certificates of public Certificate Authorities
  52691. ## (CA). These were automatically extracted from Mozilla's root certificates
  52692. ## file (certdata.txt). This file can be found in the mozilla source tree:
  52693. ## https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt
  52694. ##
  52695. ## It contains the certificates in PEM format and therefore
  52696. ## can be directly used with curl / libcurl / php_curl, or with
  52697. ## an Apache+mod_ssl webserver for SSL client authentication.
  52698. ## Just configure this file as the SSLCACertificateFile.
  52699. ##
  52700. ## Conversion done with mk-ca-bundle.pl version 1.27.
  52701. ## SHA256: fffa309937c3be940649293f749b8207fabc6eb224e50e4bb3f2c5e44e0d6a6b
  52702. ##
  52703. GlobalSign Root CA
  52704. ==================
  52705. -----BEGIN CERTIFICATE-----
  52706. MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkGA1UEBhMCQkUx
  52707. GTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jvb3QgQ0ExGzAZBgNVBAMTEkds
  52708. b2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAwMDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNV
  52709. BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYD
  52710. VQQDExJHbG9iYWxTaWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDa
  52711. DuaZjc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavpxy0Sy6sc
  52712. THAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp1Wrjsok6Vjk4bwY8iGlb
  52713. Kk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdGsnUOhugZitVtbNV4FpWi6cgKOOvyJBNP
  52714. c1STE4U6G7weNLWLBYy5d4ux2x8gkasJU26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrX
  52715. gzT/LCrBbBlDSgeF59N89iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
  52716. HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0BAQUF
  52717. AAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOzyj1hTdNGCbM+w6Dj
  52718. Y1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE38NflNUVyRRBnMRddWQVDf9VMOyG
  52719. j/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymPAbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhH
  52720. hm4qxFYxldBniYUr+WymXUadDKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveC
  52721. X4XSQRjbgbMEHMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
  52722. -----END CERTIFICATE-----
  52723. GlobalSign Root CA - R2
  52724. =======================
  52725. -----BEGIN CERTIFICATE-----
  52726. MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4GA1UECxMXR2xv
  52727. YmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  52728. bFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  52729. aWduIFJvb3QgQ0EgLSBSMjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  52730. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6
  52731. ErPLv4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8eoLrvozp
  52732. s6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklqtTleiDTsvHgMCJiEbKjN
  52733. S7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzdC9XZzPnqJworc5HGnRusyMvo4KD0L5CL
  52734. TfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pazq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6C
  52735. ygPCm48CAwEAAaOBnDCBmTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E
  52736. FgQUm+IHV2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5nbG9i
  52737. YWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG3lm0mi3f3BmGLjAN
  52738. BgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4GsJ0/WwbgcQ3izDJr86iw8bmEbTUsp
  52739. 9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu
  52740. 01yiPqFbQfXf5WRDLenVOavSot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG7
  52741. 9G+dwfCMNYxdAfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7
  52742. TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg==
  52743. -----END CERTIFICATE-----
  52744. Verisign Class 3 Public Primary Certification Authority - G3
  52745. ============================================================
  52746. -----BEGIN CERTIFICATE-----
  52747. MIIEGjCCAwICEQCbfgZJoz5iudXukEhxKe9XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQGEwJV
  52748. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  52749. cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  52750. IG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNh
  52751. dGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQsw
  52752. CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy
  52753. dXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv
  52754. cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkg
  52755. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  52756. ggEBAMu6nFL8eB8aHm8bN3O9+MlrlBIwT/A2R/XQkQr1F8ilYcEWQE37imGQ5XYgwREGfassbqb1
  52757. EUGO+i2tKmFZpGcmTNDovFJbcCAEWNF6yaRpvIMXZK0Fi7zQWM6NjPXr8EJJC52XJ2cybuGukxUc
  52758. cLwgTS8Y3pKI6GyFVxEa6X7jJhFUokWWVYPKMIno3Nij7SqAP395ZVc+FSBmCC+Vk7+qRy+oRpfw
  52759. EuL+wgorUeZ25rdGt+INpsyow0xZVYnm6FNcHOqd8GIWC6fJXwzw3sJ2zq/3avL6QaaiMxTJ5Xpj
  52760. 055iN9WFZZ4O5lMkdBteHRJTW8cs54NJOxWuimi5V5cCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA
  52761. ERSWwauSCPc/L8my/uRan2Te2yFPhpk0djZX3dAVL8WtfxUfN2JzPtTnX84XA9s1+ivbrmAJXx5f
  52762. j267Cz3qWhMeDGBvtcC1IyIuBwvLqXTLR7sdwdela8wv0kL9Sd2nic9TutoAWii/gt/4uhMdUIaC
  52763. /Y4wjylGsB49Ndo4YhYYSq3mtlFs3q9i6wHQHiT+eo8SGhJouPtmmRQURVyu565pF4ErWjfJXir0
  52764. xuKhXFSbplQAz/DxwceYMBo7Nhbbo27q/a2ywtrvAkcTisDxszGtTxzhT5yvDwyd93gN2PQ1VoDa
  52765. t20Xj50egWTh/sVFuq1ruQp6Tk9LhO5L8X3dEQ==
  52766. -----END CERTIFICATE-----
  52767. Entrust.net Premium 2048 Secure Server CA
  52768. =========================================
  52769. -----BEGIN CERTIFICATE-----
  52770. MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChMLRW50cnVzdC5u
  52771. ZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBpbmNvcnAuIGJ5IHJlZi4gKGxp
  52772. bWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNV
  52773. BAMTKkVudHJ1c3QubmV0IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQx
  52774. NzUwNTFaFw0yOTA3MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3
  52775. d3d3LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTEl
  52776. MCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEGA1UEAxMqRW50cnVzdC5u
  52777. ZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  52778. MIIBCgKCAQEArU1LqRKGsuqjIAcVFmQqK0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOL
  52779. Gp18EzoOH1u3Hs/lJBQesYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSr
  52780. hRSGlVuXMlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVTXTzW
  52781. nLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/HoZdenoVve8AjhUi
  52782. VBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH4QIDAQABo0IwQDAOBgNVHQ8BAf8E
  52783. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJ
  52784. KoZIhvcNAQEFBQADggEBADubj1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPy
  52785. T/4xmf3IDExoU8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf
  52786. zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5bu/8j72gZyxKT
  52787. J1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+bYQLCIt+jerXmCHG8+c8eS9e
  52788. nNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/ErfF6adulZkMV8gzURZVE=
  52789. -----END CERTIFICATE-----
  52790. Baltimore CyberTrust Root
  52791. =========================
  52792. -----BEGIN CERTIFICATE-----
  52793. MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJRTESMBAGA1UE
  52794. ChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYDVQQDExlCYWx0aW1vcmUgQ3li
  52795. ZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoXDTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMC
  52796. SUUxEjAQBgNVBAoTCUJhbHRpbW9yZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFs
  52797. dGltb3JlIEN5YmVyVHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKME
  52798. uyKrmD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjrIZ3AQSsB
  52799. UnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeKmpYcqWe4PwzV9/lSEy/C
  52800. G9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSuXmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9
  52801. XbIGevOF6uvUA65ehD5f/xXtabz5OTZydc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjpr
  52802. l3RjM71oGDHweI12v/yejl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoI
  52803. VDaGezq1BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEB
  52804. BQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT929hkTI7gQCvlYpNRh
  52805. cL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3WgxjkzSswF07r51XgdIGn9w/xZchMB5
  52806. hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsa
  52807. Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H
  52808. RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp
  52809. -----END CERTIFICATE-----
  52810. AddTrust External Root
  52811. ======================
  52812. -----BEGIN CERTIFICATE-----
  52813. MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
  52814. QWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYD
  52815. VQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEw
  52816. NDgzOFowbzELMAkGA1UEBhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRU
  52817. cnVzdCBFeHRlcm5hbCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0Eg
  52818. Um9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvtH7xsD821
  52819. +iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9uMq/NzgtHj6RQa1wVsfw
  52820. Tz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzXmk6vBbOmcZSccbNQYArHE504B4YCqOmo
  52821. aSYYkKtMsE8jqzpPhNjfzp/haW+710LXa0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy
  52822. 2xSoRcRdKn23tNbE7qzNE0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv7
  52823. 7+ldU9U0WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYDVR0P
  52824. BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0Jvf6xCZU7wO94CTL
  52825. VBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEmMCQGA1UECxMdQWRk
  52826. VHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsxIjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENB
  52827. IFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZl
  52828. j7DYd7usQWxHYINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5
  52829. 6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvCNr4TDea9Y355
  52830. e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEXc4g/VhsxOBi0cQ+azcgOno4u
  52831. G+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5amnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ=
  52832. -----END CERTIFICATE-----
  52833. Entrust Root Certification Authority
  52834. ====================================
  52835. -----BEGIN CERTIFICATE-----
  52836. MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMCVVMxFjAUBgNV
  52837. BAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0Lm5ldC9DUFMgaXMgaW5jb3Jw
  52838. b3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMWKGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsG
  52839. A1UEAxMkRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0
  52840. MloXDTI2MTEyNzIwNTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMu
  52841. MTkwNwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSByZWZlcmVu
  52842. Y2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNVBAMTJEVudHJ1c3QgUm9v
  52843. dCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  52844. ALaVtkNC+sZtKm9I35RMOVcF7sN5EUFoNu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYsz
  52845. A9u3g3s+IIRe7bJWKKf44LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOww
  52846. Cj0Yzfv9KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGIrb68
  52847. j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi94DkZfs0Nw4pgHBN
  52848. rziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOBsDCBrTAOBgNVHQ8BAf8EBAMCAQYw
  52849. DwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAigA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1
  52850. MzQyWjAfBgNVHSMEGDAWgBRokORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DH
  52851. hmak8fdLQ/uEvW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA
  52852. A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9tO1KzKtvn1ISM
  52853. Y/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6ZuaAGAT/3B+XxFNSRuzFVJ7yVTa
  52854. v52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTS
  52855. W3iDVuycNsMm4hH2Z0kdkquM++v/eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0
  52856. tHuu2guQOHXvgR1m0vdXcDazv/wor3ElhVsT/h5/WrQ8
  52857. -----END CERTIFICATE-----
  52858. GeoTrust Global CA
  52859. ==================
  52860. -----BEGIN CERTIFICATE-----
  52861. MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVTMRYwFAYDVQQK
  52862. Ew1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9iYWwgQ0EwHhcNMDIwNTIxMDQw
  52863. MDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5j
  52864. LjEbMBkGA1UEAxMSR2VvVHJ1c3QgR2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  52865. CgKCAQEA2swYYzD99BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjo
  52866. BbdqfnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDviS2Aelet
  52867. 8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU1XupGc1V3sjs0l44U+Vc
  52868. T4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+bw8HHa8sHo9gOeL6NlMTOdReJivbPagU
  52869. vTLrGAMoUgRx5aszPeE4uwc2hGKceeoWMPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTAD
  52870. AQH/MB0GA1UdDgQWBBTAephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVk
  52871. DBF9qn1luMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKInZ57Q
  52872. zxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfStQWVYrmm3ok9Nns4
  52873. d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcFPseKUgzbFbS9bZvlxrFUaKnjaZC2
  52874. mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Unhw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6p
  52875. XE0zX5IJL4hmXXeXxx12E6nV5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvm
  52876. Mw==
  52877. -----END CERTIFICATE-----
  52878. GeoTrust Universal CA
  52879. =====================
  52880. -----BEGIN CERTIFICATE-----
  52881. MIIFaDCCA1CgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  52882. R2VvVHJ1c3QgSW5jLjEeMBwGA1UEAxMVR2VvVHJ1c3QgVW5pdmVyc2FsIENBMB4XDTA0MDMwNDA1
  52883. MDAwMFoXDTI5MDMwNDA1MDAwMFowRTELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IElu
  52884. Yy4xHjAcBgNVBAMTFUdlb1RydXN0IFVuaXZlcnNhbCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIP
  52885. ADCCAgoCggIBAKYVVaCjxuAfjJ0hUNfBvitbtaSeodlyWL0AG0y/YckUHUWCq8YdgNY96xCcOq9t
  52886. JPi8cQGeBvV8Xx7BDlXKg5pZMK4ZyzBIle0iN430SppyZj6tlcDgFgDgEB8rMQ7XlFTTQjOgNB0e
  52887. RXbdT8oYN+yFFXoZCPzVx5zw8qkuEKmS5j1YPakWaDwvdSEYfyh3peFhF7em6fgemdtzbvQKoiFs
  52888. 7tqqhZJmr/Z6a4LauiIINQ/PQvE1+mrufislzDoR5G2vc7J2Ha3QsnhnGqQ5HFELZ1aD/ThdDc7d
  52889. 8Lsrlh/eezJS/R27tQahsiFepdaVaH/wmZ7cRQg+59IJDTWU3YBOU5fXtQlEIGQWFwMCTFMNaN7V
  52890. qnJNk22CDtucvc+081xdVHppCZbW2xHBjXWotM85yM48vCR85mLK4b19p71XZQvk/iXttmkQ3Cga
  52891. Rr0BHdCXteGYO8A3ZNY9lO4L4fUorgtWv3GLIylBjobFS1J72HGrH4oVpjuDWtdYAVHGTEHZf9hB
  52892. Z3KiKN9gg6meyHv8U3NyWfWTehd2Ds735VzZC1U0oqpbtWpU5xPKV+yXbfReBi9Fi1jUIxaS5BZu
  52893. KGNZMN9QAZxjiRqf2xeUgnA3wySemkfWWspOqGmJch+RbNt+nhutxx9z3SxPGWX9f5NAEC7S8O08
  52894. ni4oPmkmM8V7AgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNq7LqqwDLiIJlF0
  52895. XG0D08DYj3rWMB8GA1UdIwQYMBaAFNq7LqqwDLiIJlF0XG0D08DYj3rWMA4GA1UdDwEB/wQEAwIB
  52896. hjANBgkqhkiG9w0BAQUFAAOCAgEAMXjmx7XfuJRAyXHEqDXsRh3ChfMoWIawC/yOsjmPRFWrZIRc
  52897. aanQmjg8+uUfNeVE44B5lGiku8SfPeE0zTBGi1QrlaXv9z+ZhP015s8xxtxqv6fXIwjhmF7DWgh2
  52898. qaavdy+3YL1ERmrvl/9zlcGO6JP7/TG37FcREUWbMPEaiDnBTzynANXH/KttgCJwpQzgXQQpAvvL
  52899. oJHRfNbDflDVnVi+QTjruXU8FdmbyUqDWcDaU/0zuzYYm4UPFd3uLax2k7nZAY1IEKj79TiG8dsK
  52900. xr2EoyNB3tZ3b4XUhRxQ4K5RirqNPnbiucon8l+f725ZDQbYKxek0nxru18UGkiPGkzns0ccjkxF
  52901. KyDuSN/n3QmOGKjaQI2SJhFTYXNd673nxE0pN2HrrDktZy4W1vUAg4WhzH92xH3kt0tm7wNFYGm2
  52902. DFKWkoRepqO1pD4r2czYG0eq8kTaT/kD6PAUyz/zg97QwVTjt+gKN02LIFkDMBmhLMi9ER/frslK
  52903. xfMnZmaGrGiR/9nmUxwPi1xpZQomyB40w11Re9epnAahNt3ViZS82eQtDF4JbAiXfKM9fJP/P6EU
  52904. p8+1Xevb2xzEdt+Iub1FBZUbrvxGakyvSOPOrg/SfuvmbJxPgWp6ZKy7PtXny3YuxadIwVyQD8vI
  52905. P/rmMuGNG2+k5o7Y+SlIis5z/iw=
  52906. -----END CERTIFICATE-----
  52907. GeoTrust Universal CA 2
  52908. =======================
  52909. -----BEGIN CERTIFICATE-----
  52910. MIIFbDCCA1SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  52911. R2VvVHJ1c3QgSW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwHhcNMDQwMzA0
  52912. MDUwMDAwWhcNMjkwMzA0MDUwMDAwWjBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3Qg
  52913. SW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwggIiMA0GCSqGSIb3DQEBAQUA
  52914. A4ICDwAwggIKAoICAQCzVFLByT7y2dyxUxpZKeexw0Uo5dfR7cXFS6GqdHtXr0om/Nj1XqduGdt0
  52915. DE81WzILAePb63p3NeqqWuDW6KFXlPCQo3RWlEQwAx5cTiuFJnSCegx2oG9NzkEtoBUGFF+3Qs17
  52916. j1hhNNwqCPkuwwGmIkQcTAeC5lvO0Ep8BNMZcyfwqph/Lq9O64ceJHdqXbboW0W63MOhBW9Wjo8Q
  52917. JqVJwy7XQYci4E+GymC16qFjwAGXEHm9ADwSbSsVsaxLse4YuU6W3Nx2/zu+z18DwPw76L5GG//a
  52918. QMJS9/7jOvdqdzXQ2o3rXhhqMcceujwbKNZrVMaqW9eiLBsZzKIC9ptZvTdrhrVtgrrY6slWvKk2
  52919. WP0+GfPtDCapkzj4T8FdIgbQl+rhrcZV4IErKIM6+vR7IVEAvlI4zs1meaj0gVbi0IMJR1FbUGrP
  52920. 20gaXT73y/Zl92zxlfgCOzJWgjl6W70viRu/obTo/3+NjN8D8WBOWBFM66M/ECuDmgFz2ZRthAAn
  52921. ZqzwcEAJQpKtT5MNYQlRJNiS1QuUYbKHsu3/mjX/hVTK7URDrBs8FmtISgocQIgfksILAAX/8sgC
  52922. SqSqqcyZlpwvWOB94b67B9xfBHJcMTTD7F8t4D1kkCLm0ey4Lt1ZrtmhN79UNdxzMk+MBB4zsslG
  52923. 8dhcyFVQyWi9qLo2CQIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR281Xh+qQ2
  52924. +/CfXGJx7Tz0RzgQKzAfBgNVHSMEGDAWgBR281Xh+qQ2+/CfXGJx7Tz0RzgQKzAOBgNVHQ8BAf8E
  52925. BAMCAYYwDQYJKoZIhvcNAQEFBQADggIBAGbBxiPz2eAubl/oz66wsCVNK/g7WJtAJDday6sWSf+z
  52926. dXkzoS9tcBc0kf5nfo/sm+VegqlVHy/c1FEHEv6sFj4sNcZj/NwQ6w2jqtB8zNHQL1EuxBRa3ugZ
  52927. 4T7GzKQp5y6EqgYweHZUcyiYWTjgAA1i00J9IZ+uPTqM1fp3DRgrFg5fNuH8KrUwJM/gYwx7WBr+
  52928. mbpCErGR9Hxo4sjoryzqyX6uuyo9DRXcNJW2GHSoag/HtPQTxORb7QrSpJdMKu0vbBKJPfEncKpq
  52929. A1Ihn0CoZ1Dy81of398j9tx4TuaYT1U6U+Pv8vSfx3zYWK8pIpe44L2RLrB27FcRz+8pRPPphXpg
  52930. Y+RdM4kX2TGq2tbzGDVyz4crL2MjhF2EjD9XoIj8mZEoJmmZ1I+XRL6O1UixpCgp8RW04eWe3fiP
  52931. pm8m1wk8OhwRDqZsN/etRIcsKMfYdIKz0G9KV7s1KSegi+ghp4dkNl3M2Basx7InQJJVOCiNUW7d
  52932. FGdTbHFcJoRNdVq2fmBWqU2t+5sel/MN2dKXVHfaPRK34B7vCAas+YWH6aLcr34YEoP9VhdBLtUp
  52933. gn2Z9DH2canPLAEnpQW5qrJITirvn5NSUZU8UnOOVkwXQMAJKOSLakhT2+zNVVXxxvjpoixMptEm
  52934. X36vWkzaH6byHCx+rgIW0lbQL1dTR+iS
  52935. -----END CERTIFICATE-----
  52936. Comodo AAA Services root
  52937. ========================
  52938. -----BEGIN CERTIFICATE-----
  52939. MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
  52940. R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
  52941. TGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAw
  52942. MFoXDTI4MTIzMTIzNTk1OVowezELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hl
  52943. c3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNV
  52944. BAMMGEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  52945. ggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQuaBtDFcCLNSS1UY8y2bmhG
  52946. C1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe3M/vg4aijJRPn2jymJBGhCfHdr/jzDUs
  52947. i14HZGWCwEiwqJH5YZ92IFCokcdmtet4YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszW
  52948. Y19zjNoFmag4qMsXeDZRrOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjH
  52949. Ypy+g8cmez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQUoBEK
  52950. Iz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wewYDVR0f
  52951. BHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20vQUFBQ2VydGlmaWNhdGVTZXJ2aWNl
  52952. cy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29tb2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2Vz
  52953. LmNybDANBgkqhkiG9w0BAQUFAAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm
  52954. 7l3sAg9g1o1QGE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz
  52955. Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2G9w84FoVxp7Z
  52956. 8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsil2D4kF501KKaU73yqWjgom7C
  52957. 12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg==
  52958. -----END CERTIFICATE-----
  52959. QuoVadis Root CA
  52960. ================
  52961. -----BEGIN CERTIFICATE-----
  52962. MIIF0DCCBLigAwIBAgIEOrZQizANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJCTTEZMBcGA1UE
  52963. ChMQUXVvVmFkaXMgTGltaXRlZDElMCMGA1UECxMcUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0
  52964. eTEuMCwGA1UEAxMlUXVvVmFkaXMgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMTAz
  52965. MTkxODMzMzNaFw0yMTAzMTcxODMzMzNaMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRp
  52966. cyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYDVQQD
  52967. EyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEF
  52968. AAOCAQ8AMIIBCgKCAQEAv2G1lVO6V/z68mcLOhrfEYBklbTRvM16z/Ypli4kVEAkOPcahdxYTMuk
  52969. J0KX0J+DisPkBgNbAKVRHnAEdOLB1Dqr1607BxgFjv2DrOpm2RgbaIr1VxqYuvXtdj182d6UajtL
  52970. F8HVj71lODqV0D1VNk7feVcxKh7YWWVJWCCYfqtffp/p1k3sg3Spx2zY7ilKhSoGFPlU5tPaZQeL
  52971. YzcS19Dsw3sgQUSj7cugF+FxZc4dZjH3dgEZyH0DWLaVSR2mEiboxgx24ONmy+pdpibu5cxfvWen
  52972. AScOospUxbF6lR1xHkopigPcakXBpBlebzbNw6Kwt/5cOOJSvPhEQ+aQuwIDAQABo4ICUjCCAk4w
  52973. PQYIKwYBBQUHAQEEMTAvMC0GCCsGAQUFBzABhiFodHRwczovL29jc3AucXVvdmFkaXNvZmZzaG9y
  52974. ZS5jb20wDwYDVR0TAQH/BAUwAwEB/zCCARoGA1UdIASCAREwggENMIIBCQYJKwYBBAG+WAABMIH7
  52975. MIHUBggrBgEFBQcCAjCBxxqBxFJlbGlhbmNlIG9uIHRoZSBRdW9WYWRpcyBSb290IENlcnRpZmlj
  52976. YXRlIGJ5IGFueSBwYXJ0eSBhc3N1bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJs
  52977. ZSBzdGFuZGFyZCB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGNlcnRpZmljYXRpb24gcHJh
  52978. Y3RpY2VzLCBhbmQgdGhlIFF1b1ZhZGlzIENlcnRpZmljYXRlIFBvbGljeS4wIgYIKwYBBQUHAgEW
  52979. Fmh0dHA6Ly93d3cucXVvdmFkaXMuYm0wHQYDVR0OBBYEFItLbe3TKbkGGew5Oanwl4Rqy+/fMIGu
  52980. BgNVHSMEgaYwgaOAFItLbe3TKbkGGew5Oanwl4Rqy+/foYGEpIGBMH8xCzAJBgNVBAYTAkJNMRkw
  52981. FwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0
  52982. aG9yaXR5MS4wLAYDVQQDEyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggQ6
  52983. tlCLMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAitQUtf70mpKnGdSkfnIYj9lo
  52984. fFIk3WdvOXrEql494liwTXCYhGHoG+NpGA7O+0dQoE7/8CQfvbLO9Sf87C9TqnN7Az10buYWnuul
  52985. LsS/VidQK2K6vkscPFVcQR0kvoIgR13VRH56FmjffU1RcHhXHTMe/QKZnAzNCgVPx7uOpHX6Sm2x
  52986. gI4JVrmcGmD+XcHXetwReNDWXcG31a0ymQM6isxUJTkxgXsTIlG6Rmyhu576BGxJJnSP0nPrzDCi
  52987. 5upZIof4l/UO/erMkqQWxFIY6iHOsfHmhIHluqmGKPJDWl0Snawe2ajlCmqnf6CHKc/yiU3U7MXi
  52988. 5nrQNiOKSnQ2+Q==
  52989. -----END CERTIFICATE-----
  52990. QuoVadis Root CA 2
  52991. ==================
  52992. -----BEGIN CERTIFICATE-----
  52993. MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  52994. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMjAeFw0wNjExMjQx
  52995. ODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  52996. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  52997. DwAwggIKAoICAQCaGMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6
  52998. XJxgFyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55JWpzmM+Yk
  52999. lvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bBrrcCaoF6qUWD4gXmuVbB
  53000. lDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp+ARz8un+XJiM9XOva7R+zdRcAitMOeGy
  53001. lZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt
  53002. 66/3FsvbzSUr5R/7mp/iUcw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1Jdxn
  53003. wQ5hYIizPtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og/zOh
  53004. D7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UHoycR7hYQe7xFSkyy
  53005. BNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuIyV77zGHcizN300QyNQliBJIWENie
  53006. J0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1Ud
  53007. DgQWBBQahGK8SEwzJQTU7tD2A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGU
  53008. a6FJpEcwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT
  53009. ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2fBluornFdLwUv
  53010. Z+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzng/iN/Ae42l9NLmeyhP3ZRPx3
  53011. UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2BlfF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodm
  53012. VjB3pjd4M1IQWK4/YY7yarHvGH5KWWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK
  53013. +JDSV6IZUaUtl0HaB0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrW
  53014. IozchLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPRTUIZ3Ph1
  53015. WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWDmbA4CD/pXvk1B+TJYm5X
  53016. f6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0ZohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II
  53017. 4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8
  53018. VCLAAVBpQ570su9t+Oza8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u
  53019. -----END CERTIFICATE-----
  53020. QuoVadis Root CA 3
  53021. ==================
  53022. -----BEGIN CERTIFICATE-----
  53023. MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  53024. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMzAeFw0wNjExMjQx
  53025. OTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  53026. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  53027. DwAwggIKAoICAQDMV0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNgg
  53028. DhoB4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUrH556VOij
  53029. KTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd8lyyBTNvijbO0BNO/79K
  53030. DDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9CabwvvWhDFlaJKjdhkf2mrk7AyxRllDdLkgbv
  53031. BNDInIjbC3uBr7E9KsRlOni27tyAsdLTmZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwp
  53032. p5ijJUMv7/FfJuGITfhebtfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8
  53033. nT8KKdjcT5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDtWAEX
  53034. MJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZc6tsgLjoC2SToJyM
  53035. Gf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A4iLItLRkT9a6fUg+qGkM17uGcclz
  53036. uD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYDVR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHT
  53037. BgkrBgEEAb5YAAMwgcUwgZMGCCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmlj
  53038. YXRlIGNvbnN0aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0
  53039. aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVudC4wLQYIKwYB
  53040. BQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2NwczALBgNVHQ8EBAMCAQYwHQYD
  53041. VR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4GA1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4
  53042. ywLQoUmkRzBFMQswCQYDVQQGEwJCTTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UE
  53043. AxMSUXVvVmFkaXMgUm9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZV
  53044. qyM07ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSemd1o417+s
  53045. hvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd+LJ2w/w4E6oM3kJpK27z
  53046. POuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2
  53047. Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadNt54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp
  53048. 8kokUvd0/bpO5qgdAm6xDYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBC
  53049. bjPsMZ57k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6szHXu
  53050. g/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0jWy10QJLZYxkNc91p
  53051. vGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeTmJlglFwjz1onl14LBQaTNx47aTbr
  53052. qZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK4SVhM7JZG+Ju1zdXtg2pEto=
  53053. -----END CERTIFICATE-----
  53054. Security Communication Root CA
  53055. ==============================
  53056. -----BEGIN CERTIFICATE-----
  53057. MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  53058. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  53059. HhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  53060. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  53061. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw
  53062. 8yl89f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJDKaVv0uM
  53063. DPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9Ms+k2Y7CI9eNqPPYJayX
  53064. 5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/NQV3Is00qVUarH9oe4kA92819uZKAnDfd
  53065. DJZkndwi92SL32HeFZRSFaB9UslLqCHJxrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2
  53066. JChzAgMBAAGjPzA9MB0GA1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYw
  53067. DwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vGkl3g
  53068. 0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfrUj94nK9NrvjVT8+a
  53069. mCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5Bw+SUEmK3TGXX8npN6o7WWWXlDLJ
  53070. s58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJUJRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ
  53071. 6rBK+1YWc26sTfcioU+tHXotRSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAi
  53072. FL39vmwLAw==
  53073. -----END CERTIFICATE-----
  53074. Sonera Class 2 Root CA
  53075. ======================
  53076. -----BEGIN CERTIFICATE-----
  53077. MIIDIDCCAgigAwIBAgIBHTANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJGSTEPMA0GA1UEChMG
  53078. U29uZXJhMRkwFwYDVQQDExBTb25lcmEgQ2xhc3MyIENBMB4XDTAxMDQwNjA3Mjk0MFoXDTIxMDQw
  53079. NjA3Mjk0MFowOTELMAkGA1UEBhMCRkkxDzANBgNVBAoTBlNvbmVyYTEZMBcGA1UEAxMQU29uZXJh
  53080. IENsYXNzMiBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJAXSjWdyvANlsdE+hY3
  53081. /Ei9vX+ALTU74W+oZ6m/AxxNjG8yR9VBaKQTBME1DJqEQ/xcHf+Js+gXGM2RX/uJ4+q/Tl18GybT
  53082. dXnt5oTjV+WtKcT0OijnpXuENmmz/V52vaMtmdOQTiMofRhj8VQ7Jp12W5dCsv+u8E7s3TmVToMG
  53083. f+dJQMjFAbJUWmYdPfz56TwKnoG4cPABi+QjVHzIrviQHgCWctRUz2EjvOr7nQKV0ba5cTppCD8P
  53084. tOFCx4j1P5iop7oc4HFx71hXgVB6XGt0Rg6DA5jDjqhu8nYybieDwnPz3BjotJPqdURrBGAgcVeH
  53085. nfO+oJAjPYok4doh28MCAwEAAaMzMDEwDwYDVR0TAQH/BAUwAwEB/zARBgNVHQ4ECgQISqCqWITT
  53086. XjwwCwYDVR0PBAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQBazof5FnIVV0sd2ZvnoiYw7JNn39Yt
  53087. 0jSv9zilzqsWuasvfDXLrNAPtEwr/IDva4yRXzZ299uzGxnq9LIR/WFxRL8oszodv7ND6J+/3DEI
  53088. cbCdjdY0RzKQxmUk96BKfARzjzlvF4xytb1LyHr4e4PDKE6cCepnP7JnBBvDFNr450kkkdAdavph
  53089. Oe9r5yF1BgfYErQhIHBCcYHaPJo2vqZbDWpsmh+Re/n570K6Tk6ezAyNlNzZRZxe7EJQY670XcSx
  53090. EtzKO6gunRRaBXW37Ndj4ro1tgQIkejanZz2ZrUYrAqmVCY0M9IbwdR/GjqOC6oybtv8TyWf2TLH
  53091. llpwrN9M
  53092. -----END CERTIFICATE-----
  53093. XRamp Global CA Root
  53094. ====================
  53095. -----BEGIN CERTIFICATE-----
  53096. MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCBgjELMAkGA1UE
  53097. BhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2Vj
  53098. dXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB
  53099. dXRob3JpdHkwHhcNMDQxMTAxMTcxNDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMx
  53100. HjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkg
  53101. U2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3Jp
  53102. dHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS638eMpSe2OAtp87ZOqCwu
  53103. IR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCPKZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMx
  53104. foArtYzAQDsRhtDLooY2YKTVMIJt2W7QDxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FE
  53105. zG+gSqmUsE3a56k0enI4qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqs
  53106. AxcZZPRaJSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNViPvry
  53107. xS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  53108. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASsjVy16bYbMDYGA1UdHwQvMC0wK6Ap
  53109. oCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMC
  53110. AQEwDQYJKoZIhvcNAQEFBQADggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc
  53111. /Kh4ZzXxHfARvbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt
  53112. qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLaIR9NmXmd4c8n
  53113. nxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSyi6mx5O+aGtA9aZnuqCij4Tyz
  53114. 8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQO+7ETPTsJ3xCwnR8gooJybQDJbw=
  53115. -----END CERTIFICATE-----
  53116. Go Daddy Class 2 CA
  53117. ===================
  53118. -----BEGIN CERTIFICATE-----
  53119. MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMY
  53120. VGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRp
  53121. ZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkG
  53122. A1UEBhMCVVMxITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g
  53123. RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQAD
  53124. ggENADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCAPVYYYwhv
  53125. 2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6wwdhFJ2+qN1j3hybX2C32
  53126. qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXiEqITLdiOr18SPaAIBQi2XKVlOARFmR6j
  53127. YGB0xUGlcmIbYsUfb18aQr4CUWWoriMYavx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmY
  53128. vLEHZ6IVDd2gWMZEewo+YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0O
  53129. BBYEFNLEsNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h/t2o
  53130. atTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMu
  53131. MTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwG
  53132. A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wim
  53133. PQoZ+YeAEW5p5JYXMP80kWNyOO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKt
  53134. I3lpjbi2Tc7PTMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ
  53135. HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mERdEr/VxqHD3VI
  53136. Ls9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5CufReYNnyicsbkqWletNw+vHX/b
  53137. vZ8=
  53138. -----END CERTIFICATE-----
  53139. Starfield Class 2 CA
  53140. ====================
  53141. -----BEGIN CERTIFICATE-----
  53142. MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzElMCMGA1UEChMc
  53143. U3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZpZWxkIENsYXNzIDIg
  53144. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQwNjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBo
  53145. MQswCQYDVQQGEwJVUzElMCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAG
  53146. A1UECxMpU3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqG
  53147. SIb3DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf8MOh2tTY
  53148. bitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN+lq2cwQlZut3f+dZxkqZ
  53149. JRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVm
  53150. epsZGD3/cVE8MC5fvj13c7JdBmzDI1aaK4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSN
  53151. F4Azbl5KXZnJHoe0nRrA1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HF
  53152. MIHCMB0GA1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fRzt0f
  53153. hvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNo
  53154. bm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBDbGFzcyAyIENlcnRpZmljYXRpb24g
  53155. QXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGs
  53156. afPzWdqbAYcaT1epoXkJKtv3L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLM
  53157. PUxA2IGvd56Deruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl
  53158. xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynpVSJYACPq4xJD
  53159. KVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEYWQPJIrSPnNVeKtelttQKbfi3
  53160. QBFGmh95DmK/D5fs4C8fF5Q=
  53161. -----END CERTIFICATE-----
  53162. Taiwan GRCA
  53163. ===========
  53164. -----BEGIN CERTIFICATE-----
  53165. MIIFcjCCA1qgAwIBAgIQH51ZWtcvwgZEpYAIaeNe9jANBgkqhkiG9w0BAQUFADA/MQswCQYDVQQG
  53166. EwJUVzEwMC4GA1UECgwnR292ZXJubWVudCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4X
  53167. DTAyMTIwNTEzMjMzM1oXDTMyMTIwNTEzMjMzM1owPzELMAkGA1UEBhMCVFcxMDAuBgNVBAoMJ0dv
  53168. dmVybm1lbnQgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQAD
  53169. ggIPADCCAgoCggIBAJoluOzMonWoe/fOW1mKydGGEghU7Jzy50b2iPN86aXfTEc2pBsBHH8eV4qN
  53170. w8XRIePaJD9IK/ufLqGU5ywck9G/GwGHU5nOp/UKIXZ3/6m3xnOUT0b3EEk3+qhZSV1qgQdW8or5
  53171. BtD3cCJNtLdBuTK4sfCxw5w/cP1T3YGq2GN49thTbqGsaoQkclSGxtKyyhwOeYHWtXBiCAEuTk8O
  53172. 1RGvqa/lmr/czIdtJuTJV6L7lvnM4T9TjGxMfptTCAtsF/tnyMKtsc2AtJfcdgEWFelq16TheEfO
  53173. htX7MfP6Mb40qij7cEwdScevLJ1tZqa2jWR+tSBqnTuBto9AAGdLiYa4zGX+FVPpBMHWXx1E1wov
  53174. J5pGfaENda1UhhXcSTvxls4Pm6Dso3pdvtUqdULle96ltqqvKKyskKw4t9VoNSZ63Pc78/1Fm9G7
  53175. Q3hub/FCVGqY8A2tl+lSXunVanLeavcbYBT0peS2cWeqH+riTcFCQP5nRhc4L0c/cZyu5SHKYS1t
  53176. B6iEfC3uUSXxY5Ce/eFXiGvviiNtsea9P63RPZYLhY3Naye7twWb7LuRqQoHEgKXTiCQ8P8NHuJB
  53177. O9NAOueNXdpm5AKwB1KYXA6OM5zCppX7VRluTI6uSw+9wThNXo+EHWbNxWCWtFJaBYmOlXqYwZE8
  53178. lSOyDvR5tMl8wUohAgMBAAGjajBoMB0GA1UdDgQWBBTMzO/MKWCkO7GStjz6MmKPrCUVOzAMBgNV
  53179. HRMEBTADAQH/MDkGBGcqBwAEMTAvMC0CAQAwCQYFKw4DAhoFADAHBgVnKgMAAAQUA5vwIhP/lSg2
  53180. 09yewDL7MTqKUWUwDQYJKoZIhvcNAQEFBQADggIBAECASvomyc5eMN1PhnR2WPWus4MzeKR6dBcZ
  53181. TulStbngCnRiqmjKeKBMmo4sIy7VahIkv9Ro04rQ2JyftB8M3jh+Vzj8jeJPXgyfqzvS/3WXy6Tj
  53182. Zwj/5cAWtUgBfen5Cv8b5Wppv3ghqMKnI6mGq3ZW6A4M9hPdKmaKZEk9GhiHkASfQlK3T8v+R0F2
  53183. Ne//AHY2RTKbxkaFXeIksB7jSJaYV0eUVXoPQbFEJPPB/hprv4j9wabak2BegUqZIJxIZhm1AHlU
  53184. D7gsL0u8qV1bYH+Mh6XgUmMqvtg7hUAV/h62ZT/FS9p+tXo1KaMuephgIqP0fSdOLeq0dDzpD6Qz
  53185. DxARvBMB1uUO07+1EqLhRSPAzAhuYbeJq4PjJB7mXQfnHyA+z2fI56wwbSdLaG5LKlwCCDTb+Hbk
  53186. Z6MmnD+iMsJKxYEYMRBWqoTvLQr/uB930r+lWKBi5NdLkXWNiYCYfm3LU05er/ayl4WXudpVBrkk
  53187. 7tfGOB5jGxI7leFYrPLfhNVfmS8NVVvmONsuP3LpSIXLuykTjx44VbnzssQwmSNOXfJIoRIM3BKQ
  53188. CZBUkQM8R+XVyWXgt0t97EfTsws+rZ7QdAAO671RrcDeLMDDav7v3Aun+kbfYNucpllQdSNpc5Oy
  53189. +fwC00fmcc4QAu4njIT/rEUNE1yDMuAlpYYsfPQS
  53190. -----END CERTIFICATE-----
  53191. DigiCert Assured ID Root CA
  53192. ===========================
  53193. -----BEGIN CERTIFICATE-----
  53194. MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQG
  53195. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  53196. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzEx
  53197. MTEwMDAwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  53198. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0Ew
  53199. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7cJpSIqvTO
  53200. 9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYPmDI2dsze3Tyoou9q+yHy
  53201. UmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW
  53202. /lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpy
  53203. oeb6pNnVFzF1roV9Iq4/AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whf
  53204. GHdPAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRF
  53205. 66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYunpyGd823IDzANBgkq
  53206. hkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRCdWKuh+vy1dneVrOfzM4UKLkNl2Bc
  53207. EkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTffwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38Fn
  53208. SbNd67IJKusm7Xi+fT8r87cmNW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i
  53209. 8b5QZ7dsvfPxH2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe
  53210. +o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g==
  53211. -----END CERTIFICATE-----
  53212. DigiCert Global Root CA
  53213. =======================
  53214. -----BEGIN CERTIFICATE-----
  53215. MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBhMQswCQYDVQQG
  53216. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  53217. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBDQTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAw
  53218. MDAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  53219. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkq
  53220. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsBCSDMAZOn
  53221. TjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97nh6Vfe63SKMI2tavegw5
  53222. BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt43C/dxC//AH2hdmoRBBYMql1GNXRor5H
  53223. 4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7PT19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y
  53224. 7vrTC0LUq7dBMtoM1O/4gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQAB
  53225. o2MwYTAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbRTLtm
  53226. 8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUwDQYJKoZIhvcNAQEF
  53227. BQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/EsrhMAtudXH/vTBH1jLuG2cenTnmCmr
  53228. EbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIt
  53229. tep3Sp+dWOIrWcBAI+0tKIJFPnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886
  53230. UAb3LujEV0lsYSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
  53231. CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
  53232. -----END CERTIFICATE-----
  53233. DigiCert High Assurance EV Root CA
  53234. ==================================
  53235. -----BEGIN CERTIFICATE-----
  53236. MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBsMQswCQYDVQQG
  53237. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSsw
  53238. KQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5jZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAw
  53239. MFoXDTMxMTExMDAwMDAwMFowbDELMAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZ
  53240. MBcGA1UECxMQd3d3LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFu
  53241. Y2UgRVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm+9S75S0t
  53242. Mqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTWPNt0OKRKzE0lgvdKpVMS
  53243. OO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEMxChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3
  53244. MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFBIk5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQ
  53245. NAQTXKFx01p8VdteZOE3hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUe
  53246. h10aUAsgEsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMB
  53247. Af8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaAFLE+w2kD+L9HAdSY
  53248. JhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3NecnzyIZgYIVyHbIUf4KmeqvxgydkAQ
  53249. V8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6zeM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFp
  53250. myPInngiK3BD41VHMWEZ71jFhS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkK
  53251. mNEVX58Svnw2Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
  53252. vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep+OkuE6N36B9K
  53253. -----END CERTIFICATE-----
  53254. Certplus Class 2 Primary CA
  53255. ===========================
  53256. -----BEGIN CERTIFICATE-----
  53257. MIIDkjCCAnqgAwIBAgIRAIW9S/PY2uNp9pTXX8OlRCMwDQYJKoZIhvcNAQEFBQAwPTELMAkGA1UE
  53258. BhMCRlIxETAPBgNVBAoTCENlcnRwbHVzMRswGQYDVQQDExJDbGFzcyAyIFByaW1hcnkgQ0EwHhcN
  53259. OTkwNzA3MTcwNTAwWhcNMTkwNzA2MjM1OTU5WjA9MQswCQYDVQQGEwJGUjERMA8GA1UEChMIQ2Vy
  53260. dHBsdXMxGzAZBgNVBAMTEkNsYXNzIDIgUHJpbWFyeSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEP
  53261. ADCCAQoCggEBANxQltAS+DXSCHh6tlJw/W/uz7kRy1134ezpfgSN1sxvc0NXYKwzCkTsA18cgCSR
  53262. 5aiRVhKC9+Ar9NuuYS6JEI1rbLqzAr3VNsVINyPi8Fo3UjMXEuLRYE2+L0ER4/YXJQyLkcAbmXuZ
  53263. Vg2v7tK8R1fjeUl7NIknJITesezpWE7+Tt9avkGtrAjFGA7v0lPubNCdEgETjdyAYveVqUSISnFO
  53264. YFWe2yMZeVYHDD9jC1yw4r5+FfyUM1hBOHTE4Y+L3yasH7WLO7dDWWuwJKZtkIvEcupdM5i3y95e
  53265. e++U8Rs+yskhwcWYAqqi9lt3m/V+llU0HGdpwPFC40es/CgcZlUCAwEAAaOBjDCBiTAPBgNVHRME
  53266. CDAGAQH/AgEKMAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQU43Mt38sOKAze3bOkynm4jrvoMIkwEQYJ
  53267. YIZIAYb4QgEBBAQDAgEGMDcGA1UdHwQwMC4wLKAqoCiGJmh0dHA6Ly93d3cuY2VydHBsdXMuY29t
  53268. L0NSTC9jbGFzczIuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQCnVM+IRBnL39R/AN9WM2K191EBkOvD
  53269. P9GIROkkXe/nFL0gt5o8AP5tn9uQ3Nf0YtaLcF3n5QRIqWh8yfFC82x/xXp8HVGIutIKPidd3i1R
  53270. TtMTZGnkLuPT55sJmabglZvOGtd/vjzOUrMRFcEPF80Du5wlFbqidon8BvEY0JNLDnyCt6X09l/+
  53271. 7UCmnYR0ObncHoUW2ikbhiMAybuJfm6AiB4vFLQDJKgybwOaRywwvlbGp0ICcBvqQNi6BQNwB6SW
  53272. //1IMwrh3KWBkJtN3X3n57LNXMhqlfil9o3EXXgIvnsG1knPGTZQIy4I5p4FTUcY1Rbpsda2ENW7
  53273. l7+ijrRU
  53274. -----END CERTIFICATE-----
  53275. DST Root CA X3
  53276. ==============
  53277. -----BEGIN CERTIFICATE-----
  53278. MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/MSQwIgYDVQQK
  53279. ExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMTDkRTVCBSb290IENBIFgzMB4X
  53280. DTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVowPzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1
  53281. cmUgVHJ1c3QgQ28uMRcwFQYDVQQDEw5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQAD
  53282. ggEPADCCAQoCggEBAN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmT
  53283. rE4Orz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEqOLl5CjH9
  53284. UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9bxiqKqy69cK3FCxolkHRy
  53285. xXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40d
  53286. utolucbY38EVAjqr2m7xPi71XAicPNaDaeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0T
  53287. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQ
  53288. MA0GCSqGSIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69ikug
  53289. dB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXrAvHRAosZy5Q6XkjE
  53290. GB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZzR8srzJmwN0jP41ZL9c8PDHIyh8bw
  53291. RLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubS
  53292. fZGL+T0yjWW06XyxV3bqxbYoOb8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ
  53293. -----END CERTIFICATE-----
  53294. SwissSign Gold CA - G2
  53295. ======================
  53296. -----BEGIN CERTIFICATE-----
  53297. MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNVBAYTAkNIMRUw
  53298. EwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2lnbiBHb2xkIENBIC0gRzIwHhcN
  53299. MDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBFMQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dp
  53300. c3NTaWduIEFHMR8wHQYDVQQDExZTd2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0B
  53301. AQEFAAOCAg8AMIICCgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUq
  53302. t2/876LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+bbqBHH5C
  53303. jCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c6bM8K8vzARO/Ws/BtQpg
  53304. vd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqEemA8atufK+ze3gE/bk3lUIbLtK/tREDF
  53305. ylqM2tIrfKjuvqblCqoOpd8FUrdVxyJdMmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvR
  53306. AiTysybUa9oEVeXBCsdtMDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuend
  53307. jIj3o02yMszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69yFGkO
  53308. peUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPiaG59je883WX0XaxR
  53309. 7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxMgI93e2CaHt+28kgeDrpOVG2Y4OGi
  53310. GqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUw
  53311. AwEB/zAdBgNVHQ4EFgQUWyV7lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64
  53312. OfPAeGZe6Drn8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov
  53313. L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe645R88a7A3hfm
  53314. 5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczOUYrHUDFu4Up+GC9pWbY9ZIEr
  53315. 44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOf
  53316. Mke6UiI0HTJ6CVanfCU2qT1L2sCCbwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6m
  53317. Gu6uLftIdxf+u+yvGPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxp
  53318. mo/a77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCChdiDyyJk
  53319. vC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid392qgQmwLOM7XdVAyksLf
  53320. KzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEppLd6leNcG2mqeSz53OiATIgHQv2ieY2Br
  53321. NU0LbbqhPcCT4H8js1WtciVORvnSFu+wZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6Lqj
  53322. viOvrv1vA+ACOzB2+httQc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ
  53323. -----END CERTIFICATE-----
  53324. SwissSign Silver CA - G2
  53325. ========================
  53326. -----BEGIN CERTIFICATE-----
  53327. MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCQ0gxFTAT
  53328. BgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMB4X
  53329. DTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0NlowRzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3
  53330. aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG
  53331. 9w0BAQEFAAOCAg8AMIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644
  53332. N0MvFz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7brYT7QbNHm
  53333. +/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieFnbAVlDLaYQ1HTWBCrpJH
  53334. 6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH6ATK72oxh9TAtvmUcXtnZLi2kUpCe2Uu
  53335. MGoM9ZDulebyzYLs2aFK7PayS+VFheZteJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5h
  53336. qAaEuSh6XzjZG6k4sIN/c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5
  53337. FZGkECwJMoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRHHTBs
  53338. ROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTfjNFusB3hB48IHpmc
  53339. celM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb65i/4z3GcRm25xBWNOHkDRUjvxF3X
  53340. CO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/
  53341. BAUwAwEB/zAdBgNVHQ4EFgQUF6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRB
  53342. tjpbO8tFnb0cwpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0
  53343. cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBAHPGgeAn0i0P
  53344. 4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShpWJHckRE1qTodvBqlYJ7YH39F
  53345. kWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L
  53346. 3XWgwF15kIwb4FDm3jH+mHtwX6WQ2K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx
  53347. /uNncqCxv1yL5PqZIseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFa
  53348. DGi8aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2Xem1ZqSqP
  53349. e97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQRdAtq/gsD/KNVV4n+Ssuu
  53350. WxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJ
  53351. DIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ub
  53352. DgEj8Z+7fNzcbBGXJbLytGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u
  53353. -----END CERTIFICATE-----
  53354. GeoTrust Primary Certification Authority
  53355. ========================================
  53356. -----BEGIN CERTIFICATE-----
  53357. MIIDfDCCAmSgAwIBAgIQGKy1av1pthU6Y2yv2vrEoTANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQG
  53358. EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjExMC8GA1UEAxMoR2VvVHJ1c3QgUHJpbWFyeSBD
  53359. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjExMjcwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMFgx
  53360. CzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTEwLwYDVQQDEyhHZW9UcnVzdCBQ
  53361. cmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  53362. CgKCAQEAvrgVe//UfH1nrYNke8hCUy3f9oQIIGHWAVlqnEQRr+92/ZV+zmEwu3qDXwK9AWbK7hWN
  53363. b6EwnL2hhZ6UOvNWiAAxz9juapYC2e0DjPt1befquFUWBRaa9OBesYjAZIVcFU2Ix7e64HXprQU9
  53364. nceJSOC7KMgD4TCTZF5SwFlwIjVXiIrxlQqD17wxcwE07e9GceBrAqg1cmuXm2bgyxx5X9gaBGge
  53365. RwLmnWDiNpcB3841kt++Z8dtd1k7j53WkBWUvEI0EME5+bEnPn7WinXFsq+W06Lem+SYvn3h6YGt
  53366. tm/81w7a4DSwDRp35+MImO9Y+pyEtzavwt+s0vQQBnBxNQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  53367. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQULNVQQZcVi/CPNmFbSvtr2ZnJM5IwDQYJKoZI
  53368. hvcNAQEFBQADggEBAFpwfyzdtzRP9YZRqSa+S7iq8XEN3GHHoOo0Hnp3DwQ16CePbJC/kRYkRj5K
  53369. Ts4rFtULUh38H2eiAkUxT87z+gOneZ1TatnaYzr4gNfTmeGl4b7UVXGYNTq+k+qurUKykG/g/CFN
  53370. NWMziUnWm07Kx+dOCQD32sfvmWKZd7aVIl6KoKv0uHiYyjgZmclynnjNS6yvGaBzEi38wkG6gZHa
  53371. Floxt/m0cYASSJlyc1pZU8FjUjPtp8nSOQJw+uCxQmYpqptR7TBUIhRf2asdweSU8Pj1K/fqynhG
  53372. 1riR/aYNKxoUAT6A8EKglQdebc3MS6RFjasS6LPeWuWgfOgPIh1a6Vk=
  53373. -----END CERTIFICATE-----
  53374. thawte Primary Root CA
  53375. ======================
  53376. -----BEGIN CERTIFICATE-----
  53377. MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCBqTELMAkGA1UE
  53378. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  53379. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  53380. cml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMDYxMTE3
  53381. MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCBqTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwg
  53382. SW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMv
  53383. KGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMT
  53384. FnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCs
  53385. oPD7gFnUnMekz52hWXMJEEUMDSxuaPFsW0hoSVk3/AszGcJ3f8wQLZU0HObrTQmnHNK4yZc2AreJ
  53386. 1CRfBsDMRJSUjQJib+ta3RGNKJpchJAQeg29dGYvajig4tVUROsdB58Hum/u6f1OCyn1PoSgAfGc
  53387. q/gcfomk6KHYcWUNo1F77rzSImANuVud37r8UVsLr5iy6S7pBOhih94ryNdOwUxkHt3Ph1i6Sk/K
  53388. aAcdHJ1KxtUvkcx8cXIcxcBn6zL9yZJclNqFwJu/U30rCfSMnZEfl2pSy94JNqR32HuHUETVPm4p
  53389. afs5SSYeCaWAe0At6+gnhcn+Yf1+5nyXHdWdAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYD
  53390. VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR7W0XPr87Lev0xkhpqtvNG61dIUDANBgkqhkiG9w0BAQUF
  53391. AAOCAQEAeRHAS7ORtvzw6WfUDW5FvlXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeE
  53392. uzLlQRHAd9mzYJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQaEfZYGDm/Ac9IiAX
  53393. xPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqdE8hhuvU5HIe6uL17In/2/qxAeeWsEG89
  53394. jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/LHbTY5xZ3Y+m4Q6gLkH3LpVH
  53395. z7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7jVaMaA==
  53396. -----END CERTIFICATE-----
  53397. VeriSign Class 3 Public Primary Certification Authority - G5
  53398. ============================================================
  53399. -----BEGIN CERTIFICATE-----
  53400. MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE
  53401. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  53402. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  53403. IHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRp
  53404. ZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCB
  53405. yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2ln
  53406. biBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBh
  53407. dXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmlt
  53408. YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
  53409. ggEKAoIBAQCvJAgIKXo1nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKz
  53410. j/i5Vbext0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIzSdhD
  53411. Y2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQGBO+QueQA5N06tRn/
  53412. Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+rCpSx4/VBEnkjWNHiDxpg8v+R70r
  53413. fk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/
  53414. BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2Uv
  53415. Z2lmMCEwHzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy
  53416. aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKvMzEzMA0GCSqG
  53417. SIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzEp6B4Eq1iDkVwZMXnl2YtmAl+
  53418. X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y5gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKE
  53419. KQsTb47bDN0lAtukixlE0kF6BWlKWE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiC
  53420. Km0oHw0LxOXnGiYZ4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vE
  53421. ZV8NhnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq
  53422. -----END CERTIFICATE-----
  53423. SecureTrust CA
  53424. ==============
  53425. -----BEGIN CERTIFICATE-----
  53426. MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBIMQswCQYDVQQG
  53427. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xFzAVBgNVBAMTDlNlY3VyZVRy
  53428. dXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIzMTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAe
  53429. BgNVBAoTF1NlY3VyZVRydXN0IENvcnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCC
  53430. ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQX
  53431. OZEzZum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO0gMdA+9t
  53432. DWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIaowW8xQmxSPmjL8xk037uH
  53433. GFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b
  53434. 01k/unK8RCSc43Oz969XL0Imnal0ugBS8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmH
  53435. ursCAwEAAaOBnTCBmjATBgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/
  53436. BAUwAwEB/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCegJYYj
  53437. aHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  53438. KoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt36Z3q059c4EVlew3KW+JwULKUBRSu
  53439. SceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHf
  53440. mbx8IVQr5Fiiu1cprp6poxkmD5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZ
  53441. nMUFdAvnZyPSCPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR
  53442. 3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE=
  53443. -----END CERTIFICATE-----
  53444. Secure Global CA
  53445. ================
  53446. -----BEGIN CERTIFICATE-----
  53447. MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQG
  53448. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBH
  53449. bG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkxMjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEg
  53450. MB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwg
  53451. Q0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jx
  53452. YDiJiQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa/FHtaMbQ
  53453. bqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJjnIFHovdRIWCQtBJwB1g
  53454. 8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnIHmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYV
  53455. HDGA76oYa8J719rO+TMg1fW9ajMtgQT7sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi
  53456. 0XPnj3pDAgMBAAGjgZ0wgZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  53457. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCswKaAn
  53458. oCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsGAQQBgjcVAQQDAgEA
  53459. MA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0LURYD7xh8yOOvaliTFGCRsoTciE6+
  53460. OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXOH0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cn
  53461. CDpOGR86p1hcF895P4vkp9MmI50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/5
  53462. 3CYNv6ZHdAbYiNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc
  53463. f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW
  53464. -----END CERTIFICATE-----
  53465. COMODO Certification Authority
  53466. ==============================
  53467. -----BEGIN CERTIFICATE-----
  53468. MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCBgTELMAkGA1UE
  53469. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  53470. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNVBAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1
  53471. dGhvcml0eTAeFw0wNjEyMDEwMDAwMDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEb
  53472. MBkGA1UECBMSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFD
  53473. T01PRE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  53474. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3UcEbVASY06m/weaKXTuH
  53475. +7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI2GqGd0S7WWaXUF601CxwRM/aN5VCaTww
  53476. xHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV
  53477. 4EajcNxo2f8ESIl33rXp+2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA
  53478. 1KGzqSX+DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5OnKVI
  53479. rLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW/zAOBgNVHQ8BAf8E
  53480. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6gPKA6hjhodHRwOi8vY3JsLmNvbW9k
  53481. b2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOC
  53482. AQEAPpiem/Yb6dc5t3iuHXIYSdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CP
  53483. OGEIqB6BCsAvIC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/
  53484. RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4zJVSk/BwJVmc
  53485. IGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5ddBA6+C4OmF4O5MBKgxTMVBbkN
  53486. +8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IBZQ==
  53487. -----END CERTIFICATE-----
  53488. Network Solutions Certificate Authority
  53489. =======================================
  53490. -----BEGIN CERTIFICATE-----
  53491. MIID5jCCAs6gAwIBAgIQV8szb8JcFuZHFhfjkDFo4DANBgkqhkiG9w0BAQUFADBiMQswCQYDVQQG
  53492. EwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMuMTAwLgYDVQQDEydOZXR3b3Jr
  53493. IFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDYxMjAxMDAwMDAwWhcNMjkxMjMx
  53494. MjM1OTU5WjBiMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMu
  53495. MTAwLgYDVQQDEydOZXR3b3JrIFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G
  53496. CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDkvH6SMG3G2I4rC7xGzuAnlt7e+foS0zwzc7MEL7xx
  53497. jOWftiJgPl9dzgn/ggwbmlFQGiaJ3dVhXRncEg8tCqJDXRfQNJIg6nPPOCwGJgl6cvf6UDL4wpPT
  53498. aaIjzkGxzOTVHzbRijr4jGPiFFlp7Q3Tf2vouAPlT2rlmGNpSAW+Lv8ztumXWWn4Zxmuk2GWRBXT
  53499. crA/vGp97Eh/jcOrqnErU2lBUzS1sLnFBgrEsEX1QV1uiUV7PTsmjHTC5dLRfbIR1PtYMiKagMnc
  53500. /Qzpf14Dl847ABSHJ3A4qY5usyd2mFHgBeMhqxrVhSI8KbWaFsWAqPS7azCPL0YCorEMIuDTAgMB
  53501. AAGjgZcwgZQwHQYDVR0OBBYEFCEwyfsA106Y2oeqKtCnLrFAMadMMA4GA1UdDwEB/wQEAwIBBjAP
  53502. BgNVHRMBAf8EBTADAQH/MFIGA1UdHwRLMEkwR6BFoEOGQWh0dHA6Ly9jcmwubmV0c29sc3NsLmNv
  53503. bS9OZXR3b3JrU29sdXRpb25zQ2VydGlmaWNhdGVBdXRob3JpdHkuY3JsMA0GCSqGSIb3DQEBBQUA
  53504. A4IBAQC7rkvnt1frf6ott3NHhWrB5KUd5Oc86fRZZXe1eltajSU24HqXLjjAV2CDmAaDn7l2em5Q
  53505. 4LqILPxFzBiwmZVRDuwduIj/h1AcgsLj4DKAv6ALR8jDMe+ZZzKATxcheQxpXN5eNK4CtSbqUN9/
  53506. GGUsyfJj4akH/nxxH2szJGoeBfcFaMBqEssuXmHLrijTfsK0ZpEmXzwuJF/LWA/rKOyvEZbz3Htv
  53507. wKeI8lN3s2Berq4o2jUsbzRF0ybh3uxbTydrFny9RAQYgrOJeRcQcT16ohZO9QHNpGxlaKFJdlxD
  53508. ydi8NmdspZS11My5vWo1ViHe2MPr+8ukYEywVaCge1ey
  53509. -----END CERTIFICATE-----
  53510. COMODO ECC Certification Authority
  53511. ==================================
  53512. -----BEGIN CERTIFICATE-----
  53513. MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTELMAkGA1UEBhMC
  53514. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  53515. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBB
  53516. dXRob3JpdHkwHhcNMDgwMzA2MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0Ix
  53517. GzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR
  53518. Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRo
  53519. b3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSRFtSrYpn1PlILBs5BAH+X
  53520. 4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0JcfRK9ChQtP6IHG4/bC8vCVlbpVsLM5ni
  53521. wz2J+Wos77LTBumjQjBAMB0GA1UdDgQWBBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8E
  53522. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VG
  53523. FAkK+qDmfQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdvGDeA
  53524. U/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY=
  53525. -----END CERTIFICATE-----
  53526. OISTE WISeKey Global Root GA CA
  53527. ===============================
  53528. -----BEGIN CERTIFICATE-----
  53529. MIID8TCCAtmgAwIBAgIQQT1yx/RrH4FDffHSKFTfmjANBgkqhkiG9w0BAQUFADCBijELMAkGA1UE
  53530. BhMCQ0gxEDAOBgNVBAoTB1dJU2VLZXkxGzAZBgNVBAsTEkNvcHlyaWdodCAoYykgMjAwNTEiMCAG
  53531. A1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBH
  53532. bG9iYWwgUm9vdCBHQSBDQTAeFw0wNTEyMTExNjAzNDRaFw0zNzEyMTExNjA5NTFaMIGKMQswCQYD
  53533. VQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEbMBkGA1UECxMSQ29weXJpZ2h0IChjKSAyMDA1MSIw
  53534. IAYDVQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5
  53535. IEdsb2JhbCBSb290IEdBIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy0+zAJs9
  53536. Nt350UlqaxBJH+zYK7LG+DKBKUOVTJoZIyEVRd7jyBxRVVuuk+g3/ytr6dTqvirdqFEr12bDYVxg
  53537. Asj1znJ7O7jyTmUIms2kahnBAbtzptf2w93NvKSLtZlhuAGio9RN1AU9ka34tAhxZK9w8RxrfvbD
  53538. d50kc3vkDIzh2TbhmYsFmQvtRTEJysIA2/dyoJaqlYfQjse2YXMNdmaM3Bu0Y6Kff5MTMPGhJ9vZ
  53539. /yxViJGg4E8HsChWjBgbl0SOid3gF27nKu+POQoxhILYQBRJLnpB5Kf+42TMwVlxSywhp1t94B3R
  53540. LoGbw9ho972WG6xwsRYUC9tguSYBBQIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw
  53541. AwEB/zAdBgNVHQ4EFgQUswN+rja8sHnR3JQmthG+IbJphpQwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  53542. KoZIhvcNAQEFBQADggEBAEuh/wuHbrP5wUOxSPMowB0uyQlB+pQAHKSkq0lPjz0e701vvbyk9vIm
  53543. MMkQyh2I+3QZH4VFvbBsUfk2ftv1TDI6QU9bR8/oCy22xBmddMVHxjtqD6wU2zz0c5ypBd8A3HR4
  53544. +vg1YFkCExh8vPtNsCBtQ7tgMHpnM1zFmdH4LTlSc/uMqpclXHLZCB6rTjzjgTGfA6b7wP4piFXa
  53545. hNVQA7bihKOmNqoROgHhGEvWRGizPflTdISzRpFGlgC3gCy24eMQ4tui5yiPAZZiFj4A4xylNoEY
  53546. okxSdsARo27mHbrjWr42U8U+dY+GaSlYU7Wcu2+fXMUY7N0v4ZjJ/L7fCg0=
  53547. -----END CERTIFICATE-----
  53548. Certigna
  53549. ========
  53550. -----BEGIN CERTIFICATE-----
  53551. MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNVBAYTAkZSMRIw
  53552. EAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4XDTA3MDYyOTE1MTMwNVoXDTI3
  53553. MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwI
  53554. Q2VydGlnbmEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7q
  53555. XOEm7RFHYeGifBZ4QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyH
  53556. GxnygQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbwzBfsV1/p
  53557. ogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q130yGLMLLGq/jj8UEYkg
  53558. DncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKf
  53559. Irjxwo1p3Po6WAbfAgMBAAGjgbwwgbkwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQ
  53560. tCRZvgHyUtVF9lo53BEwZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJ
  53561. BgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzjAQ/J
  53562. SP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG9w0BAQUFAAOCAQEA
  53563. hQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8hbV6lUmPOEvjvKtpv6zf+EwLHyzs+
  53564. ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFncfca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1klu
  53565. PBS1xp81HlDQwY9qcEQCYsuuHWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY
  53566. 1gkIl2PlwS6wt0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw
  53567. WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg==
  53568. -----END CERTIFICATE-----
  53569. Deutsche Telekom Root CA 2
  53570. ==========================
  53571. -----BEGIN CERTIFICATE-----
  53572. MIIDnzCCAoegAwIBAgIBJjANBgkqhkiG9w0BAQUFADBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMT
  53573. RGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0GA1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEG
  53574. A1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBSb290IENBIDIwHhcNOTkwNzA5MTIxMTAwWhcNMTkwNzA5
  53575. MjM1OTAwWjBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMTRGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0G
  53576. A1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEGA1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBS
  53577. b290IENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCrC6M14IspFLEUha88EOQ5
  53578. bzVdSq7d6mGNlUn0b2SjGmBmpKlAIoTZ1KXleJMOaAGtuU1cOs7TuKhCQN/Po7qCWWqSG6wcmtoI
  53579. KyUn+WkjR/Hg6yx6m/UTAtB+NHzCnjwAWav12gz1MjwrrFDa1sPeg5TKqAyZMg4ISFZbavva4VhY
  53580. AUlfckE8FQYBjl2tqriTtM2e66foai1SNNs671x1Udrb8zH57nGYMsRUFUQM+ZtV7a3fGAigo4aK
  53581. Se5TBY8ZTNXeWHmb0mocQqvF1afPaA+W5OFhmHZhyJF81j4A4pFQh+GdCuatl9Idxjp9y7zaAzTV
  53582. jlsB9WoHtxa2bkp/AgMBAAGjQjBAMB0GA1UdDgQWBBQxw3kbuvVT1xfgiXotF2wKsyudMzAPBgNV
  53583. HRMECDAGAQH/AgEFMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAlGRZrTlk5ynr
  53584. E/5aw4sTV8gEJPB0d8Bg42f76Ymmg7+Wgnxu1MM9756AbrsptJh6sTtU6zkXR34ajgv8HzFZMQSy
  53585. zhfzLMdiNlXiItiJVbSYSKpk+tYcNthEeFpaIzpXl/V6ME+un2pMSyuOoAPjPuCp1NJ70rOo4nI8
  53586. rZ7/gFnkm0W09juwzTkZmDLl6iFhkOQxIY40sfcvNUqFENrnijchvllj4PKFiDFT1FQUhXB59C4G
  53587. dyd1Lx+4ivn+xbrYNuSD7Odlt79jWvNGr4GUN9RBjNYj1h7P9WgbRGOiWrqnNVmh5XAFmw4jV5mU
  53588. Cm26OWMohpLzGITY+9HPBVZkVw==
  53589. -----END CERTIFICATE-----
  53590. Cybertrust Global Root
  53591. ======================
  53592. -----BEGIN CERTIFICATE-----
  53593. MIIDoTCCAomgAwIBAgILBAAAAAABD4WqLUgwDQYJKoZIhvcNAQEFBQAwOzEYMBYGA1UEChMPQ3li
  53594. ZXJ0cnVzdCwgSW5jMR8wHQYDVQQDExZDeWJlcnRydXN0IEdsb2JhbCBSb290MB4XDTA2MTIxNTA4
  53595. MDAwMFoXDTIxMTIxNTA4MDAwMFowOzEYMBYGA1UEChMPQ3liZXJ0cnVzdCwgSW5jMR8wHQYDVQQD
  53596. ExZDeWJlcnRydXN0IEdsb2JhbCBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
  53597. +Mi8vRRQZhP/8NN57CPytxrHjoXxEnOmGaoQ25yiZXRadz5RfVb23CO21O1fWLE3TdVJDm71aofW
  53598. 0ozSJ8bi/zafmGWgE07GKmSb1ZASzxQG9Dvj1Ci+6A74q05IlG2OlTEQXO2iLb3VOm2yHLtgwEZL
  53599. AfVJrn5GitB0jaEMAs7u/OePuGtm839EAL9mJRQr3RAwHQeWP032a7iPt3sMpTjr3kfb1V05/Iin
  53600. 89cqdPHoWqI7n1C6poxFNcJQZZXcY4Lv3b93TZxiyWNzFtApD0mpSPCzqrdsxacwOUBdrsTiXSZT
  53601. 8M4cIwhhqJQZugRiQOwfOHB3EgZxpzAYXSUnpQIDAQABo4GlMIGiMA4GA1UdDwEB/wQEAwIBBjAP
  53602. BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBS2CHsNesysIEyGVjJez6tuhS1wVzA/BgNVHR8EODA2
  53603. MDSgMqAwhi5odHRwOi8vd3d3Mi5wdWJsaWMtdHJ1c3QuY29tL2NybC9jdC9jdHJvb3QuY3JsMB8G
  53604. A1UdIwQYMBaAFLYIew16zKwgTIZWMl7Pq26FLXBXMA0GCSqGSIb3DQEBBQUAA4IBAQBW7wojoFRO
  53605. lZfJ+InaRcHUowAl9B8Tq7ejhVhpwjCt2BWKLePJzYFa+HMjWqd8BfP9IjsO0QbE2zZMcwSO5bAi
  53606. 5MXzLqXZI+O4Tkogp24CJJ8iYGd7ix1yCcUxXOl5n4BHPa2hCwcUPUf/A2kaDAtE52Mlp3+yybh2
  53607. hO0j9n0Hq0V+09+zv+mKts2oomcrUtW3ZfA5TGOgkXmTUg9U3YO7n9GPp1Nzw8v/MOx8BLjYRB+T
  53608. X3EJIrduPuocA06dGiBh+4E37F78CkWr1+cXVdCg6mCbpvbjjFspwgZgFJ0tl0ypkxWdYcQBX0jW
  53609. WL1WMRJOEcgh4LMRkWXbtKaIOM5V
  53610. -----END CERTIFICATE-----
  53611. ePKI Root Certification Authority
  53612. =================================
  53613. -----BEGIN CERTIFICATE-----
  53614. MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBeMQswCQYDVQQG
  53615. EwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0ZC4xKjAoBgNVBAsMIWVQS0kg
  53616. Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMx
  53617. MjdaMF4xCzAJBgNVBAYTAlRXMSMwIQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEq
  53618. MCgGA1UECwwhZVBLSSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0B
  53619. AQEFAAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAHSyZbCUNs
  53620. IZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAhijHyl3SJCRImHJ7K2RKi
  53621. lTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3XDZoTM1PRYfl61dd4s5oz9wCGzh1NlDiv
  53622. qOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX
  53623. 12ruOzjjK9SXDrkb5wdJfzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0O
  53624. WQqraffAsgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uUWH1+
  53625. ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLSnT0IFaUQAS2zMnao
  53626. lQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pHdmX2Os+PYhcZewoozRrSgx4hxyy/
  53627. vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJipNiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXi
  53628. Zo1jDiVN1Rmy5nk3pyKdVDECAwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/Qkqi
  53629. MAwGA1UdEwQFMAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH
  53630. ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGBuvl2ICO1J2B0
  53631. 1GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6YlPwZpVnPDimZI+ymBV3QGypzq
  53632. KOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkPJXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdV
  53633. xrsStZf0X4OFunHB2WyBEXYKCrC/gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEP
  53634. NXubrjlpC2JgQCA2j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+r
  53635. GNm65ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUBo2M3IUxE
  53636. xJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS/jQ6fbjpKdx2qcgw+BRx
  53637. gMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2zGp1iro2C6pSe3VkQw63d4k3jMdXH7Ojy
  53638. sP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTEW9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmOD
  53639. BCEIZ43ygknQW/2xzQ+DhNQ+IIX3Sj0rnP0qCglN6oH4EZw=
  53640. -----END CERTIFICATE-----
  53641. certSIGN ROOT CA
  53642. ================
  53643. -----BEGIN CERTIFICATE-----
  53644. MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYTAlJPMREwDwYD
  53645. VQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTAeFw0wNjA3MDQxNzIwMDRa
  53646. Fw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UE
  53647. CxMQY2VydFNJR04gUk9PVCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7I
  53648. JUqOtdu0KBuqV5Do0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHH
  53649. rfAQUySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5dRdY4zTW2
  53650. ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQOA7+j0xbm0bqQfWwCHTD
  53651. 0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwvJoIQ4uNllAoEwF73XVv4EOLQunpL+943
  53652. AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B
  53653. Af8EBAMCAcYwHQYDVR0OBBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IB
  53654. AQA+0hyJLjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecYMnQ8
  53655. SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ44gx+FkagQnIl6Z0
  53656. x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6IJd1hJyMctTEHBDa0GpC9oHRxUIlt
  53657. vBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNwi/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7Nz
  53658. TogVZ96edhBiIL5VaZVDADlN9u6wWk5JRFRYX0KD
  53659. -----END CERTIFICATE-----
  53660. GeoTrust Primary Certification Authority - G3
  53661. =============================================
  53662. -----BEGIN CERTIFICATE-----
  53663. MIID/jCCAuagAwIBAgIQFaxulBmyeUtB9iepwxgPHzANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UE
  53664. BhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA4IEdlb1RydXN0
  53665. IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFy
  53666. eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEczMB4XDTA4MDQwMjAwMDAwMFoXDTM3MTIwMTIz
  53667. NTk1OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAo
  53668. YykgMjAwOCBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMT
  53669. LUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZI
  53670. hvcNAQEBBQADggEPADCCAQoCggEBANziXmJYHTNXOTIz+uvLh4yn1ErdBojqZI4xmKU4kB6Yzy5j
  53671. K/BGvESyiaHAKAxJcCGVn2TAppMSAmUmhsalifD614SgcK9PGpc/BkTVyetyEH3kMSj7HGHmKAdE
  53672. c5IiaacDiGydY8hS2pgn5whMcD60yRLBxWeDXTPzAxHsatBT4tG6NmCUgLthY2xbF37fQJQeqw3C
  53673. IShwiP/WJmxsYAQlTlV+fe+/lEjetx3dcI0FX4ilm/LC7urRQEFtYjgdVgbFA0dRIBn8exALDmKu
  53674. dlW/X3e+PkkBUz2YJQN2JFodtNuJ6nnltrM7P7pMKEF/BqxqjsHQ9gUdfeZChuOl1UcCAwEAAaNC
  53675. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMR5yo6hTgMdHNxr
  53676. 2zFblD4/MH8tMA0GCSqGSIb3DQEBCwUAA4IBAQAtxRPPVoB7eni9n64smefv2t+UXglpp+duaIy9
  53677. cr5HqQ6XErhK8WTTOd8lNNTBzU6B8A8ExCSzNJbGpqow32hhc9f5joWJ7w5elShKKiePEI4ufIbE
  53678. Ap7aDHdlDkQNkv39sxY2+hENHYwOB4lqKVb3cvTdFZx3NWZXqxNT2I7BQMXXExZacse3aQHEerGD
  53679. AWh9jUGhlBjBJVz88P6DAod8DQ3PLghcSkANPuyBYeYk28rgDi0Hsj5W3I31QYUHSJsMC8tJP33s
  53680. t/3LjWeJGqvtux6jAAgIFyqCXDFdRootD4abdNlF+9RAsXqqaC2Gspki4cErx5z481+oghLrGREt
  53681. -----END CERTIFICATE-----
  53682. thawte Primary Root CA - G2
  53683. ===========================
  53684. -----BEGIN CERTIFICATE-----
  53685. MIICiDCCAg2gAwIBAgIQNfwmXNmET8k9Jj1Xm67XVjAKBggqhkjOPQQDAzCBhDELMAkGA1UEBhMC
  53686. VVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjE4MDYGA1UECxMvKGMpIDIwMDcgdGhhd3RlLCBJbmMu
  53687. IC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3Qg
  53688. Q0EgLSBHMjAeFw0wNzExMDUwMDAwMDBaFw0zODAxMTgyMzU5NTlaMIGEMQswCQYDVQQGEwJVUzEV
  53689. MBMGA1UEChMMdGhhd3RlLCBJbmMuMTgwNgYDVQQLEy8oYykgMjAwNyB0aGF3dGUsIEluYy4gLSBG
  53690. b3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAt
  53691. IEcyMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEotWcgnuVnfFSeIf+iha/BebfowJPDQfGAFG6DAJS
  53692. LSKkQjnE/o/qycG+1E3/n3qe4rF8mq2nhglzh9HnmuN6papu+7qzcMBniKI11KOasf2twu8x+qi5
  53693. 8/sIxpHR+ymVo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU
  53694. mtgAMADna3+FGO6Lts6KDPgR4bswCgYIKoZIzj0EAwMDaQAwZgIxAN344FdHW6fmCsO99YCKlzUN
  53695. G4k8VIZ3KMqh9HneteY4sPBlcIx/AlTCv//YoT7ZzwIxAMSNlPzcU9LcnXgWHxUzI1NS41oxXZ3K
  53696. rr0TKUQNJ1uo52icEvdYPy5yAlejj6EULg==
  53697. -----END CERTIFICATE-----
  53698. thawte Primary Root CA - G3
  53699. ===========================
  53700. -----BEGIN CERTIFICATE-----
  53701. MIIEKjCCAxKgAwIBAgIQYAGXt0an6rS0mtZLL/eQ+zANBgkqhkiG9w0BAQsFADCBrjELMAkGA1UE
  53702. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  53703. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDggdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  53704. cml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMzAeFw0w
  53705. ODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIGuMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhh
  53706. d3RlLCBJbmMuMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9uMTgwNgYD
  53707. VQQLEy8oYykgMjAwOCB0aGF3dGUsIEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIG
  53708. A1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAtIEczMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  53709. MIIBCgKCAQEAsr8nLPvb2FvdeHsbnndmgcs+vHyu86YnmjSjaDFxODNi5PNxZnmxqWWjpYvVj2At
  53710. P0LMqmsywCPLLEHd5N/8YZzic7IilRFDGF/Eth9XbAoFWCLINkw6fKXRz4aviKdEAhN0cXMKQlkC
  53711. +BsUa0Lfb1+6a4KinVvnSr0eAXLbS3ToO39/fR8EtCab4LRarEc9VbjXsCZSKAExQGbY2SS99irY
  53712. 7CFJXJv2eul/VTV+lmuNk5Mny5K76qxAwJ/C+IDPXfRa3M50hqY+bAtTyr2SzhkGcuYMXDhpxwTW
  53713. vGzOW/b3aJzcJRVIiKHpqfiYnODz1TEoYRFsZ5aNOZnLwkUkOQIDAQABo0IwQDAPBgNVHRMBAf8E
  53714. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUrWyqlGCc7eT/+j4KdCtjA/e2Wb8wDQYJ
  53715. KoZIhvcNAQELBQADggEBABpA2JVlrAmSicY59BDlqQ5mU1143vokkbvnRFHfxhY0Cu9qRFHqKweK
  53716. A3rD6z8KLFIWoCtDuSWQP3CpMyVtRRooOyfPqsMpQhvfO0zAMzRbQYi/aytlryjvsvXDqmbOe1bu
  53717. t8jLZ8HJnBoYuMTDSQPxYA5QzUbF83d597YV4Djbxy8ooAw/dyZ02SUS2jHaGh7cKUGRIjxpp7sC
  53718. 8rZcJwOJ9Abqm+RyguOhCcHpABnTPtRwa7pxpqpYrvS76Wy274fMm7v/OeZWYdMKp8RcTGB7BXcm
  53719. er/YB1IsYvdwY9k5vG8cwnncdimvzsUsZAReiDZuMdRAGmI0Nj81Aa6sY6A=
  53720. -----END CERTIFICATE-----
  53721. GeoTrust Primary Certification Authority - G2
  53722. =============================================
  53723. -----BEGIN CERTIFICATE-----
  53724. MIICrjCCAjWgAwIBAgIQPLL0SAoA4v7rJDteYD7DazAKBggqhkjOPQQDAzCBmDELMAkGA1UEBhMC
  53725. VVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA3IEdlb1RydXN0IElu
  53726. Yy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBD
  53727. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMB4XDTA3MTEwNTAwMDAwMFoXDTM4MDExODIzNTk1
  53728. OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykg
  53729. MjAwNyBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMTLUdl
  53730. b1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMjB2MBAGByqGSM49AgEG
  53731. BSuBBAAiA2IABBWx6P0DFUPlrOuHNxFi79KDNlJ9RVcLSo17VDs6bl8VAsBQps8lL33KSLjHUGMc
  53732. KiEIfJo22Av+0SbFWDEwKCXzXV2juLaltJLtbCyf691DiaI8S0iRHVDsJt/WYC69IaNCMEAwDwYD
  53733. VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBVfNVdRVfslsq0DafwBo/q+
  53734. EVXVMAoGCCqGSM49BAMDA2cAMGQCMGSWWaboCd6LuvpaiIjwH5HTRqjySkwCY/tsXzjbLkGTqQ7m
  53735. ndwxHLKgpxgceeHHNgIwOlavmnRs9vuD4DPTCF+hnMJbn0bWtsuRBmOiBuczrD6ogRLQy7rQkgu2
  53736. npaqBA+K
  53737. -----END CERTIFICATE-----
  53738. VeriSign Universal Root Certification Authority
  53739. ===============================================
  53740. -----BEGIN CERTIFICATE-----
  53741. MIIEuTCCA6GgAwIBAgIQQBrEZCGzEyEDDrvkEhrFHTANBgkqhkiG9w0BAQsFADCBvTELMAkGA1UE
  53742. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  53743. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwOCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  53744. IHVzZSBvbmx5MTgwNgYDVQQDEy9WZXJpU2lnbiBVbml2ZXJzYWwgUm9vdCBDZXJ0aWZpY2F0aW9u
  53745. IEF1dGhvcml0eTAeFw0wODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIG9MQswCQYDVQQGEwJV
  53746. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  53747. cmsxOjA4BgNVBAsTMShjKSAyMDA4IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  53748. IG9ubHkxODA2BgNVBAMTL1ZlcmlTaWduIFVuaXZlcnNhbCBSb290IENlcnRpZmljYXRpb24gQXV0
  53749. aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx2E3XrEBNNti1xWb/1hajCMj
  53750. 1mCOkdeQmIN65lgZOIzF9uVkhbSicfvtvbnazU0AtMgtc6XHaXGVHzk8skQHnOgO+k1KxCHfKWGP
  53751. MiJhgsWHH26MfF8WIFFE0XBPV+rjHOPMee5Y2A7Cs0WTwCznmhcrewA3ekEzeOEz4vMQGn+HLL72
  53752. 9fdC4uW/h2KJXwBL38Xd5HVEMkE6HnFuacsLdUYI0crSK5XQz/u5QGtkjFdN/BMReYTtXlT2NJ8I
  53753. AfMQJQYXStrxHXpma5hgZqTZ79IugvHw7wnqRMkVauIDbjPTrJ9VAMf2CGqUuV/c4DPxhGD5WycR
  53754. tPwW8rtWaoAljQIDAQABo4GyMIGvMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMG0G
  53755. CCsGAQUFBwEMBGEwX6FdoFswWTBXMFUWCWltYWdlL2dpZjAhMB8wBwYFKw4DAhoEFI/l0xqGrI2O
  53756. a8PPgGrUSBgsexkuMCUWI2h0dHA6Ly9sb2dvLnZlcmlzaWduLmNvbS92c2xvZ28uZ2lmMB0GA1Ud
  53757. DgQWBBS2d/ppSEefUxLVwuoHMnYH0ZcHGTANBgkqhkiG9w0BAQsFAAOCAQEASvj4sAPmLGd75JR3
  53758. Y8xuTPl9Dg3cyLk1uXBPY/ok+myDjEedO2Pzmvl2MpWRsXe8rJq+seQxIcaBlVZaDrHC1LGmWazx
  53759. Y8u4TB1ZkErvkBYoH1quEPuBUDgMbMzxPcP1Y+Oz4yHJJDnp/RVmRvQbEdBNc6N9Rvk97ahfYtTx
  53760. P/jgdFcrGJ2BtMQo2pSXpXDrrB2+BxHw1dvd5Yzw1TKwg+ZX4o+/vqGqvz0dtdQ46tewXDpPaj+P
  53761. wGZsY6rp2aQW9IHRlRQOfc2VNNnSj3BzgXucfr2YYdhFh5iQxeuGMMY1v/D/w1WIg0vvBZIGcfK4
  53762. mJO37M2CYfE45k+XmCpajQ==
  53763. -----END CERTIFICATE-----
  53764. VeriSign Class 3 Public Primary Certification Authority - G4
  53765. ============================================================
  53766. -----BEGIN CERTIFICATE-----
  53767. MIIDhDCCAwqgAwIBAgIQL4D+I4wOIg9IZxIokYesszAKBggqhkjOPQQDAzCByjELMAkGA1UEBhMC
  53768. VVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3
  53769. b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVz
  53770. ZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmlj
  53771. YXRpb24gQXV0aG9yaXR5IC0gRzQwHhcNMDcxMTA1MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCByjEL
  53772. MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBU
  53773. cnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRo
  53774. b3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5
  53775. IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASnVnp8
  53776. Utpkmw4tXNherJI9/gHmGUo9FANL+mAnINmDiWn6VMaaGF5VKmTeBvaNSjutEDxlPZCIBIngMGGz
  53777. rl0Bp3vefLK+ymVhAIau2o970ImtTR1ZmkGxvEeA3J5iw/mjgbIwga8wDwYDVR0TAQH/BAUwAwEB
  53778. /zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEw
  53779. HzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVyaXNpZ24u
  53780. Y29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFLMWkf3upm7ktS5Jj4d4gYDs5bG1MAoGCCqGSM49BAMD
  53781. A2gAMGUCMGYhDBgmYFo4e1ZC4Kf8NoRRkSAsdk1DPcQdhCPQrNZ8NQbOzWm9kA3bbEhCHQ6qQgIx
  53782. AJw9SDkjOVgaFRJZap7v1VmyHVIsmXHNxynfGyphe3HR3vPA5Q06Sqotp9iGKt0uEA==
  53783. -----END CERTIFICATE-----
  53784. NetLock Arany (Class Gold) Főtanúsítvány
  53785. ========================================
  53786. -----BEGIN CERTIFICATE-----
  53787. MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQGEwJIVTERMA8G
  53788. A1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3MDUGA1UECwwuVGFuw7pzw610
  53789. dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBB
  53790. cmFueSAoQ2xhc3MgR29sZCkgRsWRdGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgx
  53791. MjA2MTUwODIxWjCBpzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxO
  53792. ZXRMb2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlmaWNhdGlv
  53793. biBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNzIEdvbGQpIEbFkXRhbsO6
  53794. c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxCRec75LbRTDofTjl5Bu
  53795. 0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrTlF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw
  53796. /HpYzY6b7cNGbIRwXdrzAZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAk
  53797. H3B5r9s5VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRGILdw
  53798. fzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2BJtr+UBdADTHLpl1
  53799. neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAGAQH/AgEEMA4GA1UdDwEB/wQEAwIB
  53800. BjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2MU9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwW
  53801. qZw8UQCgwBEIBaeZ5m8BiFRhbvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTta
  53802. YtOUZcTh5m2C+C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC
  53803. bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2FuLjbvrW5Kfna
  53804. NwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2XjG4Kvte9nHfRCaexOYNkbQu
  53805. dZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E=
  53806. -----END CERTIFICATE-----
  53807. Staat der Nederlanden Root CA - G2
  53808. ==================================
  53809. -----BEGIN CERTIFICATE-----
  53810. MIIFyjCCA7KgAwIBAgIEAJiWjDANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
  53811. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  53812. Um9vdCBDQSAtIEcyMB4XDTA4MDMyNjExMTgxN1oXDTIwMDMyNTExMDMxMFowWjELMAkGA1UEBhMC
  53813. TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
  53814. ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMVZ
  53815. 5291qj5LnLW4rJ4L5PnZyqtdj7U5EILXr1HgO+EASGrP2uEGQxGZqhQlEq0i6ABtQ8SpuOUfiUtn
  53816. vWFI7/3S4GCI5bkYYCjDdyutsDeqN95kWSpGV+RLufg3fNU254DBtvPUZ5uW6M7XxgpT0GtJlvOj
  53817. CwV3SPcl5XCsMBQgJeN/dVrlSPhOewMHBPqCYYdu8DvEpMfQ9XQ+pV0aCPKbJdL2rAQmPlU6Yiil
  53818. e7Iwr/g3wtG61jj99O9JMDeZJiFIhQGp5Rbn3JBV3w/oOM2ZNyFPXfUib2rFEhZgF1XyZWampzCR
  53819. OME4HYYEhLoaJXhena/MUGDWE4dS7WMfbWV9whUYdMrhfmQpjHLYFhN9C0lK8SgbIHRrxT3dsKpI
  53820. CT0ugpTNGmXZK4iambwYfp/ufWZ8Pr2UuIHOzZgweMFvZ9C+X+Bo7d7iscksWXiSqt8rYGPy5V65
  53821. 48r6f1CGPqI0GAwJaCgRHOThuVw+R7oyPxjMW4T182t0xHJ04eOLoEq9jWYv6q012iDTiIJh8BIi
  53822. trzQ1aTsr1SIJSQ8p22xcik/Plemf1WvbibG/ufMQFxRRIEKeN5KzlW/HdXZt1bv8Hb/C3m1r737
  53823. qWmRRpdogBQ2HbN/uymYNqUg+oJgYjOk7Na6B6duxc8UpufWkjTYgfX8HV2qXB72o007uPc5AgMB
  53824. AAGjgZcwgZQwDwYDVR0TAQH/BAUwAwEB/zBSBgNVHSAESzBJMEcGBFUdIAAwPzA9BggrBgEFBQcC
  53825. ARYxaHR0cDovL3d3dy5wa2lvdmVyaGVpZC5ubC9wb2xpY2llcy9yb290LXBvbGljeS1HMjAOBgNV
  53826. HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJFoMocVHYnitfGsNig0jQt8YojrMA0GCSqGSIb3DQEBCwUA
  53827. A4ICAQCoQUpnKpKBglBu4dfYszk78wIVCVBR7y29JHuIhjv5tLySCZa59sCrI2AGeYwRTlHSeYAz
  53828. +51IvuxBQ4EffkdAHOV6CMqqi3WtFMTC6GY8ggen5ieCWxjmD27ZUD6KQhgpxrRW/FYQoAUXvQwj
  53829. f/ST7ZwaUb7dRUG/kSS0H4zpX897IZmflZ85OkYcbPnNe5yQzSipx6lVu6xiNGI1E0sUOlWDuYaN
  53830. kqbG9AclVMwWVxJKgnjIFNkXgiYtXSAfea7+1HAWFpWD2DU5/1JddRwWxRNVz0fMdWVSSt7wsKfk
  53831. CpYL+63C4iWEst3kvX5ZbJvw8NjnyvLplzh+ib7M+zkXYT9y2zqR2GUBGR2tUKRXCnxLvJxxcypF
  53832. URmFzI79R6d0lR2o0a9OF7FpJsKqeFdbxU2n5Z4FF5TKsl+gSRiNNOkmbEgeqmiSBeGCc1qb3Adb
  53833. CG19ndeNIdn8FCCqwkXfP+cAslHkwvgFuXkajDTznlvkN1trSt8sV4pAWja63XVECDdCcAz+3F4h
  53834. oKOKwJCcaNpQ5kUQR3i2TtJlycM33+FCY7BXN0Ute4qcvwXqZVUz9zkQxSgqIXobisQk+T8VyJoV
  53835. IPVVYpbtbZNQvOSqeK3Zywplh6ZmwcSBo3c6WB4L7oOLnR7SUqTMHW+wmG2UMbX4cQrcufx9MmDm
  53836. 66+KAQ==
  53837. -----END CERTIFICATE-----
  53838. Hongkong Post Root CA 1
  53839. =======================
  53840. -----BEGIN CERTIFICATE-----
  53841. MIIDMDCCAhigAwIBAgICA+gwDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoT
  53842. DUhvbmdrb25nIFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMB4XDTAzMDUx
  53843. NTA1MTMxNFoXDTIzMDUxNTA0NTIyOVowRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoTDUhvbmdrb25n
  53844. IFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMIIBIjANBgkqhkiG9w0BAQEF
  53845. AAOCAQ8AMIIBCgKCAQEArP84tulmAknjorThkPlAj3n54r15/gK97iSSHSL22oVyaf7XPwnU3ZG1
  53846. ApzQjVrhVcNQhrkpJsLj2aDxaQMoIIBFIi1WpztUlVYiWR8o3x8gPW2iNr4joLFutbEnPzlTCeqr
  53847. auh0ssJlXI6/fMN4hM2eFvz1Lk8gKgifd/PFHsSaUmYeSF7jEAaPIpjhZY4bXSNmO7ilMlHIhqqh
  53848. qZ5/dpTCpmy3QfDVyAY45tQM4vM7TG1QjMSDJ8EThFk9nnV0ttgCXjqQesBCNnLsak3c78QA3xMY
  53849. V18meMjWCnl3v/evt3a5pQuEF10Q6m/hq5URX208o1xNg1vysxmKgIsLhwIDAQABoyYwJDASBgNV
  53850. HRMBAf8ECDAGAQH/AgEDMA4GA1UdDwEB/wQEAwIBxjANBgkqhkiG9w0BAQUFAAOCAQEADkbVPK7i
  53851. h9legYsCmEEIjEy82tvuJxuC52pF7BaLT4Wg87JwvVqWuspube5Gi27nKi6Wsxkz67SfqLI37pio
  53852. l7Yutmcn1KZJ/RyTZXaeQi/cImyaT/JaFTmxcdcrUehtHJjA2Sr0oYJ71clBoiMBdDhViw+5Lmei
  53853. IAQ32pwL0xch4I+XeTRvhEgCIDMb5jREn5Fw9IBehEPCKdJsEhTkYY2sEJCehFC78JZvRZ+K88ps
  53854. T/oROhUVRsPNH4NbLUES7VBnQRM9IauUiqpOfMGx+6fWtScvl6tu4B3i0RwsH0Ti/L6RoZz71ilT
  53855. c4afU9hDDl3WY4JxHYB0yvbiAmvZWg==
  53856. -----END CERTIFICATE-----
  53857. SecureSign RootCA11
  53858. ===================
  53859. -----BEGIN CERTIFICATE-----
  53860. MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDErMCkGA1UEChMi
  53861. SmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoGA1UEAxMTU2VjdXJlU2lnbiBS
  53862. b290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSsw
  53863. KQYDVQQKEyJKYXBhbiBDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1
  53864. cmVTaWduIFJvb3RDQTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvL
  53865. TJszi1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8h9uuywGO
  53866. wvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOVMdrAG/LuYpmGYz+/3ZMq
  53867. g6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rP
  53868. O7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni8McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitA
  53869. bpSACW22s293bzUIUPsCh8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZX
  53870. t94wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAKCh
  53871. OBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xmKbabfSVSSUOrTC4r
  53872. bnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQX5Ucv+2rIrVls4W6ng+4reV6G4pQ
  53873. Oh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWrQbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01
  53874. y8hSyn+B/tlr0/cR7SXf+Of5pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061
  53875. lgeLKBObjBmNQSdJQO7e5iNEOdyhIta6A/I=
  53876. -----END CERTIFICATE-----
  53877. Microsec e-Szigno Root CA 2009
  53878. ==============================
  53879. -----BEGIN CERTIFICATE-----
  53880. MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYDVQQGEwJIVTER
  53881. MA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jv
  53882. c2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o
  53883. dTAeFw0wOTA2MTYxMTMwMThaFw0yOTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UE
  53884. BwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUt
  53885. U3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTCCASIw
  53886. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvPkd6mJviZpWNwrZuuyjNA
  53887. fW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tccbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG
  53888. 0IMZfcChEhyVbUr02MelTTMuhTlAdX4UfIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKA
  53889. pxn1ntxVUwOXewdI/5n7N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm
  53890. 1HxdrtbCxkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1+rUC
  53891. AwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTLD8bf
  53892. QkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAbBgNVHREE
  53893. FDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqGSIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0o
  53894. lZMEyL/azXm4Q5DwpL7v8u8hmLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfX
  53895. I/OMn74dseGkddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775
  53896. tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c2Pm2G2JwCz02
  53897. yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5tHMN1Rq41Bab2XD0h7lbwyYIi
  53898. LXpUq3DDfSJlgnCW
  53899. -----END CERTIFICATE-----
  53900. GlobalSign Root CA - R3
  53901. =======================
  53902. -----BEGIN CERTIFICATE-----
  53903. MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4GA1UECxMXR2xv
  53904. YmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  53905. bFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  53906. aWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  53907. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWt
  53908. iHL8RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsTgHeMCOFJ
  53909. 0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmmKPZpO/bLyCiR5Z2KYVc3
  53910. rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zdQQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjl
  53911. OCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZXriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2
  53912. xmmFghcCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  53913. FI/wS3+oLkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZURUm7
  53914. lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMpjjM5RcOO5LlXbKr8
  53915. EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK6fBdRoyV3XpYKBovHd7NADdBj+1E
  53916. bddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQXmcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18
  53917. YIvDQVETI53O9zJrlAGomecsMx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7r
  53918. kpeDMdmztcpHWD9f
  53919. -----END CERTIFICATE-----
  53920. Autoridad de Certificacion Firmaprofesional CIF A62634068
  53921. =========================================================
  53922. -----BEGIN CERTIFICATE-----
  53923. MIIGFDCCA/ygAwIBAgIIU+w77vuySF8wDQYJKoZIhvcNAQEFBQAwUTELMAkGA1UEBhMCRVMxQjBA
  53924. BgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2
  53925. MjYzNDA2ODAeFw0wOTA1MjAwODM4MTVaFw0zMDEyMzEwODM4MTVaMFExCzAJBgNVBAYTAkVTMUIw
  53926. QAYDVQQDDDlBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBB
  53927. NjI2MzQwNjgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDD
  53928. Utd9thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQMcas9UX4P
  53929. B99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefGL9ItWY16Ck6WaVICqjaY
  53930. 7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15iNA9wBj4gGFrO93IbJWyTdBSTo3OxDqqH
  53931. ECNZXyAFGUftaI6SEspd/NYrspI8IM/hX68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyI
  53932. plD9amML9ZMWGxmPsu2bm8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctX
  53933. MbScyJCyZ/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirjaEbsX
  53934. LZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/TKI8xWVvTyQKmtFLK
  53935. bpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF6NkBiDkal4ZkQdU7hwxu+g/GvUgU
  53936. vzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVhOSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMBIGA1Ud
  53937. EwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRlzeurNR4APn7VdMActHNH
  53938. DhpkLzCBpgYDVR0gBIGeMIGbMIGYBgRVHSAAMIGPMC8GCCsGAQUFBwIBFiNodHRwOi8vd3d3LmZp
  53939. cm1hcHJvZmVzaW9uYWwuY29tL2NwczBcBggrBgEFBQcCAjBQHk4AUABhAHMAZQBvACAAZABlACAA
  53940. bABhACAAQgBvAG4AYQBuAG8AdgBhACAANAA3ACAAQgBhAHIAYwBlAGwAbwBuAGEAIAAwADgAMAAx
  53941. ADcwDQYJKoZIhvcNAQEFBQADggIBABd9oPm03cXF661LJLWhAqvdpYhKsg9VSytXjDvlMd3+xDLx
  53942. 51tkljYyGOylMnfX40S2wBEqgLk9am58m9Ot/MPWo+ZkKXzR4Tgegiv/J2Wv+xYVxC5xhOW1//qk
  53943. R71kMrv2JYSiJ0L1ILDCExARzRAVukKQKtJE4ZYm6zFIEv0q2skGz3QeqUvVhyj5eTSSPi5E6PaP
  53944. T481PyWzOdxjKpBrIF/EUhJOlywqrJ2X3kjyo2bbwtKDlaZmp54lD+kLM5FlClrD2VQS3a/DTg4f
  53945. Jl4N3LON7NWBcN7STyQF82xO9UxJZo3R/9ILJUFI/lGExkKvgATP0H5kSeTy36LssUzAKh3ntLFl
  53946. osS88Zj0qnAHY7S42jtM+kAiMFsRpvAFDsYCA0irhpuF3dvd6qJ2gHN99ZwExEWN57kci57q13XR
  53947. crHedUTnQn3iV2t93Jm8PYMo6oCTjcVMZcFwgbg4/EMxsvYDNEeyrPsiBsse3RdHHF9mudMaotoR
  53948. saS8I8nkvof/uZS2+F0gStRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTD
  53949. KCOM/iczQ0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQBjLMi
  53950. 6Et8Vcad+qMUu2WFbm5PEn4KPJ2V
  53951. -----END CERTIFICATE-----
  53952. Izenpe.com
  53953. ==========
  53954. -----BEGIN CERTIFICATE-----
  53955. MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4MQswCQYDVQQG
  53956. EwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wHhcNMDcxMjEz
  53957. MTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMu
  53958. QS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ
  53959. 03rKDx6sp4boFmVqscIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAK
  53960. ClaOxdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6HLmYRY2xU
  53961. +zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFXuaOKmMPsOzTFlUFpfnXC
  53962. PCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQDyCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxT
  53963. OTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbK
  53964. F7jJeodWLBoBHmy+E60QrLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK
  53965. 0GqfvEyNBjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8Lhij+
  53966. 0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIBQFqNeb+Lz0vPqhbB
  53967. leStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+HMh3/1uaD7euBUbl8agW7EekFwID
  53968. AQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2luZm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+
  53969. SVpFTlBFIFMuQS4gLSBDSUYgQTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBG
  53970. NjIgUzgxQzBBBgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx
  53971. MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  53972. BBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUAA4ICAQB4pgwWSp9MiDrAyw6l
  53973. Fn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWblaQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbga
  53974. kEyrkgPH7UIBzg/YsfqikuFgba56awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8q
  53975. hT/AQKM6WfxZSzwoJNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Cs
  53976. g1lwLDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCTVyvehQP5
  53977. aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGkLhObNA5me0mrZJfQRsN5
  53978. nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJbUjWumDqtujWTI6cfSN01RpiyEGjkpTHC
  53979. ClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZo
  53980. Q0iy2+tzJOeRf1SktoA+naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1Z
  53981. WrOZyGlsQyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw==
  53982. -----END CERTIFICATE-----
  53983. Chambers of Commerce Root - 2008
  53984. ================================
  53985. -----BEGIN CERTIFICATE-----
  53986. MIIHTzCCBTegAwIBAgIJAKPaQn6ksa7aMA0GCSqGSIb3DQEBBQUAMIGuMQswCQYDVQQGEwJFVTFD
  53987. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  53988. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  53989. QS4xKTAnBgNVBAMTIENoYW1iZXJzIG9mIENvbW1lcmNlIFJvb3QgLSAyMDA4MB4XDTA4MDgwMTEy
  53990. Mjk1MFoXDTM4MDczMTEyMjk1MFowga4xCzAJBgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNl
  53991. ZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNhbWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQF
  53992. EwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENhbWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJl
  53993. cnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC
  53994. AQCvAMtwNyuAWko6bHiUfaN/Gh/2NdW928sNRHI+JrKQUrpjOyhYb6WzbZSm891kDFX29ufyIiKA
  53995. XuFixrYp4YFs8r/lfTJqVKAyGVn+H4vXPWCGhSRv4xGzdz4gljUha7MI2XAuZPeEklPWDrCQiorj
  53996. h40G072QDuKZoRuGDtqaCrsLYVAGUvGef3bsyw/QHg3PmTA9HMRFEFis1tPo1+XqxQEHd9ZR5gN/
  53997. ikilTWh1uem8nk4ZcfUyS5xtYBkL+8ydddy/Js2Pk3g5eXNeJQ7KXOt3EgfLZEFHcpOrUMPrCXZk
  53998. NNI5t3YRCQ12RcSprj1qr7V9ZS+UWBDsXHyvfuK2GNnQm05aSd+pZgvMPMZ4fKecHePOjlO+Bd5g
  53999. D2vlGts/4+EhySnB8esHnFIbAURRPHsl18TlUlRdJQfKFiC4reRB7noI/plvg6aRArBsNlVq5331
  54000. lubKgdaX8ZSD6e2wsWsSaR6s+12pxZjptFtYer49okQ6Y1nUCyXeG0+95QGezdIp1Z8XGQpvvwyQ
  54001. 0wlf2eOKNcx5Wk0ZN5K3xMGtr/R5JJqyAQuxr1yW84Ay+1w9mPGgP0revq+ULtlVmhduYJ1jbLhj
  54002. ya6BXBg14JC7vjxPNyK5fuvPnnchpj04gftI2jE9K+OJ9dC1vX7gUMQSibMjmhAxhduub+84Mxh2
  54003. EQIDAQABo4IBbDCCAWgwEgYDVR0TAQH/BAgwBgEB/wIBDDAdBgNVHQ4EFgQU+SSsD7K1+HnA+mCI
  54004. G8TZTQKeFxkwgeMGA1UdIwSB2zCB2IAU+SSsD7K1+HnA+mCIG8TZTQKeFxmhgbSkgbEwga4xCzAJ
  54005. BgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNlZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNh
  54006. bWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQFEwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENh
  54007. bWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDiC
  54008. CQCj2kJ+pLGu2jAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUH
  54009. AgEWHGh0dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAJASryI1
  54010. wqM58C7e6bXpeHxIvj99RZJe6dqxGfwWPJ+0W2aeaufDuV2I6A+tzyMP3iU6XsxPpcG1Lawk0lgH
  54011. 3qLPaYRgM+gQDROpI9CF5Y57pp49chNyM/WqfcZjHwj0/gF/JM8rLFQJ3uIrbZLGOU8W6jx+ekbU
  54012. RWpGqOt1glanq6B8aBMz9p0w8G8nOSQjKpD9kCk18pPfNKXG9/jvjA9iSnyu0/VU+I22mlaHFoI6
  54013. M6taIgj3grrqLuBHmrS1RaMFO9ncLkVAO+rcf+g769HsJtg1pDDFOqxXnrN2pSB7+R5KBWIBpih1
  54014. YJeSDW4+TTdDDZIVnBgizVGZoCkaPF+KMjNbMMeJL0eYD6MDxvbxrN8y8NmBGuScvfaAFPDRLLmF
  54015. 9dijscilIeUcE5fuDr3fKanvNFNb0+RqE4QGtjICxFKuItLcsiFCGtpA8CnJ7AoMXOLQusxI0zcK
  54016. zBIKinmwPQN/aUv0NCB9szTqjktk9T79syNnFQ0EuPAtwQlRPLJsFfClI9eDdOTlLsn+mCdCxqvG
  54017. nrDQWzilm1DefhiYtUU79nm06PcaewaD+9CL2rvHvRirCG88gGtAPxkZumWK5r7VXNM21+9AUiRg
  54018. OGcEMeyP84LG3rlV8zsxkVrctQgVrXYlCg17LofiDKYGvCYQbTed7N14jHyAxfDZd0jQ
  54019. -----END CERTIFICATE-----
  54020. Global Chambersign Root - 2008
  54021. ==============================
  54022. -----BEGIN CERTIFICATE-----
  54023. MIIHSTCCBTGgAwIBAgIJAMnN0+nVfSPOMA0GCSqGSIb3DQEBBQUAMIGsMQswCQYDVQQGEwJFVTFD
  54024. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  54025. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  54026. QS4xJzAlBgNVBAMTHkdsb2JhbCBDaGFtYmVyc2lnbiBSb290IC0gMjAwODAeFw0wODA4MDExMjMx
  54027. NDBaFw0zODA3MzExMjMxNDBaMIGsMQswCQYDVQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUg
  54028. Y3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAGA1UEBRMJ
  54029. QTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xJzAlBgNVBAMTHkdsb2JhbCBD
  54030. aGFtYmVyc2lnbiBSb290IC0gMjAwODCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMDf
  54031. VtPkOpt2RbQT2//BthmLN0EYlVJH6xedKYiONWwGMi5HYvNJBL99RDaxccy9Wglz1dmFRP+RVyXf
  54032. XjaOcNFccUMd2drvXNL7G706tcuto8xEpw2uIRU/uXpbknXYpBI4iRmKt4DS4jJvVpyR1ogQC7N0
  54033. ZJJ0YPP2zxhPYLIj0Mc7zmFLmY/CDNBAspjcDahOo7kKrmCgrUVSY7pmvWjg+b4aqIG7HkF4ddPB
  54034. /gBVsIdU6CeQNR1MM62X/JcumIS/LMmjv9GYERTtY/jKmIhYF5ntRQOXfjyGHoiMvvKRhI9lNNgA
  54035. TH23MRdaKXoKGCQwoze1eqkBfSbW+Q6OWfH9GzO1KTsXO0G2Id3UwD2ln58fQ1DJu7xsepeY7s2M
  54036. H/ucUa6LcL0nn3HAa6x9kGbo1106DbDVwo3VyJ2dwW3Q0L9R5OP4wzg2rtandeavhENdk5IMagfe
  54037. Ox2YItaswTXbo6Al/3K1dh3ebeksZixShNBFks4c5eUzHdwHU1SjqoI7mjcv3N2gZOnm3b2u/GSF
  54038. HTynyQbehP9r6GsaPMWis0L7iwk+XwhSx2LE1AVxv8Rk5Pihg+g+EpuoHtQ2TS9x9o0o9oOpE9Jh
  54039. wZG7SMA0j0GMS0zbaRL/UJScIINZc+18ofLx/d33SdNDWKBWY8o9PeU1VlnpDsogzCtLkykPAgMB
  54040. AAGjggFqMIIBZjASBgNVHRMBAf8ECDAGAQH/AgEMMB0GA1UdDgQWBBS5CcqcHtvTbDprru1U8VuT
  54041. BjUuXjCB4QYDVR0jBIHZMIHWgBS5CcqcHtvTbDprru1U8VuTBjUuXqGBsqSBrzCBrDELMAkGA1UE
  54042. BhMCRVUxQzBBBgNVBAcTOk1hZHJpZCAoc2VlIGN1cnJlbnQgYWRkcmVzcyBhdCB3d3cuY2FtZXJm
  54043. aXJtYS5jb20vYWRkcmVzcykxEjAQBgNVBAUTCUE4Mjc0MzI4NzEbMBkGA1UEChMSQUMgQ2FtZXJm
  54044. aXJtYSBTLkEuMScwJQYDVQQDEx5HbG9iYWwgQ2hhbWJlcnNpZ24gUm9vdCAtIDIwMDiCCQDJzdPp
  54045. 1X0jzjAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUHAgEWHGh0
  54046. dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAICIf3DekijZBZRG
  54047. /5BXqfEv3xoNa/p8DhxJJHkn2EaqbylZUohwEurdPfWbU1Rv4WCiqAm57OtZfMY18dwY6fFn5a+6
  54048. ReAJ3spED8IXDneRRXozX1+WLGiLwUePmJs9wOzL9dWCkoQ10b42OFZyMVtHLaoXpGNR6woBrX/s
  54049. dZ7LoR/xfxKxueRkf2fWIyr0uDldmOghp+G9PUIadJpwr2hsUF1Jz//7Dl3mLEfXgTpZALVza2Mg
  54050. 9jFFCDkO9HB+QHBaP9BrQql0PSgvAm11cpUJjUhjxsYjV5KTXjXBjfkK9yydYhz2rXzdpjEetrHH
  54051. foUm+qRqtdpjMNHvkzeyZi99Bffnt0uYlDXA2TopwZ2yUDMdSqlapskD7+3056huirRXhOukP9Du
  54052. qqqHW2Pok+JrqNS4cnhrG+055F3Lm6qH1U9OAP7Zap88MQ8oAgF9mOinsKJknnn4SPIVqczmyETr
  54053. P3iZ8ntxPjzxmKfFGBI/5rsoM0LpRQp8bfKGeS/Fghl9CYl8slR2iK7ewfPM4W7bMdaTrpmg7yVq
  54054. c5iJWzouE4gev8CSlDQb4ye3ix5vQv/n6TebUB0tovkC7stYWDpxvGjjqsGvHCgfotwjZT+B6q6Z
  54055. 09gwzxMNTxXJhLynSC34MCN32EZLeW32jO06f2ARePTpm67VVMB0gNELQp/B
  54056. -----END CERTIFICATE-----
  54057. Go Daddy Root Certificate Authority - G2
  54058. ========================================
  54059. -----BEGIN CERTIFICATE-----
  54060. MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  54061. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoTEUdvRGFkZHkuY29tLCBJbmMu
  54062. MTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5
  54063. MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6
  54064. b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8G
  54065. A1UEAxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI
  54066. hvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKDE6bFIEMBO4Tx5oVJnyfq
  54067. 9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD
  54068. +qK+ihVqf94Lw7YZFAXK6sOoBJQ7RnwyDfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutd
  54069. fMh8+7ArU6SSYmlRJQVhGkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMl
  54070. NAJWJwGRtDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEAAaNC
  54071. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFDqahQcQZyi27/a9
  54072. BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmXWWcDYfF+OwYxdS2hII5PZYe096ac
  54073. vNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r
  54074. 5N9ss4UXnT3ZJE95kTXWXwTrgIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYV
  54075. N8Gb5DKj7Tjo2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO
  54076. LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI4uJEvlz36hz1
  54077. -----END CERTIFICATE-----
  54078. Starfield Root Certificate Authority - G2
  54079. =========================================
  54080. -----BEGIN CERTIFICATE-----
  54081. MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  54082. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  54083. b2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVsZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0
  54084. eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAw
  54085. DgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQg
  54086. VGVjaG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZpY2F0ZSBB
  54087. dXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL3twQP89o/8ArFv
  54088. W59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMgnLRJdzIpVv257IzdIvpy3Cdhl+72WoTs
  54089. bhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNk
  54090. N3mSwOxGXn/hbVNMYq/NHwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7Nf
  54091. ZTD4p7dNdloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0HZbU
  54092. JtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  54093. AQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0GCSqGSIb3DQEBCwUAA4IBAQARWfol
  54094. TwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjUsHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx
  54095. 4mcujJUDJi5DnUox9g61DLu34jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUw
  54096. F5okxBDgBPfg8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K
  54097. pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1mMpYjn0q7pBZ
  54098. c2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0
  54099. -----END CERTIFICATE-----
  54100. Starfield Services Root Certificate Authority - G2
  54101. ==================================================
  54102. -----BEGIN CERTIFICATE-----
  54103. MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  54104. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  54105. b2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVsZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRl
  54106. IEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNV
  54107. BAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxT
  54108. dGFyZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2VydmljZXMg
  54109. Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
  54110. AQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20pOsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2
  54111. h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm28xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4Pa
  54112. hHQUw2eeBGg6345AWh1KTs9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLP
  54113. LJGmpufehRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk6mFB
  54114. rMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAwDwYDVR0TAQH/BAUw
  54115. AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+qAdcwKziIorhtSpzyEZGDMA0GCSqG
  54116. SIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMIbw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPP
  54117. E95Dz+I0swSdHynVv/heyNXBve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTy
  54118. xQGjhdByPq1zqwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd
  54119. iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn0q23KXB56jza
  54120. YyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCNsSi6
  54121. -----END CERTIFICATE-----
  54122. AffirmTrust Commercial
  54123. ======================
  54124. -----BEGIN CERTIFICATE-----
  54125. MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCVVMxFDAS
  54126. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMB4XDTEw
  54127. MDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  54128. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEF
  54129. AAOCAQ8AMIIBCgKCAQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6Eqdb
  54130. DuKPHx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yrba0F8PrV
  54131. C8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPALMeIrJmqbTFeurCA+ukV6
  54132. BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1yHp52UKqK39c/s4mT6NmgTWvRLpUHhww
  54133. MmWd5jyTXlBOeuM61G7MGvv50jeuJCqrVwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNV
  54134. HQ4EFgQUnZPGU4teyq8/nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  54135. AQYwDQYJKoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYGXUPG
  54136. hi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNjvbz4YYCanrHOQnDi
  54137. qX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivtZ8SOyUOyXGsViQK8YvxO8rUzqrJv
  54138. 0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9gN53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0kh
  54139. sUlHRUe072o0EclNmsxZt9YCnlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8=
  54140. -----END CERTIFICATE-----
  54141. AffirmTrust Networking
  54142. ======================
  54143. -----BEGIN CERTIFICATE-----
  54144. MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UEBhMCVVMxFDAS
  54145. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMB4XDTEw
  54146. MDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  54147. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEF
  54148. AAOCAQ8AMIIBCgKCAQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SE
  54149. Hi3yYJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbuakCNrmreI
  54150. dIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRLQESxG9fhwoXA3hA/Pe24
  54151. /PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gb
  54152. h+0t+nvujArjqWaJGctB+d1ENmHP4ndGyH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNV
  54153. HQ4EFgQUBx/S55zawm6iQLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  54154. AQYwDQYJKoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfOtDIu
  54155. UFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzuQY0x2+c06lkh1QF6
  54156. 12S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZLgo/bNjR9eUJtGxUAArgFU2HdW23
  54157. WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4uolu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9
  54158. /ZFvgrG+CJPbFEfxojfHRZ48x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s=
  54159. -----END CERTIFICATE-----
  54160. AffirmTrust Premium
  54161. ===================
  54162. -----BEGIN CERTIFICATE-----
  54163. MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UEBhMCVVMxFDAS
  54164. BgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMB4XDTEwMDEy
  54165. OTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRy
  54166. dXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  54167. MIICCgKCAgEAxBLfqV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtn
  54168. BKAQJG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ+jjeRFcV
  54169. 5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrSs8PhaJyJ+HoAVt70VZVs
  54170. +7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmd
  54171. GPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d770O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5R
  54172. p9EixAqnOEhss/n/fauGV+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NI
  54173. S+LI+H+SqHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S5u04
  54174. 6uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4IaC1nEWTJ3s7xgaVY5
  54175. /bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TXOwF0lkLgAOIua+rF7nKsu7/+6qqo
  54176. +Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYEFJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB
  54177. /wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByv
  54178. MiPIs0laUZx2KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg
  54179. Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B8OWycvpEgjNC
  54180. 6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQMKSOyARiqcTtNd56l+0OOF6S
  54181. L5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK
  54182. +4w1IX2COPKpVJEZNZOUbWo6xbLQu4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmV
  54183. BtWVyuEklut89pMFu+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFg
  54184. IxpHYoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8GKa1qF60
  54185. g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaORtGdFNrHF+QFlozEJLUb
  54186. zxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6eKeC2uAloGRwYQw==
  54187. -----END CERTIFICATE-----
  54188. AffirmTrust Premium ECC
  54189. =======================
  54190. -----BEGIN CERTIFICATE-----
  54191. MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMCVVMxFDASBgNV
  54192. BAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQcmVtaXVtIEVDQzAeFw0xMDAx
  54193. MjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJBgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1U
  54194. cnVzdDEgMB4GA1UEAwwXQWZmaXJtVHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQA
  54195. IgNiAAQNMF4bFZ0D0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQ
  54196. N8O9ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0GA1UdDgQW
  54197. BBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAK
  54198. BggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/VsaobgxCd05DhT1wV/GzTjxi+zygk8N53X
  54199. 57hG8f2h4nECMEJZh0PUUd+60wkyWs6Iflc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKM
  54200. eQ==
  54201. -----END CERTIFICATE-----
  54202. Certum Trusted Network CA
  54203. =========================
  54204. -----BEGIN CERTIFICATE-----
  54205. MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBMMSIwIAYDVQQK
  54206. ExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlv
  54207. biBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBUcnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIy
  54208. MTIwNzM3WhcNMjkxMjMxMTIwNzM3WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBU
  54209. ZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  54210. MSIwIAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0BAQEFAAOC
  54211. AQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rHUV+rpDKmYYe2bg+G0jAC
  54212. l/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LMTXPb865Px1bVWqeWifrzq2jUI4ZZJ88J
  54213. J7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVUBBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4
  54214. fOQtf/WsX+sWn7Et0brMkUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0
  54215. cvW0QM8xAcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNVHRMB
  54216. Af8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNVHQ8BAf8EBAMCAQYw
  54217. DQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15ysHhE49wcrwn9I0j6vSrEuVUEtRCj
  54218. jSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfLI9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1
  54219. mS1FhIrlQgnXdAIv94nYmem8J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5aj
  54220. Zt3hrvJBW8qYVoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI
  54221. 03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw=
  54222. -----END CERTIFICATE-----
  54223. TWCA Root Certification Authority
  54224. =================================
  54225. -----BEGIN CERTIFICATE-----
  54226. MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJ
  54227. VEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlmaWNh
  54228. dGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMzWhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQG
  54229. EwJUVzESMBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NB
  54230. IFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
  54231. AoIBAQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFEAcK0HMMx
  54232. QhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HHK3XLfJ+utdGdIzdjp9xC
  54233. oi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeXRfwZVzsrb+RH9JlF/h3x+JejiB03HFyP
  54234. 4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/zrX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1r
  54235. y+UPizgN7gr8/g+YnzAx3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIB
  54236. BjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkqhkiG
  54237. 9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeCMErJk/9q56YAf4lC
  54238. mtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdlsXebQ79NqZp4VKIV66IIArB6nCWlW
  54239. QtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62Dlhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVY
  54240. T0bf+215WfKEIlKuD8z7fDvnaspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocny
  54241. Yh0igzyXxfkZYiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw==
  54242. -----END CERTIFICATE-----
  54243. Security Communication RootCA2
  54244. ==============================
  54245. -----BEGIN CERTIFICATE-----
  54246. MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
  54247. U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMeU2VjdXJpdHkgQ29tbXVuaWNh
  54248. dGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoXDTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMC
  54249. SlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3Vy
  54250. aXR5IENvbW11bmljYXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  54251. ANAVOVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGrzbl+dp++
  54252. +T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVMVAX3NuRFg3sUZdbcDE3R
  54253. 3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQhNBqyjoGADdH5H5XTz+L62e4iKrFvlNV
  54254. spHEfbmwhRkGeC7bYRr6hfVKkaHnFtWOojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1K
  54255. EOtOghY6rCcMU/Gt1SSwawNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8
  54256. QIH4D5csOPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEB
  54257. CwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpFcoJxDjrSzG+ntKEj
  54258. u/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXcokgfGT+Ok+vx+hfuzU7jBBJV1uXk
  54259. 3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6q
  54260. tnRGEmyR7jTV7JqR50S+kDFy1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29
  54261. mvVXIwAHIRc/SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03
  54262. -----END CERTIFICATE-----
  54263. EC-ACC
  54264. ======
  54265. -----BEGIN CERTIFICATE-----
  54266. MIIFVjCCBD6gAwIBAgIQ7is969Qh3hSoYqwE893EATANBgkqhkiG9w0BAQUFADCB8zELMAkGA1UE
  54267. BhMCRVMxOzA5BgNVBAoTMkFnZW5jaWEgQ2F0YWxhbmEgZGUgQ2VydGlmaWNhY2lvIChOSUYgUS0w
  54268. ODAxMTc2LUkpMSgwJgYDVQQLEx9TZXJ2ZWlzIFB1YmxpY3MgZGUgQ2VydGlmaWNhY2lvMTUwMwYD
  54269. VQQLEyxWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAoYykwMzE1MDMGA1UE
  54270. CxMsSmVyYXJxdWlhIEVudGl0YXRzIGRlIENlcnRpZmljYWNpbyBDYXRhbGFuZXMxDzANBgNVBAMT
  54271. BkVDLUFDQzAeFw0wMzAxMDcyMzAwMDBaFw0zMTAxMDcyMjU5NTlaMIHzMQswCQYDVQQGEwJFUzE7
  54272. MDkGA1UEChMyQWdlbmNpYSBDYXRhbGFuYSBkZSBDZXJ0aWZpY2FjaW8gKE5JRiBRLTA4MDExNzYt
  54273. SSkxKDAmBgNVBAsTH1NlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8xNTAzBgNVBAsTLFZl
  54274. Z2V1IGh0dHBzOi8vd3d3LmNhdGNlcnQubmV0L3ZlcmFycmVsIChjKTAzMTUwMwYDVQQLEyxKZXJh
  54275. cnF1aWEgRW50aXRhdHMgZGUgQ2VydGlmaWNhY2lvIENhdGFsYW5lczEPMA0GA1UEAxMGRUMtQUND
  54276. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsyLHT+KXQpWIR4NA9h0X84NzJB5R85iK
  54277. w5K4/0CQBXCHYMkAqbWUZRkiFRfCQ2xmRJoNBD45b6VLeqpjt4pEndljkYRm4CgPukLjbo73FCeT
  54278. ae6RDqNfDrHrZqJyTxIThmV6PttPB/SnCWDaOkKZx7J/sxaVHMf5NLWUhdWZXqBIoH7nF2W4onW4
  54279. HvPlQn2v7fOKSGRdghST2MDk/7NQcvJ29rNdQlB50JQ+awwAvthrDk4q7D7SzIKiGGUzE3eeml0a
  54280. E9jD2z3Il3rucO2n5nzbcc8tlGLfbdb1OL4/pYUKGbio2Al1QnDE6u/LDsg0qBIimAy4E5S2S+zw
  54281. 0JDnJwIDAQABo4HjMIHgMB0GA1UdEQQWMBSBEmVjX2FjY0BjYXRjZXJ0Lm5ldDAPBgNVHRMBAf8E
  54282. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUoMOLRKo3pUW/l4Ba0fF4opvpXY0wfwYD
  54283. VR0gBHgwdjB0BgsrBgEEAfV4AQMBCjBlMCwGCCsGAQUFBwIBFiBodHRwczovL3d3dy5jYXRjZXJ0
  54284. Lm5ldC92ZXJhcnJlbDA1BggrBgEFBQcCAjApGidWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5l
  54285. dC92ZXJhcnJlbCAwDQYJKoZIhvcNAQEFBQADggEBAKBIW4IB9k1IuDlVNZyAelOZ1Vr/sXE7zDkJ
  54286. lF7W2u++AVtd0x7Y/X1PzaBB4DSTv8vihpw3kpBWHNzrKQXlxJ7HNd+KDM3FIUPpqojlNcAZQmNa
  54287. Al6kSBg6hW/cnbw/nZzBh7h6YQjpdwt/cKt63dmXLGQehb+8dJahw3oS7AwaboMMPOhyRp/7SNVe
  54288. l+axofjk70YllJyJ22k4vuxcDlbHZVHlUIiIv0LVKz3l+bqeLrPK9HOSAgu+TGbrIP65y7WZf+a2
  54289. E/rKS03Z7lNGBjvGTq2TWoF+bCpLagVFjPIhpDGQh2xlnJ2lYJU6Un/10asIbvPuW/mIPX64b24D
  54290. 5EI=
  54291. -----END CERTIFICATE-----
  54292. Hellenic Academic and Research Institutions RootCA 2011
  54293. =======================================================
  54294. -----BEGIN CERTIFICATE-----
  54295. MIIEMTCCAxmgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBlTELMAkGA1UEBhMCR1IxRDBCBgNVBAoT
  54296. O0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9y
  54297. aXR5MUAwPgYDVQQDEzdIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  54298. IFJvb3RDQSAyMDExMB4XDTExMTIwNjEzNDk1MloXDTMxMTIwMTEzNDk1MlowgZUxCzAJBgNVBAYT
  54299. AkdSMUQwQgYDVQQKEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  54300. IENlcnQuIEF1dGhvcml0eTFAMD4GA1UEAxM3SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNo
  54301. IEluc3RpdHV0aW9ucyBSb290Q0EgMjAxMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  54302. AKlTAOMupvaO+mDYLZU++CwqVE7NuYRhlFhPjz2L5EPzdYmNUeTDN9KKiE15HrcS3UN4SoqS5tdI
  54303. 1Q+kOilENbgH9mgdVc04UfCMJDGFr4PJfel3r+0ae50X+bOdOFAPplp5kYCvN66m0zH7tSYJnTxa
  54304. 71HFK9+WXesyHgLacEnsbgzImjeN9/E2YEsmLIKe0HjzDQ9jpFEw4fkrJxIH2Oq9GGKYsFk3fb7u
  54305. 8yBRQlqD75O6aRXxYp2fmTmCobd0LovUxQt7L/DICto9eQqakxylKHJzkUOap9FNhYS5qXSPFEDH
  54306. 3N6sQWRstBmbAmNtJGSPRLIl6s5ddAxjMlyNh+UCAwEAAaOBiTCBhjAPBgNVHRMBAf8EBTADAQH/
  54307. MAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQUppFC/RNhSiOeCKQp5dgTBCPuQSUwRwYDVR0eBEAwPqA8
  54308. MAWCAy5ncjAFggMuZXUwBoIELmVkdTAGggQub3JnMAWBAy5ncjAFgQMuZXUwBoEELmVkdTAGgQQu
  54309. b3JnMA0GCSqGSIb3DQEBBQUAA4IBAQAf73lB4XtuP7KMhjdCSk4cNx6NZrokgclPEg8hwAOXhiVt
  54310. XdMiKahsog2p6z0GW5k6x8zDmjR/qw7IThzh+uTczQ2+vyT+bOdrwg3IBp5OjWEopmr95fZi6hg8
  54311. TqBTnbI6nOulnJEWtk2C4AwFSKls9cz4y51JtPACpf1wA+2KIaWuE4ZJwzNzvoc7dIsXRSZMFpGD
  54312. /md9zU1jZ/rzAxKWeAaNsWftjj++n08C9bMJL/NMh98qy5V8AcysNnq/onN694/BtZqhFLKPM58N
  54313. 7yLcZnuEvUUXBj08yrl3NI/K6s8/MT7jiOOASSXIl7WdmplNsDz4SgCbZN2fOUvRJ9e4
  54314. -----END CERTIFICATE-----
  54315. Actalis Authentication Root CA
  54316. ==============================
  54317. -----BEGIN CERTIFICATE-----
  54318. MIIFuzCCA6OgAwIBAgIIVwoRl0LE48wwDQYJKoZIhvcNAQELBQAwazELMAkGA1UEBhMCSVQxDjAM
  54319. BgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UE
  54320. AwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290IENBMB4XDTExMDkyMjExMjIwMloXDTMwMDky
  54321. MjExMjIwMlowazELMAkGA1UEBhMCSVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlz
  54322. IFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290
  54323. IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp8bEpSmkLO/lGMWwUKNvUTufClrJ
  54324. wkg4CsIcoBh/kbWHuUA/3R1oHwiD1S0eiKD4j1aPbZkCkpAW1V8IbInX4ay8IMKx4INRimlNAJZa
  54325. by/ARH6jDuSRzVju3PvHHkVH3Se5CAGfpiEd9UEtL0z9KK3giq0itFZljoZUj5NDKd45RnijMCO6
  54326. zfB9E1fAXdKDa0hMxKufgFpbOr3JpyI/gCczWw63igxdBzcIy2zSekciRDXFzMwujt0q7bd9Zg1f
  54327. YVEiVRvjRuPjPdA1YprbrxTIW6HMiRvhMCb8oJsfgadHHwTrozmSBp+Z07/T6k9QnBn+locePGX2
  54328. oxgkg4YQ51Q+qDp2JE+BIcXjDwL4k5RHILv+1A7TaLndxHqEguNTVHnd25zS8gebLra8Pu2Fbe8l
  54329. EfKXGkJh90qX6IuxEAf6ZYGyojnP9zz/GPvG8VqLWeICrHuS0E4UT1lF9gxeKF+w6D9Fz8+vm2/7
  54330. hNN3WpVvrJSEnu68wEqPSpP4RCHiMUVhUE4Q2OM1fEwZtN4Fv6MGn8i1zeQf1xcGDXqVdFUNaBr8
  54331. EBtiZJ1t4JWgw5QHVw0U5r0F+7if5t+L4sbnfpb2U8WANFAoWPASUHEXMLrmeGO89LKtmyuy/uE5
  54332. jF66CyCU3nuDuP/jVo23Eek7jPKxwV2dpAtMK9myGPW1n0sCAwEAAaNjMGEwHQYDVR0OBBYEFFLY
  54333. iDrIn3hm7YnzezhwlMkCAjbQMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUUtiIOsifeGbt
  54334. ifN7OHCUyQICNtAwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQALe3KHwGCmSUyI
  54335. WOYdiPcUZEim2FgKDk8TNd81HdTtBjHIgT5q1d07GjLukD0R0i70jsNjLiNmsGe+b7bAEzlgqqI0
  54336. JZN1Ut6nna0Oh4lScWoWPBkdg/iaKWW+9D+a2fDzWochcYBNy+A4mz+7+uAwTc+G02UQGRjRlwKx
  54337. K3JCaKygvU5a2hi/a5iB0P2avl4VSM0RFbnAKVy06Ij3Pjaut2L9HmLecHgQHEhb2rykOLpn7VU+
  54338. Xlff1ANATIGk0k9jpwlCCRT8AKnCgHNPLsBA2RF7SOp6AsDT6ygBJlh0wcBzIm2Tlf05fbsq4/aC
  54339. 4yyXX04fkZT6/iyj2HYauE2yOE+b+h1IYHkm4vP9qdCa6HCPSXrW5b0KDtst842/6+OkfcvHlXHo
  54340. 2qN8xcL4dJIEG4aspCJTQLas/kx2z/uUMsA1n3Y/buWQbqCmJqK4LL7RK4X9p2jIugErsWx0Hbhz
  54341. lefut8cl8ABMALJ+tguLHPPAUJ4lueAI3jZm/zel0btUZCzJJ7VLkn5l/9Mt4blOvH+kQSGQQXem
  54342. OR/qnuOf0GZvBeyqdn6/axag67XH/JJULysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9
  54343. vwGYT7JZVEc+NHt4bVaTLnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg==
  54344. -----END CERTIFICATE-----
  54345. Trustis FPS Root CA
  54346. ===================
  54347. -----BEGIN CERTIFICATE-----
  54348. MIIDZzCCAk+gAwIBAgIQGx+ttiD5JNM2a/fH8YygWTANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQG
  54349. EwJHQjEYMBYGA1UEChMPVHJ1c3RpcyBMaW1pdGVkMRwwGgYDVQQLExNUcnVzdGlzIEZQUyBSb290
  54350. IENBMB4XDTAzMTIyMzEyMTQwNloXDTI0MDEyMTExMzY1NFowRTELMAkGA1UEBhMCR0IxGDAWBgNV
  54351. BAoTD1RydXN0aXMgTGltaXRlZDEcMBoGA1UECxMTVHJ1c3RpcyBGUFMgUm9vdCBDQTCCASIwDQYJ
  54352. KoZIhvcNAQEBBQADggEPADCCAQoCggEBAMVQe547NdDfxIzNjpvto8A2mfRC6qc+gIMPpqdZh8mQ
  54353. RUN+AOqGeSoDvT03mYlmt+WKVoaTnGhLaASMk5MCPjDSNzoiYYkchU59j9WvezX2fihHiTHcDnlk
  54354. H5nSW7r+f2C/revnPDgpai/lkQtV/+xvWNUtyd5MZnGPDNcE2gfmHhjjvSkCqPoc4Vu5g6hBSLwa
  54355. cY3nYuUtsuvffM/bq1rKMfFMIvMFE/eC+XN5DL7XSxzA0RU8k0Fk0ea+IxciAIleH2ulrG6nS4zt
  54356. o3Lmr2NNL4XSFDWaLk6M6jKYKIahkQlBOrTh4/L68MkKokHdqeMDx4gVOxzUGpTXn2RZEm0CAwEA
  54357. AaNTMFEwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBS6+nEleYtXQSUhhgtx67JkDoshZzAd
  54358. BgNVHQ4EFgQUuvpxJXmLV0ElIYYLceuyZA6LIWcwDQYJKoZIhvcNAQEFBQADggEBAH5Y//01GX2c
  54359. GE+esCu8jowU/yyg2kdbw++BLa8F6nRIW/M+TgfHbcWzk88iNVy2P3UnXwmWzaD+vkAMXBJV+JOC
  54360. yinpXj9WV4s4NvdFGkwozZ5BuO1WTISkQMi4sKUraXAEasP41BIy+Q7DsdwyhEQsb8tGD+pmQQ9P
  54361. 8Vilpg0ND2HepZ5dfWWhPBfnqFVO76DH7cZEf1T1o+CP8HxVIo8ptoGj4W1OLBuAZ+ytIJ8MYmHV
  54362. l/9D7S3B2l0pKoU/rGXuhg8FjZBf3+6f9L/uHfuY5H+QK4R4EA5sSVPvFVtlRkpdr7r7OnIdzfYl
  54363. iB6XzCGcKQENZetX2fNXlrtIzYE=
  54364. -----END CERTIFICATE-----
  54365. Buypass Class 2 Root CA
  54366. =======================
  54367. -----BEGIN CERTIFICATE-----
  54368. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  54369. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMiBSb290IENBMB4X
  54370. DTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1owTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  54371. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIw
  54372. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1
  54373. g1Lr6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPVL4O2fuPn
  54374. 9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC911K2GScuVr1QGbNgGE41b
  54375. /+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHxMlAQTn/0hpPshNOOvEu/XAFOBz3cFIqU
  54376. CqTqc/sLUegTBxj6DvEr0VQVfTzh97QZQmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeff
  54377. awrbD02TTqigzXsu8lkBarcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgI
  54378. zRFo1clrUs3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLiFRhn
  54379. Bkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRSP/TizPJhk9H9Z2vX
  54380. Uq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN9SG9dKpN6nIDSdvHXx1iY8f93ZHs
  54381. M+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxPAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  54382. VR0OBBYEFMmAd+BikoL1RpzzuvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  54383. AAOCAgEAU18h9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s
  54384. A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3tOluwlN5E40EI
  54385. osHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo+fsicdl9sz1Gv7SEr5AcD48S
  54386. aq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYd
  54387. DnkM/crqJIByw5c/8nerQyIKx+u2DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWD
  54388. LfJ6v9r9jv6ly0UsH8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0
  54389. oyLQI+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK75t98biGC
  54390. wWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h3PFaTWwyI0PurKju7koS
  54391. CTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPzY11aWOIv4x3kqdbQCtCev9eBCfHJxyYN
  54392. rJgWVqA=
  54393. -----END CERTIFICATE-----
  54394. Buypass Class 3 Root CA
  54395. =======================
  54396. -----BEGIN CERTIFICATE-----
  54397. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  54398. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMyBSb290IENBMB4X
  54399. DTEwMTAyNjA4Mjg1OFoXDTQwMTAyNjA4Mjg1OFowTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  54400. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDMgUm9vdCBDQTCCAiIw
  54401. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKXaCpUWUOOV8l6ddjEGMnqb8RB2uACatVI2zSRH
  54402. sJ8YZLya9vrVediQYkwiL944PdbgqOkcLNt4EemOaFEVcsfzM4fkoF0LXOBXByow9c3EN3coTRiR
  54403. 5r/VUv1xLXA+58bEiuPwKAv0dpihi4dVsjoT/Lc+JzeOIuOoTyrvYLs9tznDDgFHmV0ST9tD+leh
  54404. 7fmdvhFHJlsTmKtdFoqwNxxXnUX/iJY2v7vKB3tvh2PX0DJq1l1sDPGzbjniazEuOQAnFN44wOwZ
  54405. ZoYS6J1yFhNkUsepNxz9gjDthBgd9K5c/3ATAOux9TN6S9ZV+AWNS2mw9bMoNlwUxFFzTWsL8TQH
  54406. 2xc519woe2v1n/MuwU8XKhDzzMro6/1rqy6any2CbgTUUgGTLT2G/H783+9CHaZr77kgxve9oKeV
  54407. /afmiSTYzIw0bOIjL9kSGiG5VZFvC5F5GQytQIgLcOJ60g7YaEi7ghM5EFjp2CoHxhLbWNvSO1UQ
  54408. RwUVZ2J+GGOmRj8JDlQyXr8NYnon74Do29lLBlo3WiXQCBJ31G8JUJc9yB3D34xFMFbG02SrZvPA
  54409. Xpacw8Tvw3xrizp5f7NJzz3iiZ+gMEuFuZyUJHmPfWupRWgPK9Dx2hzLabjKSWJtyNBjYt1gD1iq
  54410. j6G8BaVmos8bdrKEZLFMOVLAMLrwjEsCsLa3AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  54411. VR0OBBYEFEe4zf/lb+74suwvTg75JbCOPGvDMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  54412. AAOCAgEAACAjQTUEkMJAYmDv4jVM1z+s4jSQuKFvdvoWFqRINyzpkMLyPPgKn9iB5btb2iUspKdV
  54413. cSQy9sgL8rxq+JOssgfCX5/bzMiKqr5qb+FJEMwx14C7u8jYog5kV+qi9cKpMRXSIGrs/CIBKM+G
  54414. uIAeqcwRpTzyFrNHnfzSgCHEy9BHcEGhyoMZCCxt8l13nIoUE9Q2HJLw5QY33KbmkJs4j1xrG0aG
  54415. Q0JfPgEHU1RdZX33inOhmlRaHylDFCfChQ+1iHsaO5S3HWCntZznKWlXWpuTekMwGwPXYshApqr8
  54416. ZORK15FTAaggiG6cX0S5y2CBNOxv033aSF/rtJC8LakcC6wc1aJoIIAE1vyxjy+7SjENSoYc6+I2
  54417. KSb12tjE8nVhz36udmNKekBlk4f4HoCMhuWG1o8O/FMsYOgWYRqiPkN7zTlgVGr18okmAWiDSKIz
  54418. 6MkEkbIRNBE+6tBDGR8Dk5AM/1E9V/RBbuHLoL7ryWPNbczk+DaqaJ3tvV2XcEQNtg413OEMXbug
  54419. UZTLfhbrES+jkkXITHHZvMmZUldGL1DPvTVp9D0VzgalLA8+9oG6lLvDu79leNKGef9JOxqDDPDe
  54420. eOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq4/g7u9xN12TyUb7mqqta6THuBrxzvxNi
  54421. Cp/HuZc=
  54422. -----END CERTIFICATE-----
  54423. T-TeleSec GlobalRoot Class 3
  54424. ============================
  54425. -----BEGIN CERTIFICATE-----
  54426. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  54427. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  54428. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgx
  54429. MDAxMTAyOTU2WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  54430. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  54431. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0GCSqGSIb3
  54432. DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN8ELg63iIVl6bmlQdTQyK
  54433. 9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/RLyTPWGrTs0NvvAgJ1gORH8EGoel15YU
  54434. NpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZF
  54435. iP0Zf3WHHx+xGwpzJFu5ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W
  54436. 0eDrXltMEnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGjQjBA
  54437. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1A/d2O2GCahKqGFPr
  54438. AyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOyWL6ukK2YJ5f+AbGwUgC4TeQbIXQb
  54439. fsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ1GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzT
  54440. ucpH9sry9uetuUg/vBa3wW306gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7h
  54441. P0HHRwA11fXT91Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml
  54442. e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4pTpPDpFQUWw==
  54443. -----END CERTIFICATE-----
  54444. EE Certification Centre Root CA
  54445. ===============================
  54446. -----BEGIN CERTIFICATE-----
  54447. MIIEAzCCAuugAwIBAgIQVID5oHPtPwBMyonY43HmSjANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQG
  54448. EwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1czEoMCYGA1UEAwwfRUUgQ2Vy
  54449. dGlmaWNhdGlvbiBDZW50cmUgUm9vdCBDQTEYMBYGCSqGSIb3DQEJARYJcGtpQHNrLmVlMCIYDzIw
  54450. MTAxMDMwMTAxMDMwWhgPMjAzMDEyMTcyMzU5NTlaMHUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKDBlB
  54451. UyBTZXJ0aWZpdHNlZXJpbWlza2Vza3VzMSgwJgYDVQQDDB9FRSBDZXJ0aWZpY2F0aW9uIENlbnRy
  54452. ZSBSb290IENBMRgwFgYJKoZIhvcNAQkBFglwa2lAc2suZWUwggEiMA0GCSqGSIb3DQEBAQUAA4IB
  54453. DwAwggEKAoIBAQDIIMDs4MVLqwd4lfNE7vsLDP90jmG7sWLqI9iroWUyeuuOF0+W2Ap7kaJjbMeM
  54454. TC55v6kF/GlclY1i+blw7cNRfdCT5mzrMEvhvH2/UpvObntl8jixwKIy72KyaOBhU8E2lf/slLo2
  54455. rpwcpzIP5Xy0xm90/XsY6KxX7QYgSzIwWFv9zajmofxwvI6Sc9uXp3whrj3B9UiHbCe9nyV0gVWw
  54456. 93X2PaRka9ZP585ArQ/dMtO8ihJTmMmJ+xAdTX7Nfh9WDSFwhfYggx/2uh8Ej+p3iDXE/+pOoYtN
  54457. P2MbRMNE1CV2yreN1x5KZmTNXMWcg+HCCIia7E6j8T4cLNlsHaFLAgMBAAGjgYowgYcwDwYDVR0T
  54458. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBLyWj7qVhy/zQas8fElyalL1BSZ
  54459. MEUGA1UdJQQ+MDwGCCsGAQUFBwMCBggrBgEFBQcDAQYIKwYBBQUHAwMGCCsGAQUFBwMEBggrBgEF
  54460. BQcDCAYIKwYBBQUHAwkwDQYJKoZIhvcNAQEFBQADggEBAHv25MANqhlHt01Xo/6tu7Fq1Q+e2+Rj
  54461. xY6hUFaTlrg4wCQiZrxTFGGVv9DHKpY5P30osxBAIWrEr7BSdxjhlthWXePdNl4dp1BUoMUq5KqM
  54462. lIpPnTX/dqQGE5Gion0ARD9V04I8GtVbvFZMIi5GQ4okQC3zErg7cBqklrkar4dBGmoYDQZPxz5u
  54463. uSlNDUmJEYcyW+ZLBMjkXOZ0c5RdFpgTlf7727FE5TpwrDdr5rMzcijJs1eg9gIWiAYLtqZLICjU
  54464. 3j2LrTcFU3T+bsy8QxdxXvnFzBqpYe73dgzzcvRyrc9yAjYHR8/vGVCJYMzpJJUPwssd8m92kMfM
  54465. dcGWxZ0=
  54466. -----END CERTIFICATE-----
  54467. D-TRUST Root Class 3 CA 2 2009
  54468. ==============================
  54469. -----BEGIN CERTIFICATE-----
  54470. MIIEMzCCAxugAwIBAgIDCYPzMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  54471. DAxELVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTAe
  54472. Fw0wOTExMDUwODM1NThaFw0yOTExMDUwODM1NThaME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxE
  54473. LVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTCCASIw
  54474. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANOySs96R+91myP6Oi/WUEWJNTrGa9v+2wBoqOAD
  54475. ER03UAifTUpolDWzU9GUY6cgVq/eUXjsKj3zSEhQPgrfRlWLJ23DEE0NkVJD2IfgXU42tSHKXzlA
  54476. BF9bfsyjxiupQB7ZNoTWSPOSHjRGICTBpFGOShrvUD9pXRl/RcPHAY9RySPocq60vFYJfxLLHLGv
  54477. KZAKyVXMD9O0Gu1HNVpK7ZxzBCHQqr0ME7UAyiZsxGsMlFqVlNpQmvH/pStmMaTJOKDfHR+4CS7z
  54478. p+hnUquVH+BGPtikw8paxTGA6Eian5Rp/hnd2HN8gcqW3o7tszIFZYQ05ub9VxC1X3a/L7AQDcUC
  54479. AwEAAaOCARowggEWMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFP3aFMSfMN4hvR5COfyrYyNJ
  54480. 4PGEMA4GA1UdDwEB/wQEAwIBBjCB0wYDVR0fBIHLMIHIMIGAoH6gfIZ6bGRhcDovL2RpcmVjdG9y
  54481. eS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwUm9vdCUyMENsYXNzJTIwMyUyMENBJTIwMiUyMDIw
  54482. MDksTz1ELVRydXN0JTIwR21iSCxDPURFP2NlcnRpZmljYXRlcmV2b2NhdGlvbmxpc3QwQ6BBoD+G
  54483. PWh0dHA6Ly93d3cuZC10cnVzdC5uZXQvY3JsL2QtdHJ1c3Rfcm9vdF9jbGFzc18zX2NhXzJfMjAw
  54484. OS5jcmwwDQYJKoZIhvcNAQELBQADggEBAH+X2zDI36ScfSF6gHDOFBJpiBSVYEQBrLLpME+bUMJm
  54485. 2H6NMLVwMeniacfzcNsgFYbQDfC+rAF1hM5+n02/t2A7nPPKHeJeaNijnZflQGDSNiH+0LS4F9p0
  54486. o3/U37CYAqxva2ssJSRyoWXuJVrl5jLn8t+rSfrzkGkj2wTZ51xY/GXUl77M/C4KzCUqNQT4YJEV
  54487. dT1B/yMfGchs64JTBKbkTCJNjYy6zltz7GRUUG3RnFX7acM2w4y8PIWmawomDeCTmGCufsYkl4ph
  54488. X5GOZpIJhzbNi5stPvZR1FDUWSi9g/LMKHtThm3YJohw1+qRzT65ysCQblrGXnRl11z+o+I=
  54489. -----END CERTIFICATE-----
  54490. D-TRUST Root Class 3 CA 2 EV 2009
  54491. =================================
  54492. -----BEGIN CERTIFICATE-----
  54493. MIIEQzCCAyugAwIBAgIDCYP0MA0GCSqGSIb3DQEBCwUAMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  54494. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  54495. OTAeFw0wOTExMDUwODUwNDZaFw0yOTExMDUwODUwNDZaMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  54496. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  54497. OTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJnxhDRwui+3MKCOvXwEz75ivJn9gpfS
  54498. egpnljgJ9hBOlSJzmY3aFS3nBfwZcyK3jpgAvDw9rKFs+9Z5JUut8Mxk2og+KbgPCdM03TP1YtHh
  54499. zRnp7hhPTFiu4h7WDFsVWtg6uMQYZB7jM7K1iXdODL/ZlGsTl28So/6ZqQTMFexgaDbtCHu39b+T
  54500. 7WYxg4zGcTSHThfqr4uRjRxWQa4iN1438h3Z0S0NL2lRp75mpoo6Kr3HGrHhFPC+Oh25z1uxav60
  54501. sUYgovseO3Dvk5h9jHOW8sXvhXCtKSb8HgQ+HKDYD8tSg2J87otTlZCpV6LqYQXY+U3EJ/pure35
  54502. 11H3a6UCAwEAAaOCASQwggEgMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNOUikxiEyoZLsyv
  54503. cop9NteaHNxnMA4GA1UdDwEB/wQEAwIBBjCB3QYDVR0fBIHVMIHSMIGHoIGEoIGBhn9sZGFwOi8v
  54504. ZGlyZWN0b3J5LmQtdHJ1c3QubmV0L0NOPUQtVFJVU1QlMjBSb290JTIwQ2xhc3MlMjAzJTIwQ0El
  54505. MjAyJTIwRVYlMjAyMDA5LE89RC1UcnVzdCUyMEdtYkgsQz1ERT9jZXJ0aWZpY2F0ZXJldm9jYXRp
  54506. b25saXN0MEagRKBChkBodHRwOi8vd3d3LmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X3Jvb3RfY2xh
  54507. c3NfM19jYV8yX2V2XzIwMDkuY3JsMA0GCSqGSIb3DQEBCwUAA4IBAQA07XtaPKSUiO8aEXUHL7P+
  54508. PPoeUSbrh/Yp3uDx1MYkCenBz1UbtDDZzhr+BlGmFaQt77JLvyAoJUnRpjZ3NOhk31KxEcdzes05
  54509. nsKtjHEh8lprr988TlWvsoRlFIm5d8sqMb7Po23Pb0iUMkZv53GMoKaEGTcH8gNFCSuGdXzfX2lX
  54510. ANtu2KZyIktQ1HWYVt+3GP9DQ1CuekR78HlR10M9p9OB0/DJT7naxpeG0ILD5EJt/rDiZE4OJudA
  54511. NCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqXKVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVv
  54512. w9y4AyHqnxbxLFS1
  54513. -----END CERTIFICATE-----
  54514. CA Disig Root R2
  54515. ================
  54516. -----BEGIN CERTIFICATE-----
  54517. MIIFaTCCA1GgAwIBAgIJAJK4iNuwisFjMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNVBAYTAlNLMRMw
  54518. EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp
  54519. ZyBSb290IFIyMB4XDTEyMDcxOTA5MTUzMFoXDTQyMDcxOTA5MTUzMFowUjELMAkGA1UEBhMCU0sx
  54520. EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp
  54521. c2lnIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCio8QACdaFXS1tFPbC
  54522. w3OeNcJxVX6B+6tGUODBfEl45qt5WDza/3wcn9iXAng+a0EE6UG9vgMsRfYvZNSrXaNHPWSb6Wia
  54523. xswbP7q+sos0Ai6YVRn8jG+qX9pMzk0DIaPY0jSTVpbLTAwAFjxfGs3Ix2ymrdMxp7zo5eFm1tL7
  54524. A7RBZckQrg4FY8aAamkw/dLukO8NJ9+flXP04SXabBbeQTg06ov80egEFGEtQX6sx3dOy1FU+16S
  54525. GBsEWmjGycT6txOgmLcRK7fWV8x8nhfRyyX+hk4kLlYMeE2eARKmK6cBZW58Yh2EhN/qwGu1pSqV
  54526. g8NTEQxzHQuyRpDRQjrOQG6Vrf/GlK1ul4SOfW+eioANSW1z4nuSHsPzwfPrLgVv2RvPN3YEyLRa
  54527. 5Beny912H9AZdugsBbPWnDTYltxhh5EF5EQIM8HauQhl1K6yNg3ruji6DOWbnuuNZt2Zz9aJQfYE
  54528. koopKW1rOhzndX0CcQ7zwOe9yxndnWCywmZgtrEE7snmhrmaZkCo5xHtgUUDi/ZnWejBBhG93c+A
  54529. Ak9lQHhcR1DIm+YfgXvkRKhbhZri3lrVx/k6RGZL5DJUfORsnLMOPReisjQS1n6yqEm70XooQL6i
  54530. Fh/f5DcfEXP7kAplQ6INfPgGAVUzfbANuPT1rqVCV3w2EYx7XsQDnYx5nQIDAQABo0IwQDAPBgNV
  54531. HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUtZn4r7CU9eMg1gqtzk5WpC5u
  54532. Qu0wDQYJKoZIhvcNAQELBQADggIBACYGXnDnZTPIgm7ZnBc6G3pmsgH2eDtpXi/q/075KMOYKmFM
  54533. tCQSin1tERT3nLXK5ryeJ45MGcipvXrA1zYObYVybqjGom32+nNjf7xueQgcnYqfGopTpti72TVV
  54534. sRHFqQOzVju5hJMiXn7B9hJSi+osZ7z+Nkz1uM/Rs0mSO9MpDpkblvdhuDvEK7Z4bLQjb/D907Je
  54535. dR+Zlais9trhxTF7+9FGs9K8Z7RiVLoJ92Owk6Ka+elSLotgEqv89WBW7xBci8QaQtyDW2QOy7W8
  54536. 1k/BfDxujRNt+3vrMNDcTa/F1balTFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjx
  54537. mHHEt38OFdAlab0inSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01
  54538. utI3gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18DrG5gPcFw0
  54539. sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3OszMOl6W8KjptlwlCFtaOg
  54540. UxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8xL4ysEr3vQCj8KWefshNPZiTEUxnpHikV
  54541. 7+ZtsH8tZ/3zbBt1RqPlShfppNcL
  54542. -----END CERTIFICATE-----
  54543. ACCVRAIZ1
  54544. =========
  54545. -----BEGIN CERTIFICATE-----
  54546. MIIH0zCCBbugAwIBAgIIXsO3pkN/pOAwDQYJKoZIhvcNAQEFBQAwQjESMBAGA1UEAwwJQUNDVlJB
  54547. SVoxMRAwDgYDVQQLDAdQS0lBQ0NWMQ0wCwYDVQQKDARBQ0NWMQswCQYDVQQGEwJFUzAeFw0xMTA1
  54548. MDUwOTM3MzdaFw0zMDEyMzEwOTM3MzdaMEIxEjAQBgNVBAMMCUFDQ1ZSQUlaMTEQMA4GA1UECwwH
  54549. UEtJQUNDVjENMAsGA1UECgwEQUNDVjELMAkGA1UEBhMCRVMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  54550. DwAwggIKAoICAQCbqau/YUqXry+XZpp0X9DZlv3P4uRm7x8fRzPCRKPfmt4ftVTdFXxpNRFvu8gM
  54551. jmoYHtiP2Ra8EEg2XPBjs5BaXCQ316PWywlxufEBcoSwfdtNgM3802/J+Nq2DoLSRYWoG2ioPej0
  54552. RGy9ocLLA76MPhMAhN9KSMDjIgro6TenGEyxCQ0jVn8ETdkXhBilyNpAlHPrzg5XPAOBOp0KoVdD
  54553. aaxXbXmQeOW1tDvYvEyNKKGno6e6Ak4l0Squ7a4DIrhrIA8wKFSVf+DuzgpmndFALW4ir50awQUZ
  54554. 0m/A8p/4e7MCQvtQqR0tkw8jq8bBD5L/0KIV9VMJcRz/RROE5iZe+OCIHAr8Fraocwa48GOEAqDG
  54555. WuzndN9wrqODJerWx5eHk6fGioozl2A3ED6XPm4pFdahD9GILBKfb6qkxkLrQaLjlUPTAYVtjrs7
  54556. 8yM2x/474KElB0iryYl0/wiPgL/AlmXz7uxLaL2diMMxs0Dx6M/2OLuc5NF/1OVYm3z61PMOm3WR
  54557. 5LpSLhl+0fXNWhn8ugb2+1KoS5kE3fj5tItQo05iifCHJPqDQsGH+tUtKSpacXpkatcnYGMN285J
  54558. 9Y0fkIkyF/hzQ7jSWpOGYdbhdQrqeWZ2iE9x6wQl1gpaepPluUsXQA+xtrn13k/c4LOsOxFwYIRK
  54559. Q26ZIMApcQrAZQIDAQABo4ICyzCCAscwfQYIKwYBBQUHAQEEcTBvMEwGCCsGAQUFBzAChkBodHRw
  54560. Oi8vd3d3LmFjY3YuZXMvZmlsZWFkbWluL0FyY2hpdm9zL2NlcnRpZmljYWRvcy9yYWl6YWNjdjEu
  54561. Y3J0MB8GCCsGAQUFBzABhhNodHRwOi8vb2NzcC5hY2N2LmVzMB0GA1UdDgQWBBTSh7Tj3zcnk1X2
  54562. VuqB5TbMjB4/vTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNKHtOPfNyeTVfZW6oHlNsyM
  54563. Hj+9MIIBcwYDVR0gBIIBajCCAWYwggFiBgRVHSAAMIIBWDCCASIGCCsGAQUFBwICMIIBFB6CARAA
  54564. QQB1AHQAbwByAGkAZABhAGQAIABkAGUAIABDAGUAcgB0AGkAZgBpAGMAYQBjAGkA8wBuACAAUgBh
  54565. AO0AegAgAGQAZQAgAGwAYQAgAEEAQwBDAFYAIAAoAEEAZwBlAG4AYwBpAGEAIABkAGUAIABUAGUA
  54566. YwBuAG8AbABvAGcA7QBhACAAeQAgAEMAZQByAHQAaQBmAGkAYwBhAGMAaQDzAG4AIABFAGwAZQBj
  54567. AHQAcgDzAG4AaQBjAGEALAAgAEMASQBGACAAUQA0ADYAMAAxADEANQA2AEUAKQAuACAAQwBQAFMA
  54568. IABlAG4AIABoAHQAdABwADoALwAvAHcAdwB3AC4AYQBjAGMAdgAuAGUAczAwBggrBgEFBQcCARYk
  54569. aHR0cDovL3d3dy5hY2N2LmVzL2xlZ2lzbGFjaW9uX2MuaHRtMFUGA1UdHwROMEwwSqBIoEaGRGh0
  54570. dHA6Ly93d3cuYWNjdi5lcy9maWxlYWRtaW4vQXJjaGl2b3MvY2VydGlmaWNhZG9zL3JhaXphY2N2
  54571. MV9kZXIuY3JsMA4GA1UdDwEB/wQEAwIBBjAXBgNVHREEEDAOgQxhY2N2QGFjY3YuZXMwDQYJKoZI
  54572. hvcNAQEFBQADggIBAJcxAp/n/UNnSEQU5CmH7UwoZtCPNdpNYbdKl02125DgBS4OxnnQ8pdpD70E
  54573. R9m+27Up2pvZrqmZ1dM8MJP1jaGo/AaNRPTKFpV8M9xii6g3+CfYCS0b78gUJyCpZET/LtZ1qmxN
  54574. YEAZSUNUY9rizLpm5U9EelvZaoErQNV/+QEnWCzI7UiRfD+mAM/EKXMRNt6GGT6d7hmKG9Ww7Y49
  54575. nCrADdg9ZuM8Db3VlFzi4qc1GwQA9j9ajepDvV+JHanBsMyZ4k0ACtrJJ1vnE5Bc5PUzolVt3OAJ
  54576. TS+xJlsndQAJxGJ3KQhfnlmstn6tn1QwIgPBHnFk/vk4CpYY3QIUrCPLBhwepH2NDd4nQeit2hW3
  54577. sCPdK6jT2iWH7ehVRE2I9DZ+hJp4rPcOVkkO1jMl1oRQQmwgEh0q1b688nCBpHBgvgW1m54ERL5h
  54578. I6zppSSMEYCUWqKiuUnSwdzRp+0xESyeGabu4VXhwOrPDYTkF7eifKXeVSUG7szAh1xA2syVP1Xg
  54579. Nce4hL60Xc16gwFy7ofmXx2utYXGJt/mwZrpHgJHnyqobalbz+xFd3+YJ5oyXSrjhO7FmGYvliAd
  54580. 3djDJ9ew+f7Zfc3Qn48LFFhRny+Lwzgt3uiP1o2HpPVWQxaZLPSkVrQ0uGE3ycJYgBugl6H8WY3p
  54581. EfbRD0tVNEYqi4Y7
  54582. -----END CERTIFICATE-----
  54583. TWCA Global Root CA
  54584. ===================
  54585. -----BEGIN CERTIFICATE-----
  54586. MIIFQTCCAymgAwIBAgICDL4wDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVFcxEjAQBgNVBAoT
  54587. CVRBSVdBTi1DQTEQMA4GA1UECxMHUm9vdCBDQTEcMBoGA1UEAxMTVFdDQSBHbG9iYWwgUm9vdCBD
  54588. QTAeFw0xMjA2MjcwNjI4MzNaFw0zMDEyMzExNTU5NTlaMFExCzAJBgNVBAYTAlRXMRIwEAYDVQQK
  54589. EwlUQUlXQU4tQ0ExEDAOBgNVBAsTB1Jvb3QgQ0ExHDAaBgNVBAMTE1RXQ0EgR2xvYmFsIFJvb3Qg
  54590. Q0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCwBdvI64zEbooh745NnHEKH1Jw7W2C
  54591. nJfF10xORUnLQEK1EjRsGcJ0pDFfhQKX7EMzClPSnIyOt7h52yvVavKOZsTuKwEHktSz0ALfUPZV
  54592. r2YOy+BHYC8rMjk1Ujoog/h7FsYYuGLWRyWRzvAZEk2tY/XTP3VfKfChMBwqoJimFb3u/Rk28OKR
  54593. Q4/6ytYQJ0lM793B8YVwm8rqqFpD/G2Gb3PpN0Wp8DbHzIh1HrtsBv+baz4X7GGqcXzGHaL3SekV
  54594. tTzWoWH1EfcFbx39Eb7QMAfCKbAJTibc46KokWofwpFFiFzlmLhxpRUZyXx1EcxwdE8tmx2RRP1W
  54595. KKD+u4ZqyPpcC1jcxkt2yKsi2XMPpfRaAok/T54igu6idFMqPVMnaR1sjjIsZAAmY2E2TqNGtz99
  54596. sy2sbZCilaLOz9qC5wc0GZbpuCGqKX6mOL6OKUohZnkfs8O1CWfe1tQHRvMq2uYiN2DLgbYPoA/p
  54597. yJV/v1WRBXrPPRXAb94JlAGD1zQbzECl8LibZ9WYkTunhHiVJqRaCPgrdLQABDzfuBSO6N+pjWxn
  54598. kjMdwLfS7JLIvgm/LCkFbwJrnu+8vyq8W8BQj0FwcYeyTbcEqYSjMq+u7msXi7Kx/mzhkIyIqJdI
  54599. zshNy/MGz19qCkKxHh53L46g5pIOBvwFItIm4TFRfTLcDwIDAQABoyMwITAOBgNVHQ8BAf8EBAMC
  54600. AQYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAXzSBdu+WHdXltdkCY4QWwa6g
  54601. cFGn90xHNcgL1yg9iXHZqjNB6hQbbCEAwGxCGX6faVsgQt+i0trEfJdLjbDorMjupWkEmQqSpqsn
  54602. LhpNgb+E1HAerUf+/UqdM+DyucRFCCEK2mlpc3INvjT+lIutwx4116KD7+U4x6WFH6vPNOw/KP4M
  54603. 8VeGTslV9xzU2KV9Bnpv1d8Q34FOIWWxtuEXeZVFBs5fzNxGiWNoRI2T9GRwoD2dKAXDOXC4Ynsg
  54604. /eTb6QihuJ49CcdP+yz4k3ZB3lLg4VfSnQO8d57+nile98FRYB/e2guyLXW3Q0iT5/Z5xoRdgFlg
  54605. lPx4mI88k1HtQJAH32RjJMtOcQWh15QaiDLxInQirqWm2BJpTGCjAu4r7NRjkgtevi92a6O2JryP
  54606. A9gK8kxkRr05YuWW6zRjESjMlfGt7+/cgFhI6Uu46mWs6fyAtbXIRfmswZ/ZuepiiI7E8UuDEq3m
  54607. i4TWnsLrgxifarsbJGAzcMzs9zLzXNl5fe+epP7JI8Mk7hWSsT2RTyaGvWZzJBPqpK5jwa19hAM8
  54608. EHiGG3njxPPyBJUgriOCxLM6AGK/5jYk4Ve6xx6QddVfP5VhK8E7zeWzaGHQRiapIVJpLesux+t3
  54609. zqY6tQMzT3bR51xUAV3LePTJDL/PEo4XLSNolOer/qmyKwbQBM0=
  54610. -----END CERTIFICATE-----
  54611. TeliaSonera Root CA v1
  54612. ======================
  54613. -----BEGIN CERTIFICATE-----
  54614. MIIFODCCAyCgAwIBAgIRAJW+FqD3LkbxezmCcvqLzZYwDQYJKoZIhvcNAQEFBQAwNzEUMBIGA1UE
  54615. CgwLVGVsaWFTb25lcmExHzAdBgNVBAMMFlRlbGlhU29uZXJhIFJvb3QgQ0EgdjEwHhcNMDcxMDE4
  54616. MTIwMDUwWhcNMzIxMDE4MTIwMDUwWjA3MRQwEgYDVQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwW
  54617. VGVsaWFTb25lcmEgUm9vdCBDQSB2MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMK+
  54618. 6yfwIaPzaSZVfp3FVRaRXP3vIb9TgHot0pGMYzHw7CTww6XScnwQbfQ3t+XmfHnqjLWCi65ItqwA
  54619. 3GV17CpNX8GH9SBlK4GoRz6JI5UwFpB/6FcHSOcZrr9FZ7E3GwYq/t75rH2D+1665I+XZ75Ljo1k
  54620. B1c4VWk0Nj0TSO9P4tNmHqTPGrdeNjPUtAa9GAH9d4RQAEX1jF3oI7x+/jXh7VB7qTCNGdMJjmhn
  54621. Xb88lxhTuylixcpecsHHltTbLaC0H2kD7OriUPEMPPCs81Mt8Bz17Ww5OXOAFshSsCPN4D7c3TxH
  54622. oLs1iuKYaIu+5b9y7tL6pe0S7fyYGKkmdtwoSxAgHNN/Fnct7W+A90m7UwW7XWjH1Mh1Fj+JWov3
  54623. F0fUTPHSiXk+TT2YqGHeOh7S+F4D4MHJHIzTjU3TlTazN19jY5szFPAtJmtTfImMMsJu7D0hADnJ
  54624. oWjiUIMusDor8zagrC/kb2HCUQk5PotTubtn2txTuXZZNp1D5SDgPTJghSJRt8czu90VL6R4pgd7
  54625. gUY2BIbdeTXHlSw7sKMXNeVzH7RcWe/a6hBle3rQf5+ztCo3O3CLm1u5K7fsslESl1MpWtTwEhDc
  54626. TwK7EpIvYtQ/aUN8Ddb8WHUBiJ1YFkveupD/RwGJBmr2X7KQarMCpgKIv7NHfirZ1fpoeDVNAgMB
  54627. AAGjPzA9MA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1UdDgQWBBTwj1k4ALP1j5qW
  54628. DNXr+nuqF+gTEjANBgkqhkiG9w0BAQUFAAOCAgEAvuRcYk4k9AwI//DTDGjkk0kiP0Qnb7tt3oNm
  54629. zqjMDfz1mgbldxSR651Be5kqhOX//CHBXfDkH1e3damhXwIm/9fH907eT/j3HEbAek9ALCI18Bmx
  54630. 0GtnLLCo4MBANzX2hFxc469CeP6nyQ1Q6g2EdvZR74NTxnr/DlZJLo961gzmJ1TjTQpgcmLNkQfW
  54631. pb/ImWvtxBnmq0wROMVvMeJuScg/doAmAyYp4Db29iBT4xdwNBedY2gea+zDTYa4EzAvXUYNR0PV
  54632. G6pZDrlcjQZIrXSHX8f8MVRBE+LHIQ6e4B4N4cB7Q4WQxYpYxmUKeFfyxiMPAdkgS94P+5KFdSpc
  54633. c41teyWRyu5FrgZLAMzTsVlQ2jqIOylDRl6XK1TOU2+NSueW+r9xDkKLfP0ooNBIytrEgUy7onOT
  54634. JsjrDNYmiLbAJM+7vVvrdX3pCI6GMyx5dwlppYn8s3CQh3aP0yK7Qs69cwsgJirQmz1wHiRszYd2
  54635. qReWt88NkvuOGKmYSdGe/mBEciG5Ge3C9THxOUiIkCR1VBatzvT4aRRkOfujuLpwQMcnHL/EVlP6
  54636. Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVxSK236thZiNSQvxaz2ems
  54637. WWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY=
  54638. -----END CERTIFICATE-----
  54639. E-Tugra Certification Authority
  54640. ===============================
  54641. -----BEGIN CERTIFICATE-----
  54642. MIIGSzCCBDOgAwIBAgIIamg+nFGby1MwDQYJKoZIhvcNAQELBQAwgbIxCzAJBgNVBAYTAlRSMQ8w
  54643. DQYDVQQHDAZBbmthcmExQDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamls
  54644. ZXJpIHZlIEhpem1ldGxlcmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBN
  54645. ZXJrZXppMSgwJgYDVQQDDB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTEzMDMw
  54646. NTEyMDk0OFoXDTIzMDMwMzEyMDk0OFowgbIxCzAJBgNVBAYTAlRSMQ8wDQYDVQQHDAZBbmthcmEx
  54647. QDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamlsZXJpIHZlIEhpem1ldGxl
  54648. cmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBNZXJrZXppMSgwJgYDVQQD
  54649. DB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  54650. MIICCgKCAgEA4vU/kwVRHoViVF56C/UYB4Oufq9899SKa6VjQzm5S/fDxmSJPZQuVIBSOTkHS0vd
  54651. hQd2h8y/L5VMzH2nPbxHD5hw+IyFHnSOkm0bQNGZDbt1bsipa5rAhDGvykPL6ys06I+XawGb1Q5K
  54652. CKpbknSFQ9OArqGIW66z6l7LFpp3RMih9lRozt6Plyu6W0ACDGQXwLWTzeHxE2bODHnv0ZEoq1+g
  54653. ElIwcxmOj+GMB6LDu0rw6h8VqO4lzKRG+Bsi77MOQ7osJLjFLFzUHPhdZL3Dk14opz8n8Y4e0ypQ
  54654. BaNV2cvnOVPAmJ6MVGKLJrD3fY185MaeZkJVgkfnsliNZvcHfC425lAcP9tDJMW/hkd5s3kc91r0
  54655. E+xs+D/iWR+V7kI+ua2oMoVJl0b+SzGPWsutdEcf6ZG33ygEIqDUD13ieU/qbIWGvaimzuT6w+Gz
  54656. rt48Ue7LE3wBf4QOXVGUnhMMti6lTPk5cDZvlsouDERVxcr6XQKj39ZkjFqzAQqptQpHF//vkUAq
  54657. jqFGOjGY5RH8zLtJVor8udBhmm9lbObDyz51Sf6Pp+KJxWfXnUYTTjF2OySznhFlhqt/7x3U+Lzn
  54658. rFpct1pHXFXOVbQicVtbC/DP3KBhZOqp12gKY6fgDT+gr9Oq0n7vUaDmUStVkhUXU8u3Zg5mTPj5
  54659. dUyQ5xJwx0UCAwEAAaNjMGEwHQYDVR0OBBYEFC7j27JJ0JxUeVz6Jyr+zE7S6E5UMA8GA1UdEwEB
  54660. /wQFMAMBAf8wHwYDVR0jBBgwFoAULuPbsknQnFR5XPonKv7MTtLoTlQwDgYDVR0PAQH/BAQDAgEG
  54661. MA0GCSqGSIb3DQEBCwUAA4ICAQAFNzr0TbdF4kV1JI+2d1LoHNgQk2Xz8lkGpD4eKexd0dCrfOAK
  54662. kEh47U6YA5n+KGCRHTAduGN8qOY1tfrTYXbm1gdLymmasoR6d5NFFxWfJNCYExL/u6Au/U5Mh/jO
  54663. XKqYGwXgAEZKgoClM4so3O0409/lPun++1ndYYRP0lSWE2ETPo+Aab6TR7U1Q9Jauz1c77NCR807
  54664. VRMGsAnb/WP2OogKmW9+4c4bU2pEZiNRCHu8W1Ki/QY3OEBhj0qWuJA3+GbHeJAAFS6LrVE1Uweo
  54665. a2iu+U48BybNCAVwzDk/dr2l02cmAYamU9JgO3xDf1WKvJUawSg5TB9D0pH0clmKuVb8P7Sd2nCc
  54666. dlqMQ1DujjByTd//SffGqWfZbawCEeI6FiWnWAjLb1NBnEg4R2gz0dfHj9R0IdTDBZB6/86WiLEV
  54667. KV0jq9BgoRJP3vQXzTLlyb/IQ639Lo7xr+L0mPoSHyDYwKcMhcWQ9DstliaxLL5Mq+ux0orJ23gT
  54668. Dx4JnW2PAJ8C2sH6H3p6CcRK5ogql5+Ji/03X186zjhZhkuvcQu02PJwT58yE+Owp1fl2tpDy4Q0
  54669. 8ijE6m30Ku/Ba3ba+367hTzSU8JNvnHhRdH9I2cNE3X7z2VnIp2usAnRCf8dNL/+I5c30jn6PQ0G
  54670. C7TbO6Orb1wdtn7os4I07QZcJA==
  54671. -----END CERTIFICATE-----
  54672. T-TeleSec GlobalRoot Class 2
  54673. ============================
  54674. -----BEGIN CERTIFICATE-----
  54675. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  54676. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  54677. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwHhcNMDgx
  54678. MDAxMTA0MDE0WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  54679. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  54680. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwggEiMA0GCSqGSIb3
  54681. DQEBAQUAA4IBDwAwggEKAoIBAQCqX9obX+hzkeXaXPSi5kfl82hVYAUdAqSzm1nzHoqvNK38DcLZ
  54682. SBnuaY/JIPwhqgcZ7bBcrGXHX+0CfHt8LRvWurmAwhiCFoT6ZrAIxlQjgeTNuUk/9k9uN0goOA/F
  54683. vudocP05l03Sx5iRUKrERLMjfTlH6VJi1hKTXrcxlkIF+3anHqP1wvzpesVsqXFP6st4vGCvx970
  54684. 2cu+fjOlbpSD8DT6IavqjnKgP6TeMFvvhk1qlVtDRKgQFRzlAVfFmPHmBiiRqiDFt1MmUUOyCxGV
  54685. WOHAD3bZwI18gfNycJ5v/hqO2V81xrJvNHy+SE/iWjnX2J14np+GPgNeGYtEotXHAgMBAAGjQjBA
  54686. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS/WSA2AHmgoCJrjNXy
  54687. YdK4LMuCSjANBgkqhkiG9w0BAQsFAAOCAQEAMQOiYQsfdOhyNsZt+U2e+iKo4YFWz827n+qrkRk4
  54688. r6p8FU3ztqONpfSO9kSpp+ghla0+AGIWiPACuvxhI+YzmzB6azZie60EI4RYZeLbK4rnJVM3YlNf
  54689. vNoBYimipidx5joifsFvHZVwIEoHNN/q/xWA5brXethbdXwFeilHfkCoMRN3zUA7tFFHei4R40cR
  54690. 3p1m0IvVVGb6g1XqfMIpiRvpb7PO4gWEyS8+eIVibslfwXhjdFjASBgMmTnrpMwatXlajRWc2BQN
  54691. 9noHV8cigwUtPJslJj0Ys6lDfMjIq2SPDqO/nBudMNva0Bkuqjzx+zOAduTNrRlPBSeOE6Fuwg==
  54692. -----END CERTIFICATE-----
  54693. Atos TrustedRoot 2011
  54694. =====================
  54695. -----BEGIN CERTIFICATE-----
  54696. MIIDdzCCAl+gAwIBAgIIXDPLYixfszIwDQYJKoZIhvcNAQELBQAwPDEeMBwGA1UEAwwVQXRvcyBU
  54697. cnVzdGVkUm9vdCAyMDExMQ0wCwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0xMTA3MDcxNDU4
  54698. MzBaFw0zMDEyMzEyMzU5NTlaMDwxHjAcBgNVBAMMFUF0b3MgVHJ1c3RlZFJvb3QgMjAxMTENMAsG
  54699. A1UECgwEQXRvczELMAkGA1UEBhMCREUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCV
  54700. hTuXbyo7LjvPpvMpNb7PGKw+qtn4TaA+Gke5vJrf8v7MPkfoepbCJI419KkM/IL9bcFyYie96mvr
  54701. 54rMVD6QUM+A1JX76LWC1BTFtqlVJVfbsVD2sGBkWXppzwO3bw2+yj5vdHLqqjAqc2K+SZFhyBH+
  54702. DgMq92og3AIVDV4VavzjgsG1xZ1kCWyjWZgHJ8cblithdHFsQ/H3NYkQ4J7sVaE3IqKHBAUsR320
  54703. HLliKWYoyrfhk/WklAOZuXCFteZI6o1Q/NnezG8HDt0Lcp2AMBYHlT8oDv3FdU9T1nSatCQujgKR
  54704. z3bFmx5VdJx4IbHwLfELn8LVlhgf8FQieowHAgMBAAGjfTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7R
  54705. l+lwrrw7GWzbITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZ
  54706. bNshMBgGA1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEB
  54707. CwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8jvZfza1zv7v1Apt+h
  54708. k6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kPDpFrdRbhIfzYJsdHt6bPWHJxfrrh
  54709. TZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pcmaHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a9
  54710. 61qn8FYiqTxlVMYVqL2Gns2Dlmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G
  54711. 3mB/ufNPRJLvKrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed
  54712. -----END CERTIFICATE-----
  54713. QuoVadis Root CA 1 G3
  54714. =====================
  54715. -----BEGIN CERTIFICATE-----
  54716. MIIFYDCCA0igAwIBAgIUeFhfLq0sGUvjNwc1NBMotZbUZZMwDQYJKoZIhvcNAQELBQAwSDELMAkG
  54717. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  54718. b3QgQ0EgMSBHMzAeFw0xMjAxMTIxNzI3NDRaFw00MjAxMTIxNzI3NDRaMEgxCzAJBgNVBAYTAkJN
  54719. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDEg
  54720. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCgvlAQjunybEC0BJyFuTHK3C3kEakE
  54721. PBtVwedYMB0ktMPvhd6MLOHBPd+C5k+tR4ds7FtJwUrVu4/sh6x/gpqG7D0DmVIB0jWerNrwU8lm
  54722. PNSsAgHaJNM7qAJGr6Qc4/hzWHa39g6QDbXwz8z6+cZM5cOGMAqNF34168Xfuw6cwI2H44g4hWf6
  54723. Pser4BOcBRiYz5P1sZK0/CPTz9XEJ0ngnjybCKOLXSoh4Pw5qlPafX7PGglTvF0FBM+hSo+LdoIN
  54724. ofjSxxR3W5A2B4GbPgb6Ul5jxaYA/qXpUhtStZI5cgMJYr2wYBZupt0lwgNm3fME0UDiTouG9G/l
  54725. g6AnhF4EwfWQvTA9xO+oabw4m6SkltFi2mnAAZauy8RRNOoMqv8hjlmPSlzkYZqn0ukqeI1RPToV
  54726. 7qJZjqlc3sX5kCLliEVx3ZGZbHqfPT2YfF72vhZooF6uCyP8Wg+qInYtyaEQHeTTRCOQiJ/GKubX
  54727. 9ZqzWB4vMIkIG1SitZgj7Ah3HJVdYdHLiZxfokqRmu8hqkkWCKi9YSgxyXSthfbZxbGL0eUQMk1f
  54728. iyA6PEkfM4VZDdvLCXVDaXP7a3F98N/ETH3Goy7IlXnLc6KOTk0k+17kBL5yG6YnLUlamXrXXAkg
  54729. t3+UuU/xDRxeiEIbEbfnkduebPRq34wGmAOtzCjvpUfzUwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  54730. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUo5fW816iEOGrRZ88F2Q87gFwnMwwDQYJKoZI
  54731. hvcNAQELBQADggIBABj6W3X8PnrHX3fHyt/PX8MSxEBd1DKquGrX1RUVRpgjpeaQWxiZTOOtQqOC
  54732. MTaIzen7xASWSIsBx40Bz1szBpZGZnQdT+3Btrm0DWHMY37XLneMlhwqI2hrhVd2cDMT/uFPpiN3
  54733. GPoajOi9ZcnPP/TJF9zrx7zABC4tRi9pZsMbj/7sPtPKlL92CiUNqXsCHKnQO18LwIE6PWThv6ct
  54734. Tr1NxNgpxiIY0MWscgKCP6o6ojoilzHdCGPDdRS5YCgtW2jgFqlmgiNR9etT2DGbe+m3nUvriBbP
  54735. +V04ikkwj+3x6xn0dxoxGE1nVGwvb2X52z3sIexe9PSLymBlVNFxZPT5pqOBMzYzcfCkeF9OrYMh
  54736. 3jRJjehZrJ3ydlo28hP0r+AJx2EqbPfgna67hkooby7utHnNkDPDs3b69fBsnQGQ+p6Q9pxyz0fa
  54737. wx/kNSBT8lTR32GDpgLiJTjehTItXnOQUl1CxM49S+H5GYQd1aJQzEH7QRTDvdbJWqNjZgKAvQU6
  54738. O0ec7AAmTPWIUb+oI38YB7AL7YsmoWTTYUrrXJ/es69nA7Mf3W1daWhpq1467HxpvMc7hU6eFbm0
  54739. FU/DlXpY18ls6Wy58yljXrQs8C097Vpl4KlbQMJImYFtnh8GKjwStIsPm6Ik8KaN1nrgS7ZklmOV
  54740. hMJKzRwuJIczYOXD
  54741. -----END CERTIFICATE-----
  54742. QuoVadis Root CA 2 G3
  54743. =====================
  54744. -----BEGIN CERTIFICATE-----
  54745. MIIFYDCCA0igAwIBAgIURFc0JFuBiZs18s64KztbpybwdSgwDQYJKoZIhvcNAQELBQAwSDELMAkG
  54746. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  54747. b3QgQ0EgMiBHMzAeFw0xMjAxMTIxODU5MzJaFw00MjAxMTIxODU5MzJaMEgxCzAJBgNVBAYTAkJN
  54748. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDIg
  54749. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQChriWyARjcV4g/Ruv5r+LrI3HimtFh
  54750. ZiFfqq8nUeVuGxbULX1QsFN3vXg6YOJkApt8hpvWGo6t/x8Vf9WVHhLL5hSEBMHfNrMWn4rjyduY
  54751. NM7YMxcoRvynyfDStNVNCXJJ+fKH46nafaF9a7I6JaltUkSs+L5u+9ymc5GQYaYDFCDy54ejiK2t
  54752. oIz/pgslUiXnFgHVy7g1gQyjO/Dh4fxaXc6AcW34Sas+O7q414AB+6XrW7PFXmAqMaCvN+ggOp+o
  54753. MiwMzAkd056OXbxMmO7FGmh77FOm6RQ1o9/NgJ8MSPsc9PG/Srj61YxxSscfrf5BmrODXfKEVu+l
  54754. V0POKa2Mq1W/xPtbAd0jIaFYAI7D0GoT7RPjEiuA3GfmlbLNHiJuKvhB1PLKFAeNilUSxmn1uIZo
  54755. L1NesNKqIcGY5jDjZ1XHm26sGahVpkUG0CM62+tlXSoREfA7T8pt9DTEceT/AFr2XK4jYIVz8eQQ
  54756. sSWu1ZK7E8EM4DnatDlXtas1qnIhO4M15zHfeiFuuDIIfR0ykRVKYnLP43ehvNURG3YBZwjgQQvD
  54757. 6xVu+KQZ2aKrr+InUlYrAoosFCT5v0ICvybIxo/gbjh9Uy3l7ZizlWNof/k19N+IxWA1ksB8aRxh
  54758. lRbQ694Lrz4EEEVlWFA4r0jyWbYW8jwNkALGcC4BrTwV1wIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  54759. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU7edvdlq/YOxJW8ald7tyFnGbxD0wDQYJKoZI
  54760. hvcNAQELBQADggIBAJHfgD9DCX5xwvfrs4iP4VGyvD11+ShdyLyZm3tdquXK4Qr36LLTn91nMX66
  54761. AarHakE7kNQIXLJgapDwyM4DYvmL7ftuKtwGTTwpD4kWilhMSA/ohGHqPHKmd+RCroijQ1h5fq7K
  54762. pVMNqT1wvSAZYaRsOPxDMuHBR//47PERIjKWnML2W2mWeyAMQ0GaW/ZZGYjeVYg3UQt4XAoeo0L9
  54763. x52ID8DyeAIkVJOviYeIyUqAHerQbj5hLja7NQ4nlv1mNDthcnPxFlxHBlRJAHpYErAK74X9sbgz
  54764. dWqTHBLmYF5vHX/JHyPLhGGfHoJE+V+tYlUkmlKY7VHnoX6XOuYvHxHaU4AshZ6rNRDbIl9qxV6X
  54765. U/IyAgkwo1jwDQHVcsaxfGl7w/U2Rcxhbl5MlMVerugOXou/983g7aEOGzPuVBj+D77vfoRrQ+Nw
  54766. mNtddbINWQeFFSM51vHfqSYP1kjHs6Yi9TM3WpVHn3u6GBVv/9YUZINJ0gpnIdsPNWNgKCLjsZWD
  54767. zYWm3S8P52dSbrsvhXz1SnPnxT7AvSESBT/8twNJAlvIJebiVDj1eYeMHVOyToV7BjjHLPj4sHKN
  54768. JeV3UvQDHEimUF+IIDBu8oJDqz2XhOdT+yHBTw8imoa4WSr2Rz0ZiC3oheGe7IUIarFsNMkd7Egr
  54769. O3jtZsSOeWmD3n+M
  54770. -----END CERTIFICATE-----
  54771. QuoVadis Root CA 3 G3
  54772. =====================
  54773. -----BEGIN CERTIFICATE-----
  54774. MIIFYDCCA0igAwIBAgIULvWbAiin23r/1aOp7r0DoM8Sah0wDQYJKoZIhvcNAQELBQAwSDELMAkG
  54775. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  54776. b3QgQ0EgMyBHMzAeFw0xMjAxMTIyMDI2MzJaFw00MjAxMTIyMDI2MzJaMEgxCzAJBgNVBAYTAkJN
  54777. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDMg
  54778. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCzyw4QZ47qFJenMioKVjZ/aEzHs286
  54779. IxSR/xl/pcqs7rN2nXrpixurazHb+gtTTK/FpRp5PIpM/6zfJd5O2YIyC0TeytuMrKNuFoM7pmRL
  54780. Mon7FhY4futD4tN0SsJiCnMK3UmzV9KwCoWdcTzeo8vAMvMBOSBDGzXRU7Ox7sWTaYI+FrUoRqHe
  54781. 6okJ7UO4BUaKhvVZR74bbwEhELn9qdIoyhA5CcoTNs+cra1AdHkrAj80//ogaX3T7mH1urPnMNA3
  54782. I4ZyYUUpSFlob3emLoG+B01vr87ERRORFHAGjx+f+IdpsQ7vw4kZ6+ocYfx6bIrc1gMLnia6Et3U
  54783. VDmrJqMz6nWB2i3ND0/kA9HvFZcba5DFApCTZgIhsUfei5pKgLlVj7WiL8DWM2fafsSntARE60f7
  54784. 5li59wzweyuxwHApw0BiLTtIadwjPEjrewl5qW3aqDCYz4ByA4imW0aucnl8CAMhZa634RylsSqi
  54785. Md5mBPfAdOhx3v89WcyWJhKLhZVXGqtrdQtEPREoPHtht+KPZ0/l7DxMYIBpVzgeAVuNVejH38DM
  54786. dyM0SXV89pgR6y3e7UEuFAUCf+D+IOs15xGsIs5XPd7JMG0QA4XN8f+MFrXBsj6IbGB/kE+V9/Yt
  54787. rQE5BwT6dYB9v0lQ7e/JxHwc64B+27bQ3RP+ydOc17KXqQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  54788. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUxhfQvKjqAkPyGwaZXSuQILnXnOQwDQYJKoZI
  54789. hvcNAQELBQADggIBADRh2Va1EodVTd2jNTFGu6QHcrxfYWLopfsLN7E8trP6KZ1/AvWkyaiTt3px
  54790. KGmPc+FSkNrVvjrlt3ZqVoAh313m6Tqe5T72omnHKgqwGEfcIHB9UqM+WXzBusnIFUBhynLWcKzS
  54791. t/Ac5IYp8M7vaGPQtSCKFWGafoaYtMnCdvvMujAWzKNhxnQT5WvvoxXqA/4Ti2Tk08HS6IT7SdEQ
  54792. TXlm66r99I0xHnAUrdzeZxNMgRVhvLfZkXdxGYFgu/BYpbWcC/ePIlUnwEsBbTuZDdQdm2NnL9Du
  54793. DcpmvJRPpq3t/O5jrFc/ZSXPsoaP0Aj/uHYUbt7lJ+yreLVTubY/6CD50qi+YUbKh4yE8/nxoGib
  54794. Ih6BJpsQBJFxwAYf3KDTuVan45gtf4Od34wrnDKOMpTwATwiKp9Dwi7DmDkHOHv8XgBCH/MyJnmD
  54795. hPbl8MFREsALHgQjDFSlTC9JxUrRtm5gDWv8a4uFJGS3iQ6rJUdbPM9+Sb3H6QrG2vd+DhcI00iX
  54796. 0HGS8A85PjRqHH3Y8iKuu2n0M7SmSFXRDw4m6Oy2Cy2nhTXN/VnIn9HNPlopNLk9hM6xZdRZkZFW
  54797. dSHBd575euFgndOtBBj0fOtek49TSiIp+EgrPk2GrFt/ywaZWWDYWGWVjUTR939+J399roD1B0y2
  54798. PpxxVJkES/1Y+Zj0
  54799. -----END CERTIFICATE-----
  54800. DigiCert Assured ID Root G2
  54801. ===========================
  54802. -----BEGIN CERTIFICATE-----
  54803. MIIDljCCAn6gAwIBAgIQC5McOtY5Z+pnI7/Dr5r0SzANBgkqhkiG9w0BAQsFADBlMQswCQYDVQQG
  54804. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  54805. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIwHhcNMTMwODAxMTIwMDAwWhcNMzgw
  54806. MTE1MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  54807. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIw
  54808. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZ5ygvUj82ckmIkzTz+GoeMVSAn61UQbVH
  54809. 35ao1K+ALbkKz3X9iaV9JPrjIgwrvJUXCzO/GU1BBpAAvQxNEP4HteccbiJVMWWXvdMX0h5i89vq
  54810. bFCMP4QMls+3ywPgym2hFEwbid3tALBSfK+RbLE4E9HpEgjAALAcKxHad3A2m67OeYfcgnDmCXRw
  54811. VWmvo2ifv922ebPynXApVfSr/5Vh88lAbx3RvpO704gqu52/clpWcTs/1PPRCv4o76Pu2ZmvA9OP
  54812. YLfykqGxvYmJHzDNw6YuYjOuFgJ3RFrngQo8p0Quebg/BLxcoIfhG69Rjs3sLPr4/m3wOnyqi+Rn
  54813. lTGNAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTO
  54814. w0q5mVXyuNtgv6l+vVa1lzan1jANBgkqhkiG9w0BAQsFAAOCAQEAyqVVjOPIQW5pJ6d1Ee88hjZv
  54815. 0p3GeDgdaZaikmkuOGybfQTUiaWxMTeKySHMq2zNixya1r9I0jJmwYrA8y8678Dj1JGG0VDjA9tz
  54816. d29KOVPt3ibHtX2vK0LRdWLjSisCx1BL4GnilmwORGYQRI+tBev4eaymG+g3NJ1TyWGqolKvSnAW
  54817. hsI6yLETcDbYz+70CjTVW0z9B5yiutkBclzzTcHdDrEcDcRjvq30FPuJ7KJBDkzMyFdA0G4Dqs0M
  54818. jomZmWzwPDCvON9vvKO+KSAnq3T/EyJ43pdSVR6DtVQgA+6uwE9W3jfMw3+qBCe703e4YtsXfJwo
  54819. IhNzbM8m9Yop5w==
  54820. -----END CERTIFICATE-----
  54821. DigiCert Assured ID Root G3
  54822. ===========================
  54823. -----BEGIN CERTIFICATE-----
  54824. MIICRjCCAc2gAwIBAgIQC6Fa+h3foLVJRK/NJKBs7DAKBggqhkjOPQQDAzBlMQswCQYDVQQGEwJV
  54825. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQwIgYD
  54826. VQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  54827. MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  54828. d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwdjAQ
  54829. BgcqhkjOPQIBBgUrgQQAIgNiAAQZ57ysRGXtzbg/WPuNsVepRC0FFfLvC/8QdJ+1YlJfZn4f5dwb
  54830. RXkLzMZTCp2NXQLZqVneAlr2lSoOjThKiknGvMYDOAdfVdp+CW7if17QRSAPWXYQ1qAk8C3eNvJs
  54831. KTmjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTL0L2p4ZgF
  54832. UaFNN6KDec6NHSrkhDAKBggqhkjOPQQDAwNnADBkAjAlpIFFAmsSS3V0T8gj43DydXLefInwz5Fy
  54833. YZ5eEJJZVrmDxxDnOOlYJjZ91eQ0hjkCMHw2U/Aw5WJjOpnitqM7mzT6HtoQknFekROn3aRukswy
  54834. 1vUhZscv6pZjamVFkpUBtA==
  54835. -----END CERTIFICATE-----
  54836. DigiCert Global Root G2
  54837. =======================
  54838. -----BEGIN CERTIFICATE-----
  54839. MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQG
  54840. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  54841. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMjAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUx
  54842. MjAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  54843. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEcyMIIBIjANBgkq
  54844. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuzfNNNx7a8myaJCtSnX/RrohCgiN9RlUyfuI2/Ou8jqJ
  54845. kTx65qsGGmvPrC3oXgkkRLpimn7Wo6h+4FR1IAWsULecYxpsMNzaHxmx1x7e/dfgy5SDN67sH0NO
  54846. 3Xss0r0upS/kqbitOtSZpLYl6ZtrAGCSYP9PIUkY92eQq2EGnI/yuum06ZIya7XzV+hdG82MHauV
  54847. BJVJ8zUtluNJbd134/tJS7SsVQepj5WztCO7TG1F8PapspUwtP1MVYwnSlcUfIKdzXOS0xZKBgyM
  54848. UNGPHgm+F6HmIcr9g+UQvIOlCsRnKPZzFBQ9RnbDhxSJITRNrw9FDKZJobq7nMWxM4MphQIDAQAB
  54849. o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUTiJUIBiV5uNu
  54850. 5g/6+rkS7QYXjzkwDQYJKoZIhvcNAQELBQADggEBAGBnKJRvDkhj6zHd6mcY1Yl9PMWLSn/pvtsr
  54851. F9+wX3N3KjITOYFnQoQj8kVnNeyIv/iPsGEMNKSuIEyExtv4NeF22d+mQrvHRAiGfzZ0JFrabA0U
  54852. WTW98kndth/Jsw1HKj2ZL7tcu7XUIOGZX1NGFdtom/DzMNU+MeKNhJ7jitralj41E6Vf8PlwUHBH
  54853. QRFXGU7Aj64GxJUTFy8bJZ918rGOmaFvE7FBcf6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/
  54854. iyK5S9kJRaTepLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl
  54855. MrY=
  54856. -----END CERTIFICATE-----
  54857. DigiCert Global Root G3
  54858. =======================
  54859. -----BEGIN CERTIFICATE-----
  54860. MIICPzCCAcWgAwIBAgIQBVVWvPJepDU1w6QP1atFcjAKBggqhkjOPQQDAzBhMQswCQYDVQQGEwJV
  54861. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAwHgYD
  54862. VQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMzAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAw
  54863. MDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5k
  54864. aWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEczMHYwEAYHKoZIzj0C
  54865. AQYFK4EEACIDYgAE3afZu4q4C/sLfyHS8L6+c/MzXRq8NOrexpu80JX28MzQC7phW1FGfp4tn+6O
  54866. YwwX7Adw9c+ELkCDnOg/QW07rdOkFFk2eJ0DQ+4QE2xy3q6Ip6FrtUPOZ9wj/wMco+I+o0IwQDAP
  54867. BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUs9tIpPmhxdiuNkHMEWNp
  54868. Yim8S8YwCgYIKoZIzj0EAwMDaAAwZQIxAK288mw/EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y
  54869. 3maTD/HMsQmP3Wyr+mt/oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34
  54870. VOKa5Vt8sycX
  54871. -----END CERTIFICATE-----
  54872. DigiCert Trusted Root G4
  54873. ========================
  54874. -----BEGIN CERTIFICATE-----
  54875. MIIFkDCCA3igAwIBAgIQBZsbV56OITLiOQe9p3d1XDANBgkqhkiG9w0BAQwFADBiMQswCQYDVQQG
  54876. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSEw
  54877. HwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  54878. MTIwMDAwWjBiMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  54879. d3cuZGlnaWNlcnQuY29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwggIiMA0G
  54880. CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC/5pBzaN675F1KPDAiMGkz7MKnJS7JIT3yithZwuEp
  54881. pz1Yq3aaza57G4QNxDAf8xukOBbrVsaXbR2rsnnyyhHS5F/WBTxSD1Ifxp4VpX6+n6lXFllVcq9o
  54882. k3DCsrp1mWpzMpTREEQQLt+C8weE5nQ7bXHiLQwb7iDVySAdYyktzuxeTsiT+CFhmzTrBcZe7Fsa
  54883. vOvJz82sNEBfsXpm7nfISKhmV1efVFiODCu3T6cw2Vbuyntd463JT17lNecxy9qTXtyOj4DatpGY
  54884. QJB5w3jHtrHEtWoYOAMQjdjUN6QuBX2I9YI+EJFwq1WCQTLX2wRzKm6RAXwhTNS8rhsDdV14Ztk6
  54885. MUSaM0C/CNdaSaTC5qmgZ92kJ7yhTzm1EVgX9yRcRo9k98FpiHaYdj1ZXUJ2h4mXaXpI8OCiEhtm
  54886. mnTK3kse5w5jrubU75KSOp493ADkRSWJtppEGSt+wJS00mFt6zPZxd9LBADMfRyVw4/3IbKyEbe7
  54887. f/LVjHAsQWCqsWMYRJUadmJ+9oCw++hkpjPRiQfhvbfmQ6QYuKZ3AeEPlAwhHbJUKSWJbOUOUlFH
  54888. dL4mrLZBdd56rF+NP8m800ERElvlEFDrMcXKchYiCd98THU/Y+whX8QgUWtvsauGi0/C1kVfnSD8
  54889. oR7FwI+isX4KJpn15GkvmB0t9dmpsh3lGwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud
  54890. DwEB/wQEAwIBhjAdBgNVHQ4EFgQU7NfjgtJxXWRM3y5nP+e6mK4cD08wDQYJKoZIhvcNAQEMBQAD
  54891. ggIBALth2X2pbL4XxJEbw6GiAI3jZGgPVs93rnD5/ZpKmbnJeFwMDF/k5hQpVgs2SV1EY+CtnJYY
  54892. ZhsjDT156W1r1lT40jzBQ0CuHVD1UvyQO7uYmWlrx8GnqGikJ9yd+SeuMIW59mdNOj6PWTkiU0Tr
  54893. yF0Dyu1Qen1iIQqAyHNm0aAFYF/opbSnr6j3bTWcfFqK1qI4mfN4i/RN0iAL3gTujJtHgXINwBQy
  54894. 7zBZLq7gcfJW5GqXb5JQbZaNaHqasjYUegbyJLkJEVDXCLG4iXqEI2FCKeWjzaIgQdfRnGTZ6iah
  54895. ixTXTBmyUEFxPT9NcCOGDErcgdLMMpSEDQgJlxxPwO5rIHQw0uA5NBCFIRUBCOhVMt5xSdkoF1BN
  54896. 5r5N0XWs0Mr7QbhDparTwwVETyw2m+L64kW4I1NsBm9nVX9GtUw/bihaeSbSpKhil9Ie4u1Ki7wb
  54897. /UdKDd9nZn6yW0HQO+T0O/QEY+nvwlQAUaCKKsnOeMzV6ocEGLPOr0mIr/OSmbaz5mEP0oUA51Aa
  54898. 5BuVnRmhuZyxm7EAHu/QD09CbMkKvO5D+jpxpchNJqU1/YldvIViHTLSoCtU7ZpXwdv6EM8Zt4tK
  54899. G48BtieVU+i2iW1bvGjUI+iLUaJW+fCmgKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP
  54900. 82Z+
  54901. -----END CERTIFICATE-----
  54902. COMODO RSA Certification Authority
  54903. ==================================
  54904. -----BEGIN CERTIFICATE-----
  54905. MIIF2DCCA8CgAwIBAgIQTKr5yttjb+Af907YWwOGnTANBgkqhkiG9w0BAQwFADCBhTELMAkGA1UE
  54906. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  54907. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlv
  54908. biBBdXRob3JpdHkwHhcNMTAwMTE5MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMC
  54909. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  54910. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBB
  54911. dXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCR6FSS0gpWsawNJN3Fz0Rn
  54912. dJkrN6N9I3AAcbxT38T6KhKPS38QVr2fcHK3YX/JSw8Xpz3jsARh7v8Rl8f0hj4K+j5c+ZPmNHrZ
  54913. FGvnnLOFoIJ6dq9xkNfs/Q36nGz637CC9BR++b7Epi9Pf5l/tfxnQ3K9DADWietrLNPtj5gcFKt+
  54914. 5eNu/Nio5JIk2kNrYrhV/erBvGy2i/MOjZrkm2xpmfh4SDBF1a3hDTxFYPwyllEnvGfDyi62a+pG
  54915. x8cgoLEfZd5ICLqkTqnyg0Y3hOvozIFIQ2dOciqbXL1MGyiKXCJ7tKuY2e7gUYPDCUZObT6Z+pUX
  54916. 2nwzV0E8jVHtC7ZcryxjGt9XyD+86V3Em69FmeKjWiS0uqlWPc9vqv9JWL7wqP/0uK3pN/u6uPQL
  54917. OvnoQ0IeidiEyxPx2bvhiWC4jChWrBQdnArncevPDt09qZahSL0896+1DSJMwBGB7FY79tOi4lu3
  54918. sgQiUpWAk2nojkxl8ZEDLXB0AuqLZxUpaVICu9ffUGpVRr+goyhhf3DQw6KqLCGqR84onAZFdr+C
  54919. GCe01a60y1Dma/RMhnEw6abfFobg2P9A3fvQQoh/ozM6LlweQRGBY84YcWsr7KaKtzFcOmpH4MN5
  54920. WdYgGq/yapiqcrxXStJLnbsQ/LBMQeXtHT1eKJ2czL+zUdqnR+WEUwIDAQABo0IwQDAdBgNVHQ4E
  54921. FgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w
  54922. DQYJKoZIhvcNAQEMBQADggIBAArx1UaEt65Ru2yyTUEUAJNMnMvlwFTPoCWOAvn9sKIN9SCYPBMt
  54923. rFaisNZ+EZLpLrqeLppysb0ZRGxhNaKatBYSaVqM4dc+pBroLwP0rmEdEBsqpIt6xf4FpuHA1sj+
  54924. nq6PK7o9mfjYcwlYRm6mnPTXJ9OV2jeDchzTc+CiR5kDOF3VSXkAKRzH7JsgHAckaVd4sjn8OoSg
  54925. tZx8jb8uk2IntznaFxiuvTwJaP+EmzzV1gsD41eeFPfR60/IvYcjt7ZJQ3mFXLrrkguhxuhoqEwW
  54926. sRqZCuhTLJK7oQkYdQxlqHvLI7cawiiFwxv/0Cti76R7CZGYZ4wUAc1oBmpjIXUDgIiKboHGhfKp
  54927. pC3n9KUkEEeDys30jXlYsQab5xoq2Z0B15R97QNKyvDb6KkBPvVWmckejkk9u+UJueBPSZI9FoJA
  54928. zMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yLS0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHq
  54929. ZJx64SIDqZxubw5lT2yHh17zbqD5daWbQOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk52
  54930. 7RH89elWsn2/x20Kk4yl0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7I
  54931. LaZRfyHBNVOFBkpdn627G190
  54932. -----END CERTIFICATE-----
  54933. USERTrust RSA Certification Authority
  54934. =====================================
  54935. -----BEGIN CERTIFICATE-----
  54936. MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCBiDELMAkGA1UE
  54937. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  54938. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  54939. dGlvbiBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UE
  54940. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  54941. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  54942. dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCAEmUXNg7D2wiz
  54943. 0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2j
  54944. Y0K2dvKpOyuR+OJv0OwWIJAJPuLodMkYtJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFn
  54945. RghRy4YUVD+8M/5+bJz/Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O
  54946. +T23LLb2VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT79uq
  54947. /nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6c0Plfg6lZrEpfDKE
  54948. Y1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmTYo61Zs8liM2EuLE/pDkP2QKe6xJM
  54949. lXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97lc6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8
  54950. yexDJtC/QV9AqURE9JnnV4eeUB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+
  54951. eLf8ZxXhyVeEHg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd
  54952. BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
  54953. MAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPFUp/L+M+ZBn8b2kMVn54CVVeW
  54954. FPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KOVWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ
  54955. 7l8wXEskEVX/JJpuXior7gtNn3/3ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQ
  54956. Eg9zKC7F4iRO/Fjs8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM
  54957. 8WcRiQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYzeSf7dNXGi
  54958. FSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZXHlKYC6SQK5MNyosycdi
  54959. yA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9c
  54960. J2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRBVXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGw
  54961. sAvgnEzDHNb842m1R0aBL6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gx
  54962. Q+6IHdfGjjxDah2nGN59PRbxYvnKkKj9
  54963. -----END CERTIFICATE-----
  54964. USERTrust ECC Certification Authority
  54965. =====================================
  54966. -----BEGIN CERTIFICATE-----
  54967. MIICjzCCAhWgAwIBAgIQXIuZxVqUxdJxVt7NiYDMJjAKBggqhkjOPQQDAzCBiDELMAkGA1UEBhMC
  54968. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  54969. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  54970. biBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMC
  54971. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  54972. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  54973. biBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQarFRaqfloI+d61SRvU8Za2EurxtW2
  54974. 0eZzca7dnNYMYf3boIkDuAUU7FfO7l0/4iGzzvfUinngo4N+LZfQYcTxmdwlkWOrfzCjtHDix6Ez
  54975. nPO/LlxTsV+zfTJ/ijTjeXmjQjBAMB0GA1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1xmNjmjAOBgNV
  54976. HQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjA2Z6EWCNzklwBB
  54977. HU6+4WMBzzuqQhFkoJ2UOQIReVx7Hfpkue4WQrO/isIJxOzksU0CMQDpKmFHjFJKS04YcPbWRNZu
  54978. 9YO6bVi9JNlWSOrvxKJGgYhqOkbRqZtNyWHa0V1Xahg=
  54979. -----END CERTIFICATE-----
  54980. GlobalSign ECC Root CA - R4
  54981. ===========================
  54982. -----BEGIN CERTIFICATE-----
  54983. MIIB4TCCAYegAwIBAgIRKjikHJYKBN5CsiilC+g0mAIwCgYIKoZIzj0EAwIwUDEkMCIGA1UECxMb
  54984. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  54985. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  54986. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  54987. EwpHbG9iYWxTaWduMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEuMZ5049sJQ6fLjkZHAOkrprl
  54988. OQcJFspjsbmG+IpXwVfOQvpzofdlQv8ewQCybnMO/8ch5RikqtlxP6jUuc6MHaNCMEAwDgYDVR0P
  54989. AQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFFSwe61FuOJAf/sKbvu+M8k8o4TV
  54990. MAoGCCqGSM49BAMCA0gAMEUCIQDckqGgE6bPA7DmxCGXkPoUVy0D7O48027KqGx2vKLeuwIgJ6iF
  54991. JzWbVsaj8kfSt24bAgAXqmemFZHe+pTsewv4n4Q=
  54992. -----END CERTIFICATE-----
  54993. GlobalSign ECC Root CA - R5
  54994. ===========================
  54995. -----BEGIN CERTIFICATE-----
  54996. MIICHjCCAaSgAwIBAgIRYFlJ4CYuu1X5CneKcflK2GwwCgYIKoZIzj0EAwMwUDEkMCIGA1UECxMb
  54997. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  54998. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  54999. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  55000. EwpHbG9iYWxTaWduMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAER0UOlvt9Xb/pOdEh+J8LttV7HpI6
  55001. SFkc8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8kehOvRnkmS
  55002. h5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
  55003. BgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYIKoZIzj0EAwMDaAAwZQIxAOVpEslu28Yx
  55004. uglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7
  55005. yFz9SO8NdCKoCOJuxUnOxwy8p2Fp8fc74SrL+SvzZpA3
  55006. -----END CERTIFICATE-----
  55007. Staat der Nederlanden Root CA - G3
  55008. ==================================
  55009. -----BEGIN CERTIFICATE-----
  55010. MIIFdDCCA1ygAwIBAgIEAJiiOTANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
  55011. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  55012. Um9vdCBDQSAtIEczMB4XDTEzMTExNDExMjg0MloXDTI4MTExMzIzMDAwMFowWjELMAkGA1UEBhMC
  55013. TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
  55014. ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMzCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAL4y
  55015. olQPcPssXFnrbMSkUeiFKrPMSjTysF/zDsccPVMeiAho2G89rcKezIJnByeHaHE6n3WWIkYFsO2t
  55016. x1ueKt6c/DrGlaf1F2cY5y9JCAxcz+bMNO14+1Cx3Gsy8KL+tjzk7FqXxz8ecAgwoNzFs21v0IJy
  55017. EavSgWhZghe3eJJg+szeP4TrjTgzkApyI/o1zCZxMdFyKJLZWyNtZrVtB0LrpjPOktvA9mxjeM3K
  55018. Tj215VKb8b475lRgsGYeCasH/lSJEULR9yS6YHgamPfJEf0WwTUaVHXvQ9Plrk7O53vDxk5hUUur
  55019. mkVLoR9BvUhTFXFkC4az5S6+zqQbwSmEorXLCCN2QyIkHxcE1G6cxvx/K2Ya7Irl1s9N9WMJtxU5
  55020. 1nus6+N86U78dULI7ViVDAZCopz35HCz33JvWjdAidiFpNfxC95DGdRKWCyMijmev4SH8RY7Ngzp
  55021. 07TKbBlBUgmhHbBqv4LvcFEhMtwFdozL92TkA1CvjJFnq8Xy7ljY3r735zHPbMk7ccHViLVlvMDo
  55022. FxcHErVc0qsgk7TmgoNwNsXNo42ti+yjwUOH5kPiNL6VizXtBznaqB16nzaeErAMZRKQFWDZJkBE
  55023. 41ZgpRDUajz9QdwOWke275dhdU/Z/seyHdTtXUmzqWrLZoQT1Vyg3N9udwbRcXXIV2+vD3dbAgMB
  55024. AAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRUrfrHkleu
  55025. yjWcLhL75LpdINyUVzANBgkqhkiG9w0BAQsFAAOCAgEAMJmdBTLIXg47mAE6iqTnB/d6+Oea31BD
  55026. U5cqPco8R5gu4RV78ZLzYdqQJRZlwJ9UXQ4DO1t3ApyEtg2YXzTdO2PCwyiBwpwpLiniyMMB8jPq
  55027. KqrMCQj3ZWfGzd/TtiunvczRDnBfuCPRy5FOCvTIeuXZYzbB1N/8Ipf3YF3qKS9Ysr1YvY2WTxB1
  55028. v0h7PVGHoTx0IsL8B3+A3MSs/mrBcDCw6Y5p4ixpgZQJut3+TcCDjJRYwEYgr5wfAvg1VUkvRtTA
  55029. 8KCWAg8zxXHzniN9lLf9OtMJgwYh/WA9rjLA0u6NpvDntIJ8CsxwyXmA+P5M9zWEGYox+wrZ13+b
  55030. 8KKaa8MFSu1BYBQw0aoRQm7TIwIEC8Zl3d1Sd9qBa7Ko+gE4uZbqKmxnl4mUnrzhVNXkanjvSr0r
  55031. mj1AfsbAddJu+2gw7OyLnflJNZoaLNmzlTnVHpL3prllL+U9bTpITAjc5CgSKL59NVzq4BZ+Extq
  55032. 1z7XnvwtdbLBFNUjA9tbbws+eC8N3jONFrdI54OagQ97wUNNVQQXOEpR1VmiiXTTn74eS9fGbbeI
  55033. JG9gkaSChVtWQbzQRKtqE77RLFi3EjNYsjdj3BP1lB0/QFH1T/U67cjF68IeHRaVesd+QnGTbksV
  55034. tzDfqu1XhUisHWrdOWnk4Xl4vs4Fv6EM94B7IWcnMFk=
  55035. -----END CERTIFICATE-----
  55036. Staat der Nederlanden EV Root CA
  55037. ================================
  55038. -----BEGIN CERTIFICATE-----
  55039. MIIFcDCCA1igAwIBAgIEAJiWjTANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQGEwJOTDEeMBwGA1UE
  55040. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSkwJwYDVQQDDCBTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  55041. RVYgUm9vdCBDQTAeFw0xMDEyMDgxMTE5MjlaFw0yMjEyMDgxMTEwMjhaMFgxCzAJBgNVBAYTAk5M
  55042. MR4wHAYDVQQKDBVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xKTAnBgNVBAMMIFN0YWF0IGRlciBOZWRl
  55043. cmxhbmRlbiBFViBSb290IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA48d+ifkk
  55044. SzrSM4M1LGns3Amk41GoJSt5uAg94JG6hIXGhaTK5skuU6TJJB79VWZxXSzFYGgEt9nCUiY4iKTW
  55045. O0Cmws0/zZiTs1QUWJZV1VD+hq2kY39ch/aO5ieSZxeSAgMs3NZmdO3dZ//BYY1jTw+bbRcwJu+r
  55046. 0h8QoPnFfxZpgQNH7R5ojXKhTbImxrpsX23Wr9GxE46prfNeaXUmGD5BKyF/7otdBwadQ8QpCiv8
  55047. Kj6GyzyDOvnJDdrFmeK8eEEzduG/L13lpJhQDBXd4Pqcfzho0LKmeqfRMb1+ilgnQ7O6M5HTp5gV
  55048. XJrm0w912fxBmJc+qiXbj5IusHsMX/FjqTf5m3VpTCgmJdrV8hJwRVXj33NeN/UhbJCONVrJ0yPr
  55049. 08C+eKxCKFhmpUZtcALXEPlLVPxdhkqHz3/KRawRWrUgUY0viEeXOcDPusBCAUCZSCELa6fS/ZbV
  55050. 0b5GnUngC6agIk440ME8MLxwjyx1zNDFjFE7PZQIZCZhfbnDZY8UnCHQqv0XcgOPvZuM5l5Tnrmd
  55051. 74K74bzickFbIZTTRTeU0d8JOV3nI6qaHcptqAqGhYqCvkIH1vI4gnPah1vlPNOePqc7nvQDs/nx
  55052. fRN0Av+7oeX6AHkcpmZBiFxgV6YuCcS6/ZrPpx9Aw7vMWgpVSzs4dlG4Y4uElBbmVvMCAwEAAaNC
  55053. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFP6rAJCYniT8qcwa
  55054. ivsnuL8wbqg7MA0GCSqGSIb3DQEBCwUAA4ICAQDPdyxuVr5Os7aEAJSrR8kN0nbHhp8dB9O2tLsI
  55055. eK9p0gtJ3jPFrK3CiAJ9Brc1AsFgyb/E6JTe1NOpEyVa/m6irn0F3H3zbPB+po3u2dfOWBfoqSmu
  55056. c0iH55vKbimhZF8ZE/euBhD/UcabTVUlT5OZEAFTdfETzsemQUHSv4ilf0X8rLiltTMMgsT7B/Zq
  55057. 5SWEXwbKwYY5EdtYzXc7LMJMD16a4/CrPmEbUCTCwPTxGfARKbalGAKb12NMcIxHowNDXLldRqAN
  55058. b/9Zjr7dn3LDWyvfjFvO5QxGbJKyCqNMVEIYFRIYvdr8unRu/8G2oGTYqV9Vrp9canaW2HNnh/tN
  55059. f1zuacpzEPuKqf2evTY4SUmH9A4U8OmHuD+nT3pajnnUk+S7aFKErGzp85hwVXIy+TSrK0m1zSBi
  55060. 5Dp6Z2Orltxtrpfs/J92VoguZs9btsmksNcFuuEnL5O7Jiqik7Ab846+HUCjuTaPPoIaGl6I6lD4
  55061. WeKDRikL40Rc4ZW2aZCaFG+XroHPaO+Zmr615+F/+PoTRxZMzG0IQOeLeG9QgkRQP2YGiqtDhFZK
  55062. DyAthg710tvSeopLzaXoTvFeJiUBWSOgftL2fiFX1ye8FVdMpEbB4IMeDExNH08GGeL5qPQ6gqGy
  55063. eUN51q1veieQA6TqJIc/2b3Z6fJfUEkc7uzXLg==
  55064. -----END CERTIFICATE-----
  55065. IdenTrust Commercial Root CA 1
  55066. ==============================
  55067. -----BEGIN CERTIFICATE-----
  55068. MIIFYDCCA0igAwIBAgIQCgFCgAAAAUUjyES1AAAAAjANBgkqhkiG9w0BAQsFADBKMQswCQYDVQQG
  55069. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBS
  55070. b290IENBIDEwHhcNMTQwMTE2MTgxMjIzWhcNMzQwMTE2MTgxMjIzWjBKMQswCQYDVQQGEwJVUzES
  55071. MBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBSb290IENB
  55072. IDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnUBneP5k91DNG8W9RYYKyqU+PZ4ld
  55073. hNlT3Qwo2dfw/66VQ3KZ+bVdfIrBQuExUHTRgQ18zZshq0PirK1ehm7zCYofWjK9ouuU+ehcCuz/
  55074. mNKvcbO0U59Oh++SvL3sTzIwiEsXXlfEU8L2ApeN2WIrvyQfYo3fw7gpS0l4PJNgiCL8mdo2yMKi
  55075. 1CxUAGc1bnO/AljwpN3lsKImesrgNqUZFvX9t++uP0D1bVoE/c40yiTcdCMbXTMTEl3EASX2MN0C
  55076. XZ/g1Ue9tOsbobtJSdifWwLziuQkkORiT0/Br4sOdBeo0XKIanoBScy0RnnGF7HamB4HWfp1IYVl
  55077. 3ZBWzvurpWCdxJ35UrCLvYf5jysjCiN2O/cz4ckA82n5S6LgTrx+kzmEB/dEcH7+B1rlsazRGMzy
  55078. NeVJSQjKVsk9+w8YfYs7wRPCTY/JTw436R+hDmrfYi7LNQZReSzIJTj0+kuniVyc0uMNOYZKdHzV
  55079. WYfCP04MXFL0PfdSgvHqo6z9STQaKPNBiDoT7uje/5kdX7rL6B7yuVBgwDHTc+XvvqDtMwt0viAg
  55080. xGds8AgDelWAf0ZOlqf0Hj7h9tgJ4TNkK2PXMl6f+cB7D3hvl7yTmvmcEpB4eoCHFddydJxVdHix
  55081. uuFucAS6T6C6aMN7/zHwcz09lCqxC0EOoP5NiGVreTO01wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMC
  55082. AQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU7UQZwNPwBovupHu+QucmVMiONnYwDQYJKoZI
  55083. hvcNAQELBQADggIBAA2ukDL2pkt8RHYZYR4nKM1eVO8lvOMIkPkp165oCOGUAFjvLi5+U1KMtlwH
  55084. 6oi6mYtQlNeCgN9hCQCTrQ0U5s7B8jeUeLBfnLOic7iPBZM4zY0+sLj7wM+x8uwtLRvM7Kqas6pg
  55085. ghstO8OEPVeKlh6cdbjTMM1gCIOQ045U8U1mwF10A0Cj7oV+wh93nAbowacYXVKV7cndJZ5t+qnt
  55086. ozo00Fl72u1Q8zW/7esUTTHHYPTa8Yec4kjixsU3+wYQ+nVZZjFHKdp2mhzpgq7vmrlR94gjmmmV
  55087. YjzlVYA211QC//G5Xc7UI2/YRYRKW2XviQzdFKcgyxilJbQN+QHwotL0AMh0jqEqSI5l2xPE4iUX
  55088. feu+h1sXIFRRk0pTAwvsXcoz7WL9RccvW9xYoIA55vrX/hMUpu09lEpCdNTDd1lzzY9GvlU47/ro
  55089. kTLql1gEIt44w8y8bckzOmoKaT+gyOpyj4xjhiO9bTyWnpXgSUyqorkqG5w2gXjtw+hG4iZZRHUe
  55090. 2XWJUc0QhJ1hYMtd+ZciTY6Y5uN/9lu7rs3KSoFrXgvzUeF0K+l+J6fZmUlO+KWA2yUPHGNiiskz
  55091. Z2s8EIPGrd6ozRaOjfAHN3Gf8qv8QfXBi+wAN10J5U6A7/qxXDgGpRtK4dw4LTzcqx+QGtVKnO7R
  55092. cGzM7vRX+Bi6hG6H
  55093. -----END CERTIFICATE-----
  55094. IdenTrust Public Sector Root CA 1
  55095. =================================
  55096. -----BEGIN CERTIFICATE-----
  55097. MIIFZjCCA06gAwIBAgIQCgFCgAAAAUUjz0Z8AAAAAjANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQG
  55098. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3Rv
  55099. ciBSb290IENBIDEwHhcNMTQwMTE2MTc1MzMyWhcNMzQwMTE2MTc1MzMyWjBNMQswCQYDVQQGEwJV
  55100. UzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3RvciBS
  55101. b290IENBIDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2IpT8pEiv6EdrCvsnduTy
  55102. P4o7ekosMSqMjbCpwzFrqHd2hCa2rIFCDQjrVVi7evi8ZX3yoG2LqEfpYnYeEe4IFNGyRBb06tD6
  55103. Hi9e28tzQa68ALBKK0CyrOE7S8ItneShm+waOh7wCLPQ5CQ1B5+ctMlSbdsHyo+1W/CD80/HLaXI
  55104. rcuVIKQxKFdYWuSNG5qrng0M8gozOSI5Cpcu81N3uURF/YTLNiCBWS2ab21ISGHKTN9T0a9SvESf
  55105. qy9rg3LvdYDaBjMbXcjaY8ZNzaxmMc3R3j6HEDbhuaR672BQssvKplbgN6+rNBM5Jeg5ZuSYeqoS
  55106. mJxZZoY+rfGwyj4GD3vwEUs3oERte8uojHH01bWRNszwFcYr3lEXsZdMUD2xlVl8BX0tIdUAvwFn
  55107. ol57plzy9yLxkA2T26pEUWbMfXYD62qoKjgZl3YNa4ph+bz27nb9cCvdKTz4Ch5bQhyLVi9VGxyh
  55108. LrXHFub4qjySjmm2AcG1hp2JDws4lFTo6tyePSW8Uybt1as5qsVATFSrsrTZ2fjXctscvG29ZV/v
  55109. iDUqZi/u9rNl8DONfJhBaUYPQxxp+pu10GFqzcpL2UyQRqsVWaFHVCkugyhfHMKiq3IXAAaOReyL
  55110. 4jM9f9oZRORicsPfIsbyVtTdX5Vy7W1f90gDW/3FKqD2cyOEEBsB5wIDAQABo0IwQDAOBgNVHQ8B
  55111. Af8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU43HgntinQtnbcZFrlJPrw6PRFKMw
  55112. DQYJKoZIhvcNAQELBQADggIBAEf63QqwEZE4rU1d9+UOl1QZgkiHVIyqZJnYWv6IAcVYpZmxI1Qj
  55113. t2odIFflAWJBF9MJ23XLblSQdf4an4EKwt3X9wnQW3IV5B4Jaj0z8yGa5hV+rVHVDRDtfULAj+7A
  55114. mgjVQdZcDiFpboBhDhXAuM/FSRJSzL46zNQuOAXeNf0fb7iAaJg9TaDKQGXSc3z1i9kKlT/YPyNt
  55115. GtEqJBnZhbMX73huqVjRI9PHE+1yJX9dsXNw0H8GlwmEKYBhHfpe/3OsoOOJuBxxFcbeMX8S3OFt
  55116. m6/n6J91eEyrRjuazr8FGF1NFTwWmhlQBJqymm9li1JfPFgEKCXAZmExfrngdbkaqIHWchezxQMx
  55117. NRF4eKLg6TCMf4DfWN88uieW4oA0beOY02QnrEh+KHdcxiVhJfiFDGX6xDIvpZgF5PgLZxYWxoK4
  55118. Mhn5+bl53B/N66+rDt0b20XkeucC4pVd/GnwU2lhlXV5C15V5jgclKlZM57IcXR5f1GJtshquDDI
  55119. ajjDbp7hNxbqBWJMWxJH7ae0s1hWx0nzfxJoCTFx8G34Tkf71oXuxVhAGaQdp/lLQzfcaFpPz+vC
  55120. ZHTetBXZ9FRUGi8c15dxVJCO2SCdUyt/q4/i6jC8UDfv8Ue1fXwsBOxonbRJRBD0ckscZOf85muQ
  55121. 3Wl9af0AVqW3rLatt8o+Ae+c
  55122. -----END CERTIFICATE-----
  55123. Entrust Root Certification Authority - G2
  55124. =========================================
  55125. -----BEGIN CERTIFICATE-----
  55126. MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMCVVMxFjAUBgNV
  55127. BAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVy
  55128. bXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ug
  55129. b25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIw
  55130. HhcNMDkwNzA3MTcyNTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoT
  55131. DUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMx
  55132. OTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25s
  55133. eTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwggEi
  55134. MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP
  55135. /vaCeb9zYQYKpSfYs1/TRU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXz
  55136. HHfV1IWNcCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hWwcKU
  55137. s/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1U1+cPvQXLOZprE4y
  55138. TGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0jaWvYkxN4FisZDQSA/i2jZRjJKRx
  55139. AgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ6
  55140. 0B7vfec7aVHUbI2fkBJmqzANBgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5Z
  55141. iXMRrEPR9RP/jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ
  55142. Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v1fN2D807iDgi
  55143. nWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4RnAuknZoh8/CbCzB428Hch0P+
  55144. vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmHVHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xO
  55145. e4pIb4tF9g==
  55146. -----END CERTIFICATE-----
  55147. Entrust Root Certification Authority - EC1
  55148. ==========================================
  55149. -----BEGIN CERTIFICATE-----
  55150. MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkGA1UEBhMCVVMx
  55151. FjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVn
  55152. YWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXpl
  55153. ZCB1c2Ugb25seTEzMDEGA1UEAxMqRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  55154. IC0gRUMxMB4XDTEyMTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYw
  55155. FAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0L2xlZ2Fs
  55156. LXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhvcml6ZWQg
  55157. dXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAt
  55158. IEVDMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHy
  55159. AsWfoPZb1YsGGYZPUxBtByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef
  55160. 9eNi1KlHBz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  55161. FLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVCR98crlOZF7ZvHH3h
  55162. vxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nXhTcGtXsI/esni0qU+eH6p44mCOh8
  55163. kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G
  55164. -----END CERTIFICATE-----
  55165. CFCA EV ROOT
  55166. ============
  55167. -----BEGIN CERTIFICATE-----
  55168. MIIFjTCCA3WgAwIBAgIEGErM1jANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJDTjEwMC4GA1UE
  55169. CgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQDDAxDRkNB
  55170. IEVWIFJPT1QwHhcNMTIwODA4MDMwNzAxWhcNMjkxMjMxMDMwNzAxWjBWMQswCQYDVQQGEwJDTjEw
  55171. MC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQD
  55172. DAxDRkNBIEVWIFJPT1QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDXXWvNED8fBVnV
  55173. BU03sQ7smCuOFR36k0sXgiFxEFLXUWRwFsJVaU2OFW2fvwwbwuCjZ9YMrM8irq93VCpLTIpTUnrD
  55174. 7i7es3ElweldPe6hL6P3KjzJIx1qqx2hp/Hz7KDVRM8Vz3IvHWOX6Jn5/ZOkVIBMUtRSqy5J35DN
  55175. uF++P96hyk0g1CXohClTt7GIH//62pCfCqktQT+x8Rgp7hZZLDRJGqgG16iI0gNyejLi6mhNbiyW
  55176. ZXvKWfry4t3uMCz7zEasxGPrb382KzRzEpR/38wmnvFyXVBlWY9ps4deMm/DGIq1lY+wejfeWkU7
  55177. xzbh72fROdOXW3NiGUgthxwG+3SYIElz8AXSG7Ggo7cbcNOIabla1jj0Ytwli3i/+Oh+uFzJlU9f
  55178. py25IGvPa931DfSCt/SyZi4QKPaXWnuWFo8BGS1sbn85WAZkgwGDg8NNkt0yxoekN+kWzqotaK8K
  55179. gWU6cMGbrU1tVMoqLUuFG7OA5nBFDWteNfB/O7ic5ARwiRIlk9oKmSJgamNgTnYGmE69g60dWIol
  55180. hdLHZR4tjsbftsbhf4oEIRUpdPA+nJCdDC7xij5aqgwJHsfVPKPtl8MeNPo4+QgO48BdK4PRVmrJ
  55181. tqhUUy54Mmc9gn900PvhtgVguXDbjgv5E1hvcWAQUhC5wUEJ73IfZzF4/5YFjQIDAQABo2MwYTAf
  55182. BgNVHSMEGDAWgBTj/i39KNALtbq2osS/BqoFjJP7LzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB
  55183. /wQEAwIBBjAdBgNVHQ4EFgQU4/4t/SjQC7W6tqLEvwaqBYyT+y8wDQYJKoZIhvcNAQELBQADggIB
  55184. ACXGumvrh8vegjmWPfBEp2uEcwPenStPuiB/vHiyz5ewG5zz13ku9Ui20vsXiObTej/tUxPQ4i9q
  55185. ecsAIyjmHjdXNYmEwnZPNDatZ8POQQaIxffu2Bq41gt/UP+TqhdLjOztUmCypAbqTuv0axn96/Ua
  55186. 4CUqmtzHQTb3yHQFhDmVOdYLO6Qn+gjYXB74BGBSESgoA//vU2YApUo0FmZ8/Qmkrp5nGm9BC2sG
  55187. E5uPhnEFtC+NiWYzKXZUmhH4J/qyP5Hgzg0b8zAarb8iXRvTvyUFTeGSGn+ZnzxEk8rUQElsgIfX
  55188. BDrDMlI1Dlb4pd19xIsNER9Tyx6yF7Zod1rg1MvIB671Oi6ON7fQAUtDKXeMOZePglr4UeWJoBjn
  55189. aH9dCi77o0cOPaYjesYBx4/IXr9tgFa+iiS6M+qf4TIRnvHST4D2G0CvOJ4RUHlzEhLN5mydLIhy
  55190. PDCBBpEi6lmt2hkuIsKNuYyH4Ga8cyNfIWRjgEj1oDwYPZTISEEdQLpe/v5WOaHIz16eGWRGENoX
  55191. kbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+ZAAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3C
  55192. ekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su
  55193. -----END CERTIFICATE-----
  55194. OISTE WISeKey Global Root GB CA
  55195. ===============================
  55196. -----BEGIN CERTIFICATE-----
  55197. MIIDtTCCAp2gAwIBAgIQdrEgUnTwhYdGs/gjGvbCwDANBgkqhkiG9w0BAQsFADBtMQswCQYDVQQG
  55198. EwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNl
  55199. ZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQiBDQTAeFw0xNDEyMDExNTAw
  55200. MzJaFw0zOTEyMDExNTEwMzFaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYD
  55201. VQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEds
  55202. b2JhbCBSb290IEdCIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2Be3HEokKtaX
  55203. scriHvt9OO+Y9bI5mE4nuBFde9IllIiCFSZqGzG7qFshISvYD06fWvGxWuR51jIjK+FTzJlFXHtP
  55204. rby/h0oLS5daqPZI7H17Dc0hBt+eFf1Biki3IPShehtX1F1Q/7pn2COZH8g/497/b1t3sWtuuMlk
  55205. 9+HKQUYOKXHQuSP8yYFfTvdv37+ErXNku7dCjmn21HYdfp2nuFeKUWdy19SouJVUQHMD9ur06/4o
  55206. Qnc/nSMbsrY9gBQHTC5P99UKFg29ZkM3fiNDecNAhvVMKdqOmq0NpQSHiB6F4+lT1ZvIiwNjeOvg
  55207. GUpuuy9rM2RYk61pv48b74JIxwIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB
  55208. /zAdBgNVHQ4EFgQUNQ/INmNe4qPs+TtmFc5RUuORmj0wEAYJKwYBBAGCNxUBBAMCAQAwDQYJKoZI
  55209. hvcNAQELBQADggEBAEBM+4eymYGQfp3FsLAmzYh7KzKNbrghcViXfa43FK8+5/ea4n32cZiZBKpD
  55210. dHij40lhPnOMTZTg+XHEthYOU3gf1qKHLwI5gSk8rxWYITD+KJAAjNHhy/peyP34EEY7onhCkRd0
  55211. VQreUGdNZtGn//3ZwLWoo4rOZvUPQ82nK1d7Y0Zqqi5S2PTt4W2tKZB4SLrhI6qjiey1q5bAtEui
  55212. HZeeevJuQHHfaPFlTc58Bd9TZaml8LGXBHAVRgOY1NK/VLSgWH1Sb9pWJmLU2NuJMW8c8CLC02Ic
  55213. Nc1MaRVUGpCY3useX8p3x8uOPUNpnJpY0CQ73xtAln41rYHHTnG6iBM=
  55214. -----END CERTIFICATE-----
  55215. SZAFIR ROOT CA2
  55216. ===============
  55217. -----BEGIN CERTIFICATE-----
  55218. MIIDcjCCAlqgAwIBAgIUPopdB+xV0jLVt+O2XwHrLdzk1uQwDQYJKoZIhvcNAQELBQAwUTELMAkG
  55219. A1UEBhMCUEwxKDAmBgNVBAoMH0tyYWpvd2EgSXpiYSBSb3psaWN6ZW5pb3dhIFMuQS4xGDAWBgNV
  55220. BAMMD1NaQUZJUiBST09UIENBMjAeFw0xNTEwMTkwNzQzMzBaFw0zNTEwMTkwNzQzMzBaMFExCzAJ
  55221. BgNVBAYTAlBMMSgwJgYDVQQKDB9LcmFqb3dhIEl6YmEgUm96bGljemVuaW93YSBTLkEuMRgwFgYD
  55222. VQQDDA9TWkFGSVIgUk9PVCBDQTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC3vD5Q
  55223. qEvNQLXOYeeWyrSh2gwisPq1e3YAd4wLz32ohswmUeQgPYUM1ljj5/QqGJ3a0a4m7utT3PSQ1hNK
  55224. DJA8w/Ta0o4NkjrcsbH/ON7Dui1fgLkCvUqdGw+0w8LBZwPd3BucPbOw3gAeqDRHu5rr/gsUvTaE
  55225. 2g0gv/pby6kWIK05YO4vdbbnl5z5Pv1+TW9NL++IDWr63fE9biCloBK0TXC5ztdyO4mTp4CEHCdJ
  55226. ckm1/zuVnsHMyAHs6A6KCpbns6aH5db5BSsNl0BwPLqsdVqc1U2dAgrSS5tmS0YHF2Wtn2yIANwi
  55227. ieDhZNRnvDF5YTy7ykHNXGoAyDw4jlivAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0P
  55228. AQH/BAQDAgEGMB0GA1UdDgQWBBQuFqlKGLXLzPVvUPMjX/hd56zwyDANBgkqhkiG9w0BAQsFAAOC
  55229. AQEAtXP4A9xZWx126aMqe5Aosk3AM0+qmrHUuOQn/6mWmc5G4G18TKI4pAZw8PRBEew/R40/cof5
  55230. O/2kbytTAOD/OblqBw7rHRz2onKQy4I9EYKL0rufKq8h5mOGnXkZ7/e7DDWQw4rtTw/1zBLZpD67
  55231. oPwglV9PJi8RI4NOdQcPv5vRtB3pEAT+ymCPoky4rc/hkA/NrgrHXXu3UNLUYfrVFdvXn4dRVOul
  55232. 4+vJhaAlIDf7js4MNIThPIGyd05DpYhfhmehPea0XGG2Ptv+tyjFogeutcrKjSoS75ftwjCkySp6
  55233. +/NNIxuZMzSgLvWpCz/UXeHPhJ/iGcJfitYgHuNztw==
  55234. -----END CERTIFICATE-----
  55235. Certum Trusted Network CA 2
  55236. ===========================
  55237. -----BEGIN CERTIFICATE-----
  55238. MIIF0jCCA7qgAwIBAgIQIdbQSk8lD8kyN/yqXhKN6TANBgkqhkiG9w0BAQ0FADCBgDELMAkGA1UE
  55239. BhMCUEwxIjAgBgNVBAoTGVVuaXpldG8gVGVjaG5vbG9naWVzIFMuQS4xJzAlBgNVBAsTHkNlcnR1
  55240. bSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEkMCIGA1UEAxMbQ2VydHVtIFRydXN0ZWQgTmV0d29y
  55241. ayBDQSAyMCIYDzIwMTExMDA2MDgzOTU2WhgPMjA0NjEwMDYwODM5NTZaMIGAMQswCQYDVQQGEwJQ
  55242. TDEiMCAGA1UEChMZVW5pemV0byBUZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENl
  55243. cnRpZmljYXRpb24gQXV0aG9yaXR5MSQwIgYDVQQDExtDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENB
  55244. IDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC9+Xj45tWADGSdhhuWZGc/IjoedQF9
  55245. 7/tcZ4zJzFxrqZHmuULlIEub2pt7uZld2ZuAS9eEQCsn0+i6MLs+CRqnSZXvK0AkwpfHp+6bJe+o
  55246. CgCXhVqqndwpyeI1B+twTUrWwbNWuKFBOJvR+zF/j+Bf4bE/D44WSWDXBo0Y+aomEKsq09DRZ40b
  55247. Rr5HMNUuctHFY9rnY3lEfktjJImGLjQ/KUxSiyqnwOKRKIm5wFv5HdnnJ63/mgKXwcZQkpsCLL2p
  55248. uTRZCr+ESv/f/rOf69me4Jgj7KZrdxYq28ytOxykh9xGc14ZYmhFV+SQgkK7QtbwYeDBoz1mo130
  55249. GO6IyY0XRSmZMnUCMe4pJshrAua1YkV/NxVaI2iJ1D7eTiew8EAMvE0Xy02isx7QBlrd9pPPV3WZ
  55250. 9fqGGmd4s7+W/jTcvedSVuWz5XV710GRBdxdaeOVDUO5/IOWOZV7bIBaTxNyxtd9KXpEulKkKtVB
  55251. Rgkg/iKgtlswjbyJDNXXcPiHUv3a76xRLgezTv7QCdpw75j6VuZt27VXS9zlLCUVyJ4ueE742pye
  55252. hizKV/Ma5ciSixqClnrDvFASadgOWkaLOusm+iPJtrCBvkIApPjW/jAux9JG9uWOdf3yzLnQh1vM
  55253. BhBgu4M1t15n3kfsmUjxpKEV/q2MYo45VU85FrmxY53/twIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  55254. AQH/MB0GA1UdDgQWBBS2oVQ5AsOgP46KvPrU+Bym0ToO/TAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZI
  55255. hvcNAQENBQADggIBAHGlDs7k6b8/ONWJWsQCYftMxRQXLYtPU2sQF/xlhMcQSZDe28cmk4gmb3DW
  55256. Al45oPePq5a1pRNcgRRtDoGCERuKTsZPpd1iHkTfCVn0W3cLN+mLIMb4Ck4uWBzrM9DPhmDJ2vuA
  55257. L55MYIR4PSFk1vtBHxgP58l1cb29XN40hz5BsA72udY/CROWFC/emh1auVbONTqwX3BNXuMp8SMo
  55258. clm2q8KMZiYcdywmdjWLKKdpoPk79SPdhRB0yZADVpHnr7pH1BKXESLjokmUbOe3lEu6LaTaM4tM
  55259. pkT/WjzGHWTYtTHkpjx6qFcL2+1hGsvxznN3Y6SHb0xRONbkX8eftoEq5IVIeVheO/jbAoJnwTnb
  55260. w3RLPTYe+SmTiGhbqEQZIfCn6IENLOiTNrQ3ssqwGyZ6miUfmpqAnksqP/ujmv5zMnHCnsZy4Ypo
  55261. J/HkD7TETKVhk/iXEAcqMCWpuchxuO9ozC1+9eB+D4Kob7a6bINDd82Kkhehnlt4Fj1F4jNy3eFm
  55262. ypnTycUm/Q1oBEauttmbjL4ZvrHG8hnjXALKLNhvSgfZyTXaQHXyxKcZb55CEJh15pWLYLztxRLX
  55263. is7VmFxWlgPF7ncGNf/P5O4/E2Hu29othfDNrp2yGAlFw5Khchf8R7agCyzxxN5DaAhqXzvwdmP7
  55264. zAYspsbiDrW5viSP
  55265. -----END CERTIFICATE-----
  55266. Hellenic Academic and Research Institutions RootCA 2015
  55267. =======================================================
  55268. -----BEGIN CERTIFICATE-----
  55269. MIIGCzCCA/OgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcT
  55270. BkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0
  55271. aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNVBAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNl
  55272. YXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIwMTUwHhcNMTUwNzA3MTAxMTIxWhcNNDAwNjMwMTAx
  55273. MTIxWjCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMg
  55274. QWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNV
  55275. BAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIw
  55276. MTUwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDC+Kk/G4n8PDwEXT2QNrCROnk8Zlrv
  55277. bTkBSRq0t89/TSNTt5AA4xMqKKYx8ZEA4yjsriFBzh/a/X0SWwGDD7mwX5nh8hKDgE0GPt+sr+eh
  55278. iGsxr/CL0BgzuNtFajT0AoAkKAoCFZVedioNmToUW/bLy1O8E00BiDeUJRtCvCLYjqOWXjrZMts+
  55279. 6PAQZe104S+nfK8nNLspfZu2zwnI5dMK/IhlZXQK3HMcXM1AsRzUtoSMTFDPaI6oWa7CJ06CojXd
  55280. FPQf/7J31Ycvqm59JCfnxssm5uX+Zwdj2EUN3TpZZTlYepKZcj2chF6IIbjV9Cz82XBST3i4vTwr
  55281. i5WY9bPRaM8gFH5MXF/ni+X1NYEZN9cRCLdmvtNKzoNXADrDgfgXy5I2XdGj2HUb4Ysn6npIQf1F
  55282. GQatJ5lOwXBH3bWfgVMS5bGMSF0xQxfjjMZ6Y5ZLKTBOhE5iGV48zpeQpX8B653g+IuJ3SWYPZK2
  55283. fu/Z8VFRfS0myGlZYeCsargqNhEEelC9MoS+L9xy1dcdFkfkR2YgP/SWxa+OAXqlD3pk9Q0Yh9mu
  55284. iNX6hME6wGkoLfINaFGq46V3xqSQDqE3izEjR8EJCOtu93ib14L8hCCZSRm2Ekax+0VVFqmjZayc
  55285. Bw/qa9wfLgZy7IaIEuQt218FL+TwA9MmM+eAws1CoRc0CwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  55286. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUcRVnyMjJvXVdctA4GGqd83EkVAswDQYJKoZI
  55287. hvcNAQELBQADggIBAHW7bVRLqhBYRjTyYtcWNl0IXtVsyIe9tC5G8jH4fOpCtZMWVdyhDBKg2mF+
  55288. D1hYc2Ryx+hFjtyp8iY/xnmMsVMIM4GwVhO+5lFc2JsKT0ucVlMC6U/2DWDqTUJV6HwbISHTGzrM
  55289. d/K4kPFox/la/vot9L/J9UUbzjgQKjeKeaO04wlshYaT/4mWJ3iBj2fjRnRUjtkNaeJK9E10A/+y
  55290. d+2VZ5fkscWrv2oj6NSU4kQoYsRL4vDY4ilrGnB+JGGTe08DMiUNRSQrlrRGar9KC/eaj8GsGsVn
  55291. 82800vpzY4zvFrCopEYq+OsS7HK07/grfoxSwIuEVPkvPuNVqNxmsdnhX9izjFk0WaSrT2y7Hxjb
  55292. davYy5LNlDhhDgcGH0tGEPEVvo2FXDtKK4F5D7Rpn0lQl033DlZdwJVqwjbDG2jJ9SrcR5q+ss7F
  55293. Jej6A7na+RZukYT1HCjI/CbM1xyQVqdfbzoEvM14iQuODy+jqk+iGxI9FghAD/FGTNeqewjBCvVt
  55294. J94Cj8rDtSvK6evIIVM4pcw72Hc3MKJP2W/R8kCtQXoXxdZKNYm3QdV8hn9VTYNKpXMgwDqvkPGa
  55295. JI7ZjnHKe7iG2rKPmT4dEw0SEe7Uq/DpFXYC5ODfqiAeW2GFZECpkJcNrVPSWh2HagCXZWK0vm9q
  55296. p/UsQu0yrbYhnr68
  55297. -----END CERTIFICATE-----
  55298. Hellenic Academic and Research Institutions ECC RootCA 2015
  55299. ===========================================================
  55300. -----BEGIN CERTIFICATE-----
  55301. MIICwzCCAkqgAwIBAgIBADAKBggqhkjOPQQDAjCBqjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0
  55302. aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9u
  55303. cyBDZXJ0LiBBdXRob3JpdHkxRDBCBgNVBAMTO0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJj
  55304. aCBJbnN0aXR1dGlvbnMgRUNDIFJvb3RDQSAyMDE1MB4XDTE1MDcwNzEwMzcxMloXDTQwMDYzMDEw
  55305. MzcxMlowgaoxCzAJBgNVBAYTAkdSMQ8wDQYDVQQHEwZBdGhlbnMxRDBCBgNVBAoTO0hlbGxlbmlj
  55306. IEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9yaXR5MUQwQgYD
  55307. VQQDEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25zIEVDQyBSb290
  55308. Q0EgMjAxNTB2MBAGByqGSM49AgEGBSuBBAAiA2IABJKgQehLgoRc4vgxEZmGZE4JJS+dQS8KrjVP
  55309. dJWyUWRrjWvmP3CV8AVER6ZyOFB2lQJajq4onvktTpnvLEhvTCUp6NFxW98dwXU3tNf6e3pCnGoK
  55310. Vlp8aQuqgAkkbH7BRqNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  55311. BBYEFLQiC4KZJAEOnLvkDv2/+5cgk5kqMAoGCCqGSM49BAMCA2cAMGQCMGfOFmI4oqxiRaeplSTA
  55312. GiecMjvAwNW6qef4BENThe5SId6d9SWDPp5YSy/XZxMOIQIwBeF1Ad5o7SofTUwJCA3sS61kFyjn
  55313. dc5FZXIhF8siQQ6ME5g4mlRtm8rifOoCWCKR
  55314. -----END CERTIFICATE-----
  55315. ISRG Root X1
  55316. ============
  55317. -----BEGIN CERTIFICATE-----
  55318. MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAwTzELMAkGA1UE
  55319. BhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2VhcmNoIEdyb3VwMRUwEwYDVQQD
  55320. EwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQG
  55321. EwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMT
  55322. DElTUkcgUm9vdCBYMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54r
  55323. Vygch77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+0TM8ukj1
  55324. 3Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6UA5/TR5d8mUgjU+g4rk8K
  55325. b4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sWT8KOEUt+zwvo/7V3LvSye0rgTBIlDHCN
  55326. Aymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyHB5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ
  55327. 4Q7e2RCOFvu396j3x+UCB5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf
  55328. 1b0SHzUvKBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWnOlFu
  55329. hjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTnjh8BCNAw1FtxNrQH
  55330. usEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbwqHyGO0aoSCqI3Haadr8faqU9GY/r
  55331. OPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CIrU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4G
  55332. A1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY
  55333. 9umbbjANBgkqhkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
  55334. ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ3BebYhtF8GaV
  55335. 0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KKNFtY2PwByVS5uCbMiogziUwt
  55336. hDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJw
  55337. TdwJx4nLCgdNbOhdjsnvzqvHu7UrTkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nx
  55338. e5AW0wdeRlN8NwdCjNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZA
  55339. JzVcoyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq4RgqsahD
  55340. YVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPAmRGunUHBcnWEvgJBQl9n
  55341. JEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57demyPxgcYxn/eR44/KJ4EBs+lVDR3veyJ
  55342. m+kXQ99b21/+jh5Xos1AnX5iItreGCc=
  55343. -----END CERTIFICATE-----
  55344. AC RAIZ FNMT-RCM
  55345. ================
  55346. -----BEGIN CERTIFICATE-----
  55347. MIIFgzCCA2ugAwIBAgIPXZONMGc2yAYdGsdUhGkHMA0GCSqGSIb3DQEBCwUAMDsxCzAJBgNVBAYT
  55348. AkVTMREwDwYDVQQKDAhGTk1ULVJDTTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTAeFw0wODEw
  55349. MjkxNTU5NTZaFw0zMDAxMDEwMDAwMDBaMDsxCzAJBgNVBAYTAkVTMREwDwYDVQQKDAhGTk1ULVJD
  55350. TTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  55351. ggIBALpxgHpMhm5/yBNtwMZ9HACXjywMI7sQmkCpGreHiPibVmr75nuOi5KOpyVdWRHbNi63URcf
  55352. qQgfBBckWKo3Shjf5TnUV/3XwSyRAZHiItQDwFj8d0fsjz50Q7qsNI1NOHZnjrDIbzAzWHFctPVr
  55353. btQBULgTfmxKo0nRIBnuvMApGGWn3v7v3QqQIecaZ5JCEJhfTzC8PhxFtBDXaEAUwED653cXeuYL
  55354. j2VbPNmaUtu1vZ5Gzz3rkQUCwJaydkxNEJY7kvqcfw+Z374jNUUeAlz+taibmSXaXvMiwzn15Cou
  55355. 08YfxGyqxRxqAQVKL9LFwag0Jl1mpdICIfkYtwb1TplvqKtMUejPUBjFd8g5CSxJkjKZqLsXF3mw
  55356. WsXmo8RZZUc1g16p6DULmbvkzSDGm0oGObVo/CK67lWMK07q87Hj/LaZmtVC+nFNCM+HHmpxffnT
  55357. tOmlcYF7wk5HlqX2doWjKI/pgG6BU6VtX7hI+cL5NqYuSf+4lsKMB7ObiFj86xsc3i1w4peSMKGJ
  55358. 47xVqCfWS+2QrYv6YyVZLag13cqXM7zlzced0ezvXg5KkAYmY6252TUtB7p2ZSysV4999AeU14EC
  55359. ll2jB0nVetBX+RvnU0Z1qrB5QstocQjpYL05ac70r8NWQMetUqIJ5G+GR4of6ygnXYMgrwTJbFaa
  55360. i0b1AgMBAAGjgYMwgYAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE
  55361. FPd9xf3E6Jobd2Sn9R2gzL+HYJptMD4GA1UdIAQ3MDUwMwYEVR0gADArMCkGCCsGAQUFBwIBFh1o
  55362. dHRwOi8vd3d3LmNlcnQuZm5tdC5lcy9kcGNzLzANBgkqhkiG9w0BAQsFAAOCAgEAB5BK3/MjTvDD
  55363. nFFlm5wioooMhfNzKWtN/gHiqQxjAb8EZ6WdmF/9ARP67Jpi6Yb+tmLSbkyU+8B1RXxlDPiyN8+s
  55364. D8+Nb/kZ94/sHvJwnvDKuO+3/3Y3dlv2bojzr2IyIpMNOmqOFGYMLVN0V2Ue1bLdI4E7pWYjJ2cJ
  55365. j+F3qkPNZVEI7VFY/uY5+ctHhKQV8Xa7pO6kO8Rf77IzlhEYt8llvhjho6Tc+hj507wTmzl6NLrT
  55366. Qfv6MooqtyuGC2mDOL7Nii4LcK2NJpLuHvUBKwrZ1pebbuCoGRw6IYsMHkCtA+fdZn71uSANA+iW
  55367. +YJF1DngoABd15jmfZ5nc8OaKveri6E6FO80vFIOiZiaBECEHX5FaZNXzuvO+FB8TxxuBEOb+dY7
  55368. Ixjp6o7RTUaN8Tvkasq6+yO3m/qZASlaWFot4/nUbQ4mrcFuNLwy+AwF+mWj2zs3gyLp1txyM/1d
  55369. 8iC9djwj2ij3+RvrWWTV3F9yfiD8zYm1kGdNYno/Tq0dwzn+evQoFt9B9kiABdcPUXmsEKvU7ANm
  55370. 5mqwujGSQkBqvjrTcuFqN1W8rB2Vt2lh8kORdOag0wokRqEIr9baRRmW1FMdW4R58MD3R++Lj8UG
  55371. rp1MYp3/RgT408m2ECVAdf4WqslKYIYvuu8wd+RU4riEmViAqhOLUTpPSPaLtrM=
  55372. -----END CERTIFICATE-----
  55373. Amazon Root CA 1
  55374. ================
  55375. -----BEGIN CERTIFICATE-----
  55376. MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsFADA5MQswCQYD
  55377. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAxMB4XDTE1
  55378. MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  55379. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  55380. ggEBALJ4gHHKeNXjca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgH
  55381. FzZM9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qwIFAGbHrQ
  55382. gLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6VOujw5H5SNz/0egwLX0t
  55383. dHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L93FcXmn/6pUCyziKrlA4b9v7LWIbxcce
  55384. VOF34GfID5yHI9Y/QCB/IIDEgEw+OyQmjgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB
  55385. /zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3
  55386. DQEBCwUAA4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDIU5PM
  55387. CCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUsN+gDS63pYaACbvXy
  55388. 8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vvo/ufQJVtMVT8QtPHRh8jrdkPSHCa
  55389. 2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2
  55390. xJNDd2ZhwLnoQdeXeGADbkpyrqXRfboQnoZsG4q5WTP468SQvvG5
  55391. -----END CERTIFICATE-----
  55392. Amazon Root CA 2
  55393. ================
  55394. -----BEGIN CERTIFICATE-----
  55395. MIIFQTCCAymgAwIBAgITBmyf0pY1hp8KD+WGePhbJruKNzANBgkqhkiG9w0BAQwFADA5MQswCQYD
  55396. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAyMB4XDTE1
  55397. MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  55398. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  55399. ggIBAK2Wny2cSkxKgXlRmeyKy2tgURO8TW0G/LAIjd0ZEGrHJgw12MBvIITplLGbhQPDW9tK6Mj4
  55400. kHbZW0/jTOgGNk3Mmqw9DJArktQGGWCsN0R5hYGCrVo34A3MnaZMUnbqQ523BNFQ9lXg1dKmSYXp
  55401. N+nKfq5clU1Imj+uIFptiJXZNLhSGkOQsL9sBbm2eLfq0OQ6PBJTYv9K8nu+NQWpEjTj82R0Yiw9
  55402. AElaKP4yRLuH3WUnAnE72kr3H9rN9yFVkE8P7K6C4Z9r2UXTu/Bfh+08LDmG2j/e7HJV63mjrdvd
  55403. fLC6HM783k81ds8P+HgfajZRRidhW+mez/CiVX18JYpvL7TFz4QuK/0NURBs+18bvBt+xa47mAEx
  55404. kv8LV/SasrlX6avvDXbR8O70zoan4G7ptGmh32n2M8ZpLpcTnqWHsFcQgTfJU7O7f/aS0ZzQGPSS
  55405. btqDT6ZjmUyl+17vIWR6IF9sZIUVyzfpYgwLKhbcAS4y2j5L9Z469hdAlO+ekQiG+r5jqFoz7Mt0
  55406. Q5X5bGlSNscpb/xVA1wf+5+9R+vnSUeVC06JIglJ4PVhHvG/LopyboBZ/1c6+XUyo05f7O0oYtlN
  55407. c/LMgRdg7c3r3NunysV+Ar3yVAhU/bQtCSwXVEqY0VThUWcI0u1ufm8/0i2BWSlmy5A5lREedCf+
  55408. 3euvAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSw
  55409. DPBMMPQFWAJI/TPlUq9LhONmUjANBgkqhkiG9w0BAQwFAAOCAgEAqqiAjw54o+Ci1M3m9Zh6O+oA
  55410. A7CXDpO8Wqj2LIxyh6mx/H9z/WNxeKWHWc8w4Q0QshNabYL1auaAn6AFC2jkR2vHat+2/XcycuUY
  55411. +gn0oJMsXdKMdYV2ZZAMA3m3MSNjrXiDCYZohMr/+c8mmpJ5581LxedhpxfL86kSk5Nrp+gvU5LE
  55412. YFiwzAJRGFuFjWJZY7attN6a+yb3ACfAXVU3dJnJUH/jWS5E4ywl7uxMMne0nxrpS10gxdr9HIcW
  55413. xkPo1LsmmkVwXqkLN1PiRnsn/eBG8om3zEK2yygmbtmlyTrIQRNg91CMFa6ybRoVGld45pIq2WWQ
  55414. gj9sAq+uEjonljYE1x2igGOpm/HlurR8FLBOybEfdF849lHqm/osohHUqS0nGkWxr7JOcQ3AWEbW
  55415. aQbLU8uz/mtBzUF+fUwPfHJ5elnNXkoOrJupmHN5fLT0zLm4BwyydFy4x2+IoZCn9Kr5v2c69BoV
  55416. Yh63n749sSmvZ6ES8lgQGVMDMBu4Gon2nL2XA46jCfMdiyHxtN/kHNGfZQIG6lzWE7OE76KlXIx3
  55417. KadowGuuQNKotOrN8I1LOJwZmhsoVLiJkO/KdYE+HvJkJMcYr07/R54H9jVlpNMKVv/1F2Rs76gi
  55418. JUmTtt8AF9pYfl3uxRuw0dFfIRDH+fO6AgonB8Xx1sfT4PsJYGw=
  55419. -----END CERTIFICATE-----
  55420. Amazon Root CA 3
  55421. ================
  55422. -----BEGIN CERTIFICATE-----
  55423. MIIBtjCCAVugAwIBAgITBmyf1XSXNmY/Owua2eiedgPySjAKBggqhkjOPQQDAjA5MQswCQYDVQQG
  55424. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAzMB4XDTE1MDUy
  55425. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  55426. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCmXp8ZB
  55427. f8ANm+gBG1bG8lKlui2yEujSLtf6ycXYqm0fc4E7O5hrOXwzpcVOho6AF2hiRVd9RFgdszflZwjr
  55428. Zt6jQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSrttvXBp43
  55429. rDCGB5Fwx5zEGbF4wDAKBggqhkjOPQQDAgNJADBGAiEA4IWSoxe3jfkrBqWTrBqYaGFy+uGh0Psc
  55430. eGCmQ5nFuMQCIQCcAu/xlJyzlvnrxir4tiz+OpAUFteMYyRIHN8wfdVoOw==
  55431. -----END CERTIFICATE-----
  55432. Amazon Root CA 4
  55433. ================
  55434. -----BEGIN CERTIFICATE-----
  55435. MIIB8jCCAXigAwIBAgITBmyf18G7EEwpQ+Vxe3ssyBrBDjAKBggqhkjOPQQDAzA5MQswCQYDVQQG
  55436. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSA0MB4XDTE1MDUy
  55437. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  55438. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgNDB2MBAGByqGSM49AgEGBSuBBAAiA2IABNKrijdPo1MN
  55439. /sGKe0uoe0ZLY7Bi9i0b2whxIdIA6GO9mif78DluXeo9pcmBqqNbIJhFXRbb/egQbeOc4OO9X4Ri
  55440. 83BkM6DLJC9wuoihKqB1+IGuYgbEgds5bimwHvouXKNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV
  55441. HQ8BAf8EBAMCAYYwHQYDVR0OBBYEFNPsxzplbszh2naaVvuc84ZtV+WBMAoGCCqGSM49BAMDA2gA
  55442. MGUCMDqLIfG9fhGt0O9Yli/W651+kI0rz2ZVwyzjKKlwCkcO8DdZEv8tmZQoTipPNU0zWgIxAOp1
  55443. AE47xDqUEpHJWEadIRNyp4iciuRMStuW1KyLa2tJElMzrdfkviT8tQp21KW8EA==
  55444. -----END CERTIFICATE-----
  55445. LuxTrust Global Root 2
  55446. ======================
  55447. -----BEGIN CERTIFICATE-----
  55448. MIIFwzCCA6ugAwIBAgIUCn6m30tEntpqJIWe5rgV0xZ/u7EwDQYJKoZIhvcNAQELBQAwRjELMAkG
  55449. A1UEBhMCTFUxFjAUBgNVBAoMDUx1eFRydXN0IFMuQS4xHzAdBgNVBAMMFkx1eFRydXN0IEdsb2Jh
  55450. bCBSb290IDIwHhcNMTUwMzA1MTMyMTU3WhcNMzUwMzA1MTMyMTU3WjBGMQswCQYDVQQGEwJMVTEW
  55451. MBQGA1UECgwNTHV4VHJ1c3QgUy5BLjEfMB0GA1UEAwwWTHV4VHJ1c3QgR2xvYmFsIFJvb3QgMjCC
  55452. AiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANeFl78RmOnwYoNMPIf5U2o3C/IPPIfOb9wm
  55453. Kb3FibrJgz337spbxm1Jc7TJRqMbNBM/wYlFV/TZsfs2ZUv7COJIcRHIbjuend+JZTemhfY7RBi2
  55454. xjcwYkSSl2l9QjAk5A0MiWtj3sXh306pFGxT4GHO9hcvHTy95iJMHZP1EMShduxq3sVs35a0VkBC
  55455. wGKSMKEtFZSg0iAGCW5qbeXrt77U8PEVfIvmTroTzEsnXpk8F12PgX8zPU/TPxvsXD/wPEx1bvKm
  55456. 1Z3aLQdjAsZy6ZS8TEmVT4hSyNvoaYL4zDRbIvCGp4m9SAptZoFtyMhk+wHh9OHe2Z7d21vUKpkm
  55457. FRseTJIpgp7VkoGSQXAZ96Tlk0u8d2cx3Rz9MXANF5kM+Qw5GSoXtTBxVdUPrljhPS80m8+f9niF
  55458. wpN6cj5mj5wWEWCPnolvZ77gR1o7DJpni89Gxq44o/KnvObWhWszJHAiS8sIm7vI+AIpHb4gDEa/
  55459. a4ebsypmQjVGbKq6rfmYe+lQVRQxv7HaLe2ArWgk+2mr2HETMOZns4dA/Yl+8kPREd8vZS9kzl8U
  55460. ubG/Mb2HeFpZZYiq/FkySIbWTLkpS5XTdvN3JW1CHDiDTf2jX5t/Lax5Gw5CMZdjpPuKadUiDTSQ
  55461. MC6otOBttpSsvItO13D8xTiOZCXhTTmQzsmHhFhxAgMBAAGjgagwgaUwDwYDVR0TAQH/BAUwAwEB
  55462. /zBCBgNVHSAEOzA5MDcGByuBKwEBAQowLDAqBggrBgEFBQcCARYeaHR0cHM6Ly9yZXBvc2l0b3J5
  55463. Lmx1eHRydXN0Lmx1MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBT/GCh2+UgFLKGu8SsbK7JT
  55464. +Et8szAdBgNVHQ4EFgQU/xgodvlIBSyhrvErGyuyU/hLfLMwDQYJKoZIhvcNAQELBQADggIBAGoZ
  55465. FO1uecEsh9QNcH7X9njJCwROxLHOk3D+sFTAMs2ZMGQXvw/l4jP9BzZAcg4atmpZ1gDlaCDdLnIN
  55466. H2pkMSCEfUmmWjfrRcmF9dTHF5kH5ptV5AzoqbTOjFu1EVzPig4N1qx3gf4ynCSecs5U89BvolbW
  55467. 7MM3LGVYvlcAGvI1+ut7MV3CwRI9loGIlonBWVx65n9wNOeD4rHh4bhY79SV5GCc8JaXcozrhAIu
  55468. ZY+kt9J/Z93I055cqqmkoCUUBpvsT34tC38ddfEz2O3OuHVtPlu5mB0xDVbYQw8wkbIEa91WvpWA
  55469. VWe+2M2D2RjuLg+GLZKecBPs3lHJQ3gCpU3I+V/EkVhGFndadKpAvAefMLmx9xIX3eP/JEAdemrR
  55470. TxgKqpAd60Ae36EeRJIQmvKN4dFLRp7oRUKX6kWZ8+xm1QL68qZKJKrezrnK+T+Tb/mjuuqlPpmt
  55471. /f97mfVl7vBZKGfXkJWkE4SphMHozs51k2MavDzq1WQfLSoSOcbDWjLtR5EWDrw4wVDej8oqkDQc
  55472. 7kGUnF4ZLvhFSZl0kbAEb+MEWrGrKqv+x9CWttrhSmQGbmBNvUJO/3jaJMobtNeWOWyu8Q6qp31I
  55473. iyBMz2TWuJdGsE7RKlY6oJO9r4Ak4Ap+58rVyuiFVdw2KuGUaJPHZnJED4AhMmwlxyOAgwrr
  55474. -----END CERTIFICATE-----
  55475. TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1
  55476. =============================================
  55477. -----BEGIN CERTIFICATE-----
  55478. MIIEYzCCA0ugAwIBAgIBATANBgkqhkiG9w0BAQsFADCB0jELMAkGA1UEBhMCVFIxGDAWBgNVBAcT
  55479. D0dlYnplIC0gS29jYWVsaTFCMEAGA1UEChM5VHVya2l5ZSBCaWxpbXNlbCB2ZSBUZWtub2xvamlr
  55480. IEFyYXN0aXJtYSBLdXJ1bXUgLSBUVUJJVEFLMS0wKwYDVQQLEyRLYW11IFNlcnRpZmlrYXN5b24g
  55481. TWVya2V6aSAtIEthbXUgU00xNjA0BgNVBAMTLVRVQklUQUsgS2FtdSBTTSBTU0wgS29rIFNlcnRp
  55482. ZmlrYXNpIC0gU3VydW0gMTAeFw0xMzExMjUwODI1NTVaFw00MzEwMjUwODI1NTVaMIHSMQswCQYD
  55483. VQQGEwJUUjEYMBYGA1UEBxMPR2ViemUgLSBLb2NhZWxpMUIwQAYDVQQKEzlUdXJraXllIEJpbGlt
  55484. c2VsIHZlIFRla25vbG9qaWsgQXJhc3Rpcm1hIEt1cnVtdSAtIFRVQklUQUsxLTArBgNVBAsTJEth
  55485. bXUgU2VydGlmaWthc3lvbiBNZXJrZXppIC0gS2FtdSBTTTE2MDQGA1UEAxMtVFVCSVRBSyBLYW11
  55486. IFNNIFNTTCBLb2sgU2VydGlmaWthc2kgLSBTdXJ1bSAxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  55487. MIIBCgKCAQEAr3UwM6q7a9OZLBI3hNmNe5eA027n/5tQlT6QlVZC1xl8JoSNkvoBHToP4mQ4t4y8
  55488. 6Ij5iySrLqP1N+RAjhgleYN1Hzv/bKjFxlb4tO2KRKOrbEz8HdDc72i9z+SqzvBV96I01INrN3wc
  55489. wv61A+xXzry0tcXtAA9TNypN9E8Mg/uGz8v+jE69h/mniyFXnHrfA2eJLJ2XYacQuFWQfw4tJzh0
  55490. 3+f92k4S400VIgLI4OD8D62K18lUUMw7D8oWgITQUVbDjlZ/iSIzL+aFCr2lqBs23tPcLG07xxO9
  55491. WSMs5uWk99gL7eqQQESolbuT1dCANLZGeA4fAJNG4e7p+exPFwIDAQABo0IwQDAdBgNVHQ4EFgQU
  55492. ZT/HiobGPN08VFw1+DrtUgxHV8gwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJ
  55493. KoZIhvcNAQELBQADggEBACo/4fEyjq7hmFxLXs9rHmoJ0iKpEsdeV31zVmSAhHqT5Am5EM2fKifh
  55494. AHe+SMg1qIGf5LgsyX8OsNJLN13qudULXjS99HMpw+0mFZx+CFOKWI3QSyjfwbPfIPP54+M638yc
  55495. lNhOT8NrF7f3cuitZjO1JVOr4PhMqZ398g26rrnZqsZr+ZO7rqu4lzwDGrpDxpa5RXI4s6ehlj2R
  55496. e37AIVNMh+3yC1SVUZPVIqUNivGTDj5UDrDYyU7c8jEyVupk+eq1nRZmQnLzf9OxMUP8pI4X8W0j
  55497. q5Rm+K37DwhuJi1/FwcJsoz7UMCflo3Ptv0AnVoUmr8CRPXBwp8iXqIPoeM=
  55498. -----END CERTIFICATE-----
  55499. GDCA TrustAUTH R5 ROOT
  55500. ======================
  55501. -----BEGIN CERTIFICATE-----
  55502. MIIFiDCCA3CgAwIBAgIIfQmX/vBH6nowDQYJKoZIhvcNAQELBQAwYjELMAkGA1UEBhMCQ04xMjAw
  55503. BgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZIENPLixMVEQuMR8wHQYDVQQD
  55504. DBZHRENBIFRydXN0QVVUSCBSNSBST09UMB4XDTE0MTEyNjA1MTMxNVoXDTQwMTIzMTE1NTk1OVow
  55505. YjELMAkGA1UEBhMCQ04xMjAwBgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZ
  55506. IENPLixMVEQuMR8wHQYDVQQDDBZHRENBIFRydXN0QVVUSCBSNSBST09UMIICIjANBgkqhkiG9w0B
  55507. AQEFAAOCAg8AMIICCgKCAgEA2aMW8Mh0dHeb7zMNOwZ+Vfy1YI92hhJCfVZmPoiC7XJjDp6L3TQs
  55508. AlFRwxn9WVSEyfFrs0yw6ehGXTjGoqcuEVe6ghWinI9tsJlKCvLriXBjTnnEt1u9ol2x8kECK62p
  55509. OqPseQrsXzrj/e+APK00mxqriCZ7VqKChh/rNYmDf1+uKU49tm7srsHwJ5uu4/Ts765/94Y9cnrr
  55510. pftZTqfrlYwiOXnhLQiPzLyRuEH3FMEjqcOtmkVEs7LXLM3GKeJQEK5cy4KOFxg2fZfmiJqwTTQJ
  55511. 9Cy5WmYqsBebnh52nUpmMUHfP/vFBu8btn4aRjb3ZGM74zkYI+dndRTVdVeSN72+ahsmUPI2JgaQ
  55512. xXABZG12ZuGR224HwGGALrIuL4xwp9E7PLOR5G62xDtw8mySlwnNR30YwPO7ng/Wi64HtloPzgsM
  55513. R6flPri9fcebNaBhlzpBdRfMK5Z3KpIhHtmVdiBnaM8Nvd/WHwlqmuLMc3GkL30SgLdTMEZeS1SZ
  55514. D2fJpcjyIMGC7J0R38IC+xo70e0gmu9lZJIQDSri3nDxGGeCjGHeuLzRL5z7D9Ar7Rt2ueQ5Vfj4
  55515. oR24qoAATILnsn8JuLwwoC8N9VKejveSswoAHQBUlwbgsQfZxw9cZX08bVlX5O2ljelAU58VS6Bx
  55516. 9hoh49pwBiFYFIeFd3mqgnkCAwEAAaNCMEAwHQYDVR0OBBYEFOLJQJ9NzuiaoXzPDj9lxSmIahlR
  55517. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQDRSVfg
  55518. p8xoWLoBDysZzY2wYUWsEe1jUGn4H3++Fo/9nesLqjJHdtJnJO29fDMylyrHBYZmDRd9FBUb1Ov9
  55519. H5r2XpdptxolpAqzkT9fNqyL7FeoPueBihhXOYV0GkLH6VsTX4/5COmSdI31R9KrO9b7eGZONn35
  55520. 6ZLpBN79SWP8bfsUcZNnL0dKt7n/HipzcEYwv1ryL3ml4Y0M2fmyYzeMN2WFcGpcWwlyua1jPLHd
  55521. +PwyvzeG5LuOmCd+uh8W4XAR8gPfJWIyJyYYMoSf/wA6E7qaTfRPuBRwIrHKK5DOKcFw9C+df/KQ
  55522. HtZa37dG/OaG+svgIHZ6uqbL9XzeYqWxi+7egmaKTjowHz+Ay60nugxe19CxVsp3cbK1daFQqUBD
  55523. F8Io2c9Si1vIY9RCPqAzekYu9wogRlR+ak8x8YF+QnQ4ZXMn7sZ8uI7XpTrXmKGcjBBV09tL7ECQ
  55524. 8s1uV9JiDnxXk7Gnbc2dg7sq5+W2O3FYrf3RRbxake5TFW/TRQl1brqQXR4EzzffHqhmsYzmIGrv
  55525. /EhOdJhCrylvLmrH+33RZjEizIYAfmaDDEL0vTSSwxrqT8p+ck0LcIymSLumoRT2+1hEmRSuqguT
  55526. aaApJUqlyyvdimYHFngVV3Eb7PVHhPOeMTd61X8kreS8/f3MboPoDKi3QWwH3b08hpcv0g==
  55527. -----END CERTIFICATE-----
  55528. TrustCor RootCert CA-1
  55529. ======================
  55530. -----BEGIN CERTIFICATE-----
  55531. MIIEMDCCAxigAwIBAgIJANqb7HHzA7AZMA0GCSqGSIb3DQEBCwUAMIGkMQswCQYDVQQGEwJQQTEP
  55532. MA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3Ig
  55533. U3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5UcnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3Jp
  55534. dHkxHzAdBgNVBAMMFlRydXN0Q29yIFJvb3RDZXJ0IENBLTEwHhcNMTYwMjA0MTIzMjE2WhcNMjkx
  55535. MjMxMTcyMzE2WjCBpDELMAkGA1UEBhMCUEExDzANBgNVBAgMBlBhbmFtYTEUMBIGA1UEBwwLUGFu
  55536. YW1hIENpdHkxJDAiBgNVBAoMG1RydXN0Q29yIFN5c3RlbXMgUy4gZGUgUi5MLjEnMCUGA1UECwwe
  55537. VHJ1c3RDb3IgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MR8wHQYDVQQDDBZUcnVzdENvciBSb290Q2Vy
  55538. dCBDQS0xMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv463leLCJhJrMxnHQFgKq1mq
  55539. jQCj/IDHUHuO1CAmujIS2CNUSSUQIpidRtLByZ5OGy4sDjjzGiVoHKZaBeYei0i/mJZ0PmnK6bV4
  55540. pQa81QBeCQryJ3pS/C3Vseq0iWEk8xoT26nPUu0MJLq5nux+AHT6k61sKZKuUbS701e/s/OojZz0
  55541. JEsq1pme9J7+wH5COucLlVPat2gOkEz7cD+PSiyU8ybdY2mplNgQTsVHCJCZGxdNuWxu72CVEY4h
  55542. gLW9oHPY0LJ3xEXqWib7ZnZ2+AYfYW0PVcWDtxBWcgYHpfOxGgMFZA6dWorWhnAbJN7+KIor0Gqw
  55543. /Hqi3LJ5DotlDwIDAQABo2MwYTAdBgNVHQ4EFgQU7mtJPHo/DeOxCbeKyKsZn3MzUOcwHwYDVR0j
  55544. BBgwFoAU7mtJPHo/DeOxCbeKyKsZn3MzUOcwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  55545. AYYwDQYJKoZIhvcNAQELBQADggEBACUY1JGPE+6PHh0RU9otRCkZoB5rMZ5NDp6tPVxBb5UrJKF5
  55546. mDo4Nvu7Zp5I/5CQ7z3UuJu0h3U/IJvOcs+hVcFNZKIZBqEHMwwLKeXx6quj7LUKdJDHfXLy11yf
  55547. ke+Ri7fc7Waiz45mO7yfOgLgJ90WmMCV1Aqk5IGadZQ1nJBfiDcGrVmVCrDRZ9MZyonnMlo2HD6C
  55548. qFqTvsbQZJG2z9m2GM/bftJlo6bEjhcxwft+dtvTheNYsnd6djtsL1Ac59v2Z3kf9YKVmgenFK+P
  55549. 3CghZwnS1k1aHBkcjndcw5QkPTJrS37UeJSDvjdNzl/HHk484IkzlQsPpTLWPFp5LBk=
  55550. -----END CERTIFICATE-----
  55551. TrustCor RootCert CA-2
  55552. ======================
  55553. -----BEGIN CERTIFICATE-----
  55554. MIIGLzCCBBegAwIBAgIIJaHfyjPLWQIwDQYJKoZIhvcNAQELBQAwgaQxCzAJBgNVBAYTAlBBMQ8w
  55555. DQYDVQQIDAZQYW5hbWExFDASBgNVBAcMC1BhbmFtYSBDaXR5MSQwIgYDVQQKDBtUcnVzdENvciBT
  55556. eXN0ZW1zIFMuIGRlIFIuTC4xJzAlBgNVBAsMHlRydXN0Q29yIENlcnRpZmljYXRlIEF1dGhvcml0
  55557. eTEfMB0GA1UEAwwWVHJ1c3RDb3IgUm9vdENlcnQgQ0EtMjAeFw0xNjAyMDQxMjMyMjNaFw0zNDEy
  55558. MzExNzI2MzlaMIGkMQswCQYDVQQGEwJQQTEPMA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5h
  55559. bWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3IgU3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5U
  55560. cnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxHzAdBgNVBAMMFlRydXN0Q29yIFJvb3RDZXJ0
  55561. IENBLTIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnIG7CKqJiJJWQdsg4foDSq8Gb
  55562. ZQWU9MEKENUCrO2fk8eHyLAnK0IMPQo+QVqedd2NyuCb7GgypGmSaIwLgQ5WoD4a3SwlFIIvl9Nk
  55563. RvRUqdw6VC0xK5mC8tkq1+9xALgxpL56JAfDQiDyitSSBBtlVkxs1Pu2YVpHI7TYabS3OtB0PAx1
  55564. oYxOdqHp2yqlO/rOsP9+aij9JxzIsekp8VduZLTQwRVtDr4uDkbIXvRR/u8OYzo7cbrPb1nKDOOb
  55565. XUm4TOJXsZiKQlecdu/vvdFoqNL0Cbt3Nb4lggjEFixEIFapRBF37120Hapeaz6LMvYHL1cEksr1
  55566. /p3C6eizjkxLAjHZ5DxIgif3GIJ2SDpxsROhOdUuxTTCHWKF3wP+TfSvPd9cW436cOGlfifHhi5q
  55567. jxLGhF5DUVCcGZt45vz27Ud+ez1m7xMTiF88oWP7+ayHNZ/zgp6kPwqcMWmLmaSISo5uZk3vFsQP
  55568. eSghYA2FFn3XVDjxklb9tTNMg9zXEJ9L/cb4Qr26fHMC4P99zVvh1Kxhe1fVSntb1IVYJ12/+Ctg
  55569. rKAmrhQhJ8Z3mjOAPF5GP/fDsaOGM8boXg25NSyqRsGFAnWAoOsk+xWq5Gd/bnc/9ASKL3x74xdh
  55570. 8N0JqSDIvgmk0H5Ew7IwSjiqqewYmgeCK9u4nBit2uBGF6zPXQIDAQABo2MwYTAdBgNVHQ4EFgQU
  55571. 2f4hQG6UnrybPZx9mCAZ5YwwYrIwHwYDVR0jBBgwFoAU2f4hQG6UnrybPZx9mCAZ5YwwYrIwDwYD
  55572. VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQELBQADggIBAJ5Fngw7tu/h
  55573. Osh80QA9z+LqBrWyOrsGS2h60COXdKcs8AjYeVrXWoSK2BKaG9l9XE1wxaX5q+WjiYndAfrs3fnp
  55574. kpfbsEZC89NiqpX+MWcUaViQCqoL7jcjx1BRtPV+nuN79+TMQjItSQzL/0kMmx40/W5ulop5A7Zv
  55575. 2wnL/V9lFDfhOPXzYRZY5LVtDQsEGz9QLX+zx3oaFoBg+Iof6Rsqxvm6ARppv9JYx1RXCI/hOWB3
  55576. S6xZhBqI8d3LT3jX5+EzLfzuQfogsL7L9ziUwOHQhQ+77Sxzq+3+knYaZH9bDTMJBzN7Bj8RpFxw
  55577. PIXAz+OQqIN3+tvmxYxoZxBnpVIt8MSZj3+/0WvitUfW2dCFmU2Umw9Lje4AWkcdEQOsQRivh7dv
  55578. DDqPys/cA8GiCcjl/YBeyGBCARsaU1q7N6a3vLqE6R5sGtRk2tRD/pOLS/IseRYQ1JMLiI+h2IYU
  55579. RpFHmygk71dSTlxCnKr3Sewn6EAes6aJInKc9Q0ztFijMDvd1GpUk74aTfOTlPf8hAs/hCBcNANE
  55580. xdqtvArBAs8e5ZTZ845b2EzwnexhF7sUMlQMAimTHpKG9n/v55IFDlndmQguLvqcAFLTxWYp5KeX
  55581. RKQOKIETNcX2b2TmQcTVL8w0RSXPQQCWPUouwpaYT05KnJe32x+SMsj/D1Fu1uwJ
  55582. -----END CERTIFICATE-----
  55583. TrustCor ECA-1
  55584. ==============
  55585. -----BEGIN CERTIFICATE-----
  55586. MIIEIDCCAwigAwIBAgIJAISCLF8cYtBAMA0GCSqGSIb3DQEBCwUAMIGcMQswCQYDVQQGEwJQQTEP
  55587. MA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3Ig
  55588. U3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5UcnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3Jp
  55589. dHkxFzAVBgNVBAMMDlRydXN0Q29yIEVDQS0xMB4XDTE2MDIwNDEyMzIzM1oXDTI5MTIzMTE3Mjgw
  55590. N1owgZwxCzAJBgNVBAYTAlBBMQ8wDQYDVQQIDAZQYW5hbWExFDASBgNVBAcMC1BhbmFtYSBDaXR5
  55591. MSQwIgYDVQQKDBtUcnVzdENvciBTeXN0ZW1zIFMuIGRlIFIuTC4xJzAlBgNVBAsMHlRydXN0Q29y
  55592. IENlcnRpZmljYXRlIEF1dGhvcml0eTEXMBUGA1UEAwwOVHJ1c3RDb3IgRUNBLTEwggEiMA0GCSqG
  55593. SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDPj+ARtZ+odnbb3w9U73NjKYKtR8aja+3+XzP4Q1HpGjOR
  55594. MRegdMTUpwHmspI+ap3tDvl0mEDTPwOABoJA6LHip1GnHYMma6ve+heRK9jGrB6xnhkB1Zem6g23
  55595. xFUfJ3zSCNV2HykVh0A53ThFEXXQmqc04L/NyFIduUd+Dbi7xgz2c1cWWn5DkR9VOsZtRASqnKmc
  55596. p0yJF4OuowReUoCLHhIlERnXDH19MURB6tuvsBzvgdAsxZohmz3tQjtQJvLsznFhBmIhVE5/wZ0+
  55597. fyCMgMsq2JdiyIMzkX2woloPV+g7zPIlstR8L+xNxqE6FXrntl019fZISjZFZtS6mFjBAgMBAAGj
  55598. YzBhMB0GA1UdDgQWBBREnkj1zG1I1KBLf/5ZJC+Dl5mahjAfBgNVHSMEGDAWgBREnkj1zG1I1KBL
  55599. f/5ZJC+Dl5mahjAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsF
  55600. AAOCAQEABT41XBVwm8nHc2FvcivUwo/yQ10CzsSUuZQRg2dd4mdsdXa/uwyqNsatR5Nj3B5+1t4u
  55601. /ukZMjgDfxT2AHMsWbEhBuH7rBiVDKP/mZb3Kyeb1STMHd3BOuCYRLDE5D53sXOpZCz2HAF8P11F
  55602. hcCF5yWPldwX8zyfGm6wyuMdKulMY/okYWLW2n62HGz1Ah3UKt1VkOsqEUc8Ll50soIipX1TH0Xs
  55603. J5F95yIW6MBoNtjG8U+ARDL54dHRHareqKucBK+tIA5kmE2la8BIWJZpTdwHjFGTot+fDz2LYLSC
  55604. jaoITmJF4PkL0uDgPFveXHEnJcLmA4GLEFPjx1WitJ/X5g==
  55605. -----END CERTIFICATE-----
  55606. SSL.com Root Certification Authority RSA
  55607. ========================================
  55608. -----BEGIN CERTIFICATE-----
  55609. MIIF3TCCA8WgAwIBAgIIeyyb0xaAMpkwDQYJKoZIhvcNAQELBQAwfDELMAkGA1UEBhMCVVMxDjAM
  55610. BgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24x
  55611. MTAvBgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBSU0EwHhcNMTYw
  55612. MjEyMTczOTM5WhcNNDEwMjEyMTczOTM5WjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
  55613. EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NM
  55614. LmNvbSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFJTQTCCAiIwDQYJKoZIhvcNAQEBBQAD
  55615. ggIPADCCAgoCggIBAPkP3aMrfcvQKv7sZ4Wm5y4bunfh4/WvpOz6Sl2RxFdHaxh3a3by/ZPkPQ/C
  55616. Fp4LZsNWlJ4Xg4XOVu/yFv0AYvUiCVToZRdOQbngT0aXqhvIuG5iXmmxX9sqAn78bMrzQdjt0Oj8
  55617. P2FI7bADFB0QDksZ4LtO7IZl/zbzXmcCC52GVWH9ejjt/uIZALdvoVBidXQ8oPrIJZK0bnoix/ge
  55618. oeOy3ZExqysdBP+lSgQ36YWkMyv94tZVNHwZpEpox7Ko07fKoZOI68GXvIz5HdkihCR0xwQ9aqkp
  55619. k8zruFvh/l8lqjRYyMEjVJ0bmBHDOJx+PYZspQ9AhnwC9FwCTyjLrnGfDzrIM/4RJTXq/LrFYD3Z
  55620. fBjVsqnTdXgDciLKOsMf7yzlLqn6niy2UUb9rwPW6mBo6oUWNmuF6R7As93EJNyAKoFBbZQ+yODJ
  55621. gUEAnl6/f8UImKIYLEJAs/lvOCdLToD0PYFH4Ih86hzOtXVcUS4cK38acijnALXRdMbX5J+tB5O2
  55622. UzU1/Dfkw/ZdFr4hc96SCvigY2q8lpJqPvi8ZVWb3vUNiSYE/CUapiVpy8JtynziWV+XrOvvLsi8
  55623. 1xtZPCvM8hnIk2snYxnP/Okm+Mpxm3+T/jRnhE6Z6/yzeAkzcLpmpnbtG3PrGqUNxCITIJRWCk4s
  55624. bE6x/c+cCbqiM+2HAgMBAAGjYzBhMB0GA1UdDgQWBBTdBAkHovV6fVJTEpKV7jiAJQ2mWTAPBgNV
  55625. HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFN0ECQei9Xp9UlMSkpXuOIAlDaZZMA4GA1UdDwEB/wQE
  55626. AwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAIBgRlCn7Jp0cHh5wYfGVcpNxJK1ok1iOMq8bs3AD/CUr
  55627. dIWQPXhq9LmLpZc7tRiRux6n+UBbkflVma8eEdBcHadm47GUBwwyOabqG7B52B2ccETjit3E+ZUf
  55628. ijhDPwGFpUenPUayvOUiaPd7nNgsPgohyC0zrL/FgZkxdMF1ccW+sfAjRfSda/wZY52jvATGGAsl
  55629. u1OJD7OAUN5F7kR/q5R4ZJjT9ijdh9hwZXT7DrkT66cPYakylszeu+1jTBi7qUD3oFRuIIhxdRjq
  55630. erQ0cuAjJ3dctpDqhiVAq+8zD8ufgr6iIPv2tS0a5sKFsXQP+8hlAqRSAUfdSSLBv9jra6x+3uxj
  55631. MxW3IwiPxg+NQVrdjsW5j+VFP3jbutIbQLH+cU0/4IGiul607BXgk90IH37hVZkLId6Tngr75qNJ
  55632. vTYw/ud3sqB1l7UtgYgXZSD32pAAn8lSzDLKNXz1PQ/YK9f1JmzJBjSWFupwWRoyeXkLtoh/D1JI
  55633. Pb9s2KJELtFOt3JY04kTlf5Eq/jXixtunLwsoFvVagCvXzfh1foQC5ichucmj87w7G6KVwuA406y
  55634. wKBjYZC6VWg3dGq2ktufoYYitmUnDuy2n0Jg5GfCtdpBC8TTi2EbvPofkSvXRAdeuims2cXp71NI
  55635. WuuA8ShYIc2wBlX7Jz9TkHCpBB5XJ7k=
  55636. -----END CERTIFICATE-----
  55637. SSL.com Root Certification Authority ECC
  55638. ========================================
  55639. -----BEGIN CERTIFICATE-----
  55640. MIICjTCCAhSgAwIBAgIIdebfy8FoW6gwCgYIKoZIzj0EAwIwfDELMAkGA1UEBhMCVVMxDjAMBgNV
  55641. BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xMTAv
  55642. BgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYwMjEy
  55643. MTgxNDAzWhcNNDEwMjEyMTgxNDAzWjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAO
  55644. BgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NMLmNv
  55645. bSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuBBAAiA2IA
  55646. BEVuqVDEpiM2nl8ojRfLliJkP9x6jh3MCLOicSS6jkm5BBtHllirLZXI7Z4INcgn64mMU1jrYor+
  55647. 8FsPazFSY0E7ic3s7LaNGdM0B9y7xgZ/wkWV7Mt/qCPgCemB+vNH06NjMGEwHQYDVR0OBBYEFILR
  55648. hXMw5zUE044CkvvlpNHEIejNMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUgtGFczDnNQTT
  55649. jgKS++Wk0cQh6M0wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2cAMGQCMG/n61kRpGDPYbCW
  55650. e+0F+S8Tkdzt5fxQaxFGRrMcIQBiu77D5+jNB5n5DQtdcj7EqgIwH7y6C+IwJPt8bYBVCpk+gA0z
  55651. 5Wajs6O7pdWLjwkspl1+4vAHCGht0nxpbl/f5Wpl
  55652. -----END CERTIFICATE-----
  55653. SSL.com EV Root Certification Authority RSA R2
  55654. ==============================================
  55655. -----BEGIN CERTIFICATE-----
  55656. MIIF6zCCA9OgAwIBAgIIVrYpzTS8ePYwDQYJKoZIhvcNAQELBQAwgYIxCzAJBgNVBAYTAlVTMQ4w
  55657. DAYDVQQIDAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9u
  55658. MTcwNQYDVQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIy
  55659. MB4XDTE3MDUzMTE4MTQzN1oXDTQyMDUzMDE4MTQzN1owgYIxCzAJBgNVBAYTAlVTMQ4wDAYDVQQI
  55660. DAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMTcwNQYD
  55661. VQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIyMIICIjAN
  55662. BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAjzZlQOHWTcDXtOlG2mvqM0fNTPl9fb69LT3w23jh
  55663. hqXZuglXaO1XPqDQCEGD5yhBJB/jchXQARr7XnAjssufOePPxU7Gkm0mxnu7s9onnQqG6YE3Bf7w
  55664. cXHswxzpY6IXFJ3vG2fThVUCAtZJycxa4bH3bzKfydQ7iEGonL3Lq9ttewkfokxykNorCPzPPFTO
  55665. Zw+oz12WGQvE43LrrdF9HSfvkusQv1vrO6/PgN3B0pYEW3p+pKk8OHakYo6gOV7qd89dAFmPZiw+
  55666. B6KjBSYRaZfqhbcPlgtLyEDhULouisv3D5oi53+aNxPN8k0TayHRwMwi8qFG9kRpnMphNQcAb9Zh
  55667. CBHqurj26bNg5U257J8UZslXWNvNh2n4ioYSA0e/ZhN2rHd9NCSFg83XqpyQGp8hLH94t2S42Oim
  55668. 9HizVcuE0jLEeK6jj2HdzghTreyI/BXkmg3mnxp3zkyPuBQVPWKchjgGAGYS5Fl2WlPAApiiECto
  55669. RHuOec4zSnaqW4EWG7WK2NAAe15itAnWhmMOpgWVSbooi4iTsjQc2KRVbrcc0N6ZVTsj9CLg+Slm
  55670. JuwgUHfbSguPvuUCYHBBXtSuUDkiFCbLsjtzdFVHB3mBOagwE0TlBIqulhMlQg+5U8Sb/M3kHN48
  55671. +qvWBkofZ6aYMBzdLNvcGJVXZsb/XItW9XcCAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNV
  55672. HSMEGDAWgBT5YLvU49U09rj1BoAlp3PbRmmonjAdBgNVHQ4EFgQU+WC71OPVNPa49QaAJadz20Zp
  55673. qJ4wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQBWs47LCp1Jjr+kxJG7ZhcFUZh1
  55674. ++VQLHqe8RT6q9OKPv+RKY9ji9i0qVQBDb6Thi/5Sm3HXvVX+cpVHBK+Rw82xd9qt9t1wkclf7nx
  55675. Y/hoLVUE0fKNsKTPvDxeH3jnpaAgcLAExbf3cqfeIg29MyVGjGSSJuM+LmOW2puMPfgYCdcDzH2G
  55676. guDKBAdRUNf/ktUM79qGn5nX67evaOI5JpS6aLe/g9Pqemc9YmeuJeVy6OLk7K4S9ksrPJ/psEDz
  55677. OFSz/bdoyNrGj1E8svuR3Bznm53htw1yj+KkxKl4+esUrMZDBcJlOSgYAsOCsp0FvmXtll9ldDz7
  55678. CTUue5wT/RsPXcdtgTpWD8w74a8CLyKsRspGPKAcTNZEtF4uXBVmCeEmKf7GUmG6sXP/wwyc5Wxq
  55679. lD8UykAWlYTzWamsX0xhk23RO8yilQwipmdnRC652dKKQbNmC1r7fSOl8hqw/96bg5Qu0T/fkreR
  55680. rwU7ZcegbLHNYhLDkBvjJc40vG93drEQw/cFGsDWr3RiSBd3kmmQYRzelYB0VI8YHMPzA9C/pEN1
  55681. hlMYegouCRw2n5H9gooiS9EOUCXdywMMF8mDAAhONU2Ki+3wApRmLER/y5UnlhetCTCstnEXbosX
  55682. 9hwJ1C07mKVx01QT2WDz9UtmT/rx7iASjbSsV7FFY6GsdqnC+w==
  55683. -----END CERTIFICATE-----
  55684. SSL.com EV Root Certification Authority ECC
  55685. ===========================================
  55686. -----BEGIN CERTIFICATE-----
  55687. MIIClDCCAhqgAwIBAgIILCmcWxbtBZUwCgYIKoZIzj0EAwIwfzELMAkGA1UEBhMCVVMxDjAMBgNV
  55688. BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xNDAy
  55689. BgNVBAMMK1NTTC5jb20gRVYgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYw
  55690. MjEyMTgxNTIzWhcNNDEwMjEyMTgxNTIzWjB/MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
  55691. EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjE0MDIGA1UEAwwrU1NM
  55692. LmNvbSBFViBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuB
  55693. BAAiA2IABKoSR5CYG/vvw0AHgyBO8TCCogbR8pKGYfL2IWjKAMTH6kMAVIbc/R/fALhBYlzccBYy
  55694. 3h+Z1MzFB8gIH2EWB1E9fVwHU+M1OIzfzZ/ZLg1KthkuWnBaBu2+8KGwytAJKaNjMGEwHQYDVR0O
  55695. BBYEFFvKXuXe0oGqzagtZFG22XKbl+ZPMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUW8pe
  55696. 5d7SgarNqC1kUbbZcpuX5k8wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2gAMGUCMQCK5kCJ
  55697. N+vp1RPZytRrJPOwPYdGWBrssd9v+1a6cGvHOMzosYxPD/fxZ3YOg9AeUY8CMD32IygmTMZgh5Mm
  55698. m7I1HrrW9zzRHM76JTymGoEVW/MSD2zuZYrJh6j5B+BimoxcSg==
  55699. -----END CERTIFICATE-----
  55700. GlobalSign Root CA - R6
  55701. =======================
  55702. -----BEGIN CERTIFICATE-----
  55703. MIIFgzCCA2ugAwIBAgIORea7A4Mzw4VlSOb/RVEwDQYJKoZIhvcNAQEMBQAwTDEgMB4GA1UECxMX
  55704. R2xvYmFsU2lnbiBSb290IENBIC0gUjYxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkds
  55705. b2JhbFNpZ24wHhcNMTQxMjEwMDAwMDAwWhcNMzQxMjEwMDAwMDAwWjBMMSAwHgYDVQQLExdHbG9i
  55706. YWxTaWduIFJvb3QgQ0EgLSBSNjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFs
  55707. U2lnbjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAJUH6HPKZvnsFMp7PPcNCPG0RQss
  55708. grRIxutbPK6DuEGSMxSkb3/pKszGsIhrxbaJ0cay/xTOURQh7ErdG1rG1ofuTToVBu1kZguSgMpE
  55709. 3nOUTvOniX9PeGMIyBJQbUJmL025eShNUhqKGoC3GYEOfsSKvGRMIRxDaNc9PIrFsmbVkJq3MQbF
  55710. vuJtMgamHvm566qjuL++gmNQ0PAYid/kD3n16qIfKtJwLnvnvJO7bVPiSHyMEAc4/2ayd2F+4OqM
  55711. PKq0pPbzlUoSB239jLKJz9CgYXfIWHSw1CM69106yqLbnQneXUQtkPGBzVeS+n68UARjNN9rkxi+
  55712. azayOeSsJDa38O+2HBNXk7besvjihbdzorg1qkXy4J02oW9UivFyVm4uiMVRQkQVlO6jxTiWm05O
  55713. WgtH8wY2SXcwvHE35absIQh1/OZhFj931dmRl4QKbNQCTXTAFO39OfuD8l4UoQSwC+n+7o/hbguy
  55714. CLNhZglqsQY6ZZZZwPA1/cnaKI0aEYdwgQqomnUdnjqGBQCe24DWJfncBZ4nWUx2OVvq+aWh2IMP
  55715. 0f/fMBH5hc8zSPXKbWQULHpYT9NLCEnFlWQaYw55PfWzjMpYrZxCRXluDocZXFSxZba/jJvcE+kN
  55716. b7gu3GduyYsRtYQUigAZcIN5kZeR1BonvzceMgfYFGM8KEyvAgMBAAGjYzBhMA4GA1UdDwEB/wQE
  55717. AwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSubAWjkxPioufi1xzWx/B/yGdToDAfBgNV
  55718. HSMEGDAWgBSubAWjkxPioufi1xzWx/B/yGdToDANBgkqhkiG9w0BAQwFAAOCAgEAgyXt6NH9lVLN
  55719. nsAEoJFp5lzQhN7craJP6Ed41mWYqVuoPId8AorRbrcWc+ZfwFSY1XS+wc3iEZGtIxg93eFyRJa0
  55720. lV7Ae46ZeBZDE1ZXs6KzO7V33EByrKPrmzU+sQghoefEQzd5Mr6155wsTLxDKZmOMNOsIeDjHfrY
  55721. BzN2VAAiKrlNIC5waNrlU/yDXNOd8v9EDERm8tLjvUYAGm0CuiVdjaExUd1URhxN25mW7xocBFym
  55722. Fe944Hn+Xds+qkxV/ZoVqW/hpvvfcDDpw+5CRu3CkwWJ+n1jez/QcYF8AOiYrg54NMMl+68KnyBr
  55723. 3TsTjxKM4kEaSHpzoHdpx7Zcf4LIHv5YGygrqGytXm3ABdJ7t+uA/iU3/gKbaKxCXcPu9czc8FB1
  55724. 0jZpnOZ7BN9uBmm23goJSFmH63sUYHpkqmlD75HHTOwY3WzvUy2MmeFe8nI+z1TIvWfspA9MRf/T
  55725. uTAjB0yPEL+GltmZWrSZVxykzLsViVO6LAUP5MSeGbEYNNVMnbrt9x+vJJUEeKgDu+6B5dpffItK
  55726. oZB0JaezPkvILFa9x8jvOOJckvB595yEunQtYQEgfn7R8k8HWV+LLUNS60YMlOH1Zkd5d9VUWx+t
  55727. JDfLRVpOoERIyNiwmcUVhAn21klJwGW45hpxbqCo8YLoRT5s1gLXCmeDBVrJpBA=
  55728. -----END CERTIFICATE-----
  55729. OISTE WISeKey Global Root GC CA
  55730. ===============================
  55731. -----BEGIN CERTIFICATE-----
  55732. MIICaTCCAe+gAwIBAgIQISpWDK7aDKtARb8roi066jAKBggqhkjOPQQDAzBtMQswCQYDVQQGEwJD
  55733. SDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEo
  55734. MCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQyBDQTAeFw0xNzA1MDkwOTQ4MzRa
  55735. Fw00MjA1MDkwOTU4MzNaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYDVQQL
  55736. ExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEdsb2Jh
  55737. bCBSb290IEdDIENBMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAETOlQwMYPchi82PG6s4nieUqjFqdr
  55738. VCTbUf/q9Akkwwsin8tqJ4KBDdLArzHkdIJuyiXZjHWd8dvQmqJLIX4Wp2OQ0jnUsYd4XxiWD1Ab
  55739. NTcPasbc2RNNpI6QN+a9WzGRo1QwUjAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
  55740. BgNVHQ4EFgQUSIcUrOPDnpBgOtfKie7TrYy0UGYwEAYJKwYBBAGCNxUBBAMCAQAwCgYIKoZIzj0E
  55741. AwMDaAAwZQIwJsdpW9zV57LnyAyMjMPdeYwbY9XJUpROTYJKcx6ygISpJcBMWm1JKWB4E+J+SOtk
  55742. AjEA2zQgMgj/mkkCtojeFK9dbJlxjRo/i9fgojaGHAeCOnZT/cKi7e97sIBPWA9LUzm9
  55743. -----END CERTIFICATE-----
  55744. GTS Root R1
  55745. ===========
  55746. -----BEGIN CERTIFICATE-----
  55747. MIIFWjCCA0KgAwIBAgIQbkepxUtHDA3sM9CJuRz04TANBgkqhkiG9w0BAQwFADBHMQswCQYDVQQG
  55748. EwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJv
  55749. b3QgUjEwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAG
  55750. A1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjEwggIi
  55751. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2EQKLHuOhd5s73L+UPreVp0A8of2C+X0yBoJx
  55752. 9vaMf/vo27xqLpeXo4xL+Sv2sfnOhB2x+cWX3u+58qPpvBKJXqeqUqv4IyfLpLGcY9vXmX7wCl7r
  55753. aKb0xlpHDU0QM+NOsROjyBhsS+z8CZDfnWQpJSMHobTSPS5g4M/SCYe7zUjwTcLCeoiKu7rPWRnW
  55754. r4+wB7CeMfGCwcDfLqZtbBkOtdh+JhpFAz2weaSUKK0PfyblqAj+lug8aJRT7oM6iCsVlgmy4HqM
  55755. LnXWnOunVmSPlk9orj2XwoSPwLxAwAtcvfaHszVsrBhQf4TgTM2S0yDpM7xSma8ytSmzJSq0SPly
  55756. 4cpk9+aCEI3oncKKiPo4Zor8Y/kB+Xj9e1x3+naH+uzfsQ55lVe0vSbv1gHR6xYKu44LtcXFilWr
  55757. 06zqkUspzBmkMiVOKvFlRNACzqrOSbTqn3yDsEB750Orp2yjj32JgfpMpf/VjsPOS+C12LOORc92
  55758. wO1AK/1TD7Cn1TsNsYqiA94xrcx36m97PtbfkSIS5r762DL8EGMUUXLeXdYWk70paDPvOmbsB4om
  55759. 3xPXV2V4J95eSRQAogB/mqghtqmxlbCluQ0WEdrHbEg8QOB+DVrNVjzRlwW5y0vtOUucxD/SVRNu
  55760. JLDWcfr0wbrM7Rv1/oFB2ACYPTrIrnqYNxgFlQIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYD
  55761. VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU5K8rJnEaK0gnhS9SZizv8IkTcT4wDQYJKoZIhvcNAQEM
  55762. BQADggIBADiWCu49tJYeX++dnAsznyvgyv3SjgofQXSlfKqE1OXyHuY3UjKcC9FhHb8owbZEKTV1
  55763. d5iyfNm9dKyKaOOpMQkpAWBz40d8U6iQSifvS9efk+eCNs6aaAyC58/UEBZvXw6ZXPYfcX3v73sv
  55764. fuo21pdwCxXu11xWajOl40k4DLh9+42FpLFZXvRq4d2h9mREruZRgyFmxhE+885H7pwoHyXa/6xm
  55765. ld01D1zvICxi/ZG6qcz8WpyTgYMpl0p8WnK0OdC3d8t5/Wk6kjftbjhlRn7pYL15iJdfOBL07q9b
  55766. gsiG1eGZbYwE8na6SfZu6W0eX6DvJ4J2QPim01hcDyxC2kLGe4g0x8HYRZvBPsVhHdljUEn2NIVq
  55767. 4BjFbkerQUIpm/ZgDdIx02OYI5NaAIFItO/Nis3Jz5nu2Z6qNuFoS3FJFDYoOj0dzpqPJeaAcWEr
  55768. tXvM+SUWgeExX6GjfhaknBZqlxi9dnKlC54dNuYvoS++cJEPqOba+MSSQGwlfnuzCdyyF62ARPBo
  55769. pY+Udf90WuioAnwMCeKpSwughQtiue+hMZL77/ZRBIls6Kl0obsXs7X9SQ98POyDGCBDTtWTurQ0
  55770. sR8WNh8M5mQ5Fkzc4P4dyKliPUDqysU0ArSuiYgzNdwsE3PYJ/HQcu51OyLemGhmW/HGY0dVHLql
  55771. CFF1pkgl
  55772. -----END CERTIFICATE-----
  55773. GTS Root R2
  55774. ===========
  55775. -----BEGIN CERTIFICATE-----
  55776. MIIFWjCCA0KgAwIBAgIQbkepxlqz5yDFMJo/aFLybzANBgkqhkiG9w0BAQwFADBHMQswCQYDVQQG
  55777. EwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJv
  55778. b3QgUjIwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAG
  55779. A1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjIwggIi
  55780. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDO3v2m++zsFDQ8BwZabFn3GTXd98GdVarTzTuk
  55781. k3LvCvptnfbwhYBboUhSnznFt+4orO/LdmgUud+tAWyZH8QiHZ/+cnfgLFuv5AS/T3KgGjSY6Dlo
  55782. 7JUle3ah5mm5hRm9iYz+re026nO8/4Piy33B0s5Ks40FnotJk9/BW9BuXvAuMC6C/Pq8tBcKSOWI
  55783. m8Wba96wyrQD8Nr0kLhlZPdcTK3ofmZemde4wj7I0BOdre7kRXuJVfeKH2JShBKzwkCX44ofR5Gm
  55784. dFrS+LFjKBC4swm4VndAoiaYecb+3yXuPuWgf9RhD1FLPD+M2uFwdNjCaKH5wQzpoeJ/u1U8dgbu
  55785. ak7MkogwTZq9TwtImoS1mKPV+3PBV2HdKFZ1E66HjucMUQkQdYhMvI35ezzUIkgfKtzra7tEscsz
  55786. cTJGr61K8YzodDqs5xoic4DSMPclQsciOzsSrZYuxsN2B6ogtzVJV+mSSeh2FnIxZyuWfoqjx5RW
  55787. Ir9qS34BIbIjMt/kmkRtWVtd9QCgHJvGeJeNkP+byKq0rxFROV7Z+2et1VsRnTKaG73Vululycsl
  55788. aVNVJ1zgyjbLiGH7HrfQy+4W+9OmTN6SpdTi3/UGVN4unUu0kzCqgc7dGtxRcw1PcOnlthYhGXmy
  55789. 5okLdWTK1au8CcEYof/UVKGFPP0UJAOyh9OktwIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYD
  55790. VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUu//KjiOfT5nK2+JopqUVJxce2Q4wDQYJKoZIhvcNAQEM
  55791. BQADggIBALZp8KZ3/p7uC4Gt4cCpx/k1HUCCq+YEtN/L9x0Pg/B+E02NjO7jMyLDOfxA325BS0JT
  55792. vhaI8dI4XsRomRyYUpOM52jtG2pzegVATX9lO9ZY8c6DR2Dj/5epnGB3GFW1fgiTz9D2PGcDFWEJ
  55793. +YF59exTpJ/JjwGLc8R3dtyDovUMSRqodt6Sm2T4syzFJ9MHwAiApJiS4wGWAqoC7o87xdFtCjMw
  55794. c3i5T1QWvwsHoaRc5svJXISPD+AVdyx+Jn7axEvbpxZ3B7DNdehyQtaVhJ2Gg/LkkM0JR9SLA3Da
  55795. WsYDQvTtN6LwG1BUSw7YhN4ZKJmBR64JGz9I0cNv4rBgF/XuIwKl2gBbbZCr7qLpGzvpx0QnRY5r
  55796. n/WkhLx3+WuXrD5RRaIRpsyF7gpo8j5QOHokYh4XIDdtak23CZvJ/KRY9bb7nE4Yu5UC56Gtmwfu
  55797. Nmsk0jmGwZODUNKBRqhfYlcsu2xkiAhu7xNUX90txGdj08+JN7+dIPT7eoOboB6BAFDC5AwiWVIQ
  55798. 7UNWhwD4FFKnHYuTjKJNRn8nxnGbJN7k2oaLDX5rIMHAnuFl2GqjpuiFizoHCBy69Y9Vmhh1fuXs
  55799. gWbRIXOhNUQLgD1bnF5vKheW0YMjiGZt5obicDIvUiLnyOd/xCxgXS/Dr55FBcOEArf9LAhST4Ld
  55800. o/DUhgkC
  55801. -----END CERTIFICATE-----
  55802. GTS Root R3
  55803. ===========
  55804. -----BEGIN CERTIFICATE-----
  55805. MIICDDCCAZGgAwIBAgIQbkepx2ypcyRAiQ8DVd2NHTAKBggqhkjOPQQDAzBHMQswCQYDVQQGEwJV
  55806. UzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3Qg
  55807. UjMwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UE
  55808. ChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjMwdjAQBgcq
  55809. hkjOPQIBBgUrgQQAIgNiAAQfTzOHMymKoYTey8chWEGJ6ladK0uFxh1MJ7x/JlFyb+Kf1qPKzEUU
  55810. Rout736GjOyxfi//qXGdGIRFBEFVbivqJn+7kAHjSxm65FSWRQmx1WyRRK2EE46ajA2ADDL24Cej
  55811. QjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTB8Sa6oC2uhYHP
  55812. 0/EqEr24Cmf9vDAKBggqhkjOPQQDAwNpADBmAjEAgFukfCPAlaUs3L6JbyO5o91lAFJekazInXJ0
  55813. glMLfalAvWhgxeG4VDvBNhcl2MG9AjEAnjWSdIUlUfUk7GRSJFClH9voy8l27OyCbvWFGFPouOOa
  55814. KaqW04MjyaR7YbPMAuhd
  55815. -----END CERTIFICATE-----
  55816. GTS Root R4
  55817. ===========
  55818. -----BEGIN CERTIFICATE-----
  55819. MIICCjCCAZGgAwIBAgIQbkepyIuUtui7OyrYorLBmTAKBggqhkjOPQQDAzBHMQswCQYDVQQGEwJV
  55820. UzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3Qg
  55821. UjQwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UE
  55822. ChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjQwdjAQBgcq
  55823. hkjOPQIBBgUrgQQAIgNiAATzdHOnaItgrkO4NcWBMHtLSZ37wWHO5t5GvWvVYRg1rkDdc/eJkTBa
  55824. 6zzuhXyiQHY7qca4R9gq55KRanPpsXI5nymfopjTX15YhmUPoYRlBtHci8nHc8iMai/lxKvRHYqj
  55825. QjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSATNbrdP9JNqPV
  55826. 2Py1PsVq8JQdjDAKBggqhkjOPQQDAwNnADBkAjBqUFJ0CMRw3J5QdCHojXohw0+WbhXRIjVhLfoI
  55827. N+4Zba3bssx9BzT1YBkstTTZbyACMANxsbqjYAuG7ZoIapVon+Kz4ZNkfF6Tpt95LY2F45TPI11x
  55828. zPKwTdb+mciUqXWi4w==
  55829. -----END CERTIFICATE-----
  55830. UCA Global G2 Root
  55831. ==================
  55832. -----BEGIN CERTIFICATE-----
  55833. MIIFRjCCAy6gAwIBAgIQXd+x2lqj7V2+WmUgZQOQ7zANBgkqhkiG9w0BAQsFADA9MQswCQYDVQQG
  55834. EwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxGzAZBgNVBAMMElVDQSBHbG9iYWwgRzIgUm9vdDAeFw0x
  55835. NjAzMTEwMDAwMDBaFw00MDEyMzEwMDAwMDBaMD0xCzAJBgNVBAYTAkNOMREwDwYDVQQKDAhVbmlU
  55836. cnVzdDEbMBkGA1UEAwwSVUNBIEdsb2JhbCBHMiBSb290MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  55837. MIICCgKCAgEAxeYrb3zvJgUno4Ek2m/LAfmZmqkywiKHYUGRO8vDaBsGxUypK8FnFyIdK+35KYmT
  55838. oni9kmugow2ifsqTs6bRjDXVdfkX9s9FxeV67HeToI8jrg4aA3++1NDtLnurRiNb/yzmVHqUwCoV
  55839. 8MmNsHo7JOHXaOIxPAYzRrZUEaalLyJUKlgNAQLx+hVRZ2zA+te2G3/RVogvGjqNO7uCEeBHANBS
  55840. h6v7hn4PJGtAnTRnvI3HLYZveT6OqTwXS3+wmeOwcWDcC/Vkw85DvG1xudLeJ1uK6NjGruFZfc8o
  55841. LTW4lVYa8bJYS7cSN8h8s+1LgOGN+jIjtm+3SJUIsUROhYw6AlQgL9+/V087OpAh18EmNVQg7Mc/
  55842. R+zvWr9LesGtOxdQXGLYD0tK3Cv6brxzks3sx1DoQZbXqX5t2Okdj4q1uViSukqSKwxW/YDrCPBe
  55843. KW4bHAyvj5OJrdu9o54hyokZ7N+1wxrrFv54NkzWbtA+FxyQF2smuvt6L78RHBgOLXMDj6DlNaBa
  55844. 4kx1HXHhOThTeEDMg5PXCp6dW4+K5OXgSORIskfNTip1KnvyIvbJvgmRlld6iIis7nCs+dwp4wwc
  55845. OxJORNanTrAmyPPZGpeRaOrvjUYG0lZFWJo8DA+DuAUlwznPO6Q0ibd5Ei9Hxeepl2n8pndntd97
  55846. 8XplFeRhVmUCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0O
  55847. BBYEFIHEjMz15DD/pQwIX4wVZyF0Ad/fMA0GCSqGSIb3DQEBCwUAA4ICAQATZSL1jiutROTL/7lo
  55848. 5sOASD0Ee/ojL3rtNtqyzm325p7lX1iPyzcyochltq44PTUbPrw7tgTQvPlJ9Zv3hcU2tsu8+Mg5
  55849. 1eRfB70VVJd0ysrtT7q6ZHafgbiERUlMjW+i67HM0cOU2kTC5uLqGOiiHycFutfl1qnN3e92mI0A
  55850. Ds0b+gO3joBYDic/UvuUospeZcnWhNq5NXHzJsBPd+aBJ9J3O5oUb3n09tDh05S60FdRvScFDcH9
  55851. yBIw7m+NESsIndTUv4BFFJqIRNow6rSn4+7vW4LVPtateJLbXDzz2K36uGt/xDYotgIVilQsnLAX
  55852. c47QN6MUPJiVAAwpBVueSUmxX8fjy88nZY41F7dXyDDZQVu5FLbowg+UMaeUmMxq67XhJ/UQqAHo
  55853. jhJi6IjMtX9Gl8CbEGY4GjZGXyJoPd/JxhMnq1MGrKI8hgZlb7F+sSlEmqO6SWkoaY/X5V+tBIZk
  55854. bxqgDMUIYs6Ao9Dz7GjevjPHF1t/gMRMTLGmhIrDO7gJzRSBuhjjVFc2/tsvfEehOjPI+Vg7RE+x
  55855. ygKJBJYoaMVLuCaJu9YzL1DV/pqJuhgyklTGW+Cd+V7lDSKb9triyCGyYiGqhkCyLmTTX8jjfhFn
  55856. RR8F/uOi77Oos/N9j/gMHyIfLXC0uAE0djAA5SN4p1bXUB+K+wb1whnw0A==
  55857. -----END CERTIFICATE-----
  55858. UCA Extended Validation Root
  55859. ============================
  55860. -----BEGIN CERTIFICATE-----
  55861. MIIFWjCCA0KgAwIBAgIQT9Irj/VkyDOeTzRYZiNwYDANBgkqhkiG9w0BAQsFADBHMQswCQYDVQQG
  55862. EwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9u
  55863. IFJvb3QwHhcNMTUwMzEzMDAwMDAwWhcNMzgxMjMxMDAwMDAwWjBHMQswCQYDVQQGEwJDTjERMA8G
  55864. A1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9uIFJvb3QwggIi
  55865. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCpCQcoEwKwmeBkqh5DFnpzsZGgdT6o+uM4AHrs
  55866. iWogD4vFsJszA1qGxliG1cGFu0/GnEBNyr7uaZa4rYEwmnySBesFK5pI0Lh2PpbIILvSsPGP2KxF
  55867. Rv+qZ2C0d35qHzwaUnoEPQc8hQ2E0B92CvdqFN9y4zR8V05WAT558aopO2z6+I9tTcg1367r3CTu
  55868. eUWnhbYFiN6IXSV8l2RnCdm/WhUFhvMJHuxYMjMR83dksHYf5BA1FxvyDrFspCqjc/wJHx4yGVMR
  55869. 59mzLC52LqGj3n5qiAno8geK+LLNEOfic0CTuwjRP+H8C5SzJe98ptfRr5//lpr1kXuYC3fUfugH
  55870. 0mK1lTnj8/FtDw5lhIpjVMWAtuCeS31HJqcBCF3RiJ7XwzJE+oJKCmhUfzhTA8ykADNkUVkLo4KR
  55871. el7sFsLzKuZi2irbWWIQJUoqgQtHB0MGcIfS+pMRKXpITeuUx3BNr2fVUbGAIAEBtHoIppB/TuDv
  55872. B0GHr2qlXov7z1CymlSvw4m6WC31MJixNnI5fkkE/SmnTHnkBVfblLkWU41Gsx2VYVdWf6/wFlth
  55873. WG82UBEL2KwrlRYaDh8IzTY0ZRBiZtWAXxQgXy0MoHgKaNYs1+lvK9JKBZP8nm9rZ/+I8U6laUpS
  55874. NwXqxhaN0sSZ0YIrO7o1dfdRUVjzyAfd5LQDfwIDAQABo0IwQDAdBgNVHQ4EFgQU2XQ65DA9DfcS
  55875. 3H5aBZ8eNJr34RQwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQEL
  55876. BQADggIBADaNl8xCFWQpN5smLNb7rhVpLGsaGvdftvkHTFnq88nIua7Mui563MD1sC3AO6+fcAUR
  55877. ap8lTwEpcOPlDOHqWnzcSbvBHiqB9RZLcpHIojG5qtr8nR/zXUACE/xOHAbKsxSQVBcZEhrxH9cM
  55878. aVr2cXj0lH2RC47skFSOvG+hTKv8dGT9cZr4QQehzZHkPJrgmzI5c6sq1WnIeJEmMX3ixzDx/BR4
  55879. dxIOE/TdFpS/S2d7cFOFyrC78zhNLJA5wA3CXWvp4uXViI3WLL+rG761KIcSF3Ru/H38j9CHJrAb
  55880. +7lsq+KePRXBOy5nAliRn+/4Qh8st2j1da3Ptfb/EX3C8CSlrdP6oDyp+l3cpaDvRKS+1ujl5BOW
  55881. F3sGPjLtx7dCvHaj2GU4Kzg1USEODm8uNBNA4StnDG1KQTAYI1oyVZnJF+A83vbsea0rWBmirSwi
  55882. GpWOvpaQXUJXxPkUAzUrHC1RVwinOt4/5Mi0A3PCwSaAuwtCH60NryZy2sy+s6ODWA2CxR9GUeOc
  55883. GMyNm43sSet1UNWMKFnKdDTajAshqx7qG+XH/RU+wBeq+yNuJkbL+vmxcmtpzyKEC2IPrNkZAJSi
  55884. djzULZrtBJ4tBmIQN1IchXIbJ+XMxjHsN+xjWZsLHXbMfjKaiJUINlK73nZfdklJrX+9ZSCyycEr
  55885. dhh2n1ax
  55886. -----END CERTIFICATE-----
  55887. Certigna Root CA
  55888. ================
  55889. -----BEGIN CERTIFICATE-----
  55890. MIIGWzCCBEOgAwIBAgIRAMrpG4nxVQMNo+ZBbcTjpuEwDQYJKoZIhvcNAQELBQAwWjELMAkGA1UE
  55891. BhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczEcMBoGA1UECwwTMDAwMiA0ODE0NjMwODEwMDAzNjEZ
  55892. MBcGA1UEAwwQQ2VydGlnbmEgUm9vdCBDQTAeFw0xMzEwMDEwODMyMjdaFw0zMzEwMDEwODMyMjda
  55893. MFoxCzAJBgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxHDAaBgNVBAsMEzAwMDIgNDgxNDYz
  55894. MDgxMDAwMzYxGTAXBgNVBAMMEENlcnRpZ25hIFJvb3QgQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  55895. DwAwggIKAoICAQDNGDllGlmx6mQWDoyUJJV8g9PFOSbcDO8WV43X2KyjQn+Cyu3NW9sOty3tRQgX
  55896. stmzy9YXUnIo245Onoq2C/mehJpNdt4iKVzSs9IGPjA5qXSjklYcoW9MCiBtnyN6tMbaLOQdLNyz
  55897. KNAT8kxOAkmhVECe5uUFoC2EyP+YbNDrihqECB63aCPuI9Vwzm1RaRDuoXrC0SIxwoKF0vJVdlB8
  55898. JXrJhFwLrN1CTivngqIkicuQstDuI7pmTLtipPlTWmR7fJj6o0ieD5Wupxj0auwuA0Wv8HT4Ks16
  55899. XdG+RCYyKfHx9WzMfgIhC59vpD++nVPiz32pLHxYGpfhPTc3GGYo0kDFUYqMwy3OU4gkWGQwFsWq
  55900. 4NYKpkDfePb1BHxpE4S80dGnBs8B92jAqFe7OmGtBIyT46388NtEbVncSVmurJqZNjBBe3YzIoej
  55901. wpKGbvlw7q6Hh5UbxHq9MfPU0uWZ/75I7HX1eBYdpnDBfzwboZL7z8g81sWTCo/1VTp2lc5ZmIoJ
  55902. lXcymoO6LAQ6l73UL77XbJuiyn1tJslV1c/DeVIICZkHJC1kJWumIWmbat10TWuXekG9qxf5kBdI
  55903. jzb5LdXF2+6qhUVB+s06RbFo5jZMm5BX7CO5hwjCxAnxl4YqKE3idMDaxIzb3+KhF1nOJFl0Mdp/
  55904. /TBt2dzhauH8XwIDAQABo4IBGjCCARYwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYw
  55905. HQYDVR0OBBYEFBiHVuBud+4kNTxOc5of1uHieX4rMB8GA1UdIwQYMBaAFBiHVuBud+4kNTxOc5of
  55906. 1uHieX4rMEQGA1UdIAQ9MDswOQYEVR0gADAxMC8GCCsGAQUFBwIBFiNodHRwczovL3d3d3cuY2Vy
  55907. dGlnbmEuZnIvYXV0b3JpdGVzLzBtBgNVHR8EZjBkMC+gLaArhilodHRwOi8vY3JsLmNlcnRpZ25h
  55908. LmZyL2NlcnRpZ25hcm9vdGNhLmNybDAxoC+gLYYraHR0cDovL2NybC5kaGlteW90aXMuY29tL2Nl
  55909. cnRpZ25hcm9vdGNhLmNybDANBgkqhkiG9w0BAQsFAAOCAgEAlLieT/DjlQgi581oQfccVdV8AOIt
  55910. OoldaDgvUSILSo3L6btdPrtcPbEo/uRTVRPPoZAbAh1fZkYJMyjhDSSXcNMQH+pkV5a7XdrnxIxP
  55911. TGRGHVyH41neQtGbqH6mid2PHMkwgu07nM3A6RngatgCdTer9zQoKJHyBApPNeNgJgH60BGM+RFq
  55912. 7q89w1DTj18zeTyGqHNFkIwgtnJzFyO+B2XleJINugHA64wcZr+shncBlA2c5uk5jR+mUYyZDDl3
  55913. 4bSb+hxnV29qao6pK0xXeXpXIs/NX2NGjVxZOob4Mkdio2cNGJHc+6Zr9UhhcyNZjgKnvETq9Emd
  55914. 8VRY+WCv2hikLyhF3HqgiIZd8zvn/yk1gPxkQ5Tm4xxvvq0OKmOZK8l+hfZx6AYDlf7ej0gcWtSS
  55915. 6Cvu5zHbugRqh5jnxV/vfaci9wHYTfmJ0A6aBVmknpjZbyvKcL5kwlWj9Omvw5Ip3IgWJJk8jSaY
  55916. tlu3zM63Nwf9JtmYhST/WSMDmu2dnajkXjjO11INb9I/bbEFa0nOipFGc/T2L/Coc3cOZayhjWZS
  55917. aX5LaAzHHjcng6WMxwLkFM1JAbBzs/3GkDpv0mztO+7skb6iQ12LAEpmJURw3kAP+HwV96LOPNde
  55918. E4yBFxgX0b3xdxA61GU5wSesVywlVP+i2k+KYTlerj1KjL0=
  55919. -----END CERTIFICATE-----
  55920. emSign Root CA - G1
  55921. ===================
  55922. -----BEGIN CERTIFICATE-----
  55923. MIIDlDCCAnygAwIBAgIKMfXkYgxsWO3W2DANBgkqhkiG9w0BAQsFADBnMQswCQYDVQQGEwJJTjET
  55924. MBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRl
  55925. ZDEcMBoGA1UEAxMTZW1TaWduIFJvb3QgQ0EgLSBHMTAeFw0xODAyMTgxODMwMDBaFw00MzAyMTgx
  55926. ODMwMDBaMGcxCzAJBgNVBAYTAklOMRMwEQYDVQQLEwplbVNpZ24gUEtJMSUwIwYDVQQKExxlTXVk
  55927. aHJhIFRlY2hub2xvZ2llcyBMaW1pdGVkMRwwGgYDVQQDExNlbVNpZ24gUm9vdCBDQSAtIEcxMIIB
  55928. IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAk0u76WaK7p1b1TST0Bsew+eeuGQzf2N4aLTN
  55929. LnF115sgxk0pvLZoYIr3IZpWNVrzdr3YzZr/k1ZLpVkGoZM0Kd0WNHVO8oG0x5ZOrRkVUkr+PHB1
  55930. cM2vK6sVmjM8qrOLqs1D/fXqcP/tzxE7lM5OMhbTI0Aqd7OvPAEsbO2ZLIvZTmmYsvePQbAyeGHW
  55931. DV/D+qJAkh1cF+ZwPjXnorfCYuKrpDhMtTk1b+oDafo6VGiFbdbyL0NVHpENDtjVaqSW0RM8LHhQ
  55932. 6DqS0hdW5TUaQBw+jSztOd9C4INBdN+jzcKGYEho42kLVACL5HZpIQ15TjQIXhTCzLG3rdd8cIrH
  55933. hQIDAQABo0IwQDAdBgNVHQ4EFgQU++8Nhp6w492pufEhF38+/PB3KxowDgYDVR0PAQH/BAQDAgEG
  55934. MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAFn/8oz1h31xPaOfG1vR2vjTnGs2
  55935. vZupYeveFix0PZ7mddrXuqe8QhfnPZHr5X3dPpzxz5KsbEjMwiI/aTvFthUvozXGaCocV685743Q
  55936. NcMYDHsAVhzNixl03r4PEuDQqqE/AjSxcM6dGNYIAwlG7mDgfrbESQRRfXBgvKqy/3lyeqYdPV8q
  55937. +Mri/Tm3R7nrft8EI6/6nAYH6ftjk4BAtcZsCjEozgyfz7MjNYBBjWzEN3uBL4ChQEKF6dk4jeih
  55938. U80Bv2noWgbyRQuQ+q7hv53yrlc8pa6yVvSLZUDp/TGBLPQ5Cdjua6e0ph0VpZj3AYHYhX3zUVxx
  55939. iN66zB+Afko=
  55940. -----END CERTIFICATE-----
  55941. emSign ECC Root CA - G3
  55942. =======================
  55943. -----BEGIN CERTIFICATE-----
  55944. MIICTjCCAdOgAwIBAgIKPPYHqWhwDtqLhDAKBggqhkjOPQQDAzBrMQswCQYDVQQGEwJJTjETMBEG
  55945. A1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRlZDEg
  55946. MB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0gRzMwHhcNMTgwMjE4MTgzMDAwWhcNNDMwMjE4
  55947. MTgzMDAwWjBrMQswCQYDVQQGEwJJTjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11
  55948. ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRlZDEgMB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0g
  55949. RzMwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQjpQy4LRL1KPOxst3iAhKAnjlfSU2fySU0WXTsuwYc
  55950. 58Byr+iuL+FBVIcUqEqy6HyC5ltqtdyzdc6LBtCGI79G1Y4PPwT01xySfvalY8L1X44uT6EYGQIr
  55951. MgqCZH0Wk9GjQjBAMB0GA1UdDgQWBBR8XQKEE9TMipuBzhccLikenEhjQjAOBgNVHQ8BAf8EBAMC
  55952. AQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNpADBmAjEAvvNhzwIQHWSVB7gYboiFBS+D
  55953. CBeQyh+KTOgNG3qxrdWBCUfvO6wIBHxcmbHtRwfSAjEAnbpV/KlK6O3t5nYBQnvI+GDZjVGLVTv7
  55954. jHvrZQnD+JbNR6iC8hZVdyR+EhCVBCyj
  55955. -----END CERTIFICATE-----
  55956. emSign Root CA - C1
  55957. ===================
  55958. -----BEGIN CERTIFICATE-----
  55959. MIIDczCCAlugAwIBAgILAK7PALrEzzL4Q7IwDQYJKoZIhvcNAQELBQAwVjELMAkGA1UEBhMCVVMx
  55960. EzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMRwwGgYDVQQDExNlbVNp
  55961. Z24gUm9vdCBDQSAtIEMxMB4XDTE4MDIxODE4MzAwMFoXDTQzMDIxODE4MzAwMFowVjELMAkGA1UE
  55962. BhMCVVMxEzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMRwwGgYDVQQD
  55963. ExNlbVNpZ24gUm9vdCBDQSAtIEMxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAz+up
  55964. ufGZBczYKCFK83M0UYRWEPWgTywS4/oTmifQz/l5GnRfHXk5/Fv4cI7gklL35CX5VIPZHdPIWoU/
  55965. Xse2B+4+wM6ar6xWQio5JXDWv7V7Nq2s9nPczdcdioOl+yuQFTdrHCZH3DspVpNqs8FqOp099cGX
  55966. OFgFixwR4+S0uF2FHYP+eF8LRWgYSKVGczQ7/g/IdrvHGPMF0Ybzhe3nudkyrVWIzqa2kbBPrH4V
  55967. I5b2P/AgNBbeCsbEBEV5f6f9vtKppa+cxSMq9zwhbL2vj07FOrLzNBL834AaSaTUqZX3noleooms
  55968. lMuoaJuvimUnzYnu3Yy1aylwQ6BpC+S5DwIDAQABo0IwQDAdBgNVHQ4EFgQU/qHgcB4qAzlSWkK+
  55969. XJGFehiqTbUwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQAD
  55970. ggEBAMJKVvoVIXsoounlHfv4LcQ5lkFMOycsxGwYFYDGrK9HWS8mC+M2sO87/kOXSTKZEhVb3xEp
  55971. /6tT+LvBeA+snFOvV71ojD1pM/CjoCNjO2RnIkSt1XHLVip4kqNPEjE2NuLe/gDEo2APJ62gsIq1
  55972. NnpSob0n9CAnYuhNlCQT5AoE6TyrLshDCUrGYQTlSTR+08TI9Q/Aqum6VF7zYytPT1DU/rl7mYw9
  55973. wC68AivTxEDkigcxHpvOJpkT+xHqmiIMERnHXhuBUDDIlhJu58tBf5E7oke3VIAb3ADMmpDqw8NQ
  55974. BmIMMMAVSKeoWXzhriKi4gp6D/piq1JM4fHfyr6DDUI=
  55975. -----END CERTIFICATE-----
  55976. emSign ECC Root CA - C3
  55977. =======================
  55978. -----BEGIN CERTIFICATE-----
  55979. MIICKzCCAbGgAwIBAgIKe3G2gla4EnycqDAKBggqhkjOPQQDAzBaMQswCQYDVQQGEwJVUzETMBEG
  55980. A1UECxMKZW1TaWduIFBLSTEUMBIGA1UEChMLZU11ZGhyYSBJbmMxIDAeBgNVBAMTF2VtU2lnbiBF
  55981. Q0MgUm9vdCBDQSAtIEMzMB4XDTE4MDIxODE4MzAwMFoXDTQzMDIxODE4MzAwMFowWjELMAkGA1UE
  55982. BhMCVVMxEzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMSAwHgYDVQQD
  55983. ExdlbVNpZ24gRUNDIFJvb3QgQ0EgLSBDMzB2MBAGByqGSM49AgEGBSuBBAAiA2IABP2lYa57JhAd
  55984. 6bciMK4G9IGzsUJxlTm801Ljr6/58pc1kjZGDoeVjbk5Wum739D+yAdBPLtVb4OjavtisIGJAnB9
  55985. SMVK4+kiVCJNk7tCDK93nCOmfddhEc5lx/h//vXyqaNCMEAwHQYDVR0OBBYEFPtaSNCAIEDyqOkA
  55986. B2kZd6fmw/TPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MAoGCCqGSM49BAMDA2gA
  55987. MGUCMQC02C8Cif22TGK6Q04ThHK1rt0c3ta13FaPWEBaLd4gTCKDypOofu4SQMfWh0/434UCMBwU
  55988. ZOR8loMRnLDRWmFLpg9J0wD8ofzkpf9/rdcw0Md3f76BB1UwUCAU9Vc4CqgxUQ==
  55989. -----END CERTIFICATE-----
  55990. Hongkong Post Root CA 3
  55991. =======================
  55992. -----BEGIN CERTIFICATE-----
  55993. MIIFzzCCA7egAwIBAgIUCBZfikyl7ADJk0DfxMauI7gcWqQwDQYJKoZIhvcNAQELBQAwbzELMAkG
  55994. A1UEBhMCSEsxEjAQBgNVBAgTCUhvbmcgS29uZzESMBAGA1UEBxMJSG9uZyBLb25nMRYwFAYDVQQK
  55995. Ew1Ib25na29uZyBQb3N0MSAwHgYDVQQDExdIb25na29uZyBQb3N0IFJvb3QgQ0EgMzAeFw0xNzA2
  55996. MDMwMjI5NDZaFw00MjA2MDMwMjI5NDZaMG8xCzAJBgNVBAYTAkhLMRIwEAYDVQQIEwlIb25nIEtv
  55997. bmcxEjAQBgNVBAcTCUhvbmcgS29uZzEWMBQGA1UEChMNSG9uZ2tvbmcgUG9zdDEgMB4GA1UEAxMX
  55998. SG9uZ2tvbmcgUG9zdCBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCz
  55999. iNfqzg8gTr7m1gNt7ln8wlffKWihgw4+aMdoWJwcYEuJQwy51BWy7sFOdem1p+/l6TWZ5Mwc50tf
  56000. jTMwIDNT2aa71T4Tjukfh0mtUC1Qyhi+AViiE3CWu4mIVoBc+L0sPOFMV4i707mV78vH9toxdCim
  56001. 5lSJ9UExyuUmGs2C4HDaOym71QP1mbpV9WTRYA6ziUm4ii8F0oRFKHyPaFASePwLtVPLwpgchKOe
  56002. sL4jpNrcyCse2m5FHomY2vkALgbpDDtw1VAliJnLzXNg99X/NWfFobxeq81KuEXryGgeDQ0URhLj
  56003. 0mRiikKYvLTGCAj4/ahMZJx2Ab0vqWwzD9g/KLg8aQFChn5pwckGyuV6RmXpwtZQQS4/t+TtbNe/
  56004. JgERohYpSms0BpDsE9K2+2p20jzt8NYt3eEV7KObLyzJPivkaTv/ciWxNoZbx39ri1UbSsUgYT2u
  56005. y1DhCDq+sI9jQVMwCFk8mB13umOResoQUGC/8Ne8lYePl8X+l2oBlKN8W4UdKjk60FSh0Tlxnf0h
  56006. +bV78OLgAo9uliQlLKAeLKjEiafv7ZkGL7YKTE/bosw3Gq9HhS2KX8Q0NEwA/RiTZxPRN+ZItIsG
  56007. xVd7GYYKecsAyVKvQv83j+GjHno9UKtjBucVtT+2RTeUN7F+8kjDf8V1/peNRY8apxpyKBpADwID
  56008. AQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBQXnc0e
  56009. i9Y5K3DTXNSguB+wAPzFYTAdBgNVHQ4EFgQUF53NHovWOStw01zUoLgfsAD8xWEwDQYJKoZIhvcN
  56010. AQELBQADggIBAFbVe27mIgHSQpsY1Q7XZiNc4/6gx5LS6ZStS6LG7BJ8dNVI0lkUmcDrudHr9Egw
  56011. W62nV3OZqdPlt9EuWSRY3GguLmLYauRwCy0gUCCkMpXRAJi70/33MvJJrsZ64Ee+bs7Lo3I6LWld
  56012. y8joRTnU+kLBEUx3XZL7av9YROXrgZ6voJmtvqkBZss4HTzfQx/0TW60uhdG/H39h4F5ag0zD/ov
  56013. +BS5gLNdTaqX4fnkGMX41TiMJjz98iji7lpJiCzfeT2OnpA8vUFKOt1b9pq0zj8lMH8yfaIDlNDc
  56014. eqFS3m6TjRgm/VWsvY+b0s+v54Ysyx8Jb6NvqYTUc79NoXQbTiNg8swOqn+knEwlqLJmOzj/2ZQw
  56015. 9nKEvmhVEA/GcywWaZMH/rFF7buiVWqw2rVKAiUnhde3t4ZEFolsgCs+l6mc1X5VTMbeRRAc6uk7
  56016. nwNT7u56AQIWeNTowr5GdogTPyK7SBIdUgC0An4hGh6cJfTzPV4e0hz5sy229zdcxsshTrD3mUcY
  56017. hcErulWuBurQB7Lcq9CClnXO0lD+mefPL5/ndtFhKvshuzHQqp9HpLIiyhY6UFfEW0NnxWViA0kB
  56018. 60PZ2Pierc+xYw5F9KBaLJstxabArahH9CdMOA0uG0k7UvToiIMrVCjU8jVStDKDYmlkDJGcn5fq
  56019. dBb9HxEGmpv0
  56020. -----END CERTIFICATE-----
  56021. <?php
  56022. if (PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg') {
  56023. echo 'Warning: Composer should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
  56024. }
  56025. setlocale(LC_ALL, 'C');
  56026. require __DIR__.'/../src/bootstrap.php';
  56027. use Composer\Console\Application;
  56028. use Composer\XdebugHandler\XdebugHandler;
  56029. error_reporting(-1);
  56030. // Restart without Xdebug
  56031. $xdebug = new XdebugHandler('Composer', '--ansi');
  56032. $xdebug->check();
  56033. unset($xdebug);
  56034. if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '4.0', '>=')) {
  56035. echo 'HHVM 4.0 has dropped support for Composer, please use PHP instead. Aborting.'.PHP_EOL;
  56036. exit(1);
  56037. }
  56038. if (function_exists('ini_set')) {
  56039. @ini_set('display_errors', 1);
  56040. $memoryInBytes = function ($value) {
  56041. $unit = strtolower(substr($value, -1, 1));
  56042. $value = (int) $value;
  56043. switch($unit) {
  56044. case 'g':
  56045. $value *= 1024;
  56046. // no break (cumulative multiplier)
  56047. case 'm':
  56048. $value *= 1024;
  56049. // no break (cumulative multiplier)
  56050. case 'k':
  56051. $value *= 1024;
  56052. }
  56053. return $value;
  56054. };
  56055. $memoryLimit = trim(ini_get('memory_limit'));
  56056. // Increase memory_limit if it is lower than 1.5GB
  56057. if ($memoryLimit != -1 && $memoryInBytes($memoryLimit) < 1024 * 1024 * 1536) {
  56058. @ini_set('memory_limit', '1536M');
  56059. }
  56060. // Set user defined memory limit
  56061. if ($memoryLimit = getenv('COMPOSER_MEMORY_LIMIT')) {
  56062. @ini_set('memory_limit', $memoryLimit);
  56063. }
  56064. unset($memoryInBytes, $memoryLimit);
  56065. }
  56066. putenv('COMPOSER_BINARY='.realpath($_SERVER['argv'][0]));
  56067. // run the command application
  56068. $application = new Application();
  56069. $application->run();
  56070. Copyright (c) Nils Adermann, Jordi Boggiano
  56071. Permission is hereby granted, free of charge, to any person obtaining a copy
  56072. of this software and associated documentation files (the "Software"), to deal
  56073. in the Software without restriction, including without limitation the rights
  56074. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  56075. copies of the Software, and to permit persons to whom the Software is furnished
  56076. to do so, subject to the following conditions:
  56077. The above copyright notice and this permission notice shall be included in all
  56078. copies or substantial portions of the Software.
  56079. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  56080. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  56081. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  56082. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  56083. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  56084. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  56085. THE SOFTWARE.
  56086. ³LycªRíªE¿wÙ†<Héº���GBMB